Compare commits

..

No commits in common. "aef8cb5cb5b011c67e063b9f7565c4796c374834" and "57ffa71c86f494a9f141d05125121ac4bacf01da" have entirely different histories.

4 changed files with 9 additions and 11 deletions

View File

@ -50,8 +50,7 @@ class PlaydatesTable(Model):
lastplayed: Mapped[dt.datetime] = mapped_column(index=True)
track_id: Mapped[int] = mapped_column(ForeignKey("tracks.id"))
track: Mapped["TracksTable"] = relationship(
"TracksTable",
back_populates="playdates",
"TracksTable", back_populates="playdates"
)
def __repr__(self) -> str:
@ -104,7 +103,7 @@ class PlaylistRowsTable(Model):
)
playlist: Mapped[PlaylistsTable] = relationship(back_populates="rows")
track_id: Mapped[Optional[int]] = mapped_column(ForeignKey("tracks.id", ondelete="CASCADE"))
track_id: Mapped[Optional[int]] = mapped_column(ForeignKey("tracks.id"))
track: Mapped["TracksTable"] = relationship(
"TracksTable",
back_populates="playlistrows",

View File

@ -36,6 +36,7 @@ if DATABASE_URL is None:
if "unittest" in sys.modules and "sqlite" not in DATABASE_URL:
raise ValueError("Unit tests running on non-Sqlite database")
db = DatabaseManager.get_instance(DATABASE_URL, engine_options=Config.ENGINE_OPTIONS).db
db.create_all()
# Database classes

View File

@ -502,7 +502,9 @@ class Window(QMainWindow):
)
)
file_menu.addSeparator()
file_menu.addAction(self.create_action("Exit", self.close))
file_menu.addAction(
self.create_action("Exit", self.close)
) # Default action for closing
# Playlist Menu
playlist_menu = menu_bar.addMenu("&Playlist")
@ -766,7 +768,7 @@ class Window(QMainWindow):
def create_playlist_tab(self, playlist: Playlists) -> int:
"""
Take the passed playlist, create a playlist tab and
Take the passed proxy model, create a playlist tab and
add tab to display. Return index number of tab.
"""
@ -957,10 +959,10 @@ class Window(QMainWindow):
if self.hide_played_tracks:
self.hide_played_tracks = False
self.current.base_model.hide_played_tracks(False)
self.footer_section.btnHidePlayed.setText("Hide played")
self.btnHidePlayed.setText("Hide played")
else:
self.hide_played_tracks = True
self.footer_section.btnHidePlayed.setText("Show played")
self.btnHidePlayed.setText("Show played")
if Config.HIDE_PLAYED_MODE == Config.HIDE_PLAYED_MODE_SECTIONS:
self.active_tab().hide_played_sections()
else:

View File

@ -1279,10 +1279,6 @@ class PlaylistModel(QAbstractTableModel):
unplayed_count: int = 0
duration: int = 0
if rat.row_number == 0:
# Meaningless to have a subtotal on row 0
return Config.SUBTOTAL_ON_ROW_ZERO
# Show subtotal
for row_number in range(rat.row_number - 1, -1, -1):
row_rat = self.playlist_rows[row_number]