mirror of
https://github.com/msberends/AMR.git
synced 2026-11-15 22:20:47 +01:00
(v3.0.1.9133) Fix the as.mo() session cache being cleared on every call in interactive sessions without an mo_source file
This commit is contained in:
1 parent
1a1a3abed1
commit
e88faf8d40
3 files changed
+8
-5
No files matched your search
+1
-1
@@ -1,5 +1,5 @@
|
||||
Package: AMR
|
||||
Version: 3.0.1.9132
|
||||
Version: 3.0.1.9133
|
||||
Date: 2026-10-14
|
||||
Title: Antimicrobial Resistance Data Analysis
|
||||
Description: Functions to simplify and standardise antimicrobial resistance (AMR)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# AMR 3.0.1.9132
|
||||
# AMR 3.0.1.9133
|
||||
|
||||
Planned as v3.1.0, mid October 2026.
|
||||
|
||||
|
||||
+6
-3
@@ -132,10 +132,11 @@ set_mo_source <- function(path, destination = getOption("AMR_mo_source", "~/mo_s
|
||||
stop_ifnot(destination %like% "[.]rds$", "the {.arg destination} must be a file location with file extension .rds.")
|
||||
mo_source_destination <- path.expand(destination)
|
||||
|
||||
# earlier coercions might have been based on another mo_source
|
||||
AMR_env$mo_previously_coerced <- new_coercion_cache()
|
||||
|
||||
if (is.null(path) || path %in% c(FALSE, "")) {
|
||||
if (!is.null(AMR_env$mo_source) || file.exists(mo_source_destination)) {
|
||||
# earlier coercions might have been based on this mo_source; get_mo_source() calls this function on every as.mo() call when no mo_source exists, so only reset when there was one
|
||||
AMR_env$mo_previously_coerced <- new_coercion_cache()
|
||||
}
|
||||
AMR_env$mo_source <- NULL
|
||||
if (file.exists(mo_source_destination)) {
|
||||
unlink(mo_source_destination)
|
||||
@@ -229,6 +230,8 @@ set_mo_source <- function(path, destination = getOption("AMR_mo_source", "~/mo_s
|
||||
attr(df, "mo_source_timestamp") <- file.mtime(path)
|
||||
saveRDS(df, mo_source_destination)
|
||||
AMR_env$mo_source <- df
|
||||
# earlier coercions might have been based on another mo_source
|
||||
AMR_env$mo_previously_coerced <- new_coercion_cache()
|
||||
message_(
|
||||
action, " mo_source file '", font_bold(mo_source_destination),
|
||||
"' (", formatted_filesize(mo_source_destination),
|
||||
|
||||
Reference in new issue
Block a user