-
Notifications
You must be signed in to change notification settings - Fork 2
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(website): don't display data as "restricted" when the last restricted data use terms expired #2914
Merged
Conversation
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
fengelniederhammer
changed the title
fix(website): don't display data as "restricted" when the last restricted data user terms expired
fix(website): don't display data as "restricted" when the last restricted data use terms expired
Oct 1, 2024
fengelniederhammer
force-pushed
the
fixDataUseTermsDisplay
branch
from
October 1, 2024 08:56
c967f3e
to
db748ee
Compare
corneliusroemer
added
preview
Triggers a deployment to argocd
website
Tasks related to the web application
bug
Something isn't working
labels
Oct 1, 2024
…cted data use terms expired The backend only returns the history - which does not include "OPEN" as a last entry when the restricted period expired. LAPIS has the correct values - let's simply rely on that.
fengelniederhammer
force-pushed
the
fixDataUseTermsDisplay
branch
from
October 1, 2024 09:13
db748ee
to
d46d598
Compare
corneliusroemer
added
the
format_me
Triggers github_actions to format website code on PR
label
Oct 1, 2024
Testing this here:
|
corneliusroemer
approved these changes
Oct 1, 2024
} | ||
|
||
const isRestricted = currentDataUseTerms.type === 'RESTRICTED'; | ||
const dataUseTerms = tableData.find((entry) => entry.name === DATA_USE_TERMS_FIELD); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggested change
const dataUseTerms = tableData.find((entry) => entry.name === DATA_USE_TERMS_FIELD); | |
const dataUseTerms = tableData.find((entry) => entry.name === DATA_USE_TERMS_FIELD); | |
// Calculation below is based on the assumption that dataUseTerms is a string | |
// Hence assert to get loud error instead of quiet false data | |
if (typeof dataUseTerms?.value !== 'string') { | |
throw new Error('Code assumes dataUseTerms are of type string. If it isn't, then need to change the calculation of isRestricted.'); | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry - already merged. If you still think it's necessary, you can open a separate PR.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
preview URL: http://fixdatausetermsdisplay.loculus.org
Bug
Website seq details showed restricted even after expiration of restriction.
See https://loculus.slack.com/archives/C05G172HL6L/p1727769592602569
Summary
Root cause was misunderstanding in website code of what the dataUseTermsHistory contains.
The website code assumed there would be a new entry when something becomes open, but in fact the history is just a log of changes.
The backend only returns the history - which does not include "OPEN" as a last entry when the restricted period expired. LAPIS has the correct values - let's simply rely on that.
This assumes the following as correct:
We now simply take the use terms from LAPIS, that means the calculation is done in a single place for search and display.
Screenshot
PR Checklist