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

feat: Changed pdf datetime to event timezones #7452

Merged
merged 1 commit into from
Nov 18, 2020

Conversation

codedsun
Copy link
Contributor

Fixes #7438

Short description of what this resolves:

feat: Changed pdf datetime to event timezones

Changes proposed in this pull request:

Checklist

  • I have read the Contribution & Best practices Guide and my PR follows them.
  • My branch is up-to-date with the Upstream development branch.
  • The unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
  • All the functions created/modified in this PR contain relevant docstrings.

@auto-label auto-label bot added the feature label Nov 16, 2020
@codecov
Copy link

codecov bot commented Nov 16, 2020

Codecov Report

Merging #7452 (06841fe) into development (b0a90f0) will increase coverage by 0.04%.
The diff coverage is 7.69%.

Impacted file tree graph

@@               Coverage Diff               @@
##           development    #7452      +/-   ##
===============================================
+ Coverage        65.34%   65.38%   +0.04%     
===============================================
  Files              265      265              
  Lines            13239    13235       -4     
===============================================
+ Hits              8651     8654       +3     
+ Misses            4588     4581       -7     
Impacted Files Coverage Δ
app/api/helpers/scheduled_jobs.py 61.26% <0.00%> (+2.08%) ⬆️
app/templates/flask_ext/jinja/filters.py 84.61% <100.00%> (+8.61%) ⬆️
app/api/events.py 38.91% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update aaacb23...ac50b5f. Read the comment docs.

@codedsun
Copy link
Contributor Author

@iamareebjamal - Review

return self.issued_at.astimezone(pytz.timezone(self.event.timezone))

@property
def due_at_tz(self):
Copy link
Member

Choose a reason for hiding this comment

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

Please use datetime helper, it has timezone support already

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@iamareebjamal return self.due_at.astimezone(datetime.astimezone(self.event.timezone)) like this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Or you meant datetime(order.event.timezone) like this in jinja template?

<span style="font-size: 15px;">From: {{ order.event.starts_at | datetime(order.event.timezone) }}</span><br>
<span style="font-size: 15px;">To: {{ order.event.ends_at | datetime(order.event.timezone) }}</span>
<span style="font-size: 15px;">From: {{ order.event.starts_at_tz | datetime(order.event.timezone) }}</span><br>
<span style="font-size: 15px;">To: {{ order.event.ends_at_tz | datetime(order.event.timezone) }}</span>
Copy link
Member

Choose a reason for hiding this comment

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

This was already according to event timezone

@codedsun
Copy link
Contributor Author

@iamareebjamal - Review

return self.created_at.astimezone(pytz.timezone(self.event.timezone))

@property
def completed_at_tz(self):
Copy link
Member

Choose a reason for hiding this comment

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

As I said in last review, not needed

@@ -97,10 +97,10 @@ <h3 style="text-align:center;">{{ holders[0].event.name }} - {{ ("Attendees List

{% if holder.order and holder.order.status == 'completed' %}
<span
class="datetime">{{ holder.order.completed_at | datetime }} - {{ holder.order.completed_at | humanize }}</span>
class="datetime">{{ holder.order.completed_at_tz | datetime }} - {{ holder.order.completed_at_tz | humanize }}</span>
Copy link
Member

Choose a reason for hiding this comment

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

Use the datetime helper as suggested in last review

font-size: 12px;
background: #FFFFFF;
font-family: Arial, sans-serif;
font-size: 12px;
Copy link
Member

Choose a reason for hiding this comment

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

Why?

@@ -103,9 +103,9 @@ <h3 style="text-align:center;">{{ event.name }} - {{ ("Order List") }}</h3>
{{ ('NA') }}
{% endif %}<br>
{% if order.status == 'completed' %}
<span class="datetime">{{ order.completed_at | datetime }}</span>
<span class="datetime">{{ order.completed_at_tz | datetime }}</span>
Copy link
Member

Choose a reason for hiding this comment

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

Not needed

Copy link
Member

@iamareebjamal iamareebjamal left a comment

Choose a reason for hiding this comment

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

Moved even further from expected since last review

@codedsun codedsun force-pushed the timezone branch 2 times, most recently from edbe7b4 to c63c60b Compare November 17, 2020 08:13
<div><span>DATE</span> {{ invoice.issued_at | date }}</div>
<div><span>DUE DATE</span> {{ invoice.due_at | date }}</div>
<div><span>DATE</span> {{ invoice.issued_at | datetime(event.timezone) }}</div>
<div><span>DUE DATE</span> {{ invoice.due_at | datetime(event.timezone) }}</div>
Copy link
Member

Choose a reason for hiding this comment

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

This is date and not datetime, make date helper timezone aware

@codedsun codedsun force-pushed the timezone branch 2 times, most recently from 2ecd492 to 417167b Compare November 17, 2020 08:27
<div><span>DATE</span> {{ invoice.issued_at | date }}</div>
<div><span>DUE DATE</span> {{ invoice.due_at | date }}</div>
<div><span>DATE</span> {{ invoice.issued_at | date(event.timezone) }}</div>
<div><span>DUE DATE</span> {{ invoice.due_at | date(event.timezone) }}</div>
Copy link
Member

Choose a reason for hiding this comment

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

The date filter is not timezone aware. It'll fail. Please test the changes before asking for review. Reduce the request review cycle please. The changes on this PR either go opposite of what it should be or plain don't work.

Why don't you test it first?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't requested for review this tym. I will test and then ask for review and will make sure to reduce the request review cycle. Sorry for the inconvinience

Comment on lines 34 to 36
if not date:
return ''
return date.strftime('%B %d, %Y')
return date.astimezone(pytz.timezone(timezone)).strftime('%B %d, %Y')
Copy link
Member

Choose a reason for hiding this comment

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

return simple_datetime_display(date, timezone, '%B %d, %Y')

@codedsun
Copy link
Contributor Author

@iamareebjamal - Review

Comment on lines 34 to 35
if not date:
return ''
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if not date:
return ''

@iamareebjamal
Copy link
Member

Other emails contain time as well

@codedsun
Copy link
Contributor Author

'subject': 'Your invoice for {event_name} for {date} is available on {app_name}',

'subject': 'Reminder: Your invoice for {event_name} for {date} is available on {app_name}',

'subject': 'Reminder: Your invoice for {event_name} for {date} is available on {app_name}',

'subject': 'Please pay your overdue invoice for {event_name} for {date} on {app_name}',

@iamareebjamal Correct?

@iamareebjamal
Copy link
Member

After event email and others as well

@codedsun
Copy link
Contributor Author

codedsun commented Nov 18, 2020

@iamareebjamal As you mentioned after event email

AFTER_EVENT: {
'recipient': 'Owner, Organizer, Speaker',
'subject': 'Event {event_name} is over',
'message': (
"Hi {email},<br/>"
+ "Thank You for participating in our event. We hope you enjoyed it. "
"Please check out other upcoming events around you on {url} <br />"
),
'sent_at': '1 day after the event',

Are you referring to sent at field? as I can't see anyother field which uses time

@iamareebjamal
Copy link
Member

No, I must have forgot. If that's it, then yes, those are the only emails

@codedsun
Copy link
Contributor Author

@iamareebjamal - Tested

subject : Your invoice for Event Till March for Oct 2020 is available on Open Event

message:
Hello Suneet  Srivastava,<br><br>The invoice for your event Event Till March on eventyay.com for Oct 2020 is now available. Your invoice payment is due within 30 days.<br><br>Amount Due: INR 100.0<br><br>Please pay within 30 days.<br><br>Pay Now at: <a href='http://eventyay.com/event-invoice/22345ad1/review'>http://eventyay.com/event-invoice/22345ad1/review</a><br><br>A detailed invoice is available in <a href='https://eventyay.com/account/billing/invoices/'>the billing area</a> of your account. If you have any questions about invoices, please find more information on our FAQ at https://support.eventyay.com.<br><br><em>Thank you for using Open Event!</em><br><br>Open Event Team

image

@iamareebjamal iamareebjamal merged commit 8a65edc into fossasia:development Nov 18, 2020
@codedsun
Copy link
Contributor Author

Thanks! yeah 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Change email and PDF datetimes to event timezone
2 participants