-
Notifications
You must be signed in to change notification settings - Fork 1.9k
fix: Same discount and access codes cannot be applied to two different events #6208
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: Same discount and access codes cannot be applied to two different events #6208
Conversation
app/api/discount_codes.py
Outdated
# filter on deleted_at is required to catch the id of a | ||
# discount code which has not been deleted. | ||
discount = db.session.query(DiscountCode).filter_by(code=kwargs.get('code'), deleted_at=None).first() | ||
discount = db.session.query(DiscountCode).filter_by(code=kwargs.get('code'), event_id=kwargs.get('event_id') |
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.
whitespace before ','
from app.api.event_sub_topics import EventSubTopicList, EventSubTopicListPost, EventSubTopicDetail, \ | ||
EventSubTopicRelationshipRequired, EventSubTopicRelationshipOptional | ||
from app.api.event_topics import EventTopicList, EventTopicDetail, EventTopicRelationship | ||
from app.api.event_types import EventTypeList, EventTypeDetail, EventTypeRelationship | ||
from app.api.events import EventList, EventDetail, EventRelationship, EventCopyResource |
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.
'app.api.events.EventCopyResource' imported but unused
app/api/__init__.py
Outdated
@@ -613,7 +614,7 @@ | |||
# Admin Statistics API | |||
api.route(AdminStatisticsSessionDetail, 'admin_statistics_session_detail', '/admin/statistics/sessions') | |||
api.route(AdminStatisticsEventDetail, 'admin_statistics_event_detail', '/admin/statistics/events') | |||
api.route(AdminStatisticsUserDetail, 'admin_statistics_user_detail', '/admin/statistics/users') | |||
api.route(AdminStatisticsUserDetail, 'admin_statistics_user_detail', '/admin/tistics/users') |
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.
What is tistics? Is it something millenials use instead of statistics?
tests/hook_main.py
Outdated
:param transaction: | ||
:return: | ||
""" | ||
with stash['app'].app_context(): | ||
event = EventFactoryBasic() | ||
db.session.add(event) | ||
db.session.commit() |
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.
If you're going to remove this, how the discount code is going to be attached to the event?
tests/hook_main.py
Outdated
@@ -2804,15 +2804,11 @@ def discount_delete(transaction): | |||
@hooks.before("Discount Codes > Get Discount Code Detail using the code > Get Discount Code Detail") | |||
def discount_code_get_detail_using_code(transaction): | |||
""" | |||
GET /discount-codes/DC101 | |||
GET event_id/1/discount-code/DC101 |
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.
And this is absolutely wrong. There is no route event_id/
in the API. Not sure what you're trying to do
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.
@iamareebjamal Had to write event/
, made a mistake.
887ed48
to
f85ed5f
Compare
c691eb1
to
1cc7d11
Compare
Codecov Report
@@ Coverage Diff @@
## development #6208 +/- ##
============================================
Coverage 65.88% 65.88%
============================================
Files 288 288
Lines 14575 14575
============================================
Hits 9603 9603
Misses 4972 4972
Continue to review full report at Codecov.
|
@iamareebjamal @uds5501 @mrsaicharan1 Please review. |
See how simple it was. Had to make small changes. And how complicated you made it |
@iamareebjamal Yaa !!! |
Fixes #6027
Short description of what this resolves:
Same discount and access code not able to apply to two different events.
Changes proposed in this pull request:
Checking discount and access code with event_id and access/discount code name, and changing the endpoint accordingly.
Checklist
development
branch.