Fix bug when any of the rows from any sensor do not belong a time segment

pull/125/head v0.4.3
JulioV 2021-02-09 14:51:54 -05:00
parent 47bd695249
commit d8813e2d04
2 changed files with 3 additions and 1 deletions

View File

@ -1,5 +1,7 @@
# Change Log # Change Log
## v0.4.3
- Fix bug when any of the rows from any sensor do not belong a time segment
## v0.4.2 ## v0.4.2
- Update battery testing - Update battery testing
- Fix location processing bug when certain columns don't exist - Fix location processing bug when certain columns don't exist

View File

@ -29,7 +29,7 @@ get_segment_dates <- function(data, local_timezone, day_type, delay){
assign_rows_to_segments <- function(nested_data, nested_inferred_time_segments){ assign_rows_to_segments <- function(nested_data, nested_inferred_time_segments){
nested_data <- nested_data %>% mutate(assigned_segments = "") nested_data <- nested_data %>% mutate(assigned_segments = "")
for(i in 1:nrow(nested_inferred_time_segments)) { for(i in seq_len(nrow(nested_inferred_time_segments))) {
segment <- nested_inferred_time_segments[i,] segment <- nested_inferred_time_segments[i,]
nested_data$assigned_segments <- ifelse(segment$segment_start_ts<= nested_data$timestamp & segment$segment_end_ts >= nested_data$timestamp, nested_data$assigned_segments <- ifelse(segment$segment_start_ts<= nested_data$timestamp & segment$segment_end_ts >= nested_data$timestamp,
stringi::stri_c(nested_data$assigned_segments, segment$segment_id, sep = "|"), nested_data$assigned_segments) stringi::stri_c(nested_data$assigned_segments, segment$segment_id, sep = "|"), nested_data$assigned_segments)