Skip to content

Fixed time sync for Map and Dashboard #34

Merged
merged 1 commit into from Jun 9, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 16 additions & 3 deletions app.R
Expand Up @@ -114,11 +114,14 @@ ui <- dashboardPage(skin = "black", title = "COVID SafeCampus",
tags$style(type = "text/css",
".irs-grid-text:nth-last-child(1) {opacity: 0}"),
div(style="margin-left:0px; width: 350px;",
sliderInput("time", "Select a time period",
sliderInput("time",
"Select a time range",
min = as_datetime(hms::parse_hm("0:00")),
max = as_datetime(hms::parse_hm("23:30")),
value = c(now_time-hours(2),now_time),
timeFormat = "%H:%M",timezone = "GMT",step = 30*60)))))),
timeFormat = "%H:%M",
timezone = "GMT",
step = 30*60)))))),
shinyjs::hidden(
tags$div(id = "more_tabs",
fluidRow(column(h4(uiOutput('reactive_title'), style = 'color: #d6001c'),width =12)),
Expand Down Expand Up @@ -180,7 +183,9 @@ ui <- dashboardPage(skin = "black", title = "COVID SafeCampus",
# value = c(as_datetime(hms::parse_hm("14:00:00")),
# as_datetime(hms::parse_hm("16:00:00"))),
value = c(now_time-hours(2),now_time),
timeFormat = "%H:%M",timezone = "GMT",step = 30*60)))),
timeFormat = "%H:%M",
timezone = "GMT",
step = 30*60)))),
fluidRow(column(9,br(),fluidRow(column(12, div(uiOutput("discrete_plot3", height = "100%")), downloadButton("downloadDiscreteplot3", "Download Graph"))),
br(),fluidRow(column(12, div(uiOutput("discrete_plot1", height = "100%")), downloadButton("downloadDiscreteplot1", "Download Graph")))),
column(3,br(),fluidRow(column(12, div(uiOutput("discrete_plot4", height = "100%")), downloadButton("downloadDiscreteplot4", "Download Graph"))),
Expand Down Expand Up @@ -365,6 +370,10 @@ server <- function(input, output, session) {
incoming <- reactive({
start_time <- hms::as_hms(input$time[1])
end_time <- hms::as_hms(input$time[2])

# Update other slider
updateSliderInput(session,"timeRange",value=c(input$time[1],input$time[2]))

if(input$semester=="f20"){
db <- dbConnect(MySQL(), dbname = "safecampus", user = "dataincite", password = "P4Z2w@d!", host = "sequel.idea.rpi.edu")
query_data <- dbGetQuery(db, paste0("SELECT * FROM rpi_wap_f20 WHERE Date='", as.Date(input$day),"'", " AND ", "time BETWEEN '", start_time, "'", " AND '", end_time, "'"))
Expand Down Expand Up @@ -1061,6 +1070,10 @@ server <- function(input, output, session) {
output$title_dashboard <- renderUI({
start_time <- format(input$timeRange[1], "%I:%M %p")
end_time <- format(input$timeRange[2], "%I:%M %p")

# Update other slider
updateSliderInput(session,"time",value=c(input$timeRange[1],input$timeRange[2]))

if(input$floor_number == "NA"){
if(input$buildingStr_discrete=="all"){
if(length(input$buildingType_discrete)==1){
Expand Down