Skip to content

Commit

Permalink
Revert unsw specific changes (#831)
Browse files Browse the repository at this point in the history
* Revert "chore: remove unused json"

This reverts commit d825fc2.

* Revert "patch(Diary): update tripgj label directly with the new answer"

This reverts commit c5ead07.

* Revert "patch(Diary): get rid of isAnalyzed and migrate to isDraft"

This reverts commit 9e6a2cd.

* Revert "patch(Intro): use SurveyLaunch"

This reverts commit c82d60a.

* Revert "patch(Settings): refactor to use new startSurveyPrefilled options param"

This reverts commit b8a7ab0.

* Revert "patch(Diary): optimize isAnalyzed call"

This reverts commit b57742a.

* Revert "patch(Settings): change domain to fourstep.dev"

This reverts commit 2447ecb.

* Revert "patch(Login): login with anonymous token"

This reverts commit 4b3cbab.

* Revert "patch(Login): login with anonymous token"

This reverts commit 4b3cbab.

* Revert "patch(Intro): update consent and intro pages to match RCITI profile"

This reverts commit b38e5a4.

* Revert "patch(Profile): add edit User Profile and End Survey buttons that launch surveys"

This reverts commit 32425b9.

* Revert "patch(Enketo): fix answers not restore correctly"

This reverts commit 04eb99f.

* Revert "patch(Diary): use EnketoSurvey for trip confirmation"

This reverts commit e425caf.

* Revert "patch(Diary): Dynamic input confirm button sizing"

This reverts commit a7f43d1.

* Revert "feat(Enketo): Enketo survey support"

This reverts commit fb338f1.

* Revert "patch(Tabs): hide Label and Heatmap tabs"

This reverts commit 610fdab.

* Revert "Shorten trip confirm options with emojis 🙉"

This reverts commit 7e6672e.

* Revert "Modify trip confirm options"

This reverts commit 26173fb.

* Revert "Update the login instruction"

This reverts commit 75eb6db.

* Revert "Update the support line number"

This reverts commit 1ab1002.

* Revert "Make styling changes to consent-text.html"

This reverts commit 802d39a.

* Revert "Change consent text's text-align  from 'justify' to 'left'"

This reverts commit 8024fcb.

* Revert "Comment out onCurentTrip"

This reverts commit 32f3b07.

* Revert "Remove some options  from the control list"

This reverts commit 34980a7.

* Revert "Use the defined css classes in consent-text.html"

This reverts commit 9c90fd8.

* Revert "Modify the login screen to only accept token"

This reverts commit c1b2c6a.

* Revert "Increase text size in intro.css"

This reverts commit 714018d.

* Revert "Replace a missing function"

This reverts commit ed2b9c2.

* Revert "Add edit user profile and end survey buttons."

This reverts commit 5104cec.

* Revert "Use an indirect link to open the user profile survey"

This reverts commit cdeaf45.

* Revert "Use random token login and initial kobotoolbox survey"

This reverts commit d2028a3.

* Revert "Comment out the summary screen"

This reverts commit 25e8795.

* Restore the labels for the survey option

* Revert "Revert "feat(Enketo): Enketo survey support""

This reverts commit 28a0b63.

* Manually revert isAnalysed function

Manually revert parts of
fb338f1
that are not related to enabling the survey code and that we don't want to restore

* Revert other changes that we don't want to include just yet

* Remove external survey launch dependency from the control settings

Since we use the new button directive instead

* revert to multilabel + restore answers while switching between diary and label

+ whitespace fixes

* Change the default options to map to MULTILABEL instead of ENKETO

To be consistent with the list view

* Revert the description for the share button

Should change to NREL later

* One final change to metrics

* Remove merge conflict

* Remove merge conflict!

* Revert email address from Amarin to me

* Remove the overridden trip confirmation

To avoid future merge conflicts
+ fix the sample

* Remove this specific configuration

To avoid future conflicts
+ expand the sample

* Restore whitespace

* Fix whitespace

* Restore dashboard since we also restored the multilabel survey

* Ensure that we show the survey page after the login

So we replace `finish` with `next`
This should not have been reverted
  • Loading branch information
shankari authored May 26, 2022
1 parent a4eb053 commit e8c1321
Show file tree
Hide file tree
Showing 21 changed files with 179 additions and 267 deletions.
21 changes: 2 additions & 19 deletions www/css/intro.css
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,11 @@
padding-left: 8%;
font-size: 18px;
}
.intro-text-large {
padding-top: 5%;
padding-right: 8%;
padding-left: 8%;
font-size: 18px;
line-height: 1.5;
text-align: left;
}
.intro-text {
padding-top: 5%;
padding-right: 8%;
padding-left: 8%;
font-size: 16px;
font-size: 15px;
line-height: 1.5;
text-align: left;
}
Expand All @@ -64,7 +56,7 @@
padding-top: 5%;
padding-right: 8%;
padding-left: 8%;
font-size: 16px;
font-size: 15px;
line-height: 1.5;
text-align: left;
}
Expand Down Expand Up @@ -93,12 +85,3 @@
padding-left: 8%;
padding-right: 8%;
}
/* rciti start */
ul {
list-style-type: initial;
}

ol {
list-style-type: decimal;
}
/* rciti end */
3 changes: 1 addition & 2 deletions www/css/main.diary.css
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,7 @@ a.item-content {
line-height: 30px;
min-height: 30px;
font-size: 0.8em !important;
/* NOTE: Please use ConfirmHelper.inputDetails["key"].width config if you need to resize the button */
width: 100%;
width: 115px;
padding: 0;
}
.input-confirm-container {
Expand Down
9 changes: 1 addition & 8 deletions www/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -701,14 +701,7 @@ background-image: none !important; }
width: 64px;
font-size:20px;
}
/* rciti start */
.control-icon-user-profile {
background-color: rgb(201, 217, 236);
}
.control-icon-end-survey {
background-color: #E0A1A1 !important;
}
/* rciti end */


#switch-user.control-icon-button{
background-color: #E0A1A1 !important;
Expand Down
6 changes: 3 additions & 3 deletions www/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@
"consent-found": "Consent found!",
"consented-to": "Consented to protocol {{protocol_id}}, {{approval_date}}",
"consented-ok": "OK",
"share-message": "Join me in making transportation greener and healthier \nDownload the emTripLog app:",
"share-subject": "UNSW Travel Survey",
"share-url": "https://www.taharashidi.com/travel-survey"
"share-message": "Join me in making transportation greener and healthier \nDownload the emission app:",
"share-subject": "Emission - UC Berkeley Research Project",
"share-url": "https://bic2cal.eecs.berkeley.edu/#download"
},

"metrics":{
Expand Down
2 changes: 1 addition & 1 deletion www/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
<script src="lib/moment/min/locales.min.js"></script>
<script src="lib/moment/min/moment-with-locales.min.js"></script>
<script src="lib/moment-timezone/builds/moment-timezone-with-data.min.js"></script>
<!-- <script src="lib/ngCordova/dist/ng-cordova.js"></script> -->
<script src="lib/ngCordova/dist/ng-cordova.js"></script>
<script src="lib/angular-animate/angular-animate.js"></script>
<script src="lib/ng-walkthrough/ng-walkthrough.js"></script>
<script src="lib/ng-walkthrough/ng-walkthrough.tap_icons.js"></script>
Expand Down
9 changes: 1 addition & 8 deletions www/js/control/general-settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,13 @@ angular.module('emission.main.control',['emission.services',
'emission.stats.clientstats',
'emission.plugin.kvstore',
'emission.survey.enketo.demographics',
'emission.survey.external.launch',
'emission.plugin.logger'])

.controller('ControlCtrl', function($scope, $window, $ionicScrollDelegate,
$ionicPlatform,
$state, $ionicPopup, $ionicActionSheet, $ionicPopover,
$ionicModal, $stateParams,
$rootScope, KVStore, SurveyLaunch, ionicDatePicker,
$rootScope, KVStore, ionicDatePicker,
StartPrefs, ControlHelper, EmailHelper, UploadHelper,
ControlCollectionHelper, ControlSyncHelper,
ControlTransitionNotifyHelper,
Expand Down Expand Up @@ -494,12 +493,6 @@ angular.module('emission.main.control',['emission.services',
}
});
};
$scope.launchEndSurvey = function() {
SurveyLaunch.startSurveyPrefilled('https://pe.fourstep.dev/', {
returnURL: 'https://www.taharashidi.com/endsurvey',
});
$scope.endForceSync();
};
$scope.userStartStopTracking = function() {
if ($scope.settings.collect.trackingOn){
return ControlCollectionHelper.forceTransition('STOP_TRACKING');
Expand Down
7 changes: 4 additions & 3 deletions www/js/diary/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ angular.module('emission.main.diary.list',['ui-leaflet',
$timeout,
ionicDatePicker,
leafletData, Timeline, CommonGraph, DiaryHelper,
SurveyOptions,
SurveyOptions,
Config, ImperialConfig, PostTripManualMarker, nzTour, KVStore, Logger, UnifiedDataLoader, $ionicPopover, $translate) {
console.log("controller DiaryListCtrl called");
const DEFAULT_ITEM_HT = 335;
$scope.surveyOpt = SurveyOptions.ENKETO;
$scope.surveyOpt = SurveyOptions.MULTILABEL;
ClientStats.addReading(ClientStats.getStatKeys().LABEL_TAB_SWITCH,
{"source": null, "dest": $scope.data? $scope.data.currDay : undefined});
// Add option
Expand Down Expand Up @@ -161,6 +161,7 @@ angular.module('emission.main.diary.list',['ui-leaflet',
ionicDatePicker.openDatePicker($scope.datepickerObject);
}


$scope.populateBasicClasses = function(tripgj) {
tripgj.display_start_time = DiaryHelper.getLocalTimeString(tripgj.data.properties.start_local_dt);
tripgj.display_end_time = DiaryHelper.getLocalTimeString(tripgj.data.properties.end_local_dt);
Expand Down Expand Up @@ -480,6 +481,7 @@ angular.module('emission.main.diary.list',['ui-leaflet',
the code to read the manual inputs is completely different.
Instead, let's find the corresponding trip from the label view and
copy over the `userInput` (and potentially the `user_input`) values over
*/
$scope.$apply(() => {
if ($scope.data && $scope.data.currDayTripWrappers) {
$scope.data.currDayTripWrappers.forEach(function(tripgj, tripIndex, array) {
Expand All @@ -493,7 +495,6 @@ angular.module('emission.main.diary.list',['ui-leaflet',
console.log("No trips loaded yet, no inputs to copy over");
}
});
*/
if($rootScope.barDetail){
readAndUpdateForDay($rootScope.barDetailDate);
$rootScope.barDetail = false;
Expand Down
2 changes: 1 addition & 1 deletion www/js/diary/services.js
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ angular.module('emission.main.diary.services', ['emission.plugin.logger',
timeline.data.unifiedConfirmsResults = null;
timeline.UPDATE_DONE = "TIMELINE_UPDATE_DONE";

const surveyOpt = SurveyOptions.ENKETO;
const surveyOpt = SurveyOptions.MULTILABEL;
const manualInputFactory = $injector.get(surveyOpt.service);

// Internal function, not publicly exposed
Expand Down
55 changes: 9 additions & 46 deletions www/js/intro.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ angular.module('emission.intro', ['emission.splash.startprefs',
});
})

.controller('IntroCtrl', function($scope, $rootScope, $http, $state, $window,
.controller('IntroCtrl', function($scope, $rootScope, $state, $window,
$ionicPlatform, $ionicSlideBoxDelegate,
$ionicPopup, $ionicHistory, ionicToast, $timeout, CommHelper, StartPrefs, SurveyLaunch, UpdateCheck, i18nUtils) {

Expand Down Expand Up @@ -105,64 +105,27 @@ angular.module('emission.intro', ['emission.splash.startprefs',
});
}

$scope.loginExisting = function() {
$scope.data = {};
const tokenPopup = $ionicPopup.show({
template: '<input type="String" ng-model="data.existing_token">',
title: 'Enter the existing token that you have',
scope: $scope,
buttons: [
{
text: '<b>OK</b>',
type: 'button-positive',
onTap: function(e) {
if (!$scope.data.existing_token) {
//don't allow the user to close unless he enters a username

e.preventDefault();
} else {
return $scope.data.existing_token;
}
}
},{
text: '<b>Cancel</b>',
type: 'button-stable',
onTap: function(e) {
return null;
}
}
]
});
tokenPopup.then(function(token) {
if (token != null) {
$scope.login(token);
}
}).catch(function(err) {
$scope.alertError(err);
});
};

$scope.login = function(token) {
window.cordova.plugins.BEMJWTAuth.setPromptedAuthToken(token).then(function(userEmail) {
$scope.login = function() {
window.cordova.plugins.BEMJWTAuth.signIn().then(function(userEmail) {
// ionicToast.show(message, position, stick, time);
// $scope.next();
ionicToast.show(userEmail, 'middle', false, 2500);
if (userEmail == "null" || userEmail == "") {
$scope.alertError("Invalid login "+userEmail);
} else {
CommHelper.registerUser(function(successResult) {
ionicToast.show(userEmail, 'middle', false, 2500);
$scope.next();
// $scope.finish();
UpdateCheck.getChannel().then(function(retVal) {
CommHelper.updateUser({
client: retVal
});
});
$scope.next();
}, function(errorResult) {
// ionicToast.show(userEmail, 'middle', false, 2500);
$scope.alertError('User registration error', errorResult);
// $scope.finish();
});
}
}, function(error) {
$scope.alertError('Sign in error', error);
// $scope.finish();
});
};

Expand Down
20 changes: 10 additions & 10 deletions www/js/metrics.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,13 @@ angular.module('emission.main.metrics',['nvd3',

/*
$scope.onCurrentTrip = function() {
// window.cordova.plugins.BEMDataCollection.getState().then(function(result) {
// Logger.log("Current trip state" + JSON.stringify(result));
// if(JSON.stringify(result) == "\"STATE_ONGOING_TRIP\""||
// JSON.stringify(result) == "\"local.state.ongoing_trip\"") {
// $state.go("root.main.current");
// }
// });
window.cordova.plugins.BEMDataCollection.getState().then(function(result) {
Logger.log("Current trip state" + JSON.stringify(result));
if(JSON.stringify(result) == "\"STATE_ONGOING_TRIP\""||
JSON.stringify(result) == "\"local.state.ongoing_trip\"") {
$state.go("root.main.current");
}
});
};
*/

Expand All @@ -112,9 +112,9 @@ angular.module('emission.main.metrics',['nvd3',
// If we want to share this function (see the pun?) between the control screen and the dashboard, we need to put it into a service/factory.
// But it is not clear to me why it needs to be in the profile screen...
var prepopulateMessage = {
message: 'Have fun, support research and get active. Your privacy is protected. \nDownload the emTripLog app:', // not supported on some apps (Facebook, Instagram)
subject: 'Help Sydney become more bikeable and walkable', // fi. for email
url: 'https://www.taharashidi.com/travel-survey'
message: 'Have fun, support research and get active. Your privacy is protected. \nDownload the emission app:', // not supported on some apps (Facebook, Instagram)
subject: 'Help Berkeley become more bikeable and walkable', // fi. for email
url: 'https://bic2cal.eecs.berkeley.edu/#download'
}

$scope.share = function() {
Expand Down
2 changes: 1 addition & 1 deletion www/js/survey/enketo/service.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ angular.module('emission.survey.enketo.service', [
/**
* _restoreAnswer restore the most recent answer for the survey
* @param {EnketoAnswer[]} answers survey answers
* @returns {Promise<string>} answer string promise
* @returns {string} answer string
*/
function _restoreAnswer() {
if (_state.opts.trip) {
Expand Down
2 changes: 1 addition & 1 deletion www/json/emailConfig.json.sample
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"address": "[email protected]"
"address": "[email protected]"
}
14 changes: 0 additions & 14 deletions www/json/enketoSurveyConfig.json

This file was deleted.

6 changes: 4 additions & 2 deletions www/json/enketoSurveyConfig.json.sample
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
"TripConfirmSurvey": {
"formPath": "json/trip-end-survey-multiple-select.json",
"version": 1.2,
"compatibleWith": 1
"compatibleWith": 1,
"dataKey": "manual/trip_user_input"
},
"UserProfileSurvey": {
"formPath": "json/user-profile.json",
"version": 1,
"compatibleWith": 1
"compatibleWith": 1,
"dataKey": "manual/demographic_survey"
}
}
44 changes: 22 additions & 22 deletions www/json/trip_confirm_options.json.sample
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
{
"MODE" : [
{"text":"Vehicle Driver", "value":"driver", "met_equivalent": "IN_VEHICLE", "co2PerMeter": 0.22031},
{"text":"Vehicle Passenger","value":"passenger", "met_equivalent": "IN_VEHICLE", "co2PerMeter": 0.11015},
{"text":"Walk","value":"walk", "met_equivalent": "WALKING", "co2PerMeter": 0},
{"text":"Train","value":"train", "met_equivalent": "IN_VEHICLE", "co2PerMeter": 0.12256},
{"text":"Walk", "value":"walk", "met_equivalent": "WALKING", "co2PerMeter": 0},
{"text":"Bike","value":"bike", "met_equivalent": "BICYCLING", "co2PerMeter": 0},
{"text":"Drove Alone","value":"drove_alone", "met_equivalent": "IN_VEHICLE", "co2PerMeter": 0.22031},
{"text":"Shared Ride","value":"shared_ride", "met_equivalent": "IN_VEHICLE", "co2PerMeter": 0.11015},
{"text":"Taxi/Uber/Lyft","value":"taxi", "met_equivalent": "IN_VEHICLE", "co2PerMeter": 0.30741},
{"text":"Bus","value":"bus", "met_equivalent": "IN_VEHICLE", "co2PerMeter": 0.20727},
{"text":"Tram","value":"tram", "met_equivalent": "UNKNOWN", "co2PerMeter": 0},
{"text":"Ferry","value":"ferry", "met_equivalent": "UNKNOWN", "co2PerMeter": 0},
{"text":"Taxi & Uber","value":"taxi", "met_equivalent": "IN_VEHICLE", "co2PerMeter": 0.30741},
{"text":"Bicycle","value":"bike", "met_equivalent": "BICYCLING", "co2PerMeter": 0},
{"text":"Motorcycle","value":"motorbike", "met_equivalent": "UNKNOWN", "co2PerMeter": 0},
{"text":"Trip not valid","value":"spurious_trip", "met_equivalent": "UNKNOWN", "co2PerMeter": 0}],
{"text":"Train","value":"train", "met_equivalent": "IN_VEHICLE", "co2PerMeter": 0.12256},
{"text":"Free Shuttle","value":"free_shuttle", "met_equivalent": "IN_VEHICLE", "co2PerMeter": 0.20727},
{"text":"Air","value":"air", "met_equivalent": "IN_VEHICLE", "co2PerMeter": 0.09975},
{"text":"Other","value":"other", "met_equivalent": "UNKNOWN", "co2PerMeter": 0}],
"PURPOSE" : [
{"text":"Go Home", "value":"home"},
{"text":"Work related","value":"work"},
{"text":"Pick-up/Drop off 🙍‍♂️","value":"pick_drop_person"},
{"text":"Buy something","value":"buy_something"},
{"text":"Education","value":"education"},
{"text":"Social/Dine out","value":"social"},
{"text":"Recreation/Exercise","value":"exercise"},
{"text":"Personal/Medical","value":"personal_med"},
{"text":"Accompany", "value":"accompany_someone"},
{"text":"Pick-up/Deliver 📦", "value":"pick_drop_thing"},
{"text":"Home", "value":"home"},
{"text":"To Work","value":"work"},
{"text":"At Work","value":"at_work"},
{"text":"School","value":"school"},
{"text":"Transit transfer", "value":"transit_transfer"},
{"text":"Other","value":"other"},
{"text":"Trip not valid","value":"spurious_trip"}]
{"text":"Shopping","value":"shopping"},
{"text":"Meal","value":"meal"},
{"text":"Pick-up/Drop off","value":"pick_drop"},
{"text":"Personal/Medical","value":"personal_med"},
{"text":"Access Recreation","value":"access_recreation"},
{"text":"Recreation/Exercise","value":"exercise"},
{"text":"Entertainment/Social","value":"entertainment"},
{"text":"Religious", "value":"religious"},
{"text":"Other","value":"other"}]
}
Loading

0 comments on commit e8c1321

Please sign in to comment.