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

Update merge_expression_module.R #93

Closed
wants to merge 3 commits into from
Closed

Update merge_expression_module.R #93

wants to merge 3 commits into from

Conversation

Polkas
Copy link
Contributor

@Polkas Polkas commented Aug 18, 2022

No description provided.

@Polkas Polkas marked this pull request as ready for review August 18, 2022 14:00
@github-actions
Copy link
Contributor

badge

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       92      11  88.04%   75-82, 84, 87-88, 141
R/data_extract_module.R             247      61  75.30%   3, 121, 126, 143, 146-151, 153, 172-175, 203-249, 446, 451, 482, 585
R/data_extract_read_module.R        122      13  89.34%   28, 32-35, 102-107, 116, 133
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                58      15  74.14%   101-118
R/filter_spec.R                     186       1  99.46%   373
R/format_data_extract.R              16       1  93.75%   49
R/get_dplyr_call.R                  299       0  100.00%
R/get_merge_call.R                  280      29  89.64%   28-34, 45, 206-215, 368, 384-396
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                  135       6  95.56%   72, 220-224
R/merge_expression_module.R          46       1  97.83%   148
R/resolve_delayed.R                  16       0  100.00%
R/resolve.R                         114      44  61.40%   229-312
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                              2318     432  81.36%

Results for commit: f7ffc3a

Minimum allowed coverage is 80%

♻️ This comment has been updated with latest results

@github-actions
Copy link
Contributor

Unit Tests Summary

    1 files    24 suites   53s ⏱️
192 tests 191 ✔️ 1 💤 0
667 runs  666 ✔️ 1 💤 0

Results for commit 6b230ad.

@@ -335,7 +335,7 @@ merge_expression_srv <- function(id = "merge_id",
merge_fun_name <- if (inherits(merge_function, "reactive")) merge_function() else merge_function
check_merge_function(merge_fun_name)

ds <- Filter(Negate(is.null), lapply(selector_list(), function(x) x()))
ds <- Filter(function(e) length(e) > 0, lapply(selector_list(), function(x) x()))
Copy link
Contributor

Choose a reason for hiding this comment

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

selector_list is an output from the data_extract_multiple_srv and it's a list of selectors and it's hard to imagine that this line wouldn't remove null's already. So NULL and length == 0 is not possible for this list.

Let's focus on the possible look of the selector. Each selector is a list which contains:

  • filters
  • select
  • always selected
  • reshape <logical(1)>
  • dataname <character(1)>
  • internal_id <character(1)>
  • keys

To make sure that you fix this please fix it to the following way

Suggested change
ds <- Filter(function(e) length(e) > 0, lapply(selector_list(), function(x) x()))
ds <- Filter(function(e) length(e$select) > 0, lapply(selector_list(), function(x) x()))

If we do so, we can close this issue:

Copy link
Contributor

Choose a reason for hiding this comment

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

This would require also:

  • change the news file
  • validate(need(length(ds) > 0, "Nothing selected"))

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, above suggestion and line in tmg where we removing selector with empty -select slot is wrong.
We need to overcome this in different way

@@ -335,8 +335,8 @@ merge_expression_srv <- function(id = "merge_id",
merge_fun_name <- if (inherits(merge_function, "reactive")) merge_function() else merge_function
check_merge_function(merge_fun_name)

ds <- Filter(Negate(is.null), lapply(selector_list(), function(x) x()))
validate(need(length(ds) > 0, "At least one dataset needs to be selected"))
ds <- Filter(function(e) length(e$select) > 0, lapply(selector_list(), function(x) x()))
Copy link
Contributor

Choose a reason for hiding this comment

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

This would drop this variable from the $columns_source, so it would fail some validation. We need to dig into merge_datasets and not merge selector which is not selected

Copy link
Contributor Author

@Polkas Polkas Aug 19, 2022

Choose a reason for hiding this comment

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

I am closing this PR as not has even an issue number.
I assume this will be a quick updated. FOr sure this have to be properly tested

@Polkas Polkas closed this Aug 19, 2022
@gogonzo gogonzo deleted the selector_fix@main branch August 19, 2022 07:19
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