Fix bugs in readable datetime and screen episodes

pull/130/head
JulioV 2021-03-16 20:01:43 -04:00
parent bb737237d0
commit 4c2f60fffd
2 changed files with 3 additions and 3 deletions

View File

@ -49,8 +49,8 @@ validate_user_timezones <- function(timezone_parameters){
} }
create_mising_temporal_column <- function(data, device_type){ create_mising_temporal_column <- function(data, device_type){
if(device_type == "fitbit" && all(data$timestamp == 0)){ if(device_type == "fitbit" && all(data$timestamp == 0) && "local_date_time" %in% colnames(data)){
# For fibit we infere timestamp from Fitbit's local date time # For fibit we infere timestamp from Fitbit's local date time only right after pulling it
if(nrow(data) == 0) if(nrow(data) == 0)
return(data %>% mutate(timestamp = NA_real_)) return(data %>% mutate(timestamp = NA_real_))
if(any(is.na(parse_date_time(data$local_date_time, orders= c("%Y/%m/%d %H:%M:%S","%Y-%m-%d %H:%M:%S"), exact=T)))) if(any(is.na(parse_date_time(data$local_date_time, orders= c("%Y/%m/%d %H:%M:%S","%Y-%m-%d %H:%M:%S"), exact=T))))

View File

@ -56,7 +56,7 @@ get_screen_episodes <- function(screen){
} }
if(nrow(screen) < 2){ if(nrow(screen) < 2){
episodes <- data.frame(device_id = character(),, episodes <- data.frame(device_id = character(),
episode = character(), episode = character(),
screen_sequence = character(), screen_sequence = character(),
start_timestamp = character(), start_timestamp = character(),