Skip to content

Commit 64010e2

Browse files
committed
Fix otn_query CQL regex to match exact project name with optional node
1 parent 078e18b commit 64010e2

File tree

4 files changed

+16
-3
lines changed

4 files changed

+16
-3
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: otndo
22
Title: Understand your OTN data
3-
Version: 0.3.1
3+
Version: 0.3.2
44
Authors@R:
55
person("Michael", "O'Brien", , "mike@obrien.page", role = c("aut", "cre"),
66
comment = c(ORCID = "0000-0003-1420-6395"))

NEWS.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
## otndo 0.3
2+
### v 0.3.2
3+
* Fix bug where `otn_query` could return multiple projects from one code, resulting in multiple identical reports being created.
4+
5+
### v 0.3.1
6+
* Fix bug where internal helper functions would break if no H:M:S data was listed in deployment or recovery time metadata
7+
28
### v 0.3.0
39
* Summarize according to species for those projects/networks which provide species information. [Issue #41](https://github.com/mhpob/otndo/issues/41)
410
* Update OTN URLs. [Issue #42](https://github.com/mhpob/otndo/issues/42)

R/otn_query.R

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,10 @@ otn_query <- function(projects) {
2727
"&outputFormat=csv&CQL_FILTER=strMatches(collectioncode,'",
2828
paste(
2929
paste0(
30-
".*",
31-
gsub(".*\\.", "", projects)
30+
# "(.*\\.)?",
31+
"((.*\\.)|^)",
32+
gsub(".*\\.", "", projects),
33+
"$"
3234
),
3335
collapse = "|"
3436
),

tests/testthat/test-otn_query.R

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,8 @@ test_that("is node agnostic", {
5959
without_network$project_metadata
6060
)
6161
})
62+
63+
64+
test_that("returns exact match or node-appended ONLY", {
65+
expect_true(nrow(otn_query("KSC")[[1]]) == 1)
66+
})

0 commit comments

Comments
 (0)