Fix bug that unified battery status for iOS client v2

pull/95/head
JulioV 2020-04-09 12:10:03 -04:00
parent 5d68b5052c
commit e2b2643ba9
1 changed files with 6 additions and 3 deletions

View File

@ -3,9 +3,12 @@ source("packrat/init.R")
library(dplyr)
unify_ios_battery <- function(ios_battery){
ios_battery <- ios_battery %>%
mutate(battery_status = replace(battery_status, battery_status == 3, 5),
battery_status = replace(battery_status, battery_status == 1, 3))
# We only need to unify battery data for iOS client V1. V2 does it out-of-the-box
# V1 will not have rows where battery_status is equal to 4
if(nrow(ios_battery %>% filter(battery_status == 4)) == 0)
ios_battery <- ios_battery %>%
mutate(battery_status = replace(battery_status, battery_status == 3, 5),
battery_status = replace(battery_status, battery_status == 1, 3))
}
unify_ios_calls <- function(ios_calls){