-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Update ticket_holder table schema #6675
Conversation
app/factories/attendee.py
Outdated
@@ -11,6 +12,7 @@ class Meta: | |||
sqlalchemy_session = db.session | |||
|
|||
event = factory.RelatedFactory(EventFactoryBasic) | |||
ticket = factory.RelatedFactory(TicketFactory) |
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?
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.
Without doing this, while running tests, some test were failing because of ticket_id
being None
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.
Please check for CI Failing.
Migration is needed for this. |
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.
Your dredd test are failing, also do create the migration
Codecov Report
@@ Coverage Diff @@
## development #6675 +/- ##
==============================================
Coverage ? 65.61%
==============================================
Files ? 300
Lines ? 15256
Branches ? 0
==============================================
Hits ? 10010
Misses ? 5246
Partials ? 0
Continue to review full report at Codecov.
|
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.
Please follow Semantic PR Naming for your PR title.
app/factories/attendee.py
Outdated
@@ -21,4 +21,5 @@ class Meta: | |||
is_checked_in = True | |||
pdf_url = common.url_ | |||
event_id = 1 | |||
# ticket_id = 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.
Remove comment
order_id: int = db.Column(db.Integer, db.ForeignKey('orders.id', ondelete='CASCADE')) | ||
is_checked_in: bool = db.Column(db.Boolean, default=False) | ||
is_checked_out: bool = db.Column(db.Boolean, default=False) | ||
device_name_checkin: str = db.Column(db.String) | ||
checkin_times: str = db.Column(db.String) | ||
checkout_times: str = db.Column(db.String) | ||
attendee_notes: str = db.Column(db.String) | ||
event_id: int = db.Column(db.Integer, db.ForeignKey('events.id', ondelete='CASCADE')) | ||
event_id: int = db.Column(db.Integer, db.ForeignKey('events.id', ondelete='CASCADE'), nullable=False) |
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.
Add migration files for the following.
5aeac31
to
9028721
Compare
docs/api/blueprint/attendees.apib
Outdated
@@ -73,7 +73,8 @@ Create a new attendee. | |||
"country": "IN", | |||
"is-checked-in": "false", | |||
"attendee-notes": "example", | |||
"pdf-url": "http://example.com" | |||
"pdf-url": "http://example.com", |
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.
Revert
docs/api/blueprint/attendees.apib
Outdated
@@ -73,7 +73,8 @@ Create a new attendee. | |||
"country": "IN", | |||
"is-checked-in": "false", | |||
"attendee-notes": "example", | |||
"pdf-url": "http://example.com" | |||
"pdf-url": "http://example.com", | |||
"ticket-id": "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.
revert
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.
@kushthedude If you explain the problem it would be very helpful
e5012a1
to
ef88094
Compare
tests/hook_main.py
Outdated
@@ -1858,7 +1858,7 @@ def attendee_post(transaction): | |||
ticket = TicketFactory() | |||
db.session.add(ticket) | |||
|
|||
attendee = AttendeeFactory(ticket_id=1) | |||
attendee = AttendeeFactory(ticket_id=1, event_id=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.
It's the default value. Not needed
docs/api/blueprint/attendees.apib
Outdated
"pdf-url": "http://example.com" | ||
"pdf-url": "http://example.com", | ||
"ticket-id": "1", | ||
"event-id": "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.
Unneeded
Updated the fields ticket_id and event_id to be not null
@@ -50,7 +50,6 @@ def validate_json(self, data, original_data): | |||
gender = fields.Str(allow_none=True) | |||
birth_date = fields.DateTime(allow_none=True) | |||
|
|||
ticket_id = fields.Str(allow_none=True) |
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.
Undo this and run the tests.
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 I think the tests are failing due to this.
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 have tried it. The issue still persists.
@@ -37,15 +37,15 @@ class TicketHolder(SoftDeletionModel): | |||
gender: str = db.Column(db.String) | |||
birth_date: datetime = db.Column(db.DateTime(timezone=True)) | |||
pdf_url: str = db.Column(db.String) | |||
ticket_id: int = db.Column(db.Integer, db.ForeignKey('tickets.id', ondelete='CASCADE')) | |||
ticket_id: int = db.Column(db.Integer, db.ForeignKey('tickets.id', ondelete='CASCADE'), nullable=False) |
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.
Black would make changes.
app/api/attendees.py
Outdated
|
||
# populate event id and ticket id | ||
data['ticket_id'] = ticket.id | ||
data['event_id'] = ticket.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.
Not needed
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.
Hi @iamareebjamal I am trying to debug what is the exact reason of the ticket_id
and event_id
becoming null
after the object creation. That's why I tried passing them in the data payload. Any you help me find out what can be the exact reason? Am I going in the right direction as per tracing the problem?
@@ -93,7 +93,7 @@ class Meta: | |||
self_view_kwargs={'id': '<id>'}, | |||
related_view='v1.ticket_detail', | |||
related_view_kwargs={'attendee_id': '<id>'}, | |||
schema='TicketSchemaPublic', | |||
schema='TicketSchema', |
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.
Can you please stop hit and trial. This is not needed and wrong
Stale |
Fixes #6669
Short description of what this resolves:
Updated the fields ticket_id and event_id to be not null
Changes proposed in this pull request:
ticket_holder
table. The fieldsticket_id
andevent_id
have been added with not null contraintChecklist
development
branch.