Skip to content

Commit

Permalink
Remove "performance hack" for the user matching
Browse files Browse the repository at this point in the history
Where if the user input list has a single entry, we can return it.
If we have one user input and multiple trips, we can't just return that one
input. That is the input for one trip, not the others!
e-mission/e-mission-docs#727 (comment)

wrt performance, we already handled the major performance issue by only having
to manually match unprocessed entries after the end of the pipeline

Testing done:
- loaded a day with a single user input
- before this change, all trips were flagged with that input
- after this change, only the first was
  • Loading branch information
shankari committed May 27, 2022
1 parent fd27504 commit fec362a
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions www/js/survey/input-matcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,11 @@ angular.module('emission.survey.inputmatcher', ['emission.plugin.logger'])
}

im.getUserInputForTrip = function(trip, nextTrip, userInputList) {
// If there is only one item in the list, return it.
// This make it compatible when fake list is given (for Enketo Survey).
// As well as optimize the performance.
if (userInputList === undefined) {
Logger.log("In getUserInputForTrip, no user input, returning []");
return undefined;
}

if (userInputList.length === 1) {
return userInputList[0];
}
if (userInputList.length < 20) {
console.log("Input list = "+userInputList.map(printUserInput));
}
Expand Down

0 comments on commit fec362a

Please sign in to comment.