Skip to content
This repository has been archived by the owner on May 13, 2024. It is now read-only.

Commit

Permalink
fix(task-selection): reset selection correctly
Browse files Browse the repository at this point in the history
* fix model factory for testing
* fix selection (re-)set
  • Loading branch information
derrabauke committed Dec 20, 2022
1 parent 034999c commit b64b62b
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
6 changes: 6 additions & 0 deletions app/analysis/index/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,12 @@ export default class AnalysisController extends Controller.extend(
@tracked _lastPage = 0;
@tracked selectedReportIds;

@tracked user;
@tracked reviewer;
@tracked customer;
@tracked project;
@tracked task;

setup() {
this._dataCache = A();
this.selectedReportIds = A();
Expand Down
3 changes: 1 addition & 2 deletions app/components/task-selection/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ export default class TaskSelectionComponent extends Component {
this.onProjectChange(null);
}

if (!options.preventAction && this._customer) {
if (!options.preventAction) {
later(this, () => {
(this.args["on-set-customer"] === undefined
? () => {}
Expand All @@ -345,7 +345,6 @@ export default class TaskSelectionComponent extends Component {
(value === null || value.get("id") !== this.task.get("project.id"))
) {
this.onTaskChange(null);
return;
}

if (!this.customer && value?.get("customer.id")) {
Expand Down
14 changes: 14 additions & 0 deletions mirage/factories/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,24 @@ export default Factory.extend({
email: () => faker.internet.email(),
password: () => faker.internet.password(),

fullName() {
if (!this.firstName && !this.lastName) {
return "";
}

return `${this.firstName} ${this.lastName}`;
},

username() {
return `${this.firstName}${this.lastName.charAt(0)}`.toLowerCase();
},

longName() {
return this.fullName
? `${this.fullName} (${this.username})`
: this.username;
},

isStaff: true,
isActive: true,
isSuperuser: false,
Expand Down

0 comments on commit b64b62b

Please sign in to comment.