Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
hayato24s committed Mar 28, 2024
1 parent 04e0920 commit c4a7977
Show file tree
Hide file tree
Showing 5 changed files with 389 additions and 109 deletions.
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
src/api/
src/infrastructure/api/gen
10 changes: 9 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,14 @@
"apigen": "rm -rf src/infrastructure/api/aspida && npx openapi2aspida",
"prepare": "husky install && rimraf ./node_modules/@types/react",
"storybook": "start-storybook -p 6006",
"build-storybook": "yarn typecheck && build-storybook"
"build-storybook": "yarn typecheck && build-storybook",
"buf-gen": "rm -rf src/infrastructure/api/gen && buf generate --template ./twinte-proto/buf.front.gen.yaml ./twinte-proto"
},
"dependencies": {
"@aspida/axios": "^1.12.0",
"@bufbuild/protobuf": "^1.8.0",
"@connectrpc/connect": "^1.4.0",
"@connectrpc/connect-web": "^1.4.0",
"@gtm-support/vue-gtm": "^2.0.0",
"@sentry/rollup-plugin": "^0.4.0",
"@sentry/tracing": "^7.16.0",
Expand All @@ -31,6 +35,7 @@
"@vueuse/core": "^9.12.0",
"@vueuse/head": "^1.0.24",
"aspida": "^1.6.3",
"async-mutex": "^0.5.0",
"axios": "^1.4.0",
"core-js": "^3.33.0",
"dayjs": "^1.10.4",
Expand All @@ -44,6 +49,9 @@
"vuex": "4.1.0"
},
"devDependencies": {
"@bufbuild/buf": "^1.30.0",
"@bufbuild/protoc-gen-es": "^1.8.0",
"@connectrpc/protoc-gen-connect-es": "^1.4.0",
"@rushstack/eslint-patch": "^1.1.1",
"@storybook/addon-actions": "^6.5.12",
"@storybook/addon-essentials": "^6.4.19",
Expand Down
28 changes: 27 additions & 1 deletion src/domain/timetable.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { initializeObject } from "~/utils";
import { NormalDay, normalDays, SpecialDay, specialDays } from "./day";
import { days, NormalDay, normalDays, SpecialDay, specialDays } from "./day";

Check warning on line 2 in src/domain/timetable.ts

View workflow job for this annotation

GitHub Actions / build

'days' is defined but never used
import { Module, modules } from "./module";
import { Period, periods } from "./period";
import {
Expand Down Expand Up @@ -97,3 +97,29 @@ export const schedulesToTimetable = (

return timetable;
};

export const timetableToSchedules = (
timetable: Timetable<Module, boolean>
): Schedule[] => {
const schedules: Schedule[] = [];

modules.forEach((module) => {
normalDays.forEach((day) => {
periods.forEach((period) => {
if (timetable.normal[module][day][period]) {
schedules.push({ module, day, period });
}
});
});
});

modules.forEach((module) => {
specialDays.forEach((day) => {
if (timetable.special[module][day]) {
schedules.push({ module, day });
}
});
});

return schedules;
};
Loading

0 comments on commit c4a7977

Please sign in to comment.