fix: логинг отключен + фикс в функции сравнении таблиц
This commit is contained in:
92
app.R
92
app.R
@@ -11,10 +11,6 @@ suppressPackageStartupMessages({
|
||||
|
||||
source("helpers/functions.R")
|
||||
|
||||
|
||||
# box::purge_cache()
|
||||
# box::use(./helpers/db)
|
||||
|
||||
# SOURCE FILES ============================
|
||||
box::purge_cache()
|
||||
box::use(
|
||||
@@ -22,7 +18,7 @@ box::use(
|
||||
modules/global_options,
|
||||
modules/db,
|
||||
modules/data_validation,
|
||||
helpers/scheme_generator[scheme_R6]
|
||||
modules/scheme_generator[scheme_R6]
|
||||
)
|
||||
|
||||
# SETTINGS ================================
|
||||
@@ -1122,57 +1118,57 @@ server <- function(input, output, session) {
|
||||
}
|
||||
|
||||
# КРАТКАЯ СВОДКА ПРО ЛОГГИНГ ------------------
|
||||
observe({
|
||||
# observe({
|
||||
|
||||
output$display_log <- renderUI({
|
||||
# output$display_log <- renderUI({
|
||||
|
||||
con <- db$make_db_connection("display_log")
|
||||
on.exit(db$close_db_connection(con, "display_log"), add = TRUE)
|
||||
# con <- db$make_db_connection("display_log")
|
||||
# on.exit(db$close_db_connection(con, "display_log"), add = TRUE)
|
||||
|
||||
query <- if (!is.null(values$main_key)) {
|
||||
sprintf("SELECT * FROM log WHERE key = '%s'", values$main_key)
|
||||
} else {
|
||||
"SELECT * FROM log"
|
||||
}
|
||||
# query <- if (!is.null(values$main_key)) {
|
||||
# sprintf("SELECT * FROM log WHERE key = '%s'", values$main_key)
|
||||
# } else {
|
||||
# "SELECT * FROM log"
|
||||
# }
|
||||
|
||||
log_rows <- DBI::dbGetQuery(con, query)
|
||||
# log_rows <- DBI::dbGetQuery(con, query)
|
||||
|
||||
if (nrow(log_rows) > 0) {
|
||||
# if (nrow(log_rows) > 0) {
|
||||
|
||||
lines <- log_rows |>
|
||||
mutate(date = as.POSIXct(date)) |>
|
||||
mutate(
|
||||
# date = date + lubridate::hours(3), # fix datetime
|
||||
date_day = as.Date(date)
|
||||
) |>
|
||||
mutate(cons_actions = dplyr::consecutive_id(action, user)) |>
|
||||
mutate(n_actions = row_number(), .by = c(cons_actions, user, action, date_day)) |>
|
||||
slice(which.max(n_actions), .by = c(user, action, date_day)) |>
|
||||
mutate(string_to_print = sprintf(
|
||||
"<b>[%s %s]</b>: %s - %s (%s)",
|
||||
format(date, "%d.%m.%y"),
|
||||
format(date, "%H:%M"),
|
||||
user,
|
||||
action,
|
||||
n_actions
|
||||
)) |>
|
||||
pull(string_to_print) |>
|
||||
paste(collapse = "</br>")
|
||||
# lines <- log_rows |>
|
||||
# mutate(date = as.POSIXct(date)) |>
|
||||
# mutate(
|
||||
# # date = date + lubridate::hours(3), # fix datetime
|
||||
# date_day = as.Date(date)
|
||||
# ) |>
|
||||
# mutate(cons_actions = dplyr::consecutive_id(action, user)) |>
|
||||
# mutate(n_actions = row_number(), .by = c(cons_actions, user, action, date_day)) |>
|
||||
# slice(which.max(n_actions), .by = c(user, action, date_day)) |>
|
||||
# mutate(string_to_print = sprintf(
|
||||
# "<b>[%s %s]</b>: %s - %s (%s)",
|
||||
# format(date, "%d.%m.%y"),
|
||||
# format(date, "%H:%M"),
|
||||
# user,
|
||||
# action,
|
||||
# n_actions
|
||||
# )) |>
|
||||
# pull(string_to_print) |>
|
||||
# paste(collapse = "</br>")
|
||||
|
||||
} else {
|
||||
lines <- ""
|
||||
}
|
||||
# } else {
|
||||
# lines <- ""
|
||||
# }
|
||||
|
||||
tagList(
|
||||
paste0("ID: ", values$main_key),
|
||||
br(),
|
||||
p(
|
||||
HTML(lines),
|
||||
style = "font-size:10px;"
|
||||
)
|
||||
)
|
||||
})
|
||||
})
|
||||
# tagList(
|
||||
# paste0("ID: ", values$main_key),
|
||||
# br(),
|
||||
# p(
|
||||
# HTML(lines),
|
||||
# style = "font-size:10px;"
|
||||
# )
|
||||
# )
|
||||
# })
|
||||
# })
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user