Skip to content

find-free-rooms command#5

Draft
BasileBux wants to merge 1 commit into
heig-lherman:masterfrom
BasileBux:find-free-rooms-clean
Draft

find-free-rooms command#5
BasileBux wants to merge 1 commit into
heig-lherman:masterfrom
BasileBux:find-free-rooms-clean

Conversation

@BasileBux

Copy link
Copy Markdown
Contributor

I saw the #1 issue and thought I would implement it because it would be really useful.

For command to work, I needed to write the registry part. It fetches the students, teachers and rooms ids and corresponding names. This is a pretty slow operation but it allows the command not to depend on some cached list.

The command arguments are the following:

-e, --end-time string     End time in HH:MM format (default "10:00")
-h, --help                help for find-free-rooms
-m, --semester uint       Semester number (0, 1, 2), 0 is summer (default 1)
-l, --site string         Site location ('Cheseaux' or 'St-Roch') (default "Cheseaux")
-s, --start-time string   Start time in HH:MM format (default "08:00")
-w, --weekday string      Day of the week (e.g., Monday) (default "Monday")

The command is really slow (~15sec execution) because it has to fetch the schedules for all rooms.

There are a few things that could be improved but I don't know what is best or haven't found a solution:

  • The output format isn't the best, there probably is a better formatting possible but I don't know how
  • There is no way to apply filters on the rooms. Like some rooms might be locked or not correspond to what someone would be looking for. The only thing I can think of would be hard coding the filters

Let me know what you think about it and if you need me to make modifications I will be happy to do so!

The registry is a way to get all the ids for students, teachers and
rooms and their corresponding name. find-free-rooms uses the registry
so that values aren't hard coded. This is slower but ensures it will
work forever needing no maintenance.
@BasileBux BasileBux marked this pull request as draft April 14, 2025 11:41
@BasileBux

Copy link
Copy Markdown
Contributor Author

Actually, there is an issue with even and odd weeks. The week checked is the first of the given semester, when it should check the two first weeks for even / odd weeks

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.

1 participant