Skip to content

Commit

Permalink
fixed order by (#903)
Browse files Browse the repository at this point in the history
* fixed order by

* delete console
  • Loading branch information
elizabeth-tang authored Mar 16, 2024
1 parent b05dbc2 commit 4de15fb
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/components/Requirements/MultiplePlansDropdown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ export default defineComponent({
'setCurrentPlan',
store.state.plans.find(p => p.name === plan)
);
store.commit('setOrderByNewest', store.state.orderByNewest);
this.shown = !this.shown;
}
},
Expand Down
1 change: 1 addition & 0 deletions src/components/Requirements/RequirementSideBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,7 @@ export default defineComponent({
'setCurrentPlan',
store.state.plans.find(plan => plan.name === name)
);
store.commit('setOrderByNewest', store.state.orderByNewest);
this.confirmationText = `${oldname} has been renamed to ${name}!`;
this.isConfirmationOpen = true;
setTimeout(() => {
Expand Down
1 change: 1 addition & 0 deletions src/global-firestore-data/user-semesters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export const editPlans = async (
await updateDoc(doc(semestersCollection, store.state.currentFirebaseUser.email), {
plans,
});
store.commit('setOrderByNewest', store.state.orderByNewest);
};
/**
* Sets whether semesters are ordered by newest/oldest
Expand Down
4 changes: 3 additions & 1 deletion src/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,9 @@ const store: TypedVuexStore = new TypedVuexStore({
name: state.currentPlan.name,
semesters: sortedSemesters(semesters, state.orderByNewest),
};
const editedPlans = state.plans.map(plan => (plan === state.currentPlan ? editedPlan : plan));
const editedPlans = state.plans.map(plan =>
plan.name === state.currentPlan.name ? editedPlan : plan
);
state.plans = editedPlans;
state.currentPlan = editedPlan;
},
Expand Down

0 comments on commit 4de15fb

Please sign in to comment.