Skip to content

Guidance hours to internal#816

Open
PetterTjeldeVaagen wants to merge 11 commits into
mainfrom
feature/guidance-hours-to-internal
Open

Guidance hours to internal#816
PetterTjeldeVaagen wants to merge 11 commits into
mainfrom
feature/guidance-hours-to-internal

Conversation

@PetterTjeldeVaagen
Copy link
Copy Markdown
Contributor

@PetterTjeldeVaagen PetterTjeldeVaagen commented May 6, 2026

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)

  • I've run makemigrations, makemessages and compilemessages
  • I've written tests that fail without these changes (if relevant/possible)
  • I've manually tested the website UI with different device layouts
    • Most common is to test with typical screen sizes for mobile (320-425 px), tablet (768 px) and desktop (1024+ px), which can easily be done with your browser's dev tools
  • I've manually tested with different users locally
    • This can be e.g. anonymous users (i.e. not being logged in), "normal" non-member users, members of different committees, and superusers
  • I've made sure that my code conforms to the code style guides
    • It's not intended that you read through this whole document, but that you get yourself an overview over its contents, and that you use it as a reference guide / checklist while taking a second look at your code before opening a pull request
  • I've attempted to minimize the number of common code smells
    • See the comment for the previous checkbox
  • I've added documentation
    • E.g. comments, docstrings, or in the README
  • I've added my changes to the "Unreleased" section of the changelog, together with a link to this PR
    • Mainly the changes that are of particular interest to users and/or developers, if any
  • I've added a "Deployment notes" section above and labelled the PR with has-deployment-notes
    • ...if anything out of the ordinary should be done when deploying these changes to the server (e.g. adding/removing an environment variable, manually creating/changing some objects, running a management command, etc.)
  • I've structured my commits reasonably

@PetterTjeldeVaagen PetterTjeldeVaagen added the feature New functionality on the page label May 6, 2026
@make-bot make-bot Bot added this to web May 6, 2026
@make-bot make-bot Bot moved this to Ready for Review in web May 6, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 6, 2026

Codecov Report

❌ Patch coverage is 86.18421% with 21 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.94%. Comparing base (787ea4b) to head (347caac).

Files with missing lines Patch % Lines
src/internal/views.py 83.96% 17 Missing ⚠️
src/internal/admin.py 84.61% 2 Missing ⚠️
src/internal/models.py 87.50% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            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     
Files with missing lines Coverage Δ
src/internal/forms.py 86.99% <100.00%> (+1.40%) ⬆️
src/internal/urls.py 100.00% <100.00%> (ø)
src/internal/admin.py 97.29% <84.61%> (-2.71%) ⬇️
src/internal/models.py 93.33% <87.50%> (-0.57%) ⬇️
src/internal/views.py 88.17% <83.96%> (-2.60%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ba11e-mos
Copy link
Copy Markdown

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)
inside the box, and clicking a slot opens a popup with the booking/cancel button + the comments textarea. Cuts the visual clutter of separate "book/cancel/full" + "comments" + admin columns down to one boxslot per timeslot.

image

Most of the backend is already there — GuidanceHoursView.get_context_data (src/internal/views.py:391-407) builds grouped_hours per weekday, so swapping the table layout in src/internal/templates/internal/guidance_hours.html + moving the action/notes UI into a modal would carry over the existing context cleanly. Solid implementation overall, just thought a denser layout could land better with daily users.

Copy link
Copy Markdown
Member

@TheStrgamer TheStrgamer left a comment

Choose a reason for hiding this comment

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

Most of this looks pretty good
Some smaller changes in style, layout and translation could be beneficial

Comment thread src/internal/models.py
)
from_time = models.TimeField(verbose_name=_("from time"))
to_time = models.TimeField(verbose_name=_("to time"))
notes = models.TextField(blank=True, verbose_name=_("notes"))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
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;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
background-color: #0C426A;
background-color: var(--make-blue);

Use var from style.css instead

Comment on lines +28 to +29
.guidance_hours_grey td { background-color: #DCDDDE; }
.guidance_hours_yellow td { background-color: #F8C811; }
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
.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;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
border-left: 4px solid #0C426A;
border-left: 4px solid var(--make-blue);

.cancel_button,
.book_button,
.toggle_notes_button {
border: 1px solid #0C426A;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
border: 1px solid #0C426A;
border: 1px solid var(--make-blue);

Comment thread src/internal/views.py
current_weekday = timezone.localdate().weekday()
current_time = timezone.localtime().time()

for slot in context["hours"]:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
for slot in context["hours"]:
all_slots = list(context["hours"])
for slot in all_slots:

This method calls context["hours"] more than needed

Comment thread src/internal/views.py
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
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
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

Comment thread src/internal/views.py
Comment on lines +404 to +407
if slot.weekday not in grouped:
grouped[slot.weekday] = []

grouped[slot.weekday].append(slot)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
if slot.weekday not in grouped:
grouped[slot.weekday] = []
grouped[slot.weekday].append(slot)
grouped.setdefault(slot.weekday, []).append(slot)

Comment thread src/internal/models.py
return _("“{quote}” —{quoted}").format(quote=self.quote, quoted=self.quoted)


class GuidanceHours(models.Model):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
class GuidanceHours(models.Model):
class GuidanceHour(models.Model):

Models should be singular, should be changed all places it us used

Comment thread src/internal/models.py
notes = models.TextField(blank=True, verbose_name=_("notes"))
members = models.ManyToManyField(
to=Member,
related_name="guidance_hours",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
related_name="guidance_hours",
related_name="guidance_hour",

singular here too

Copy link
Copy Markdown
Member

@TheStrgamer TheStrgamer left a comment

Choose a reason for hiding this comment

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

Most of this looks pretty good
Some smaller changes in style, layout and translation could be beneficial

Copy link
Copy Markdown
Member

@TheStrgamer TheStrgamer left a comment

Choose a reason for hiding this comment

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

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

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

Labels

feature New functionality on the page has-deployment-notes

Projects

Status: Ready for Review

Development

Successfully merging this pull request may close these issues.

3 participants