Skip to content

Commit c8118cb

Browse files
committed
init() function added, and record_sdd() now records date with higher precision.
1 parent 354db02 commit c8118cb

File tree

13 files changed

+80
-26
lines changed

13 files changed

+80
-26
lines changed

.Rbuildignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,6 @@ Makefile
1414
^.*\.Rproj$
1515
LICENSE
1616
data-raw
17-
data-raw/*
17+
data-raw/*
18+
Untitled
19+
Untitled/*

DESCRIPTION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: BioDataScience
22
Type: Package
3-
Version: 2019.6.0
3+
Version: 2020.0.9000
44
Title: A Series of Learnr Documents for Biological Data Science
55
Description: Interactive documents using learnr for studying biological data science.
66
Authors@R: c(
@@ -18,5 +18,5 @@ LazyData: true
1818
URL: https://github.com/BioDataScience-Course/BioDataScience
1919
BugReports: https://github.com/BioDataScience-Course/BioDataScience/issues
2020
Roxygen: list(markdown = TRUE)
21-
RoxygenNote: 6.1.0
21+
RoxygenNote: 7.1.0
2222
VignetteBuilder: knitr

NAMESPACE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Generated by roxygen2: do not edit by hand
22

33
export(checker_sdd)
4+
export(init)
45
export(record_sdd)
56
export(run)
67
export(send_mail_sdd)

NEWS.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# BioDataScience News
22

3+
## Changes in version 2020.0.9000
4+
5+
- In `record_sdd()`, date is now recorded in GMT timezone and with microseconds.
6+
- An `init()` function is added to set globally `MONGO_URL` and `MONGO_BASE`
7+
environment variables for lerarndown Shiny and learnr applications.
8+
39
## Changes in version 2019.6.0
410

511
- correction tutorial 06b_recombinaison

R/init.R

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#' Initialize the environment for our BioDataScience courses
2+
#'
3+
#' @return Nothing, the function is used for its side-effect of creating global
4+
#' variables.
5+
#' @export
6+
#'
7+
#' @examples
8+
#' # Use this at the beginning of your learndown Shiny or learnr applications
9+
#' BioDataScience::init()
10+
#' # Now, you have access to MONGO_URL and MONGO_BASE
11+
#' Sys.getenv("MONGO_URL")
12+
#' Sys.getenv("MONGO_BASE")
13+
init <- function() {
14+
# Set variable environment required to locate our sdd MongoDB database
15+
Sys.setenv(MONGO_URL = "mongodb://sdd:sdd@sdd-umons-shard-00-00-umnnw.mongodb.net:27017,sdd-umons-shard-00-01-umnnw.mongodb.net:27017,sdd-umons-shard-00-02-umnnw.mongodb.net:27017/test?ssl=true&replicaSet=sdd-umons-shard-0&authSource=admin")
16+
Sys.setenv(MONGO_BASE = "sdd")
17+
# ... other global stuff to do here...
18+
return()
19+
}

R/record_sdd.R

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,11 @@ record_sdd <- function(tutorial_id, tutorial_version, user_id, event, data) {
3434
correct <- ""
3535
}
3636
data$correct <- NULL
37-
entry <- data.frame(date = Sys.time(), tutorial = tutorial_id,
38-
version = tutorial_version, user = user_id, user_name = user_name(),
39-
user_email = user_email(), label = label, correct = correct, event = event,
40-
data = list_to_json(data))
37+
entry <- data.frame(
38+
date = format(Sys.time(), format = "%Y-%m-%d %H:%M:%OS6", tz = "GMT"),
39+
tutorial = tutorial_id, version = tutorial_version, user = user_id,
40+
user_name = user_name(), user_email = user_email(), label = label,
41+
correct = correct, event = event, data = list_to_json(data))
4142
# Not a good idea: if user never clicks "Submit", nothing is fed to database
4243
#if (correct == "") {
4344
# add_file_base64(entry, file = bds_file)

man/biometrie.Rd

Lines changed: 4 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/biometry.Rd

Lines changed: 4 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/checker_sdd.Rd

Lines changed: 10 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/init.Rd

Lines changed: 22 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)