From 725c2d69ef148a85c2f2f8a418084ac4b8f0aaa3 Mon Sep 17 00:00:00 2001 From: Jack Greenlee Date: Mon, 15 Apr 2024 15:35:31 -0400 Subject: [PATCH] update showsIf conditions for conditional surveys Finally! First, the coordinates change from NREL Building 16 (which we were using for the purpose of testing) to DFC Building 40 (which is the actual location of the Fermata chargers). Second, instead of using the 'sensed_mode_str' (which we were also doing for the purpose of testing), we can actually use the vehicle detected by bluetooth to show surveys conditionally. These "showsIf" expressions work with the changes in https://github.com/e-mission/e-mission-phone/pull/1145. It will not work in Python yet; I am planning a way to do that later. "confirmedMode" is either a vehicle detected by bluetooth, or the label chosen by the user. In this instance it is the former; it is one of the vehicles defined under "vehicle_identities" (or, for a trip where there was no vehicle detected, detected it is undefined). Updating config version to 3 so we can receive these updates using the in-app config refresh feature! --- configs/dfc-fermata.nrel-op.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configs/dfc-fermata.nrel-op.json b/configs/dfc-fermata.nrel-op.json index ef1ffac3..11f166ba 100644 --- a/configs/dfc-fermata.nrel-op.json +++ b/configs/dfc-fermata.nrel-op.json @@ -1,6 +1,6 @@ { "url_abbreviation": "dfc-fermata", - "version": 2, + "version": 3, "ts": 1707714796485, "server": { "connectUrl": "https://dfc-fermata-openpath.nrel.gov/api/", @@ -69,17 +69,17 @@ { "surveyName": "DfcGasTrip", "not-filled-in-label": { "en": "Gas Car Survey" }, - "showsIf": "sections[0]['sensed_mode_str'] == 'CAR'" + "showsIf": "confirmedMode?.baseMode == 'CAR'" }, { "surveyName": "DfcEvRoamingTrip", "not-filled-in-label": { "en": "EV Survey" }, - "showsIf": "sections[0]['sensed_mode_str'] != 'CAR' && !pointIsWithinBounds(end_loc['coordinates'], [[-105.153, 39.745], [-105.150, 39.743]])" + "showsIf": "confirmedMode?.baseMode == 'E_CAR' && !pointIsWithinBounds(end_loc['coordinates'], [[-105.118, 39.719], [-105.115, 39.717]])" }, { "surveyName": "DfcEvReturnTrip", "not-filled-in-label": { "en": "EV Survey" }, - "showsIf": "sections[0]['sensed_mode_str'] != 'CAR' && pointIsWithinBounds(end_loc['coordinates'], [[-105.153, 39.745], [-105.150, 39.743]])" + "showsIf": "confirmedMode?.baseMode == 'E_CAR' && pointIsWithinBounds(end_loc['coordinates'], [[-105.118, 39.719], [-105.115, 39.717]])" } ] },