hopefully fix for creating new record
This commit is contained in:
parent
3b53614737
commit
88fbaa37a2
60
eprilog.r
60
eprilog.r
|
@ -3,29 +3,14 @@
|
||||||
# Author: PMF
|
# Author: PMF
|
||||||
#
|
#
|
||||||
#####
|
#####
|
||||||
|
|
||||||
require(shiny)
|
require(shiny)
|
||||||
#theme_set(theme_minimal())
|
#theme_set(theme_minimal())
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# preperation
|
# preperation
|
||||||
# Get the status if r shiny is running in docker or not
|
# Get the status if r shiny is running in docker or not
|
||||||
readRenviron("./.status-docker")
|
readRenviron("./.status-docker")
|
||||||
statusDocker <- Sys.getenv("statusDockerENV")
|
statusDocker <- Sys.getenv("statusDockerENV")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ui <- navbarPage("EpriLog",
|
ui <- navbarPage("EpriLog",
|
||||||
tabPanel("Eprilog",
|
tabPanel("Eprilog",
|
||||||
sidebarLayout(
|
sidebarLayout(
|
||||||
|
@ -76,8 +61,6 @@ ui <- navbarPage("EpriLog",
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
server <- function(input, output){
|
server <- function(input, output){
|
||||||
|
|
||||||
# loading data from csv files
|
# loading data from csv files
|
||||||
|
@ -89,8 +72,9 @@ server <- function(input, output){
|
||||||
# Render History Table
|
# Render History Table
|
||||||
output$history = DT::renderDataTable(
|
output$history = DT::renderDataTable(
|
||||||
brews, server = TRUE,
|
brews, server = TRUE,
|
||||||
options = list(order = list(3, "desc")))
|
options = list(order = list(3, "desc")
|
||||||
# columnDefs = list(list(visible = FALSE, targets = c(4)))))
|
columnDefs = list(list(visible = FALSE, targets = c(1,3,9,10,11,12,13,14,15)))
|
||||||
|
))
|
||||||
|
|
||||||
|
|
||||||
# insert new entry
|
# insert new entry
|
||||||
|
@ -99,26 +83,28 @@ server <- function(input, output){
|
||||||
brews <- (read.csv(file = "./data/brews.csv", header = TRUE, sep = ",", row.names = 1))
|
brews <- (read.csv(file = "./data/brews.csv", header = TRUE, sep = ",", row.names = 1))
|
||||||
# get currentTime
|
# get currentTime
|
||||||
currentTime <- Sys.time()
|
currentTime <- Sys.time()
|
||||||
|
# count up for new brew id
|
||||||
|
newID <- (brew$id + 1)
|
||||||
# add new line entry to history
|
# add new line entry to history
|
||||||
brews[nrow(brews) + 1,] = list(
|
brews[nrow(brews) + 1, 1] <- newID
|
||||||
(brews$id + 1),
|
brews[nrow(brews), 2] <- input$date
|
||||||
input$date,
|
brews[nrow(brews), 3] <- currentTime
|
||||||
currentTime,
|
brews[nrow(brews), 4] <- input$coffeeName
|
||||||
input$coffeeName,
|
brews[nrow(brews), 5] <- input$grindTime
|
||||||
input$grindTime,
|
brews[nrow(brews), 6] <- input$grindSize
|
||||||
input$grindSize,
|
brews[nrow(brews), 7] <- input$flowResult
|
||||||
input$flowResult,
|
brews[nrow(brews), 8] <- input$taste
|
||||||
input$taste,
|
brews[nrow(brews), 9] <- input$wdt
|
||||||
input$wdt,
|
brews[nrow(brews), 10] <- input$brewTemp
|
||||||
input$brewTemp,
|
brews[nrow(brews), 11] <- input$brewPreinfusion
|
||||||
input$brewPreinfusion,
|
brews[nrow(brews), 12] <- input$brewTime
|
||||||
input$brewTime,
|
brews[nrow(brews), 13] <- input$grinderDevice
|
||||||
input$grinderDevice,
|
brews[nrow(brews), 14] <- input$machineDevice
|
||||||
input$machineDevice,
|
brews[nrow(brews), 15] <- input$portaInsert
|
||||||
input$portaInsert,
|
brews[nrow(brews), 16] <- input$notes
|
||||||
input$notes
|
|
||||||
)
|
|
||||||
# save changes to .csv file
|
# save changes to .csv file
|
||||||
|
print("New entry added:")
|
||||||
print(brews)
|
print(brews)
|
||||||
write.csv(brews, file = "./data/brews.csv")
|
write.csv(brews, file = "./data/brews.csv")
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue