Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate odk compatible surveys using enketo #832

Merged
merged 95 commits into from
May 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
95 commits
Select commit Hold shift + click to select a range
15cb98e
Modify the consent text file
asiripanich Aug 10, 2021
25e8795
Comment out the summary screen
asiripanich Aug 10, 2021
d77eeef
Email log to Amarin
asiripanich May 14, 2021
d2028a3
Use random token login and initial kobotoolbox survey
asiripanich Aug 10, 2021
2ee8172
Merge pull request #40 from rciti/rciti-intro
asiripanich Aug 10, 2021
cdeaf45
Use an indirect link to open the user profile survey
asiripanich Aug 10, 2021
5104cec
Add edit user profile and end survey buttons.
asiripanich Aug 10, 2021
ed2b9c2
Replace a missing function
asiripanich Aug 10, 2021
26df155
Merge pull request #778 from rciti/rciti
shankari Aug 10, 2021
2462619
Comment out the Label tab from the main screen
asiripanich Aug 13, 2021
714018d
Increase text size in intro.css
asiripanich Aug 13, 2021
c1b2c6a
Modify the login screen to only accept token
asiripanich Aug 13, 2021
9c90fd8
Use the defined css classes in consent-text.html
asiripanich Aug 13, 2021
34980a7
Remove some options from the control list
asiripanich Aug 13, 2021
69d7f33
Merge pull request #782 from rciti/rciti
shankari Aug 14, 2021
32f3b07
Comment out onCurentTrip
asiripanich Aug 15, 2021
6f64f44
Comment out the heatmap screen
asiripanich Aug 15, 2021
6467da5
Merge pull request #783 from rciti/rciti
shankari Aug 15, 2021
8024fcb
Change consent text's text-align from 'justify' to 'left'
asiripanich Aug 16, 2021
802d39a
Make styling changes to consent-text.html
asiripanich Aug 16, 2021
1ab1002
Update the support line number
asiripanich Aug 16, 2021
29b4fa6
Merge pull request #784 from rciti/rciti
shankari Aug 17, 2021
75eb6db
Update the login instruction
asiripanich Aug 18, 2021
26173fb
Modify trip confirm options
asiripanich Aug 18, 2021
388fe8a
Modify share messages
asiripanich Aug 18, 2021
5905856
Merge pull request #788 from rciti/rciti
shankari Aug 18, 2021
7e6672e
Shorten trip confirm options with emojis 🙉
asiripanich Aug 18, 2021
425d479
Merge pull request #789 from rciti/rciti
shankari Aug 18, 2021
610fdab
patch(Tabs): hide Label and Heatmap tabs
atton16 Sep 21, 2021
fb338f1
feat(Enketo): Enketo survey support
atton16 Sep 23, 2021
a7f43d1
patch(Diary): Dynamic input confirm button sizing
atton16 Sep 23, 2021
e425caf
patch(Diary): use EnketoSurvey for trip confirmation
atton16 Sep 23, 2021
04eb99f
patch(Enketo): fix answers not restore correctly
atton16 Sep 23, 2021
32425b9
patch(Profile): add edit User Profile and End Survey buttons that lau…
atton16 Sep 24, 2021
5c84bf4
Merge branch 'rciti' into rciti
asiripanich Sep 26, 2021
b38e5a4
patch(Intro): update consent and intro pages to match RCITI profile
atton16 Sep 27, 2021
4b3cbab
patch(Login): login with anonymous token
atton16 Sep 27, 2021
2447ecb
patch(Settings): change domain to fourstep.dev
atton16 Sep 27, 2021
b1b8bfd
Merge branch 'rciti' of github.com:rciti/e-mission-phone into rciti
atton16 Sep 27, 2021
bb507ba
chore: add json files
atton16 Sep 27, 2021
b57742a
patch(Diary): optimize isAnalyzed call
atton16 Sep 28, 2021
69180be
patch(SurveyLaunch): startSurveyPrefilled support auto close
atton16 Sep 28, 2021
b8a7ab0
patch(Settings): refactor to use new startSurveyPrefilled options param
atton16 Sep 28, 2021
c82d60a
patch(Intro): use SurveyLaunch
atton16 Sep 28, 2021
9e6a2cd
patch(Diary): get rid of isAnalyzed and migrate to isDraft
atton16 Sep 28, 2021
c5ead07
patch(Diary): update tripgj label directly with the new answer
atton16 Sep 28, 2021
d825fc2
chore: remove unused json
atton16 Sep 29, 2021
59690cb
Merge pull request #798 from rciti/rciti
shankari Sep 29, 2021
fe9bedd
Merge branch 'master' of https://github.com/e-mission/e-mission-phone…
shankari May 6, 2022
26a015f
Fixes to populateManualInputs from testing
shankari May 6, 2022
b328159
Comment out the dashboard screen
shankari May 6, 2022
08d03f7
Move all the enketo code into a separate directory
shankari May 6, 2022
2f34128
Rename some more to make names shorter and avoid verbosity
shankari May 6, 2022
b6ad175
Initial version of the enketo trip button works
shankari May 7, 2022
8aa8900
Formatting fix
shankari May 7, 2022
0636a90
Also ensure that the value that is read in is visible
shankari May 7, 2022
4761d6b
Remove enketo dependency from multi-label UI
shankari May 9, 2022
73bc4ab
Remove all references to the ConfirmHelper and the inputs from the ne…
shankari May 9, 2022
9f3ac2e
Remove NOP if statement
shankari May 9, 2022
aec0051
Refactor the diary code to consistently call `processManualInputs` to…
shankari May 9, 2022
1db4c98
Move the input matching code out of the DiaryHelper
shankari May 10, 2022
97d748f
Inject the service for the directive that we are using
shankari May 10, 2022
75e5507
Pull out the code to extract the results from the promise response
shankari May 10, 2022
d30ab76
Remove all references to the ConfirmHelper from the diary services
shankari May 10, 2022
5a362c5
Revert unncessary changes introduced by the enketo code
shankari May 10, 2022
7a8b99b
Remove all references to the UUID in the enketo wrappers
shankari May 10, 2022
05fc212
Refactor the answer matching code for the survey
shankari May 11, 2022
72ba468
Refactor the answer matching code for the survey
shankari May 11, 2022
d6475e4
Merge branch 'refactor_enketo' of https://github.com/e-mission/e-miss…
shankari May 11, 2022
40e6b84
Make the data key to store the user input be configurable
shankari May 11, 2022
ed47530
Turn on the demographic survey from the control screen
shankari May 11, 2022
c987e3f
Introduce the onboarding survey as a slide in the intro
shankari May 12, 2022
eba0a57
Change `ngdone` to `ng-done` (ngDone in the controller) for better re…
shankari May 12, 2022
61e138a
once the intro is done, remove the intro view
shankari May 12, 2022
ff7863d
Replace the content in the modal with the inline content
shankari May 12, 2022
df21f08
Get the onboarding inline survey to work with previous entries
shankari May 14, 2022
b3e6e3b
Add functionality to display a preview of the loaded survey
shankari May 23, 2022
4d5efb4
Make the inline screen for the survey better
shankari May 23, 2022
2308f0e
Add border to the buttons
shankari May 23, 2022
9ae72b0
Store the survey result as JSON in addition to XML
shankari May 24, 2022
56621ef
Revert "Store the survey result as JSON in addition to XML"
shankari May 24, 2022
71dfd01
Revert "Revert "Store the survey result as JSON in addition to XML""
shankari May 24, 2022
7d7ad7b
Add in the pulled out form base
shankari May 25, 2022
2816d66
Change the enketo answer to be consistent with the server data model
shankari May 25, 2022
269e199
Remove implementations of NOP functions
shankari May 25, 2022
19f97a4
Fix path to enketo logo
shankari May 25, 2022
a4eb053
Merge pull request #830 from e-mission/refactor_enketo
shankari May 26, 2022
e8c1321
Revert unsw specific changes (#831)
shankari May 26, 2022
0ccab07
Gracefully handle the case in which there are no user inputs
shankari May 27, 2022
fd27504
Fix the formatting of the enketo survey button
shankari May 27, 2022
fec362a
Remove "performance hack" for the user matching
shankari May 27, 2022
7daeada
Fix the promises code to retrieve unprocessed labels
shankari May 27, 2022
d4d6759
Ensure that the entries from the diary are copied to the label screen…
shankari May 27, 2022
99b15f4
Ensure that we can save the trip entries from the label view as well
shankari May 27, 2022
136343f
Ensure that the filters work for the enketo buttons as well
shankari May 27, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"angular-translate": "^2.18.1",
"angular-translate-loader-static-files": "^2.18.1",
"angular-translate-interpolation-messageformat": "^2.18.1",
"bottleneck": "^2.19.5"
"bottleneck": "^2.19.5",
"jquery-xml2json": "^0.0.8"
}
}
9 changes: 9 additions & 0 deletions www/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@

"control":{
"profile": "Profile",
"edit-demographics": "Edit Demographics",
"tracking": "Tracking",
"app-status": "App Status",
"medium-accuracy": "Medium accuracy",
Expand Down Expand Up @@ -155,6 +156,7 @@
"time": "Time",
"mode": "Mode",
"purpose": "Purpose",
"survey": "Details",
"unlabeled": "All Unlabeled",
"invalid-ebike": "Invalid",
"to-label": "To Label",
Expand All @@ -167,6 +169,7 @@
"choose-mode": "Mode 📝 ",
"choose-replaced-mode": "Replaces 📝",
"choose-purpose": "Purpose 📝",
"choose-survey": "Add Trip Details 📝 ",
"select-mode-scroll": "Mode (👇 for more)",
"select-replaced-mode-scroll": "Replaces (👇 for more)",
"select-purpose-scroll": "Purpose (👇 for more)",
Expand Down Expand Up @@ -396,5 +399,11 @@
"sensor_explanation":{
"button-accept": "OK",
"button-decline": "Stop"
},
"survey": {
"prev-survey-found": "Found previous survey response",
"use-prior-response": "Use prior response",
"edit-response": "Edit response",
"move-on": "Move on"
}
}
17 changes: 17 additions & 0 deletions www/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@
<link href="common/img/sprites/spritesmith/quests/bosses/quest.bosses.css" rel="stylesheet">
<link rel="stylesheet" href="lib/ng-walkthrough/css/ng-walkthrough.css">
<link href="lib/angularjs-slider/dist/rzslider.css" rel="stylesheet">
<!-- <link href='http://fonts.googleapis.com/css?family=Open+Sans:400,700,600&amp;subset=latin,cyrillic-ext,cyrillic,greek-ext,greek,vietnamese,latin-ext' rel='stylesheet' type='text/css'> -->
<link href="manual_lib/enketo/css/formhub.css" media="all" rel="stylesheet">
<!--<link type="text/css" href="manual_lib/enketo/css/plain.css" media="all" rel="stylesheet" />-->
<!--<link type="text/css" href="manual_lib/enketo/css/grid.css" media="all" rel="stylesheet" />-->
<link href="manual_lib/enketo/css/formhub-print.css" media="print" rel="stylesheet">
<!--<link type="text/css" href="manual_lib/enketo/css/plain-print.css" media="print" rel="stylesheet" />-->
<!--<link type="text/css" href="manual_lib/enketo/css/grid-print.css" media="print" rel="stylesheet" />-->
<link href="manual_lib/fontawesome/css/all.min.css" rel="stylesheet">

<!-- IF using Sass (run gulp sass first), then uncomment below and remove the CSS includes above
Expand All @@ -29,6 +36,7 @@

<!-- ionic/angularjs js -->
<script src="lib/jquery/dist/jquery.min.js"></script>
<script src="lib/jquery-xml2json/src/xml2json.js"></script>
<script src="lib/ionic/js/ionic.bundle.js"></script>
<script src="lib/ionic-toast/dist/ionic-toast.bundle.min.js"></script>
<script src="lib/angular-translate/angular-translate.min.js"></script>
Expand Down Expand Up @@ -58,6 +66,7 @@
<script src="lib/angular-cookies/angular-cookies.min.js"></script>
<script src="lib/angularLocalStorage/dist/angularLocalStorage.min.js"></script>
<script src="lib/angularjs-slider/dist/rzslider.min.js"></script>
<script src="manual_lib/enketo/enketo-bundle.js"></script>
<!-- Manually installed javascript for libraries that are not published through bower -->
<!-- cordova script (this will be a 404 in the browser) -->
<script type="text/javascript" src="cordova.js"></script>
Expand All @@ -81,6 +90,7 @@
<script src="js/main.js"></script>
<script src="js/recent.js"></script>
<script src="js/survey/survey.js"></script>
<script src="js/survey/input-matcher.js"></script>
<script src="js/survey/one-click-button.js"></script>
<script src="js/incident/post-trip-manual.js"></script>
<script src="js/survey/multilabel/infinite_scroll_filters.js"></script>
Expand All @@ -103,6 +113,13 @@
<script src="js/common/place-detail.js"></script>
<script src="js/common/services.js"></script>
<script src="js/survey/external/launch.js"></script>
<script src="js/survey/enketo/answer.js"></script>
<script src="js/survey/enketo/launch.js"></script>
<script src="js/survey/enketo/service.js"></script>
<script src="js/survey/enketo/infinite_scroll_filters.js"></script>
<script src="js/survey/enketo/enketo-trip-button.js"></script>
<script src="js/survey/enketo/enketo-demographics.js"></script>
<script src="js/survey/enketo/enketo-preview.js"></script>
<script src="js/heatmap.js"></script>
<script src="js/metrics.js"></script>
<script src="js/goals.js"></script>
Expand Down
1 change: 1 addition & 0 deletions www/js/control/general-settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ angular.module('emission.main.control',['emission.services',
'emission.main.metrics.factory',
'emission.stats.clientstats',
'emission.plugin.kvstore',
'emission.survey.enketo.demographics',
'emission.plugin.logger'])

.controller('ControlCtrl', function($scope, $window, $ionicScrollDelegate,
Expand Down
151 changes: 16 additions & 135 deletions www/js/diary/services.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

angular.module('emission.main.diary.services', ['emission.plugin.logger',
'emission.services', 'emission.main.common.services',
'emission.incident.posttrip.manual', 'emission.survey.multilabel.services'])
'emission.incident.posttrip.manual'])
.factory('DiaryHelper', function(CommonGraph, PostTripManualMarker, $translate){
var dh = {};
// dh.expandEarlierOrLater = function(id) {
Expand Down Expand Up @@ -372,127 +372,20 @@ angular.module('emission.main.diary.services', ['emission.plugin.logger',
return getColoredStyle(baseDict, dh.getColor(feature.properties.sensed_mode));
};

var fmtTs = function(ts_in_secs, tz) {
return moment(ts_in_secs * 1000).tz(tz).format();
}

var printUserInput = function(ui) {
return fmtTs(ui.data.start_ts, ui.metadata.time_zone) + "("+ui.data.start_ts + ") -> "+
fmtTs(ui.data.end_ts, ui.metadata.time_zone) + "("+ui.data.end_ts + ")"+
" " + ui.data.label + " logged at "+ ui.metadata.write_ts;
}

dh.getUserInputForTrip = function(trip, nextTrip, userInputList) {
if (userInputList.length < 20) {
console.log("Input list = "+userInputList.map(printUserInput));
}
// undefined != true, so this covers the label view case as well
var isDraft = trip.isDraft == true;
var potentialCandidates = userInputList.filter(function(userInput) {
/*
console.log("startDelta "+userInput.data.label+
"= user("+fmtTs(userInput.data.start_ts, userInput.metadata.time_zone)+
") - trip("+fmtTs(userInput.data.start_ts, userInput.metadata.time_zone)+") = "+
(userInput.data.start_ts - trip.start_ts)+" should be positive");
console.log("endDelta = "+userInput.data.label+
"user("+fmtTs(userInput.data.end_ts, userInput.metadata.time_zone)+
") - trip("+fmtTs(trip.end_ts, userInput.metadata.time_zone)+") = "+
(userInput.data.end_ts - trip.end_ts)+" should be negative");
*/
// logic described in
// https://github.com/e-mission/e-mission-docs/issues/423
if (isDraft) {
if (userInputList.length < 20) {
var logStr = "Draft trip: comparing user = "+fmtTs(userInput.data.start_ts, userInput.metadata.time_zone)
+" -> "+fmtTs(userInput.data.end_ts, userInput.metadata.time_zone)
+" trip = "+fmtTs(trip.start_ts, userInput.metadata.time_zone)
+" -> "+fmtTs(trip.end_ts, userInput.metadata.time_zone)
+" checks are ("+(userInput.data.start_ts >= trip.start_ts)
+" && "+(userInput.data.start_ts <= trip.end_ts)
+" || "+(-(userInput.data.start_ts - trip.start_ts) <= 15 * 60)
+") && "+(userInput.data.end_ts <= trip.end_ts);
console.log(logStr);
// Logger.log(logStr);
}
return (userInput.data.start_ts >= trip.start_ts
&& userInput.data.start_ts <= trip.end_ts
|| -(userInput.data.start_ts - trip.start_ts) <= 15 * 60)
&& userInput.data.end_ts <= trip.end_ts;
} else {
// we know that the trip is cleaned so we can use the fmt_time
// but the confirm objects are not necessarily filled out
if (userInputList.length < 20) {
var logStr = "Cleaned trip: comparing user = "
+fmtTs(userInput.data.start_ts, userInput.metadata.time_zone)
+" -> "+fmtTs(userInput.data.end_ts, userInput.metadata.time_zone)
+" trip = "+trip.start_fmt_time
+" -> "+trip.end_fmt_time
+" start checks are "+(userInput.data.start_ts >= trip.start_ts)
+" && "+(userInput.data.start_ts <= trip.end_ts)
+" end checks are "+(userInput.data.end_ts <= trip.end_ts)
+" || "+((userInput.data.end_ts - trip.end_ts) <= 15 * 60)+")";
Logger.log(logStr);
}
// https://github.com/e-mission/e-mission-docs/issues/476#issuecomment-747222181
const startChecks = userInput.data.start_ts >= trip.start_ts &&
userInput.data.start_ts <= trip.end_ts;
var endChecks = (userInput.data.end_ts <= trip.end_ts ||
(userInput.data.end_ts - trip.end_ts) <= 15 * 60);
if (startChecks && !endChecks) {
if (angular.isDefined(nextTrip)) {
endChecks = userInput.data.end_ts <= nextTrip.start_ts;
Logger.log("Second level of end checks when the next trip is defined("+userInput.data.end_ts+" <= "+ nextTrip.start_ts+") = "+endChecks);
} else {
// next trip is not defined, last trip
endChecks = (userInput.data.end_local_dt.day == userInput.data.start_local_dt.day)
Logger.log("Second level of end checks for the last trip of the day");
Logger.log("compare "+userInput.data.end_local_dt.day + " with " + userInput.data.start_local_dt.day + " = " + endChecks);
}
if (endChecks) {
// If we have flipped the values, check to see that there
// is sufficient overlap
const overlapDuration = Math.min(userInput.data.end_ts, trip.end_ts) - Math.max(userInput.data.start_ts, trip.start_ts)
Logger.log("Flipped endCheck, overlap("+overlapDuration+
")/trip("+trip.duration+") = "+ (overlapDuration / trip.duration));
endChecks = (overlapDuration/trip.duration) > 0.5;
}
}
return startChecks && endChecks;
}
});
if (potentialCandidates.length === 0) {
if (userInputList.length < 20) {
Logger.log("In getUserInputForTripStartEnd, no potential candidates, returning []");
}
return undefined;
}

if (potentialCandidates.length === 1) {
Logger.log("In getUserInputForTripStartEnd, one potential candidate, returning "+ printUserInput(potentialCandidates[0]));
return potentialCandidates[0];
}

Logger.log("potentialCandidates are "+potentialCandidates.map(printUserInput));
var sortedPC = potentialCandidates.sort(function(pc1, pc2) {
return pc2.metadata.write_ts - pc1.metadata.write_ts;
});
var mostRecentEntry = sortedPC[0];
Logger.log("Returning mostRecentEntry "+printUserInput(mostRecentEntry));
return mostRecentEntry;
}


return dh;
})
.factory('Timeline', function(CommHelper, ConfirmHelper, $http, $ionicLoading, $window,
$rootScope, CommonGraph, UnifiedDataLoader, Logger, $translate) {
.factory('Timeline', function(CommHelper, SurveyOptions, $http, $ionicLoading, $window,
$rootScope, CommonGraph, UnifiedDataLoader, Logger, $injector, $translate) {
var timeline = {};
// corresponds to the old $scope.data. Contains all state for the current
// day, including the indication of the current day
timeline.data = {};
timeline.data.unifiedConfirmsResults = null;
timeline.UPDATE_DONE = "TIMELINE_UPDATE_DONE";

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

// Internal function, not publicly exposed
var getKeyForDate = function(date) {
var dateString = date.startOf('day').format('YYYY-MM-DD');
Expand All @@ -509,15 +402,13 @@ angular.module('emission.main.diary.services', ['emission.plugin.logger',
startTs: result.end_ts - 10,
endTs: moment().unix() + 10
}
var manualPromises = ConfirmHelper.INPUTS.map(function(inp) {
var manualPromises = manualInputFactory.MANUAL_KEYS.map(function(inp_key) {
return UnifiedDataLoader.getUnifiedMessagesForInterval(
ConfirmHelper.inputDetails[inp].key, pendingLabelQuery);
inp_key, pendingLabelQuery).then(manualInputFactory.extractResult);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note to self: extractResult is primarily for enketo where we check for version number matching.

});
const manualConfirmResults = {};
return Promise.all(manualPromises).then((manualResults) => {
const manualConfirmResults = {};
manualResults.forEach(function(mr, index) {
manualConfirmResults[ConfirmHelper.INPUTS[index]] = mr;
});
manualInputFactory.processManualInputs(manualResults, manualConfirmResults);
return [result, manualConfirmResults];
});
}).catch((err) => {
Expand Down Expand Up @@ -1097,18 +988,6 @@ angular.module('emission.main.diary.services', ['emission.plugin.logger',

var localCacheReadFn = timeline.updateFromDatabase;

var processManualInputs = function(manualResults) {
var mrString = 'unprocessed manual inputs '
+ manualResults.map(function(item, index) {
return ` ${item.length} ${ConfirmHelper.INPUTS[index]}`;
});
console.log(mrString);
timeline.data.unifiedConfirmsResults = {}
manualResults.forEach(function(mr, index) {
timeline.data.unifiedConfirmsResults[ConfirmHelper.INPUTS[index]] = mr;
});
}

var addUnprocessedTrips = function(processedTripList, day, completeStatus) {
var tripList = processedTripList;
if (!completeStatus) {
Expand All @@ -1126,13 +1005,15 @@ angular.module('emission.main.diary.services', ['emission.plugin.logger',
}

var readTripsAndUnprocessedInputs = function(day, tripReadFn, completeStatus, tq) {
var manualPromises = ConfirmHelper.INPUTS.map(function(inp) {
console.log("Reading values for list ", manualInputFactory.MANUAL_KEYS);
var manualPromises = manualInputFactory.MANUAL_KEYS.map(function(inp_key) {
return UnifiedDataLoader.getUnifiedMessagesForInterval(
ConfirmHelper.inputDetails[inp].key, tq);
inp_key, tq).then(manualInputFactory.extractResult);
});
let tripsReadPromise = tripReadFn(day);
// var surveyAnswersPromise = EnketoSurvey.getAllSurveyAnswers("manual/confirm_survey", { populateLabels: true });
let allManualPromise = Promise.all(manualPromises).then(processManualInputs);
timeline.data.unifiedConfirmsResults = {};
let allManualPromise = Promise.all(manualPromises).then((manualResults) =>
manualInputFactory.processManualInputs(manualResults, timeline.data.unifiedConfirmsResults));

let allTripsPromise = tripsReadPromise.then((processedTripList) => {
console.log("Reading trips from server finished successfully with length "
Expand Down
12 changes: 9 additions & 3 deletions www/js/intro.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

angular.module('emission.intro', ['emission.splash.startprefs',
'emission.splash.updatecheck',
'emission.survey.external.launch',
'emission.survey.enketo.demographics',
'emission.appstatus.permissioncheck',
'emission.i18n.utils',
'ionic-toast'])
Expand Down Expand Up @@ -30,7 +30,8 @@ angular.module('emission.intro', ['emission.splash.startprefs',
i18nUtils.geti18nFileName("templates/", "intro/summary", ".html"),
i18nUtils.geti18nFileName("templates/", "intro/consent", ".html"),
i18nUtils.geti18nFileName("templates/", "intro/sensor_explanation", ".html"),
i18nUtils.geti18nFileName("templates/", "intro/login", ".html")
i18nUtils.geti18nFileName("templates/", "intro/login", ".html"),
i18nUtils.geti18nFileName("templates/", "intro/survey", ".html")
]);
allIntroFiles.then(function(allIntroFilePaths) {
$scope.$apply(function() {
Expand All @@ -39,6 +40,7 @@ angular.module('emission.intro', ['emission.splash.startprefs',
$scope.consentFile = allIntroFilePaths[1];
$scope.explainFile = allIntroFilePaths[2];
$scope.loginFile = allIntroFilePaths[3];
$scope.surveyFile = allIntroFilePaths[4];
});
});

Expand Down Expand Up @@ -117,7 +119,7 @@ angular.module('emission.intro', ['emission.splash.startprefs',
client: retVal
});
});
$scope.finish();
$scope.next();
}, function(errorResult) {
$scope.alertError('User registration error', errorResult);
});
Expand Down Expand Up @@ -149,6 +151,10 @@ angular.module('emission.intro', ['emission.splash.startprefs',
StartPrefs.markIntroDone();
$scope.getIntroBox().slide(0);
StartPrefs.loadPreferredScreen();
// remove this view since the intro is done
// when we go back to the intro state, it will be recreated
$("[state='root.intro']").remove();
$scope.$destroy();
}

$ionicPlatform.ready().then(function() {
Expand Down
Loading