Skip to content
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

Exclude deleted/purged and fix size calculation in archivable-histories query #146

Merged
merged 1 commit into from
Jan 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions parts/22-query.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5028,18 +5028,14 @@ query_archivable-histories() { ##? [--user-last-active=360] [--history-last-acti
extra_selects=
extra_joins=
extra_conds=
group_by=
if [[ -n $arg_size ]]; then
extra_selects=',
sum(dataset.total_size) AS size
'
extra_joins='JOIN history_dataset_association on history.id = history_dataset_association.history_id
extra_joins='
JOIN dataset on history_dataset_association.dataset_id = dataset.id'
extra_conds='AND NOT history_dataset_association.purged
extra_conds='AND NOT dataset.deleted
AND NOT dataset.purged'
group_by='GROUP BY
history.id, galaxy_user.id
'
fi

email=$(gdpr_safe galaxy_user.email email)
Expand All @@ -5054,13 +5050,19 @@ query_archivable-histories() { ##? [--user-last-active=360] [--history-last-acti
FROM
history
JOIN galaxy_user ON history.user_id = galaxy_user.id
JOIN history_dataset_association on history.id = history_dataset_association.history_id
$extra_joins
WHERE
NOT history.published
AND history.update_time < now() - interval '$arg_history_last_active days'
AND galaxy_user.update_time < now() - interval '$arg_user_last_active days'
AND NOT history.deleted
AND NOT history.purged
AND NOT history_dataset_association.deleted
AND NOT history_dataset_association.purged
AND history.update_time < now() - interval '$arg_history_last_active minutes'
AND galaxy_user.update_time < now() - interval '$arg_user_last_active minutes'
$extra_conds
$group_by
GROUP BY
history.id, galaxy_user.id
ORDER BY
user_age ASC,
galaxy_user.email ASC,
Expand Down
Loading