Skip to content

Commit

Permalink
fix(frontend/projects): don't list same customer more than once
Browse files Browse the repository at this point in the history
  • Loading branch information
c0rydoras committed Aug 12, 2024
1 parent 07d91ea commit 298c1bc
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
10 changes: 5 additions & 5 deletions frontend/app/projects/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { action } from "@ember/object";
import { inject as service } from "@ember/service";
import { tracked } from "@glimmer/tracking";
import { dropTask, lastValue, task } from "ember-concurrency";
import uniqBy from "lodash.uniqby";
import ProjectValidations from "timed/validations/project";
import TaskValidations from "timed/validations/task";

Expand Down Expand Up @@ -33,11 +34,10 @@ export default class ProjectsController extends Controller {
}

get customers() {
return [
...(new Set(
this.projects?.map((p) => p.get("customer")).filter(Boolean)
) ?? []),
].toSorted((c) => c.get("name"));
return uniqBy(
this.projects?.map((p) => p?.get("customer")).filter(Boolean) ?? [],
(c) => c.get("id")
).toSorted((c) => c.get("name"));
}

@task
Expand Down
1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@
"fast-redact": "3.3.0",
"graphql": "16.8.1",
"loader.js": "4.7.0",
"lodash.uniqby": "^4.7.0",
"miragejs": "^0.1.48",
"prettier": "2.8.8",
"qunit": "2.19.4",
Expand Down
3 changes: 3 additions & 0 deletions frontend/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 298c1bc

Please sign in to comment.