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

Fix time comparison in annotation history check #1369

Merged
merged 1 commit into from
Nov 10, 2023
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
### Bug Fixes
- Default to "None" for the DICOM assetstore limit ([#1359](../../pull/1359))
- Fix series detection for some bioformats files ([#1365](../../pull/1365), [#1367](../../pull/1367))
- Fix time comparison in annotation history check ([#1369](../../pull/1369))

## 1.26.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1361,7 +1361,7 @@ def removeOldAnnotations(self, remove=False, minAgeInDays=30, keepInactiveVersio
keep -= 1
report['recentVersions'] += 1
continue
if max(record['created'], record['updated']) < age:
if max(record['created'], record['updated']).timestamp() < age.timestamp():
if remove:
self.collection.delete_one({'_id': record['_id']})
Annotationelement().removeWithQuery({'_version': record['_version']})
Expand Down
7 changes: 7 additions & 0 deletions girder_annotation/test_annotation/test_annotations_rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,13 @@ def testAnnotationHistoryEndpoints(self, server, user, admin):
resp = server.request('/annotation/old', method='GET', user=admin)
assert utilities.respStatus(resp) == 200
assert resp.json['abandonedVersions'] == 0
resp = server.request(
'/annotation/old', method='DELETE', user=admin, params={'versions': -1})
assert utilities.respStatus(resp) == 400
assert 'keepInactiveVersions' in resp.json['message']
resp = server.request(
'/annotation/old', method='GET', user=admin, params={'age': 0, 'versions': 0})
assert utilities.respStatus(resp) == 200
resp = server.request('/annotation/old', method='DELETE', user=admin)
assert utilities.respStatus(resp) == 200
assert resp.json['abandonedVersions'] == 0
Expand Down