Fix/log time on click - #189
Merged
Merged
Conversation
nakenyon
marked this pull request as draft
May 4, 2026 21:58
nakenyon
force-pushed
the
fix/log-time-on-click
branch
from
May 4, 2026 21:59
e5f196d to
ac01904
Compare
nakenyon
marked this pull request as ready for review
May 4, 2026 21:59
The datetime auto-fill for new play records was capturing the time once
at component initialisation and reusing that stale value. For the main
track modal (mediaStatusDateHandler.js) this meant the status-change
handler always inserted the page-load time rather than the time the user
actually changed the status. For the episode track modal
(fill_track_episode.html) the time was baked in server-side via Django's
{% now %} tag, so it was frozen at page render.
Fix: call getCurrentDateTime() at the moment each field is written
(mediaStatusDateHandler.js), and replace the server-rendered default with
an Alpine x-effect that recomputes the current time whenever the episode
modal opens (fill_track_episode.html).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
nakenyon
force-pushed
the
fix/log-time-on-click
branch
from
May 4, 2026 22:31
ac01904 to
9f05f8d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix: Use current time when logging plays, not page load time
Summary
When logging a new play, the datetime field was pre-filled with the time the page was loaded rather than the time the user actually interacted with the form. This affected two separate code paths:
mediaStatusDateHandler.js): The current time was captured once into aconst nowvariable during Alpine.js component initialisation and reused for all subsequent writes — including inside the status-change event listener, which could fire minutes after the page loaded.fill_track_episode.html,fill_track_song.html): The watch date was set server-side using Django's{% now %}template tag, baking the page-render time into the HTML before the user had even opened the modal.Changes
src/static/js/mediaStatusDateHandler.js: Removed the upfrontconst now = getCurrentDateTime()call and replaced each usage with a freshgetCurrentDateTime()call at the moment the field value is actually written.src/templates/app/components/fill_track_episode.htmlandsrc/templates/app/components/fill_track_song.html: Replaced the server-rendered{% now %}default with an Alpinex-effectthat recomputes the current time (with timezone adjustment) each time the modal is opened.fill_track_song.htmlis shared between music album and podcast episode tracking.Testing