-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Check whether custom timestamps are available in `split.data.time.bas…
…ed.by.timestamps` If no custom event timestamps are available in the ProjectData object, an error is thrown in `split.data.time.based.by.timestamps`, to avoid passing `NULL` to the called splitting functions. Signed-off-by: Thomas Bock <[email protected]>
- Loading branch information
Showing
1 changed file
with
8 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,7 @@ | |
## Copyright 2020 by Christian Hechtl <[email protected]> | ||
## Copyright 2017 by Felix Prasse <[email protected]> | ||
## Copyright 2017-2018 by Thomas Bock <[email protected]> | ||
## Copyright 2020 by Thomas Bock <[email protected]> | ||
## Copyright 2020, 2024 by Thomas Bock <[email protected]> | ||
## Copyright 2021 by Niklas Schneider <[email protected]> | ||
## Copyright 2021 by Johannes Hostert <[email protected]> | ||
## Copyright 2022 by Jonathan Baumann <[email protected]> | ||
|
@@ -135,7 +135,7 @@ split.data.by.bins = function(project.data, activity.amount, bins, split.basis = | |
#' and the last range ends with the last timestamp. | ||
#' | ||
#' If timestamps are not provided, the custom event timestamps in \code{project.data} are | ||
#' used instead. | ||
#' used instead. If no custom event timestamps are available in \code{project.data}, an error is thrown. | ||
#' | ||
#' @param project.data the *Data object from which the data is retrieved | ||
#' @param bins a vector of timestamps [default: NULL] | ||
|
@@ -148,6 +148,12 @@ split.data.time.based.by.timestamps = function(project.data, bins = NULL, projec | |
|
||
if (is.null(bins)) { # bins were not provided, use custom timestamps from project | ||
bins = unlist(project.data$get.custom.event.timestamps()) | ||
|
||
if (is.null(bins)) { # stop if no custom timestamps are available | ||
logging::logerror("There are no custom timestamps available for splitting (configured file: %s).", | ||
project.data$get.project.conf.entry("custom.event.timestamps.file")) | ||
stop("Stopping due to missing data.") | ||
} | ||
} | ||
|
||
return (split.data.time.based(project.data, bins = bins, project.conf.new)); | ||
|