Repository navigation
feat: sort content by date added or recently updated - #1080
Open
tunaseckin wants to merge 2 commits into
Open
tunaseckin wants to merge 2 commits into
tunaseckin wants to merge 2 commits into
Conversation
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.
Two people asked for this in #suggestions on Discord ("Mods ordered in when added" and "sort mods by update date"). The content list could only sort by name or size, so this adds two options to the sort menu:
Rows with no date go to the bottom, with name as the tie-break.
The release date was already loaded (
published_at). The date added wasn't stored for anything a user installed, becauseinstalled_atonly covers bundle files and gets cleared when a bundle drops one. So there's a migration that addscluster_artifacts.added_at, copies over theinstalled_atvalues that exist, and adds an insert trigger that stamps new rows. I used a trigger instead of setting it in each insert because SQLite won't take a non-constant default onALTER TABLE, and it covers every path that links a file, including the shared-folder copies. Relinking the same file goes through the upsert, so it keeps its original date. A new version of a mod is a new row, so updating a mod counts as adding it.Files installed before this have no date, so they sit at the bottom of Recently Added until they're reinstalled or updated.
.sqlxis regenerated for the changedlist_cluster_artifacts_detailedquery. I checked the trigger against a migrated database (new rows get a time, upserts keep theirs, explicit values aren't touched) and added a test for the sort order. Workspace tests pass.