Skip to content

Commit 46281ee

Browse files
committed
update: 不完全なデータ
1 parent b54a703 commit 46281ee

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/parser.ts

+6-4
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ const analyzeRow = (columns: string[]) => {
120120
year: analyzeYear(columns[4]),
121121
details: [],
122122
instructor: columns[8],
123+
error: false,
123124
}
124125

125126
const moduleString = columns[5]
@@ -142,15 +143,17 @@ const analyzeRow = (columns: string[]) => {
142143
(periodArray.length === count || periodArray.length === 1) &&
143144
(roomArray.length === count || roomArray.length === 1)
144145
)
145-
)
146+
) {
146147
console.log('Warning!')
148+
classData.error = true
149+
}
147150

148151
for (let i = 0; i < count; i++) {
149152
const modules = analyzeModule(
150-
moduleArray.length === 1 ? moduleArray[0] : moduleArray[i] || ''
153+
moduleArray.length === 1 ? moduleArray[0] : moduleArray[i] || 'unknown'
151154
)
152155
const when = analyzeDayAndPeriod(
153-
periodArray.length === 1 ? periodArray[0] : periodArray[i] || ''
156+
periodArray.length === 1 ? periodArray[0] : periodArray[i] || 'unknown'
154157
)
155158
modules.forEach((mod) =>
156159
when.forEach((w) =>
@@ -181,7 +184,6 @@ export default (data: Buffer): Lecture[] => {
181184
for (let c = 0; c < 16; c++)
182185
columns.push(sheet[utils.encode_cell({ r, c })].v)
183186
if (columns[0] === '') break
184-
// console.log(r)
185187
classes.push(analyzeRow(columns))
186188
}
187189
console.log('✔ Done')

src/types.ts

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export interface Lecture {
1313
room: string
1414
}[]
1515
instructor: string
16+
error: boolean
1617
}
1718

1819
export enum Module {

0 commit comments

Comments
 (0)