Skip to content

Commit

Permalink
allowed Date and datetime in value_choices (#1226)
Browse files Browse the repository at this point in the history
* allowed Date and datetime in value_choices

* ensure the timezone is shown in value_choices dropdown

* used as.POSIXlt to get tzone; added datetime_to_char

* spelling

* WORDLIST

* used format function

* removed memoise

* Update R/choices_labeled.R

Co-Authored-By: Pagacz, Konrad {FIEV~Warsaw} <[email protected]>

* Update R/choices_labeled.R

* detect when timezone is not present

* Update inst/WORDLIST

* roxygen2::roxygenize('.', roclets = c('rd', 'collate', 'namespace'))

Co-authored-by: Junlue Zhao <[email protected]>
Co-authored-by: Pagacz, Konrad {FIEV~Warsaw} <[email protected]>
  • Loading branch information
3 people authored and GitHub Enterprise committed Jun 29, 2021
1 parent ea6b5b7 commit a14443b
Show file tree
Hide file tree
Showing 134 changed files with 152 additions and 135 deletions.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

### Bug fixes
* Fixed an edge case error when creating a filter on variable with all missing values crashed the app.
* Fixed a bug that crashes app whenever a `Date` or `datetime` column is selected from a `filter_spec`.

# teal 0.9.4

Expand Down
18 changes: 17 additions & 1 deletion R/choices_labeled.R
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,23 @@ value_choices.data.frame <- function(data, # nolint
)
}

choices <- if (length(var_choices) > 1 || is.character(df_choices[[1]]) || is.factor(df_choices[[1]])) {
choices <- if (
length(var_choices) > 1 ||
is.character(df_choices[[1]]) ||
is.factor(df_choices[[1]]) ||
inherits(df_choices[[1]], c("Date", "POSIXct", "POSIXlt", "POSIXt"))
) {
df_choices <- dplyr::mutate_if(
df_choices,
.predicate = function(col) inherits(col, c("POSIXct", "POSIXlt", "POSIXt")),
.fun = function(col) {
if (is.null(attr(col, "tzone")) || all(attr(col, "tzone") == "")) {
format(trunc(col), "%Y-%m-%d %H:%M:%S")
} else {
format(trunc(col), "%Y-%m-%d %H:%M:%S %Z")
}
}
)
apply(df_choices, 1, paste, collapse = sep)
} else {
df_choices[[var_choices]]
Expand Down
2 changes: 1 addition & 1 deletion man/CDISCData.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/CDISCDataConnector.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/CDISCDataset.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/CDISCDatasetConnector.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/CDISCFilteredData.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/Callable.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/CallableCode.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/CallableFunction.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/CallablePythonCode.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/CodeClass.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/DataAbstract.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/DataConnection.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/DatasetConnector.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/FilteredData.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/JoinKeys.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/PythonCodeClass.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/RelationalData.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/RelationalDataConnector.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/add_no_selected_choices.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/as_cdisc.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/as_cdisc_relational.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/as_relational.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/bookmarkableShinyApp.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/callable_code.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/callable_function.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/cdisc_data.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/cdisc_data_file.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/cdisc_dataset.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/cdisc_dataset_connector.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/cdisc_dataset_connector_file.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/cdisc_dataset_file.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/choices_labeled.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit a14443b

Please sign in to comment.