Initial scheduling algorithm and judging round mutation#8
Initial scheduling algorithm and judging round mutation#8HarshitaJindia19 wants to merge 16 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
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.
| <h1 className={styles.welcome}>Schedule</h1> | ||
| <ul> | ||
| {mySchedule.map((timeSlot) => ( | ||
| <li key={`${timeSlot.teamName}-${timeSlot.start.getTime()}`}> |
There was a problem hiding this comment.
some build errors here. run a build locally and fix errors before pushing up a branch
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 currently working on making it so that multiple judges can be assigned to a team.
| 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?
| }); | ||
| } | ||
|
|
||
| return { sucess: true }; |
| const schedule = createSchedule(teams, judges, round.startTime, 15); | ||
|
|
||
| // Insert assignments | ||
| for (const slot of schedule) { |
There was a problem hiding this comment.
inserting one by one might be slow. look into a batch or bulk insert. also look into try catch blocks for a more graceful exit if there is a failure.
| } | ||
|
|
||
| // 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