-
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
Remove old endpoints, add tests #523
Conversation
0613dc5
to
6c549dc
Compare
## Update some labels to match what naomi requires | ||
## TODO: Some of this is shared between model running and here so we | ||
## should use use common code when we merge this back into hintr. | ||
## This endpoint currently isn't called see mrc-592. |
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.
This is unrelated, but just tidied this up whilst I was here
## This is kind of gross but logic is, if setFilters is not included | ||
## in an effect, then use all the available filters. So have to replicate | ||
## this here for validation |
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.
@M-Kusumgar this is true right?
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.
this is not true, https://github.com/mrc-ide/hint/blob/mrc-4856/src/app/static/src/app/store/plotSelections/utils.ts#L59 we initialise filterRefs
as empty unless by "available" you mean setFilters
on a default effect.
Basically all plots need to have at least one setFilters
on the defaultEffect
or one of the options in a plot control otherwise nothing shows up on the UI
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.
Thanks! Should have looked at that code, thanks for the link. I've updated the test using proper information from here. This has simplified this function a bit too!
724f7ef
to
eb91c31
Compare
These are failing for annoying to diagnose reasons, but we don't actually need this code to run on mac.
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.
Mostly looks good to me! i had a couple of questions just to make sure im understanding this correctly!
## This is kind of gross but logic is, if setFilters is not included | ||
## in an effect, then use all the available filters. So have to replicate | ||
## this here for validation |
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.
this is not true, https://github.com/mrc-ide/hint/blob/mrc-4856/src/app/static/src/app/store/plotSelections/utils.ts#L59 we initialise filterRefs
as empty unless by "available" you mean setFilters
on a default effect.
Basically all plots need to have at least one setFilters
on the defaultEffect
or one of the options in a plot control otherwise nothing shows up on the UI
## Testthat skips if only calling custom expect function, so add this | ||
## noddy test to force it to run. |
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.
wow thats annoying
if (isTRUE(filter_types[[filter_id]])) { | ||
break | ||
} |
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 bit confused by this, is this a truthy check on whether the key exists in filter_types
and why do we break if the key does exist?
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.
o damn more silly mistakes here. This is supposed to be if use_shape_regions
is true for this filter then skip the check of the options
expect_option_exists(all_option_ids, | ||
effects$setFilterValues[[state_filter_id]], | ||
paste(context, "setFilterValues"), | ||
effect$id) |
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.
where is effect$id
coming from?
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.
agh this is some old junk from previous loop which I missed. Should be state_filter_id
now, thanks.
8e09d6a
to
3d0a4ea
Compare
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.
happy to approve after that debug is removed, had an optional comment about testing the behaviour of the setFilters
effect!
if (isTRUE(filter_types[[filter_id]]$use_shape_regions)) { | ||
## If we're referring to a filter which uses regions from | ||
## shape file, we have no options in metadata. So skip this check. | ||
browser() |
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.
rogue debug?
set_filters <- effects$setFilters | ||
if (length(effects$setFilters) == 0) { | ||
set_filters <- default_effects$setFilters | ||
} | ||
expect(length(set_filters) > 0, | ||
paste(context, "setFilters must be set in plot setting or", | ||
"default settings.")) |
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.
while this is currently true for all plots, this is not necessarily true, feel free to leave this in, but you can technically do more with the metadata.
For example, say there was a plot control A
and a plot control B
and a default effect C
. You can have it so that only A
contains a setFilters
effect for all its settings and B
, C
do not contain a setFilters
. Then when your test gets to plot control B
, it will fail this test but every option from plot control A
still specifies setFilters
so everything in the UI would be fine
if you want to properly test this behaviour i would go one level up, pull our combined setFilters
(combined from all combinations of all available plot controls + default effect) and test that none of those combined setFilters
are empty. that would test it out properly but up to you whether you want to do this or not
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.
Thanks, added a note about this (feeling a bit lazy!)
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.
no problem!
This PR will
Note I left the time series endpoints as they are for now. When you tidy that up perhaps we should remove those? Though not too much harm leaving them in