Skip to content

Commit 07d96ff

Browse files
committed
FEFACTARY:自动化加分beta
1 parent 7b5fd3a commit 07d96ff

33 files changed

+1373
-1262
lines changed

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,12 @@
4040
"chokidar": "^5.0.0",
4141
"es-object-atoms": "^1.1.1",
4242
"express": "^5.2.1",
43+
"json-rules-engine": "^7.3.1",
4344
"mica-electron": "^1.5.16",
4445
"os": "^0.1.2",
4546
"pg": "^8.19.0",
4647
"pinyin-pro": "^3.27.0",
48+
"react-querybuilder": "^8.14.0",
4749
"react-router-dom": "^6.28.0",
4850
"reflect-metadata": "^0.2.2",
4951
"typeorm": "^0.3.27",

pnpm-lock.yaml

Lines changed: 232 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main/repos/EventRepository.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,4 +224,27 @@ export class EventRepository extends Service {
224224
const rows = await qb.getRawMany()
225225
return { startTime, rows }
226226
}
227+
228+
async getLastScoreTimeByStudents(
229+
studentNames: string[]
230+
): Promise<Map<string, Date>> {
231+
if (studentNames.length === 0) return new Map()
232+
233+
const repo = this.ctx.db.dataSource.getRepository(ScoreEventEntity)
234+
const results = await repo
235+
.createQueryBuilder('e')
236+
.select('e.student_name', 'student_name')
237+
.addSelect('MAX(e.event_time)', 'last_time')
238+
.where('e.student_name IN (:...studentNames)', { studentNames })
239+
.groupBy('e.student_name')
240+
.getRawMany()
241+
242+
const map = new Map<string, Date>()
243+
for (const row of results) {
244+
if (row.last_time) {
245+
map.set(row.student_name, new Date(row.last_time))
246+
}
247+
}
248+
return map
249+
}
227250
}

0 commit comments

Comments
 (0)