forked from daattali/shiny-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhelpers.R
34 lines (29 loc) · 1013 Bytes
/
helpers.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# validate the reviewr-reviewee pair
validateReviewerReviewee <- function(reviewer, reviewee) {
return(reviewer != reviewee)
}
# validate the form fields
validateForm <- function(input) {
return(validateReviewerReviewee(input$reviewer, input$reviewee))
}
# get current Epoch time
getEpochTime <- function() {
return(as.integer(Sys.time()))
}
# get a formatted string of the timestamp (exclude colons as they are invalid
# characters in Windows filenames)
getFormattedTimestamp <- function() {
format(Sys.time(), "%Y%m%d-%H%M%OS")
}
# decide if the form is active or not (can be a simple T/F or based on date for example)
isFormActive <- function() {
return(TRUE)
}
# return a vector of canonical student names to use as the class list
## TO DO: keep this classlist up-to-date!
getClassList <- function() {
dataDir <- file.path("data")
classInfo <- read.csv(file.path(dataDir, "2014-class-list.csv"), header = TRUE)
classList <- sort(c("", as.character(classInfo$name)))
return(classList)
}