- Refactors dashboard and org profile preview to use private API endpoint, to fix public collections not showing when the org visibility is hidden - Adds additional sorting options for collections - Adds unique page url counts for archived items, collections, and organizations to backend and exposes this in collections - Shows collection period (i.e. `dateEarliest` to `dateLatest`) in collections list - Shows same collection metadata in private and public views, updates private view info bar - Fixes "Update Org Profile" action item showing for crawler roles --------- Co-authored-by: sua yoo <sua@webrecorder.org> Co-authored-by: sua yoo <sua@suayoo.com> Co-authored-by: Ilya Kreymer <ikreymer@gmail.com>
44 lines
1.2 KiB
Python
44 lines
1.2 KiB
Python
"""
|
|
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,
|
|
)
|