Skip to content

Commit e1c945e

Browse files
Using plural only for API resources
1 parent bff47f1 commit e1c945e

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

R/utils_render_register_general.r

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,8 @@ generate_output_dir <- function(filter, table_details = list()) {
185185

186186
# The table belongs to a subcat so we need a nested folder
187187
if ("subcat" %in% names(table_details)){
188-
output_dir <- paste0(base_dir, filter, "/", table_details[["subcat"]], "/", table_name, "/")
188+
plural_subcat <- CONFIG$VENUE_SUBCAT_PLURAL[[table_details[["subcat"]]]]
189+
output_dir <- paste0(base_dir, filter, "/", plural_subcat, "/", table_name, "/")
189190
}
190191

191192
# The table does not belong to a subcat

inst/extdata/config.R

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,13 @@ CONFIG$HYPERLINKS <- list(
7979
zenodo_deposit = "https://zenodo.org/deposit/"
8080
)
8181

82+
# Plural of venue subcategories
83+
CONFIG$VENUE_SUBCAT_PLURAL <- list(
84+
conference = "conferences",
85+
journal = "journals",
86+
community = "communities"
87+
)
88+
8289
# NON-REGISTER_TABLE
8390
CONFIG$NON_REG_TITLE_BASE <- "CODECHECK List of"
8491
CONFIG$NON_REG_TITLE_FNS <- list(
@@ -131,11 +138,7 @@ CONFIG$NON_REG_SUBTEXT <- list(
131138

132139
# Making the venue_name_subtext plural if necessary
133140
if (no_venues_subcat > 1){
134-
venue_name_subtext <- switch (subcat,
135-
"conference" = "conferences",
136-
"journal" = "journals",
137-
"community" = "communities"
138-
)
141+
venue_name_subtext <- CONFIG$VENUE_SUBCAT_PLURAL[[subcat]]
139142
}
140143
return(paste("In total,", total_codechecks, codecheck_word, "were completed for", no_venues_subcat, venue_name_subtext))
141144
}

0 commit comments

Comments
 (0)