Skip to content

Commit

Permalink
fix sorting in Person table in course planning (#105)
Browse files Browse the repository at this point in the history
  • Loading branch information
jxjj authored Feb 19, 2024
1 parent e89097b commit 918637d
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions resources/js/pages/CoursePlanningPage/stores/usePersonStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ import { defineStore } from "pinia";
import { computed, reactive, toRefs } from "vue";
import * as api from "@/api";
import * as T from "@/types";
import { countBy, groupBy, keyBy } from "lodash";
import { countBy, keyBy } from "lodash";
import { useEnrollmentStore } from "./useEnrollmentStore";
import { sortByName } from "@/utils";

interface PersonStoreState {
activeGroupId: T.Group["id"] | null;
Expand All @@ -21,10 +22,12 @@ export const usePersonStore = defineStore("person", () => {
});

const getters = {
allPeople: computed(
(): T.Person[] =>
Object.values(state.personLookupByEmpId).filter(Boolean) as T.Person[],
),
allPeople: computed((): T.Person[] => {
const people = Object.values(state.personLookupByEmpId).filter(
Boolean,
) as T.Person[];
return people.sort(sortByName);
}),
getPersonByEmplId: computed(
() =>
(emplId: T.Person["emplid"]): T.Person | null => {
Expand Down

0 comments on commit 918637d

Please sign in to comment.