Initial scheduling algorithm and judging round mutation#8
Initial scheduling algorithm and judging round mutation#8HarshitaJindia19 wants to merge 19 commits intomainfrom
Conversation
HarshitaJindia19
commented
Feb 19, 2026
- Created a scheduler.ts which takes a list of teams and judges to generate time-slotted assignments. Like a round-robin style algorithm.
- Added a generateSchedule mutation in judging-rounds that fetches from the organization and user data from the database, and adds the scheduling information to the judgingAssignments table.
…em available rooms. Jump to the next time block if all rooms full.
…em available rooms. Jump to the next time block if all rooms full.
…-the-Change-YYC/hackathon-management-tool-v2 into HMTV2-13-schedule-algorithm
…em available rooms. Jump to the next time block if all rooms full.
…em available rooms. Jump to the next time block if all rooms full.
…-the-Change-YYC/hackathon-management-tool-v2 into HMTV2-13-schedule-algorithm
…-the-Change-YYC/hackathon-management-tool-v2 into HMTV2-13-schedule-algorithm
drizzle/0000_noisy_dragon_lord.sql
Outdated
There was a problem hiding this comment.
use db push! we shouldn't have any migration files to deal with.
https://orm.drizzle.team/docs/migrations --> we are using the codebase first approach.
There was a problem hiding this comment.
I deleted the migration files.
There was a problem hiding this comment.
great start - looking at this it seems that the schedule will kind of create a diagonal on a calendar. looking at the currentTime pointer - it is incremented each time a team is scheduled and done. that means that judge 1 is idle while judge 0 judges, and only begins judging the next team after that first team is done (if that makes sense). lets extend this algorithm - many judges are available concurrently and the schedule should compensate for that.
There was a problem hiding this comment.
I edited the scheduler.ts so that now it assigns a judge to each team. Once all judges have been assigned a team, it moves to the remaining of teams, until all teams have been assigned a time slot. This way no judge will be idle.
I am still figuring out how to make it so that multiple judges can be assigned a team. I will have to look into Justins PR to see how he created the RoomTables.
| const judges = await ctx.db.query.user.findMany({}); | ||
|
|
||
| // Run scheduling algorithm | ||
| const schedule = createSchedule(teams, judges, round.startTime, 15); |
There was a problem hiding this comment.
magic number, can we make this a user input?
There was a problem hiding this comment.
also consider using a try catch or adding some common error checking here. like what if u queried no judges ? no teams? should the schedule run at all?
There was a problem hiding this comment.
Added a try catch block, and I output Error messages when there are no judges or teams found.
| } | ||
|
|
||
| // Get all teams (organizations) | ||
| const teams = await ctx.db.query.organization.findMany(); |
There was a problem hiding this comment.
remember that this should be filtered data and not everything in the database. we only want teams that have passed a certain round (prescreen, round 1, etc). might be blocked by justin's pr
There was a problem hiding this comment.
It only takes users with the role 'judge' now. I am still trying to figure out how to only get teams that have passed a specific round.