From f6d87f8baa02574e7f84c89b27317103cb86e4b4 Mon Sep 17 00:00:00 2001 From: ImJustChew Date: Mon, 15 Apr 2024 23:09:21 +0800 Subject: [PATCH 1/2] fix: summer courses will now appear in grade --- package-lock.json | 39 +++++++++++++++++++ .../student/grades/GradesViewer.tsx | 6 ++- 2 files changed, 43 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 313d0b3b..67a5b641 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4969,6 +4969,7 @@ }, "node_modules/@types/eslint": { "version": "8.44.5", + "dev": true, "license": "MIT", "dependencies": { "@types/estree": "*", @@ -4977,6 +4978,7 @@ }, "node_modules/@types/eslint-scope": { "version": "3.7.6", + "dev": true, "license": "MIT", "dependencies": { "@types/eslint": "*", @@ -5215,6 +5217,7 @@ }, "node_modules/@webassemblyjs/ast": { "version": "1.11.6", + "dev": true, "license": "MIT", "dependencies": { "@webassemblyjs/helper-numbers": "1.11.6", @@ -5223,18 +5226,22 @@ }, "node_modules/@webassemblyjs/floating-point-hex-parser": { "version": "1.11.6", + "dev": true, "license": "MIT" }, "node_modules/@webassemblyjs/helper-api-error": { "version": "1.11.6", + "dev": true, "license": "MIT" }, "node_modules/@webassemblyjs/helper-buffer": { "version": "1.11.6", + "dev": true, "license": "MIT" }, "node_modules/@webassemblyjs/helper-numbers": { "version": "1.11.6", + "dev": true, "license": "MIT", "dependencies": { "@webassemblyjs/floating-point-hex-parser": "1.11.6", @@ -5244,10 +5251,12 @@ }, "node_modules/@webassemblyjs/helper-wasm-bytecode": { "version": "1.11.6", + "dev": true, "license": "MIT" }, "node_modules/@webassemblyjs/helper-wasm-section": { "version": "1.11.6", + "dev": true, "license": "MIT", "dependencies": { "@webassemblyjs/ast": "1.11.6", @@ -5258,6 +5267,7 @@ }, "node_modules/@webassemblyjs/ieee754": { "version": "1.11.6", + "dev": true, "license": "MIT", "dependencies": { "@xtuc/ieee754": "^1.2.0" @@ -5265,6 +5275,7 @@ }, "node_modules/@webassemblyjs/leb128": { "version": "1.11.6", + "dev": true, "license": "Apache-2.0", "dependencies": { "@xtuc/long": "4.2.2" @@ -5272,10 +5283,12 @@ }, "node_modules/@webassemblyjs/utf8": { "version": "1.11.6", + "dev": true, "license": "MIT" }, "node_modules/@webassemblyjs/wasm-edit": { "version": "1.11.6", + "dev": true, "license": "MIT", "dependencies": { "@webassemblyjs/ast": "1.11.6", @@ -5290,6 +5303,7 @@ }, "node_modules/@webassemblyjs/wasm-gen": { "version": "1.11.6", + "dev": true, "license": "MIT", "dependencies": { "@webassemblyjs/ast": "1.11.6", @@ -5301,6 +5315,7 @@ }, "node_modules/@webassemblyjs/wasm-opt": { "version": "1.11.6", + "dev": true, "license": "MIT", "dependencies": { "@webassemblyjs/ast": "1.11.6", @@ -5311,6 +5326,7 @@ }, "node_modules/@webassemblyjs/wasm-parser": { "version": "1.11.6", + "dev": true, "license": "MIT", "dependencies": { "@webassemblyjs/ast": "1.11.6", @@ -5323,6 +5339,7 @@ }, "node_modules/@webassemblyjs/wast-printer": { "version": "1.11.6", + "dev": true, "license": "MIT", "dependencies": { "@webassemblyjs/ast": "1.11.6", @@ -5339,10 +5356,12 @@ }, "node_modules/@xtuc/ieee754": { "version": "1.2.0", + "dev": true, "license": "BSD-3-Clause" }, "node_modules/@xtuc/long": { "version": "4.2.2", + "dev": true, "license": "Apache-2.0" }, "node_modules/acorn": { @@ -5357,6 +5376,7 @@ }, "node_modules/acorn-import-assertions": { "version": "1.9.0", + "dev": true, "license": "MIT", "peerDependencies": { "acorn": "^8" @@ -5903,6 +5923,7 @@ }, "node_modules/chrome-trace-event": { "version": "1.0.3", + "dev": true, "license": "MIT", "engines": { "node": ">=6.0" @@ -6607,6 +6628,7 @@ }, "node_modules/enhanced-resolve": { "version": "5.15.0", + "dev": true, "license": "MIT", "dependencies": { "graceful-fs": "^4.2.4", @@ -6694,6 +6716,7 @@ }, "node_modules/es-module-lexer": { "version": "1.3.1", + "dev": true, "license": "MIT" }, "node_modules/es-set-tostringtag": { @@ -6742,6 +6765,7 @@ }, "node_modules/eslint-scope": { "version": "5.1.1", + "dev": true, "license": "BSD-2-Clause", "dependencies": { "esrecurse": "^4.3.0", @@ -6753,6 +6777,7 @@ }, "node_modules/eslint-scope/node_modules/estraverse": { "version": "4.3.0", + "dev": true, "license": "BSD-2-Clause", "engines": { "node": ">=4.0" @@ -6760,6 +6785,7 @@ }, "node_modules/esrecurse": { "version": "4.3.0", + "dev": true, "license": "BSD-2-Clause", "dependencies": { "estraverse": "^5.2.0" @@ -6770,6 +6796,7 @@ }, "node_modules/estraverse": { "version": "5.3.0", + "dev": true, "license": "BSD-2-Clause", "engines": { "node": ">=4.0" @@ -6793,6 +6820,7 @@ }, "node_modules/events": { "version": "3.3.0", + "dev": true, "license": "MIT", "engines": { "node": ">=0.8.x" @@ -7140,6 +7168,7 @@ }, "node_modules/glob-to-regexp": { "version": "0.4.1", + "dev": true, "license": "BSD-2-Clause" }, "node_modules/globals": { @@ -8150,6 +8179,7 @@ }, "node_modules/loader-runner": { "version": "4.3.0", + "dev": true, "license": "MIT", "engines": { "node": ">=6.11.5" @@ -8463,6 +8493,7 @@ }, "node_modules/neo-async": { "version": "2.6.2", + "dev": true, "license": "MIT" }, "node_modules/next": { @@ -10355,6 +10386,7 @@ }, "node_modules/tapable": { "version": "2.2.1", + "dev": true, "license": "MIT", "engines": { "node": ">=6" @@ -10961,6 +10993,7 @@ }, "node_modules/watchpack": { "version": "2.4.0", + "dev": true, "license": "MIT", "dependencies": { "glob-to-regexp": "^0.4.1", @@ -10984,6 +11017,7 @@ }, "node_modules/webpack": { "version": "5.89.0", + "dev": true, "license": "MIT", "dependencies": { "@types/eslint-scope": "^3.7.3", @@ -11098,6 +11132,7 @@ }, "node_modules/webpack/node_modules/ajv": { "version": "6.12.6", + "dev": true, "license": "MIT", "dependencies": { "fast-deep-equal": "^3.1.1", @@ -11112,6 +11147,7 @@ }, "node_modules/webpack/node_modules/ajv-keywords": { "version": "3.5.2", + "dev": true, "license": "MIT", "peerDependencies": { "ajv": "^6.9.1" @@ -11119,10 +11155,12 @@ }, "node_modules/webpack/node_modules/json-schema-traverse": { "version": "0.4.1", + "dev": true, "license": "MIT" }, "node_modules/webpack/node_modules/schema-utils": { "version": "3.3.0", + "dev": true, "license": "MIT", "dependencies": { "@types/json-schema": "^7.0.8", @@ -11139,6 +11177,7 @@ }, "node_modules/webpack/node_modules/webpack-sources": { "version": "3.2.3", + "dev": true, "license": "MIT", "engines": { "node": ">=10.13.0" diff --git a/src/app/[lang]/(mods-pages)/student/grades/GradesViewer.tsx b/src/app/[lang]/(mods-pages)/student/grades/GradesViewer.tsx index cdee1927..c5529e2e 100644 --- a/src/app/[lang]/(mods-pages)/student/grades/GradesViewer.tsx +++ b/src/app/[lang]/(mods-pages)/student/grades/GradesViewer.tsx @@ -127,9 +127,11 @@ const GradesViewer = ({ grades }: { grades: GradeObject }) => { // get unique semesters const semesters = Array.from(new Set(grades.ranking.data.map(grade => grade.year + grade.semester))).toReversed(); + // grades might have semesters that are not in ranking + const gradesSemesters = grades.grades.map(grade => grade.year + grade.semester); const displayGrades = grades.grades.filter(grade => { - if (selectedSemester == "All") return semesters.includes(grade.year + grade.semester); + if (selectedSemester == "All") return true; return grade.year + grade.semester == selectedSemester; }); @@ -175,7 +177,7 @@ const GradesViewer = ({ grades }: { grades: GradeObject }) => { 全部課程 - {semesters.map(sem_id => {toPrettySemester(sem_id)})} + {gradesSemesters.map(sem_id => {toPrettySemester(sem_id)})} } {tab == "semester" &&