Skip to content

Commit

Permalink
fixed htm vs zip bug
Browse files Browse the repository at this point in the history
  • Loading branch information
triphook committed Feb 6, 2024
1 parent 9e5f0df commit ba3b71a
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 32 deletions.
1 change: 0 additions & 1 deletion R/app_server.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
# Below increases the max data upload size from the Shiny default of 5MB per file
# to 30MB for file
options(shiny.maxRequestSize = 30 * 1024^2)
options(warn = 2)
app_server <- function(input, output, session) {
# Your application server logic
tadat <- shiny::reactiveValues() # create a list object that holds reactive values passed between modules
Expand Down
18 changes: 7 additions & 11 deletions R/mod_TADA_summary.R
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ mod_TADA_summary_ui <- function(id) {
"site_clean"
)))),
shiny::fluidRow(column(6, shiny::uiOutput(ns(
"dwn_all"
"dwn_working"
)))),
shiny::fluidRow(column(6, shiny::uiOutput(ns(
"dwn_ts"
"dwn_final"
))))#,
# shiny::fluidRow(column(
# 6,
Expand Down Expand Up @@ -81,11 +81,6 @@ mod_TADA_summary_server <- function(id, tadat) {
# calculate the stats needed to fill the summary box
shiny::observe({
shiny::req(tadat$raw)
<<<<<<< HEAD
=======
print("Updating summary stats")
print(nrow(tadat$raw))
>>>>>>> a5e2c871b534920ebc52df213410dd6a135a9828
summary_things$rem_rec <-
length(tadat$raw$ResultIdentifier[tadat$raw$TADA.Remove ==
TRUE])
Expand Down Expand Up @@ -174,15 +169,15 @@ mod_TADA_summary_server <- function(id, tadat) {
})

# download dataset button - only appears if there data exists in the app already
output$dwn_all <- shiny::renderUI({
output$dwn_working <- shiny::renderUI({
shiny::req(tadat$raw)
shiny::downloadButton(ns("download_working"),
"Download Working Dataset (.zip)",
style = "color: #fff; background-color: #337ab7; border-color: #2e6da4",
contentType = "application/zip")
})

output$dwn_ts <- shiny::renderUI({
output$dwn_final <- shiny::renderUI({
shiny::req(tadat$raw)
shiny::downloadButton(ns("download_final"),
"Download Final Dataset (.zip)",
Expand All @@ -201,7 +196,6 @@ mod_TADA_summary_server <- function(id, tadat) {
datafile_name = paste0(tadat$default_outfile, ".xlsx")
progress_file_name = paste0(tadat$default_outfile, "_prog.RData")
desc <- writeNarrativeDataFrame(tadat)
out_data = TADA::TADA_OrderCols(tadat$raw[tadat$raw])
dfs <-
list(Data = TADA::TADA_OrderCols(tadat$raw), Parameterization = desc)
writeFile(tadat, progress_file_name)
Expand All @@ -223,8 +217,10 @@ mod_TADA_summary_server <- function(id, tadat) {
datafile_name = paste0(tadat$default_outfile, ".xlsx")
progress_file_name = paste0(tadat$default_outfile, "_prog.RData")
desc <- writeNarrativeDataFrame(tadat)

# Remove all rows flagged for removal
dfs <-
list(Data = TADA::TADA_OrderCols(tadat$raw), Parameterization = desc)
list(Data = TADA::TADA_OrderCols(tadat$raw[!tadat$raw$TADA.Remove,]), Parameterization = desc)
writeFile(tadat, progress_file_name)
writexl::write_xlsx(dfs, path = datafile_name)
utils::zip(zipfile = fname,
Expand Down
10 changes: 0 additions & 10 deletions R/mod_harmonize_np.R
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,6 @@ mod_harmonize_np_server <- function(id, tadat) {
dat <- subset(tadat$raw, tadat$raw$TADA.Remove == FALSE)
rem <- subset(tadat$raw, tadat$raw$TADA.Remove == TRUE)
dat <- TADA::TADA_HarmonizeSynonyms(dat, ref = harm$ref)
<<<<<<< HEAD
=======
# print(4567)
print(nrow(tadat$raw))
>>>>>>> a5e2c871b534920ebc52df213410dd6a135a9828
tadat$raw <- plyr::rbind.fill(dat, rem)
tadat$raw <- TADA::TADA_OrderCols(tadat$raw)

Expand Down Expand Up @@ -227,11 +222,6 @@ mod_harmonize_np_server <- function(id, tadat) {
new_df <- as.data.frame(matrix(FALSE, ncol = ncols, nrow = nrows))
names(new_df) <- names(tadat$removals)
tadat$removals <- plyr::rbind.fill(tadat$removals, new_df)
<<<<<<< HEAD
=======
# print(5678)
print(nrow(tadat$raw))
>>>>>>> a5e2c871b534920ebc52df213410dd6a135a9828
tadat$raw <- plyr::rbind.fill(dat, rem)
tadat$raw <- TADA::TADA_OrderCols(tadat$raw)
nitrolen <- length(dat$TADA.NutrientSummation.Flag[dat$TADA.NutrientSummation.Flag %in% c("Nutrient summation from one or more subspecies.")])
Expand Down
5 changes: 0 additions & 5 deletions R/mod_query_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -497,11 +497,6 @@ initializeTable <- function(tadat, raw) {
removals <- data.frame(matrix(nrow = nrow(raw), ncol = 0))
# removals["Media Type"] = ifelse(!raw$TADA.ActivityMediaName%in%c("WATER"),TRUE,raw$Removed)
# removals["Special Characters"] = ifelse(raw$TADA.ResultMeasureValueDataTypes.Flag%in%c("ND or NA","Text","Coerced to NA"),TRUE,raw$Removed)
<<<<<<< HEAD
=======
# print(6789)
print(nrow(tadat$raw))
>>>>>>> a5e2c871b534920ebc52df213410dd6a135a9828
tadat$raw <- raw
tadat$removals <- removals
}
Expand Down
Empty file removed R/sandbox.R
Empty file.
6 changes: 1 addition & 5 deletions R/utils_track_progress.R
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,7 @@ writeFile <- function(tadat, filename) {
readFile <- function(tadat, filename) {
load(filename, verbose = FALSE)
tadat$load_progress_file = filename
<<<<<<< HEAD
=======
print("Loading progress file")
print(nrow(tadat$raw))
>>>>>>> a5e2c871b534920ebc52df213410dd6a135a9828

# Confirm compatibility
job_id = job_id
if (!is.null(m2f)) {
Expand Down

0 comments on commit ba3b71a

Please sign in to comment.