Skip to content

Initial scheduling algorithm and judging round mutation#8

Open
HarshitaJindia19 wants to merge 19 commits intomainfrom
HMTV2-13-schedule-algorithm
Open

Initial scheduling algorithm and judging round mutation#8
HarshitaJindia19 wants to merge 19 commits intomainfrom
HMTV2-13-schedule-algorithm

Conversation

@HarshitaJindia19
Copy link

  • 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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I deleted the migration files.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Author

@HarshitaJindia19 HarshitaJindia19 Feb 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

magic number, can we make this a user input?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants