Retention period default date issues
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 1.1k
- Forks
- 564
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 29
Description
What steps does it take to reproduce the issue? Wile testing #12421, two related issues were discovered w.r.t. the default/suggested date when setting a retention period. First, when intially launched the retention dialog shows a date one day after the minimum allowed date, e.g. Nov 19 instead of 18 (which is allowed) in:
Second, if the dialog is closed and reopened, the default changes to 1000 years in the future:
-
When does this issue occur?
Editing the retention period. -
Which page(s) does it occurs on?
Dataset and file pages. -
Why does it happen?
Due to
dataverse/src/main/java/edu/harvard/iq/dataverse/DatasetPage.java
Line 2307 in 0b87f4b
selectionRetention.setDateUnavailable(minRetentiondate.plusDays(1L));
and
dataverse/src/main/java/edu/harvard/iq/dataverse/FilePage.java
Line 296 in 0b87f4b
selectionRetention.setDateUnavailable(minRetentiondate.plusDays(1L));
, the initial choice for retention period is the day after the minimum - seems like plusDays(1) isn't needed if the minimum now has a minusDays(1).
If I cancel the retention dialog and reopen it, the default date shown is 1000 years in the future. I think that's due to creation of a new Retention at
dataverse/src/main/java/edu/harvard/iq/dataverse/DatasetPage.java
Line 6849 in 0b87f4b
selectionRetention= new Retention();
(which defaults to 1000 years in the constructor), without code like this
dataverse/src/main/java/edu/harvard/iq/dataverse/DatasetPage.java
Lines 2305 to 2308 in 0b87f4b
LocalDate minRetentiondate = settingsWrapper.getMinRetentionDate();
if (minRetentiondate != null){
selectionRetention.setDateUnavailable(minRetentiondate.plusDays(1L));
}
which is done at page init but not in the clearRetentionPopup method. (Similar issue with the FilePage.)
As these are all retention date related and relatively simple, would you like to fix them in this PR, or do you want to treat them as a separate issue/possible PR for the future?
Which version of Dataverse are you using?
6.11+ / develop
Any related open or closed issues to this bug report?
Screenshots:
No matter the issue, screenshots are always welcome.
To add a screenshot, please use one of the following formats and/or methods described here:
Are you thinking about creating a pull request for this issue?
Help is always welcome, is this bug something you or your organization plan to fix?
Just capturing the issue at present.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in DatasetPage.java and FilePage.java, reading the retention dialog initialization and clearRetentionPopup methods, especially setDateUnavailable and new Retention. Verify the minimum allowed date is shown on first open and that reopening the dialog does not reset the date to 1000 years ahead on dataset and file pages.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 72/100