-
Notifications
You must be signed in to change notification settings - Fork 114
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
Rk unsw #615
base: rk-unsw
Are you sure you want to change the base?
Rk unsw #615
Conversation
Can one of the admins verify this patch? |
@@ -64,6 +64,15 @@ angular.module('emission.enketo-survey.service', [ | |||
null; | |||
} | |||
|
|||
function getFirstUserProfile(user_properties, answers) { | |||
const potentialCandidates = answers.filter(function(answer) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do you need to do this? you should not be able to retrieve profiles for other users anyway. You can argue that it doesn't hurt anything, but extra code = extra computation = slower response time.
tripgj.isDraft = $scope.isDraft(tripgj); | ||
// Fix "Invalid date" for processed trips | ||
if (!tripgj.isDraft) { | ||
start_dt.month = start_dt.month - 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tripgj.data.properties.start_local_dt and tripgj.data.properties.end_local_dt use a 1-12 month value while moment needs 0-11 month value. The test was done on December which translated to value 12. Hence moment throw Invalid date
Are you sure this is the problem? Because if this were the case, then the month would always be off by one (e.g. January would be 1 in the local_dt
, converted to February by moment and displayed as such in the UI), and somebody would have noticed before this. Note that getLocalTimeString
is used in the master branch as well.
Based on the screenshots, I believe that this fixes the immediate issue that you found, but I am concerned that if it is not based on a well-formed understanding of the underlying bug, it may lead to other regressions.
I would like to see screenshots showing that:
- without this fix, on your channel, November dates are displayed as December and January dates are displayed as February
- on one of the standard channels (e.g. https://e-mission.eecs.berkeley.edu/#/client_setup?new_client=urap2017emotion&clear_usercache=true&clear_local_storage=true), December dates are not displayed correctly
before I approve the change.
ok, I poked around to understand #615 (comment) a bit better. I first confirmed, using the web console, that moment is off by one.
But then how does this work on master?! I used the blame feature to go back into the history of
Then, as part of the internationalization (d8e0a27) we used So why didn't we immediately notice that the month was off? Well, it turns out that we don't display the month! We format the resulting moment as "LT" (which is However, the date should be displayed as "Invalid" for all of December, so I am still not sure why @PatGendre and @stephhuerre, who are using the FabMob fork with the internationalization changes have not yet noticed this. Maybe they haven't been checking a lot in December because of the holidays? @PatGendre @stephhuerre can you confirm that the i18ned version does not display the times correctly for dates in December? |
@atton16 given that this is a generic issue, I think you should fix it in Please also submit this fix to master. Master can't use the user profile fixes obviously. |
At a high level, I am not opposed to making the months zero-indexed in the localdate. I just think that it should be consistent across processed and draft trips. moment uses zero indexed months to be consistent with the Date constructor, but they do say
Since we also support searches by local date, let's not pass on this frustration to our end users, who don't care about the |
FYI, moment's decision to use zero indexing has caused a lot of comments/requests for change. |
Hi @shankari @atton16 @stephhuerre and happy new Year!
I confirm I have the invalid date too in December, sorry for not having noticed it, in part because I tested other versions of the app. |
Thanks @PatGendre Concretely, change both |
Hi @shankari, Sorry, I totally missed the notifications on the #615, otherwise, I would have answered... We would be happy to submit an PR, however:
If we modify
|
@stephhuerre there is a mismatch between the python and moment implementations of date expansions. We have to pick one, and I pick the python implementation, because the zero indexing in moment seems to generate a lot of confusion. So the standard for e-mission is that the month will be 1-indexed (so January == 1 ... December == 12). Given this decision, we need to make two changes.
Please let me know if this is still not clear and I will attach a patch for you to test since that is easier than a more detailed description. For testing, I would suggest:
https://github.com/e-mission/e-mission-server#loading-test-data |
I have a pending PR to load data to a remote staging server (e-mission/e-mission-server#726) that has been languishing because I am busy. If that will help you, please vote for it! If it gets sufficient votes, I will move it up my dev queue. |
Rk unsw branch
fix(Deploy): fix white screen
Update index.html
…p-browser Rk unsw end survey inapp browser
Features
Apparently, the date stored in
tripgj.data.properties.start_local_dt
andtripgj.data.properties.end_local_dt
use a1-12
month value whilemoment
needs0-11
month value. The test was done on December which translated to value12
. Hence moment throwInvalid date
. However, this problem does not persist fordraft trip
so we skip the fix for those trips.Before:
After:
Example: I answered on January 1st, 2020