-
Notifications
You must be signed in to change notification settings - Fork 652
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
Fix remaining trial days calculation #15470
Conversation
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.
One doubt and one comment. Let's discuss if we tackle them as part of this PR or what :)
I still see some weird numbers, i.e.
|
@alrocar I think it was missing the bump in package.json. I've also added some other improvements I made in the free plan branch. It's already deployed in staging. |
Tested in staging with the
😅 |
@alrocar the problem is that there were many ways to calculate the difference in days... I've updated the frontend views to do it the same way as in backend (ceil). It's deployed in Staging. |
@@ -14,7 +14,7 @@ | |||
|
|||
<script> | |||
import { mapState } from 'vuex'; | |||
import distanceInWordsStrict from 'date-fns/distance_in_words_strict'; | |||
import moment from 'moment'; | |||
import WelcomeCompact from './WelcomeCompact'; |
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.
I feel that you can use differenceInCalendarDays
from date-fns
instead of importing the whole moment library. I think it does the ceiling for you https://date-fns.org/v1.29.0/docs/differenceInCalendarDays Can you try it out?
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.
Thanks! I've tested it, but it's doing round
instead of ceil
, and it's not configurable... So I'm leaving it with moment
for the moment
:D
> differenceInCalendarDays('2020-02-12T22:00:00', '2020-02-12T08:00:00');
0
@@ -1,4 +1,4 @@ | |||
<% if current_user.trial_user? %> | |||
<% if current_user.show_trial_reminder? %> |
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.
This is much clearer this way!!
I tested it in staging and it works like a charm ✨ @gonzaloriestra I leave it assigned to you, deploy when you consider. |
Related to https://github.com/CartoDB/support/issues/1997, #15046
(the account should be locked or paying in that case)
remaining_trial_days
as 0 when the trial ends (it was showing negative numbers)