Skip to content

Commit

Permalink
Merge pull request #179 from Nathaniel-Fernandes/master
Browse files Browse the repository at this point in the history
bugfix: match.arg was not working in the Shiny App for Mage plot
  • Loading branch information
irinagain authored Mar 6, 2025
2 parents 4dcd8f3 + 7756d17 commit ffbedd6
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:

- name: Upload test results
if: failure()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: coverage-test-failures
path: ${{ runner.temp }}/package
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# iglu 4.2.2
* Fixed bug in Shiny app where MAGE plot was not rendering

# iglu 4.2.1
* Fixed bug in MAGE

Expand Down
2 changes: 1 addition & 1 deletion R/mage.R
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ mage <- function(data,
short_ma = 5, long_ma = 32,
return_type = c('num', 'df'),
direction = c('avg', 'service', 'max', 'plus', 'minus'),
tz = "", inter_gap = 45,
tz = "", inter_gap = 45,
max_gap=180,
plot = FALSE, title = NA, xlab = NA, ylab = NA, show_ma = FALSE, show_excursions = TRUE) {

Expand Down
2 changes: 1 addition & 1 deletion R/mage_ma_single.R
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ mage_ma_single <- function(data,
if(plot) {
# 6.1 Label 'Peaks' and 'Nadirs'
direction = match.arg(direction, c('avg', 'service', 'max', 'plus', 'minus'))
static_or_gui = match.arg(static_or_gui, c('ggplot', 'plotly'))
static_or_gui = match.arg(static_or_gui, c('plotly', 'ggplot'))

if (direction == 'avg') {
tp_indexes <- dplyr::select(all_tp_indexes, idx, peak_or_nadir, plus_or_minus)
Expand Down
4 changes: 1 addition & 3 deletions inst/shiny_iglu/server.R
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,6 @@ shinyServer(function(input, output) {
}
else if(parameter_type == "all_metrics") {
string = paste0("iglu::", input$metric, "(data, , , , , , '", input$parameter , "')")
print(string)
}
else if(parameter_type == 'pgs'){
string = paste0('iglu::', input$metric, '(data, ', input$parameter, ', ', input$parameter2, ')')
Expand Down Expand Up @@ -877,8 +876,7 @@ shinyServer(function(input, output) {

string = paste0("iglu::mage_ma_single(data=data,plot=TRUE,short_ma=",input$mage_short_ma,",long_ma=",
input$mage_long_ma,", direction='", input$direction, "', max_gap='", input$max_gap,
"', show_ma=", input$mage_show_ma,", show_excursions=", input$show_excursions, ",title=",mage_title,",xlab=", mage_xlab,",ylab=",mage_ylab,")")

"', show_ma=", input$mage_show_ma,", show_excursions=", input$show_excursions, ",title=",mage_title,",xlab=", mage_xlab,",ylab=",mage_ylab,",static_or_gui='ggplot')")
eval(parse(text=string))
}
})
Expand Down

0 comments on commit ffbedd6

Please sign in to comment.