Skip to content

Conversation

syroBx
Copy link
Collaborator

@syroBx syroBx commented Apr 9, 2025

Add warning for 'update_filter' and 'stat' function for #15

update_filter

Before:

> coh$update_filter(1L, "film_filter", active = "FALSE")

> get_state(coh)
[[1]]
[[1]]$step
[1] "1"
...
[[1]]$filters[[2]]$active
[1] "FALSE"

> run(coh)
Error in `purrr::keep()`:
ℹ In index: 2.
ℹ With name: film_filter.
Caused by error:
! `.p()` must return a single `TRUE` or `FALSE`, not a string.
Run `rlang::last_trace()` to see where the error occurred.

After:

> coh$update_filter(1L, "film_filter", active = "FALSE")
Warning message:
In coh$update_filter(1L, "film_filter", active = "FALSE") :
  Active accepts only logical values

> get_state(coh)
[[1]]
[[1]]$step
[1] "1"
...
[[1]]$filters[[2]]$active
[1] TRUE

> run(coh)
> coh$update_filter(1L, "film_filter", active = FALSE)
> get_state(coh)
[[1]]
[[1]]$step
[1] "1"
...
[[1]]$filters[[2]]$active
[1] FALSE

stat

Before:

> stat(coh,10)
$actor
$actor$n_rows
NULL

...

$store
$store$n_rows
NULL

After:

> stat(coh,10)
Error in x$get_stats(step_id, filter_id, ..., state = state) : 
  Step is not exist in this cohort object.

@syroBx syroBx requested review from galachad and krystian8207 April 9, 2025 11:39
@syroBx syroBx self-assigned this Apr 9, 2025
Copy link

codecov bot commented Apr 9, 2025

Codecov Report

Attention: Patch coverage is 80.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 66.51%. Comparing base (086713f) to head (315f4d9).

Files with missing lines Patch % Lines
R/cohort_methods.R 80.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              dev      #80      +/-   ##
==========================================
+ Coverage   66.41%   66.51%   +0.10%     
==========================================
  Files          11       11              
  Lines        1977     1983       +6     
==========================================
+ Hits         1313     1319       +6     
  Misses        664      664              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@syroBx syroBx changed the title Add warning for 'update_filter' function Add some warnings and errors for cohort methods. Apr 19, 2025
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.

1 participant