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

feat: added a formatting function for the output of data_extract_srv #60

Merged
merged 8 commits into from
May 18, 2022

Conversation

kpagacz
Copy link
Contributor

@kpagacz kpagacz commented May 13, 2022

@kpagacz kpagacz added the core label May 13, 2022
@github-actions
Copy link
Contributor

github-actions bot commented May 13, 2022

Code Coverage Summary

Filename                          Stmts    Miss  Cover    Missing
------------------------------  -------  ------  -------  ---------------------------------------------------------------------
R/all_choices.R                       1       0  100.00%
R/call_utils.R                      156     124  20.51%   14-23, 64, 66, 68, 107-431
R/check_selector.R                   31       0  100.00%
R/choices_labeled.R                 202      61  69.80%   60, 71, 76, 87, 103, 221-225, 229-234, 264-277, 390-391, 393, 425-473
R/choices_selected.R                 81      11  86.42%   201-229, 260
R/column_functions.R                  3       3  0.00%    13-16
R/data_extract_datanames.R           32       8  75.00%   9-13, 64-66
R/data_extract_filter_module.R       91      32  64.84%   68-81, 83, 86-87, 89-105, 142
R/data_extract_module.R             205      20  90.24%   3, 121, 126, 143, 146-151, 153, 172-175, 222, 353, 358, 390, 396
R/data_extract_read_module.R        121      13  89.26%   27, 31-34, 101-106, 115, 132
R/data_extract_select_module.R       32      18  43.75%   31-48
R/data_extract_single_module.R       53       2  96.23%   29, 42
R/data_extract_spec.R                32       0  100.00%
R/data_merge_module.R                44      19  56.82%   102-123
R/filter_spec.R                     186       1  99.46%   373
R/format_data_extract.R              16       1  93.75%   53
R/get_dplyr_call.R                  298       0  100.00%
R/get_merge_call.R                  283      32  88.69%   29-36, 47, 210-219, 362, 369, 385-397, 460
R/include_css_js.R                    5       0  100.00%
R/input_checks.R                     11       2  81.82%   18-19
R/merge_data_utils.R                  2       0  100.00%
R/merge_datasets.R                  154       7  95.45%   71, 123, 251-255
R/resolve_delayed.R                 104      44  57.69%   220-303
R/select_spec.R                      49       8  83.67%   149, 213-220
R/utils.R                            15      11  26.67%   26-39
R/zzz.R                               2       2  0.00%    2-3
TOTAL                              2209     419  81.03%

Results for commit: 988dc88

Minimum allowed coverage is 80%

♻️ This comment has been updated with latest results

@github-actions
Copy link
Contributor

github-actions bot commented May 13, 2022

Unit Tests Summary

    1 files    20 suites   33s ⏱️
146 tests 145 ✔️ 1 💤 0
543 runs  542 ✔️ 1 💤 0

Results for commit c4ec672.

♻️ This comment has been updated with latest results.

@nikolas-burkoff nikolas-burkoff self-assigned this May 16, 2022
Copy link
Contributor

@nikolas-burkoff nikolas-burkoff left a comment

Choose a reason for hiding this comment

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

  • I would add NEWS item for this
  • What about reshape? (Does that matter given des are likely to be replaced soon...)
    image

vignettes/data-extract.Rmd Outdated Show resolved Hide resolved
R/format_data_extract.R Outdated Show resolved Hide resolved
#' }
#' @export
#'
format_data_extract <- function(data_extract) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I could imagine this being called in a reactive context so maybe we should not have the assert and stop?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Then, the reactive caller should catch the error and rethrow a shiny::validate error. This function does not know about shiny.

Copy link
Contributor

Choose a reason for hiding this comment

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

True - though in practice that will never be done of course.

This function will be being called when the add_to_report button is pressed so there's unlikely to be some weird initialization issue where this function is being called maybe with DDL where data_extract is say NULL? I get very confused as to the sequence of events during load up. You could imagine adding a if(is.null(data_exrtract)) return NULL or some such thing to make people lives a little easier if needed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added a guard statement for null

R/format_data_extract.R Show resolved Hide resolved
tests/testthat/test-format_data_extract.R Show resolved Hide resolved
select = select_spec(choices = c("Petal.Length", "Species"))
)

shiny::testServer(
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, it's not ideal because data_extract_srv does not output the structure with all values filled but just a skeleton due to the use of js for some logic.

A proper test boots up a headless browser for this, which I am keen on doing.

@kpagacz
Copy link
Contributor Author

kpagacz commented May 17, 2022

  • I would add NEWS item for this

    • What about reshape? (Does that matter given des are likely to be replaced soon...)
      image

NEWS entry added

@kpagacz kpagacz enabled auto-merge (squash) May 17, 2022 13:37
Copy link
Contributor

@nikolas-burkoff nikolas-burkoff left a comment

Choose a reason for hiding this comment

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

image

:(

})

testthat::test_that("format_data_extract integrates with data_extract_srv and the filtered data object", {
skip_if_too_deep(4)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is 4 our convention for these tests?

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 don't think there's a convention. This file takes around 10% of the whole test-suite duration, and most of it can be attributed to this particular test. I think it's unreasonable to run it always.

Copy link
Contributor

Choose a reason for hiding this comment

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

happy to not always run it - in other places (tmh?)I think we use 5 not 4

Copy link
Contributor

@nikolas-burkoff nikolas-burkoff left a comment

Choose a reason for hiding this comment

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

Approving, will let you decide what to do with the browser test

@kpagacz kpagacz merged commit 0e870d5 into main May 18, 2022
@kpagacz kpagacz deleted the 8_teal.reporter_filter_list_print2@main branch May 18, 2022 09:19
@kpagacz
Copy link
Contributor Author

kpagacz commented May 18, 2022

Oh crap. It was on auto merge, grr. I will open a new PR to fix the headless browser test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants