Guidance hours to internal#816
Conversation
Added guidance hours objects which are stored in the database Added a guidance hours page which shows these objects as tables
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #816 +/- ##
==========================================
- Coverage 87.99% 87.94% -0.06%
==========================================
Files 153 153
Lines 6249 6394 +145
==========================================
+ Hits 5499 5623 +124
- Misses 750 771 +21
🚀 New features to boost your workflow:
|
|
This is very nice, I've always wanted something like this on the website! One UX thing tho: could the layout be more compact, similar to Hackerspace's shift schedule? Each slot could just show member names (first name / short name)
Most of the backend is already there — |
TheStrgamer
left a comment
There was a problem hiding this comment.
Most of this looks pretty good
Some smaller changes in style, layout and translation could be beneficial
| ) | ||
| from_time = models.TimeField(verbose_name=_("from time")) | ||
| to_time = models.TimeField(verbose_name=_("to time")) | ||
| notes = models.TextField(blank=True, verbose_name=_("notes")) |
There was a problem hiding this comment.
| notes = models.TextField(blank=True, verbose_name=_("notes")) | |
| notes = models.TextField(blank=True, max_length=MAX_NOTES_LENGTH, verbose_name=_("notes")) |
Det er som regel bedre å enforce max lengde i modellen direkte.
| } | ||
|
|
||
| :is(.guidance_hours_grey, .guidance_hours_yellow) th { | ||
| background-color: #0C426A; |
There was a problem hiding this comment.
| background-color: #0C426A; | |
| background-color: var(--make-blue); |
Use var from style.css instead
| .guidance_hours_grey td { background-color: #DCDDDE; } | ||
| .guidance_hours_yellow td { background-color: #F8C811; } |
There was a problem hiding this comment.
| .guidance_hours_grey td { background-color: #DCDDDE; } | |
| .guidance_hours_yellow td { background-color: #F8C811; } | |
| .guidance_hours_grey td { background-color: var(--make-light-grey); } | |
| .guidance_hours_yellow td { background-color: var(--make-yellow); } |
Var here too
| margin: 0 auto 10px; | ||
| padding-left: 6px; | ||
| background-color: #eef4f8; | ||
| border-left: 4px solid #0C426A; |
There was a problem hiding this comment.
| border-left: 4px solid #0C426A; | |
| border-left: 4px solid var(--make-blue); |
| .cancel_button, | ||
| .book_button, | ||
| .toggle_notes_button { | ||
| border: 1px solid #0C426A; |
There was a problem hiding this comment.
| border: 1px solid #0C426A; | |
| border: 1px solid var(--make-blue); |
| current_weekday = timezone.localdate().weekday() | ||
| current_time = timezone.localtime().time() | ||
|
|
||
| for slot in context["hours"]: |
There was a problem hiding this comment.
| for slot in context["hours"]: | |
| all_slots = list(context["hours"]) | |
| for slot in all_slots: |
This method calls context["hours"] more than needed
| current_member = None | ||
| context["current_member"] = current_member | ||
| context["current_member_slots"] = [ | ||
| slot for slot in context["hours"] if current_member in slot.all_members |
There was a problem hiding this comment.
| slot for slot in context["hours"] if current_member in slot.all_members | |
| slot for slot in all_slots if current_member in slot.all_members |
| if slot.weekday not in grouped: | ||
| grouped[slot.weekday] = [] | ||
|
|
||
| grouped[slot.weekday].append(slot) |
There was a problem hiding this comment.
| if slot.weekday not in grouped: | |
| grouped[slot.weekday] = [] | |
| grouped[slot.weekday].append(slot) | |
| grouped.setdefault(slot.weekday, []).append(slot) |
| return _("“{quote}” —{quoted}").format(quote=self.quote, quoted=self.quoted) | ||
|
|
||
|
|
||
| class GuidanceHours(models.Model): |
There was a problem hiding this comment.
| class GuidanceHours(models.Model): | |
| class GuidanceHour(models.Model): |
Models should be singular, should be changed all places it us used
| notes = models.TextField(blank=True, verbose_name=_("notes")) | ||
| members = models.ManyToManyField( | ||
| to=Member, | ||
| related_name="guidance_hours", |
There was a problem hiding this comment.
| related_name="guidance_hours", | |
| related_name="guidance_hour", |
singular here too
TheStrgamer
left a comment
There was a problem hiding this comment.
Most of this looks pretty good
Some smaller changes in style, layout and translation could be beneficial
TheStrgamer
left a comment
There was a problem hiding this comment.
I agree with what ba11e-mos says about a more compact layout, with only name showing and not needing a booking button, but i also think we should keep the comment and general layout the same, and maybe make the tables collapsable.
Another thing is that you can now add different times that overlap or are equal, so maybe put a restricion there. for example i can have two 16-18 monday, or one 16-18 and one 17-19

Proposed changes
Added the guidance hours to the internal pages of the website
Review guidance
Deployment notes
Manually fills in the current times for guidance hours
Checklist
(If any of the points are not relevant, mark them as checked, so that it's easy to see which points you've handled or not)
makemigrations,makemessagesandcompilemessages