Skip to content

Commit

Permalink
Improve types
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanieJaeger committed Sep 20, 2023
1 parent 9de2d13 commit 5eb35fe
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
3 changes: 2 additions & 1 deletion src/helpers/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ export type Semester = {
};

export type UnknownModule = {
moduleId: string, semesterNumber: number,
id: string,
semesterNumber: number,
};

type ModuleFocus = {
Expand Down
10 changes: 5 additions & 5 deletions src/views/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@
<ul>
<li
v-for="unknown in unknownModules"
:key="unknown.moduleId"
:key="unknown.id"
>
{{ unknown.moduleId }} in semester {{ unknown.semesterNumber }}
{{ unknown.id }} in semester {{ unknown.semesterNumber }}
</li>
</ul>
<button
Expand Down Expand Up @@ -359,7 +359,7 @@ export default defineComponent({
removeModule(semesterNumber: number, moduleId: string) {
this.semesters[semesterNumber - 1].modules = this.semesters[semesterNumber - 1].modules
.filter((module) => module.id !== moduleId);
this.unknownModules = this.unknownModules.filter((f) => f.moduleId !== moduleId);
this.unknownModules = this.unknownModules.filter((f) => f.id !== moduleId);
this.updateUrlFragment();
},
Expand All @@ -384,8 +384,8 @@ export default defineComponent({
}, 3000);
},
showUnknownModulesError(semesterNumber: number, moduleId: string) {
if (this.unknownModules.find((f) => f.moduleId === moduleId)) return;
this.unknownModules.push({ semesterNumber, moduleId });
if (this.unknownModules.find((f) => f.id === moduleId)) return;
this.unknownModules.push({ semesterNumber, id: moduleId });
},
removeUnknownModulesFromUrl() {
this.unknownModules = [];
Expand Down

0 comments on commit 5eb35fe

Please sign in to comment.