Skip to content

Conversation

@mrsaicharan1
Copy link
Member

Fixes #6282

Short description of what this resolves:

Implemented function for previous month's ticket sales count. Also refactored object method to reduce code dupl.

Changes proposed in this pull request:

  • Added previous month ticket sales count object
  • Refactored existing method

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.

@codecov
Copy link

codecov bot commented Aug 1, 2019

Codecov Report

Merging #6287 into development will decrease coverage by 0.01%.
The diff coverage is 28.57%.

Impacted file tree graph

@@               Coverage Diff               @@
##           development    #6287      +/-   ##
===============================================
- Coverage        65.26%   65.24%   -0.02%     
===============================================
  Files              287      287              
  Lines            14713    14719       +6     
===============================================
+ Hits              9602     9604       +2     
- Misses            5111     5115       +4
Impacted Files Coverage Δ
app/models/event.py 78.49% <28.57%> (-1%) ⬇️

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 e390b56...91c959b. Read the comment docs.

@mrsaicharan1
Copy link
Member Author

@iamareebjamal @uds5501 @shreyanshdwivedi Please have a look

@iamareebjamal iamareebjamal merged commit 257b354 into fossasia:development Aug 8, 2019
Copy link
Contributor

@uds5501 uds5501 left a comment

Choose a reason for hiding this comment

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

Please see the comments

def calc_tickets_sold_prev_month(self):
"""Calculate tickets sold in the previous month"""
previous_month = datetime.datetime.now().month - 1
return self.tickets_sold.filter_by(completed_at=previous_month).count()
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't it be self.tickets_sold_object instead of self.tickets_sold ?

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.

Implement function for tickets sold in previous month

4 participants