-
-
Notifications
You must be signed in to change notification settings - Fork 52
feat: Update collection sorting, metadata, stats #2327
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
1d6d122
Add snapshotCount to archived items
tw4l f93ecdc
Rationalize counts for collections, add migration to recalc
tw4l ce8bbde
Add snapshotCounts to org metrics endpoint
tw4l da4de38
Update tests
tw4l 1718cfa
Recalculate collection counts on import
tw4l 462e427
Fix linting
tw4l 5215649
Add pylint comment
tw4l 6eaa9ae
Fix collection test
tw4l a43fff2
Ensure page counts are based on unique URLs in that object specifically
tw4l 94b7a2f
Add pylint comment
tw4l 2ac44f4
Update collections when archived items are deleted
tw4l cad2301
Add pylint comment
tw4l 4af8ea6
Add missing await
tw4l 09387f5
feat: Update collection sorting & metadata (#2324)
SuaYoo 1c50181
Change backend terminology: use pageCount and uniquePageCount
tw4l cc8cac2
update field
SuaYoo cdd0d22
replace instances of snapshot
SuaYoo b351576
update total pages
SuaYoo 7fcb84d
fix wrong count used
SuaYoo 1218c87
update strings
SuaYoo 7e2398c
fix typo in migration
ikreymer cab55a4
test: add crawlUniquePageCount and uploadUniquePageCount to tests
ikreymer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
43 changes: 43 additions & 0 deletions
43
backend/btrixcloud/migrations/migration_0041_pages_snapshots.py
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
""" | ||
Migration 0041 - Rationalize page counts | ||
""" | ||
|
||
from btrixcloud.migrations import BaseMigration | ||
|
||
|
||
MIGRATION_VERSION = "0041" | ||
|
||
|
||
class Migration(BaseMigration): | ||
"""Migration class.""" | ||
|
||
# pylint: disable=unused-argument | ||
def __init__(self, mdb, **kwargs): | ||
super().__init__(mdb, migration_version=MIGRATION_VERSION) | ||
|
||
self.coll_ops = kwargs.get("coll_ops") | ||
|
||
async def migrate_up(self): | ||
"""Perform migration up. | ||
|
||
Recalculate collections to get new page and unique page counts | ||
""" | ||
colls_mdb = self.mdb["collections"] | ||
|
||
if self.coll_ops is None: | ||
print( | ||
"Unable to set collection page counts, missing coll_ops", | ||
flush=True, | ||
) | ||
return | ||
|
||
async for coll in colls_mdb.find({}): | ||
coll_id = coll["_id"] | ||
try: | ||
await self.coll_ops.update_collection_counts_and_tags(coll_id) | ||
# pylint: disable=broad-exception-caught | ||
except Exception as err: | ||
print( | ||
f"Unable to update page counts for collection {coll_id}: {err}", | ||
flush=True, | ||
) |
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.