Compare commits

...

2 Commits

Author SHA1 Message Date
Keith Edmunds
a8a38fa5b7 Fix "=" header
Fixes: #276
2025-02-14 19:38:06 +00:00
Keith Edmunds
24b5cb5fe0 Fix order of playdates on hover
Fixes: #275
2025-02-14 19:27:47 +00:00
2 changed files with 9 additions and 9 deletions

View File

@ -129,13 +129,13 @@ class Playdates(dbtables.PlaydatesTable):
) -> Sequence["Playdates"]: ) -> Sequence["Playdates"]:
""" """
Return a list of the last limit playdates for this track, sorted Return a list of the last limit playdates for this track, sorted
earliest to latest. latest to earliest.
""" """
return session.scalars( return session.scalars(
Playdates.select() Playdates.select()
.where(Playdates.track_id == track_id) .where(Playdates.track_id == track_id)
.order_by(Playdates.lastplayed.asc()) .order_by(Playdates.lastplayed.desc())
.limit(limit) .limit(limit)
).all() ).all()

View File

@ -32,6 +32,7 @@ import obswebsocket # type: ignore
# App imports # App imports
from classes import ( from classes import (
ApplicationError,
Col, Col,
MusicMusterSignals, MusicMusterSignals,
) )
@ -1281,10 +1282,10 @@ class PlaylistModel(QAbstractTableModel):
# Show subtotal # Show subtotal
for row_number in range(rat.row_number - 1, -1, -1): for row_number in range(rat.row_number - 1, -1, -1):
row_rat = self.playlist_rows[row_number] row_rat = self.playlist_rows[row_number]
if self.is_header_row(row_number): if self.is_header_row(row_number) or row_number == 0:
if row_rat.note.endswith(Config.SECTION_STARTS): if row_rat.note.endswith(Config.SECTION_STARTS) or row_number == 0:
# If we are playing this section, also # If we are playing this section, also
# calculate end time if all tracks are played. # calculate end time when all tracks are played.
end_time_str = "" end_time_str = ""
if ( if (
track_sequence.current track_sequence.current
@ -1323,9 +1324,8 @@ class PlaylistModel(QAbstractTableModel):
unplayed_count += 1 unplayed_count += 1
duration += row_rat.duration duration += row_rat.duration
# We should only get here if there were no rows in section (ie, # We should never get here
# this was row zero) raise ApplicationError("Error in section_subtotal_header()")
return Config.SUBTOTAL_ON_ROW_ZERO
def selection_is_sortable(self, row_numbers: list[int]) -> bool: def selection_is_sortable(self, row_numbers: list[int]) -> bool:
""" """
@ -1559,7 +1559,7 @@ class PlaylistModel(QAbstractTableModel):
"<br>".join( "<br>".join(
[ [
a.lastplayed.strftime(Config.LAST_PLAYED_TOOLTIP_DATE_FORMAT) a.lastplayed.strftime(Config.LAST_PLAYED_TOOLTIP_DATE_FORMAT)
for a in reversed(playdates) for a in playdates
] ]
) )
) )