Loosen record version warning check
Closed this issue · 0 comments
Description
When viewing a record from a URL with the version in the URL, the warning about old versions is popped up even if you are looking at the current version of the record.
Expected Behaviour
The warning to only show up if you are actually viewing an old version of the record.
To Reproduce
An example: specimen record with ID: 5731551
. The latest version of the record can be seen here: https://data.nhm.ac.uk/object/a42fff2a-37c2-4913-b378-2ed78601e69f.
This record has the following versions:
[
1504051200000,
1512432000000,
1601164800000,
1612915200000,
1641600000000,
1678752000000
]
If we look at the record at version 1641600000000
we get the warning correctly.
If we look at the record at version 1678752000000
we don't get the warning correctly.
If we look at the record at an arbitrary version, say 1ms after the latest version (1678752000001
), we get the warning incorrectly.
This appears to be because we compare the version provided in the URL to the latest version of the record and if they do not match, we show the warning. We should only show the warning if the requested version is less than the latest version of the record. Should be an easy fix on this line: https://github.com/NaturalHistoryMuseum/ckanext-nhm/blob/main/ckanext/nhm/theme/templates/record/view.html#L29.