Skip to content

Conversation

@vedhav
Copy link
Contributor

@vedhav vedhav commented Feb 20, 2025

Closes #849

@vedhav vedhav added the core label Feb 20, 2025
@vedhav vedhav enabled auto-merge (squash) February 20, 2025 06:10
@vedhav vedhav requested a review from m7pr February 20, 2025 06:17
@github-actions
Copy link
Contributor

github-actions bot commented Feb 20, 2025

badge

Code Coverage Summary

Filename                      Stmts    Miss  Cover    Missing
--------------------------  -------  ------  -------  ---------------------------------------
R/tm_a_pca.R                    888     888  0.00%    136-1157
R/tm_a_regression.R             777     777  0.00%    175-1057
R/tm_data_table.R               211     211  0.00%    100-359
R/tm_file_viewer.R              173     173  0.00%    47-255
R/tm_front_page.R               144     133  7.64%    77-247
R/tm_g_association.R            346     346  0.00%    156-577
R/tm_g_bivariate.R              690     426  38.26%   328-815, 856, 967, 984, 1002, 1013-1035
R/tm_g_distribution.R          1119    1119  0.00%    153-1419
R/tm_g_response.R               369     369  0.00%    174-622
R/tm_g_scatterplot.R            731     731  0.00%    257-1092
R/tm_g_scatterplotmatrix.R      296     277  6.42%    195-528, 589, 603
R/tm_missing_data.R            1133    1133  0.00%    121-1431
R/tm_outliers.R                1044    1044  0.00%    160-1355
R/tm_t_crosstable.R             261     261  0.00%    160-469
R/tm_variable_browser.R         832     827  0.60%    89-1078, 1116-1299
R/utils.R                       151     135  10.60%   89-274, 304-340, 352-361, 366, 380-399
R/zzz.R                           2       2  0.00%    2-3
TOTAL                          9167    8852  3.44%

Diff against main

Filename                 Stmts    Miss  Cover
---------------------  -------  ------  --------
R/tm_g_distribution.R       -4      -4  +100.00%
TOTAL                       -4      -4  +0.00%

Results for commit: cd0e4dd

Minimum allowed coverage is 80%

♻️ This comment has been updated with latest results

@github-actions
Copy link
Contributor

github-actions bot commented Feb 20, 2025

Unit Tests Summary

  1 files   22 suites   12m 58s ⏱️
144 tests 107 ✅ 37 💤 0 ❌
474 runs  437 ✅ 37 💤 0 ❌

Results for commit cd0e4dd.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 20, 2025

Unit Test Performance Difference

Test Suite $Status$ Time on main $±Time$ $±Tests$ $±Skipped$ $±Failures$ $±Errors$
examples 💚 $5.33$ $-4.76$ $-1$ $+37$ $0$ $0$
shinytest2-tm_a_pca 💚 $117.60$ $-1.41$ $0$ $0$ $0$ $0$
Additional test case details
Test Suite $Status$ Time on main $±Time$ Test Case
examples 💚 $1.77$ $-1.69$ example_add_facet_labels.Rd

Results for commit 635b403

♻️ This comment has been updated with latest results.

Copy link
Contributor

@m7pr m7pr left a comment

Choose a reason for hiding this comment

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

Tested with below. Works like a charm

table_decorator <- function(.color1 = "#f9f9f9", .color2 = "#f0f0f0", .var_to_replace = "table") {
  teal_transform_module(
    label = "Table color",
    ui = function(id) {
      selectInput(
        NS(id, "style"),
        "Table Style",
        choices = c("Default", "Color1", "Color2"),
        selected = "Default"
      )
    },
    server = function(id, data) {
      moduleServer(id, function(input, output, session) {
        logger::log_info("🔵 Table row color called to action!", namespace = "teal.modules.general")
        reactive({
          req(data(), input$style)
          logger::log_info("changing the Table row color '{input$style}'", namespace = "teal.modules.general")
          teal.code::eval_code(data(), substitute({
            .var_to_replace <- switch(
              style,
              "Color1" = DT::formatStyle(
                .var_to_replace,
                columns = attr(.var_to_replace$x, "colnames")[-1],
                target = "row",
                backgroundColor = .color1
              ),
              "Color2" = DT::formatStyle(
                .var_to_replace,
                columns = attr(.var_to_replace$x, "colnames")[-1],
                target = "row",
                backgroundColor = .color2
              ),
              .var_to_replace
            )
          }, env = list(
            style = input$style,
            .var_to_replace = as.name(.var_to_replace),
            .color1 = .color1,
            .color2 = .color2
          )))
        })
      })
    }
  )
}


# general data example
data <- teal_data()
data <- within(data, {
  iris <- iris
})

app <- init(
  data = data,
  modules = list(
    tm_g_distribution(
      dist_var = data_extract_spec(
        dataname = "iris",
        select = select_spec(variable_choices("iris"), "Petal.Length")
      ),
      decorators = list(summary_table = table_decorator(.var_to_replace = "summary_table"))
    )
  )
)
if (interactive()) {
  shinyApp(app$ui, app$server)
}
image

@vedhav vedhav merged commit 59bb1b1 into main Feb 20, 2025
27 checks passed
@vedhav vedhav deleted the 849-fix-tm_g_distribution-decorators@main branch February 20, 2025 11:31
@github-actions github-actions bot locked and limited conversation to collaborators Feb 20, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Decorators does not work for tm_g_distribution's outputs summary_table and test_table

3 participants