SORMAS-Project
SORMAS-Project copied to clipboard
Remove time from case report and last contact date in mobile app [2]
Bug Description
When a Case is created in the Android app, in the Case Directory, it is displayed that the Case was reported 'just now' (because the current time is considered), but when a Case is created in the Vaadin app, it is displayed that the Case was reported ' x hours ago' (because the report time is automatically set to 12 AM)
Steps to Reproduce
- In the Android app, create a Case with the Report Date set to the current date;
- In the Vaadin app, create a Case with the Report Date set to the current date;
- Navigate to the Cases Directory in the Android app and inspect what reporting time is displayed in the bottom right corner of the Case Card.
- Also, in the Vaadin app, navigate to the Cases Directory and set the view to Detailed; inspect the Date of Report of the two Cases;
Actual Behavior
When the Case is created in the Vaadin app, the time of the Report Date is automatically set to 12 AM and when a Case is created in the Android app, the time is automatically set to the current time;
Expected Behavior
There should be a consistency: either the current time, either 12 AM should be set, regardless if the Case was created in the Android app or in the Vaadin app. It needs to be decided which time should be considered.
Implementation Details
- [ ] Save case report date and last contact date as dates "without" time in the mobile app (i.e. the resulting date should look similar to the date when creating cases/contacts in the web app, which sets the time to 12 AM)
- [ ] Adjust the TimeAgo logic in a way that allows us to use "today" (needs to be added as a new period) instead of anything below "yesterday" (i.e. hours, minutes, just now, etc.); this probably involves adding a new attribute that can be used in the list item layouts (suggestion: "timeAgoDetailLevelDays" as a boolean attribute); use this new attribute for the report date in the case list and the last contact date in the contact list
- [ ] In the case grid only show the date of the report date, not the time
Screenshots
Case 1 (created in the Android app)
Case 2 (created in the Vaadin app)
Case 1 and Case 2
System Details
- Device:
- SORMAS version: Sormas 1.75.0-SNAPSHOT (6c28468)
- Android version/Browser: Android 11
- Server URL: https://test-de.sormas.netzlink.com/sormas-rest/
- User Role: SurvOff
Additional Information
The solution here is probaly to make sure that we also include the time when creating cases in the web app; I'm not sure whether it's trivial to do this though. @MartinWahnschaffe Do you have a preferred solution here?
The date of report should only be a date - the time should be neglected. E.g. creating a case and setting the case to yesterday, combined with the current time, would not make sense.
This means:
- The android app should follow the approach of the vaadin app and set the time part to 12 AM
- The android app should either use the creation date to display the "x hours ago" in the case list OR use the date of report, but only display day precision information (today, 1 day ago, ...). @bernardsilenou or @zohaibhassan122 please decide which solution is preferable.
- The date of report should nowhere be display with the timestamp.
@MartinWahnschaffe
- The android app can use the earliest of (creation date , edited date) for "x hours ago",
- Ie cases created last week but edited today would show at the top of the list, just as in the vaadin app
@bernardsilenou This makes sense to me. It means that we also have to change the order in the list, which is currently based on the date of report.
@bernardsilenou I have discussed this again with Maté and we think that the reference point in time for "x days ago" information in the case list should stay the date of report, because for contacts it's the date of last contact - so it would be much more consistent like that.
What should probably be changed is the sorting of the case list - it would make a lot more sense to sort by change date, like it's done for pretty much all other lists. Please discuss at HZI whether this should be done and if so, create an issue for it.
Verified ticket on local environment using the latest version of Sormas 1.76.0-SNAPSHOT (0c95d19) from the development branch.