Skip to content

Commit

Permalink
Merge pull request #57 from vimc/i2357
Browse files Browse the repository at this point in the history
i2357: include displayname and description in the orderly db
  • Loading branch information
hillalex authored Nov 7, 2018
2 parents 930125e + 766040e commit 0e0901c
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: orderly
Title: R support for montagu-reports
Version: 0.5.5
Version: 0.5.6
Description: Order, create and store reports from R.
License: MIT + file LICENSE
Encoding: UTF-8
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 0.5.6

* The `displayname` and `description` fields are correctly copied into the new orderly database.

# 0.5.5

* New `connection` column in the `report_version` table in orderly's database (VIMC-2327)
Expand Down
4 changes: 2 additions & 2 deletions R/db2.R
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,8 @@ report_data_import <- function(con, workdir, config) {
id = id,
report = dat_rds$meta$name,
date = dat_rds$meta$date,
displayname = dat_rds$meta$displayname %||% NA_character_,
description = dat_rds$meta$description %||% NA_character_,
displayname = dat_in$displayname %||% NA_character_,
description = dat_in$description %||% NA_character_,
published = published,
connection = dat_rds$meta$connection)
if (nrow(config$fields) > 0L) {
Expand Down
13 changes: 13 additions & 0 deletions tests/testthat/test-z-demo.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,17 @@ context("demo")
test_that("orderly_demo", {
path <- create_orderly_demo()
expect_true(file.exists(path))

con <- orderly_db("destination", config = path)
on.exit(DBI::dbDisconnect(con))
## displayname and description are the only two nullable columns
## (VIMC-2357)
sql <- paste("SELECT id, report, displayname, description",
"FROM report_version")
d <- DBI::dbGetQuery(con, sql)

expect_false(any(is.na(d$displayname[d$report == "other"])))
expect_false(any(is.na(d$description[d$report == "other"])))
expect_true(all(is.na(d$displayname[d$report == "minimal"])))
expect_true(all(is.na(d$description[d$report == "minimal"])))
})

0 comments on commit 0e0901c

Please sign in to comment.