-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #445 from uhh-lt/fix-mui-upgrade-issues
Fix frontend issues
- Loading branch information
Showing
100 changed files
with
1,254 additions
and
1,288 deletions.
There are no files selected for viewing
53 changes: 53 additions & 0 deletions
53
backend/src/alembic/versions/312438bf1885_add_timelineanalysis_filterid.py
This file contains 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,53 @@ | ||
"""add id to timeline analysis filter | ||
Revision ID: 312438bf1885 | ||
Revises: 5bcc9d14725a | ||
Create Date: 2024-10-15 12:29:23.410076 | ||
""" | ||
|
||
import uuid | ||
from typing import Any, Sequence, Union | ||
|
||
import sqlalchemy as sa | ||
import srsly | ||
|
||
from alembic import op | ||
|
||
# revision identifiers, used by Alembic. | ||
revision: str = "312438bf1885" | ||
down_revision: Union[str, None] = "5bcc9d14725a" | ||
branch_labels: Union[str, Sequence[str], None] = None | ||
depends_on: Union[str, Sequence[str], None] = None | ||
|
||
|
||
def upgrade() -> None: | ||
# we need to update all existing timeline analysis columns' concept field to include the id | ||
conn = op.get_bind() | ||
res = conn.execute( | ||
sa.text("SELECT id, concepts FROM timelineanalysis WHERE concepts IS NOT NULL") | ||
) | ||
|
||
def add_id_to_filter(filter: Any): | ||
filter["id"] = str(uuid.uuid4()) | ||
if "items" in filter: | ||
for item in filter["items"]: | ||
add_id_to_filter(item) | ||
|
||
for row in res: | ||
idx = row[0] | ||
concepts = row[1] | ||
|
||
concepts: Any = srsly.json_loads(concepts) | ||
for concept in concepts: | ||
add_id_to_filter(concept["filter"]) | ||
|
||
conn.execute( | ||
sa.text( | ||
"UPDATE timelineanalysis SET concepts = :concepts WHERE id = :id" | ||
).bindparams(concepts=srsly.json_dumps(concepts), id=idx) | ||
) | ||
|
||
|
||
def downgrade() -> None: | ||
pass |
This file contains 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 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 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 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 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.