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

OKRS-24-55 #1243

Merged

Conversation

dmytrotsko
Copy link
Contributor

@dmytrotsko dmytrotsko commented Feb 26, 2024

Prerequisites:

  • Branch is up-to-date with the branch to be merged with, i.e. dev
  • Build is successful
  • Code is cleaned up and formatted

Summary

"latest known data" link now preserves context.
Set default date to the date when we have data for all 3 sensors in 'Overview'. When date is present in URL, the date doesn't change to "default date". Added "NoRecentDataWarning" in order to nofity user about "old" data

Copy link

netlify bot commented Feb 26, 2024

Preview link ready!

Name Link
🔨 Latest commit a465b1a
🔍 Latest deploy log https://app.netlify.com/sites/cmu-delphi-covidcast/deploys/6627d894b13ec90008b3e315
😎 Deploy Preview https://deploy-preview-1243--cmu-delphi-covidcast.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

…oved annotation for Hosptal Admissions sensor when we don't have recent data for choosen date
Copy link
Contributor

@melange396 melange396 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great! I especially appreciate how you got rid of the asterisks and added tooltip hovers for the latest dates of each of the 3 highlighted indicators.

There is one behavior that we might want to change though (and we can merge this PR and fix it later, if necessary) -- when you go to the dashboard without any url parameters (like https://deploy-preview-1243--cmu-delphi-covidcast.netlify.app/ ), it shows the warning message as appropriate. However, when you go to the dashboard with a date specified that matches minMaxDate, it still shows the warning message (for instance, as of today 20240416, the most recent date with all 3 indicators available is 20240329, so today this happens when you visit https://deploy-preview-1243--cmu-delphi-covidcast.netlify.app/?date=20240329 ). This doesn't give incorrect information, but it could be fairly confusing for users.

<a href="?date={formatAPITime(sensor.timeFrame.max)}" on:click={switchDate}
>{formatDateYearDayOfWeekAbbr(sensor.timeFrame.max)}</a
<a
href="?date={formatAPITime(sensor.timeFrame.max)}&{window.location.search.split('&').slice(1).join('&')}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this file still used anywhere? It looks like it has been replaced by your new NoRecentDataWarning.svelte...

If we are keeping the file, we should include a comment describing what this split/slice/join operation is doing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't mean to replace "IndicatorWarning.svelte" by "NoRecentDataWarning.svelte", but I didn't want to change existing "Indicator.svelte" either.
I would prefer to add comment and leave both of them (at least for now).

src/modes/summary/Overview.svelte Show resolved Hide resolved
src/modes/summary/Overview.svelte Show resolved Hide resolved
src/blocks/NoRecentDataWarning.svelte Outdated Show resolved Hide resolved
src/modes/summary/Overview.svelte Show resolved Hide resolved
src/blocks/NoRecentDataWarning.svelte Outdated Show resolved Hide resolved
@dmytrotsko
Copy link
Contributor Author

This looks great! I especially appreciate how you got rid of the asterisks and added tooltip hovers for the latest dates of each of the 3 highlighted indicators.

There is one behavior that we might want to change though (and we can merge this PR and fix it later, if necessary) -- when you go to the dashboard without any url parameters (like https://deploy-preview-1243--cmu-delphi-covidcast.netlify.app/ ), it shows the warning message as appropriate. However, when you go to the dashboard with a date specified that matches minMaxDate, it still shows the warning message (for instance, as of today 20240416, the most recent date with all 3 indicators available is 20240329, so today this happens when you visit https://deploy-preview-1243--cmu-delphi-covidcast.netlify.app/?date=20240329 ). This doesn't give incorrect information, but it could be fairly confusing for users.

Yeah, I agree that it is uncorrect behaviour and I wanted to fix that, but I have not found how to do that yet.

@dmytrotsko dmytrotsko requested a review from melange396 April 17, 2024 13:33
Copy link
Contributor

@melange396 melange396 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great! Just two little things for punctuation, and then one comment/question about code location.

Comment on lines +48 to +67
// warningType is indicator of which exact warning message should be shown.
// By default, when user opens page with no specified date, the date will be set to the latest date we have data for all 3 indicators.
// In this case, warningType should be set to 1.
// In case selected date is set to future date (date > minMaxDate, where we don't have recent data for all 3 indicators), the warningType will be set to 2
// which has different warning message.
// In case selected date is set to some date which is < minMaxDate, the warningType will be set to 0 which means that we will not show
// any warning message.

// warningType should be set in beforeUpdate() method, to guess correct warningType.

let warningType = 1;
beforeUpdate(() => {
if (date.value > minMaxDate) {
warningType = 2;
} else if (date.value < minMaxDate) {
warningType = 0;
} else {
warningType = 1;
}
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we do the date.value != minMaxDate comparisons inside NoRecentDataWarning.svelte? That way we wouldn't have to pass warningType... Or do we need to do the comparisons inside of the beforeUpdate() event here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i talked to Dmytro on slack, he is going to look at this but we will release the current state in the meantime as the functionality is doing what its supposed to.

src/blocks/NoRecentDataWarning.svelte Outdated Show resolved Hide resolved
src/blocks/NoRecentDataWarning.svelte Outdated Show resolved Hide resolved
Copy link
Contributor

@melange396 melange396 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome!

@melange396
Copy link
Contributor

ah crap, build is now failing because prettier doesnt like something in src/blocks/NoRecentDataWarning.svelte

@melange396
Copy link
Contributor

thanks Dmytro, youre the best!

@melange396 melange396 merged commit 0b42ad1 into dev Apr 23, 2024
6 checks passed
@melange396 melange396 deleted the OKRS24-55-UX-default-to-most-recent-data-preserve-user-context branch April 23, 2024 15:54
@melange396 melange396 mentioned this pull request Apr 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants