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

Error creating badge in magfest-master #340

Closed
jmdawson opened this issue Aug 10, 2019 · 3 comments
Closed

Error creating badge in magfest-master #340

jmdawson opened this issue Aug 10, 2019 · 3 comments
Assignees
Labels

Comments

@jmdawson
Copy link

jmdawson commented Aug 10, 2019

Running #339 code, run into this issue while attempting to register

Got an error while calling charge(self, payment_id='acf5dcba7ff84faa81ddc097df785106', stripeToken='tok_FbEVD1Ir2SyIw7', ignored={'csrf_token': '303331e7b93b49bb80e2b7637b7158ce', 'stripeTokenType': 'card'}):
Traceback (most recent call last):
 File "/app/plugins/uber/uber/models/types.py", line 189, in process_bind_param
   assert self.allow_unspecified or int(value) in self.choices
AssertionError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
 File "/app/env/lib/python3.4/site-packages/sqlalchemy/engine/base.py", line 1127, in _execute_context
   context = constructor(dialect, self, conn, *args)
 File "/app/env/lib/python3.4/site-packages/sqlalchemy/engine/default.py", line 693, in _init_compiled
   for key in compiled_params
 File "/app/env/lib/python3.4/site-packages/sqlalchemy/engine/default.py", line 693, in <genexpr>
   for key in compiled_params
 File "/app/env/lib/python3.4/site-packages/sqlalchemy/sql/type_api.py", line 1160, in process
   return process_param(value, dialect)
 File "/app/plugins/uber/uber/models/types.py", line 192, in process_bind_param
   value, self.choices))
ValueError: 0 not a valid option out of {}

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
 File "/app/plugins/uber/uber/decorators.py", line 358, in charge
   return func(self, session=session, payment_id=payment_id, stripeToken=stripeToken)
 File "/app/plugins/uber/uber/site_sections/preregistration.py", line 393, in prereg_payment
   session.commit()  # paranoia: really make sure we lock in marking taking payments in the database
 File "/app/env/lib/python3.4/site-packages/sqlalchemy/orm/session.py", line 943, in commit
   self.transaction.commit()
 File "/app/env/lib/python3.4/site-packages/sqlalchemy/orm/session.py", line 467, in commit
   self._prepare_impl()
 File "/app/env/lib/python3.4/site-packages/sqlalchemy/orm/session.py", line 447, in _prepare_impl
   self.session.flush()
 File "/app/env/lib/python3.4/site-packages/sqlalchemy/orm/session.py", line 2254, in flush
   self._flush(objects)
 File "/app/env/lib/python3.4/site-packages/sqlalchemy/orm/session.py", line 2380, in _flush
   transaction.rollback(_capture_exception=True)
 File "/app/env/lib/python3.4/site-packages/sqlalchemy/util/langhelpers.py", line 66, in __exit__
   compat.reraise(exc_type, exc_value, exc_tb)
 File "/app/env/lib/python3.4/site-packages/sqlalchemy/util/compat.py", line 187, in reraise
   raise value
 File "/app/env/lib/python3.4/site-packages/sqlalchemy/orm/session.py", line 2344, in _flush
   flush_context.execute()
 File "/app/env/lib/python3.4/site-packages/sqlalchemy/orm/unitofwork.py", line 391, in execute
   rec.execute(self)
 File "/app/env/lib/python3.4/site-packages/sqlalchemy/orm/unitofwork.py", line 556, in execute
   uow
 File "/app/env/lib/python3.4/site-packages/sqlalchemy/orm/persistence.py", line 181, in save_obj
   mapper, table, insert)
 File "/app/env/lib/python3.4/site-packages/sqlalchemy/orm/persistence.py", line 830, in _emit_insert_statements
   execute(statement, multiparams)
 File "/app/env/lib/python3.4/site-packages/sqlalchemy/engine/base.py", line 948, in execute
   return meth(self, multiparams, params)
 File "/app/env/lib/python3.4/site-packages/sqlalchemy/sql/elements.py", line 269, in _execute_on_connection
   return connection._execute_clauseelement(self, multiparams, params)
 File "/app/env/lib/python3.4/site-packages/sqlalchemy/engine/base.py", line 1060, in _execute_clauseelement
   compiled_sql, distilled_params
 File "/app/env/lib/python3.4/site-packages/sqlalchemy/engine/base.py", line 1132, in _execute_context
   None, None)
 File "/app/env/lib/python3.4/site-packages/sqlalchemy/engine/base.py", line 1413, in _handle_dbapi_exception
   exc_info
 File "/app/env/lib/python3.4/site-packages/sqlalchemy/util/compat.py", line 203, in raise_from_cause
   reraise(type(exception), exception, tb=exc_tb, cause=cause)
 File "/app/env/lib/python3.4/site-packages/sqlalchemy/util/compat.py", line 186, in reraise
   raise value.with_traceback(tb)
 File "/app/env/lib/python3.4/site-packages/sqlalchemy/engine/base.py", line 1127, in _execute_context
   context = constructor(dialect, self, conn, *args)
 File "/app/env/lib/python3.4/site-packages/sqlalchemy/engine/default.py", line 693, in _init_compiled
   for key in compiled_params
 File "/app/env/lib/python3.4/site-packages/sqlalchemy/engine/default.py", line 693, in <genexpr>
   for key in compiled_params
 File "/app/env/lib/python3.4/site-packages/sqlalchemy/sql/type_api.py", line 1160, in process
   return process_param(value, dialect)
 File "/app/plugins/uber/uber/models/types.py", line 192, in process_bind_param
   value, self.choices))
sqlalchemy.exc.StatementError: (builtins.ValueError) 0 not a valid option out of {} [SQL: 'INSERT INTO attendee (id, watchlist_id, group_id, promo_code_id, placeholder, first_name, last_name, legal_name, email, birthdate, age_group, international, zip_code, address1, address2, city, region, country, no_cellphone, ec_name, ec_phone, cellphone, requested_hotel_info, requested_accessibility_services, interests, found_how, comments, for_review, admin_notes, public_id, badge_num, badge_type, badge_status, ribbon, affiliate, shirt, num_event_shirts, can_spam, regdesk_info, extra_merch, got_merch, got_staff_merch, got_swadge, reg_station, confirmed, checked_in, paid, overridden_price, base_badge_price, amount_paid, amount_extra, extra_donation, payment_method, amount_refunded, badge_printed_name, staffing, agreed_to_volunteer_agreement, nonshift_hours, past_years, can_work_setup, can_work_teardown, hotel_eligible, hotel_pin, notification_pref, attractions_opt_out, print_pending, times_printed, comped_reason, fursuiting) VALUES (%(id)s, %(watchlist_id)s, %(group_id)s, %(promo_code_id)s, %(placeholder)s, %(first_name)s, %(last_name)s, %(legal_name)s, %(email)s, %(birthdate)s, %(age_group)s, %(international)s, %(zip_code)s, %(address1)s, %(address2)s, %(city)s, %(region)s, %(country)s, %(no_cellphone)s, %(ec_name)s, %(ec_phone)s, %(cellphone)s, %(requested_hotel_info)s, %(requested_accessibility_services)s, %(interests)s, %(found_how)s, %(comments)s, %(for_review)s, %(admin_notes)s, %(public_id)s, %(badge_num)s, %(badge_type)s, %(badge_status)s, %(ribbon)s, %(affiliate)s, %(shirt)s, %(num_event_shirts)s, %(can_spam)s, %(regdesk_info)s, %(extra_merch)s, %(got_merch)s, %(got_staff_merch)s, %(got_swadge)s, %(reg_station)s, %(confirmed)s, %(checked_in)s, %(paid)s, %(overridden_price)s, %(base_badge_price)s, %(amount_paid)s, %(amount_extra)s, %(extra_donation)s, %(payment_method)s, %(amount_refunded)s, %(badge_printed_name)s, %(staffing)s, %(agreed_to_volunteer_agreement)s, %(nonshift_hours)s, %(past_years)s, %(can_work_setup)s, %(can_work_teardown)s, %(hotel_eligible)s, %(hotel_pin)s, %(notification_pref)s, %(attractions_opt_out)s, %(print_pending)s, %(times_printed)s, %(comped_reason)s, %(fursuiting)s)'] [parameters: [{'ec_phone': '123-123-1234', 'staffing': False, 'requested_accessibility_services': False, 'got_swadge': False, 'public_id': '3e2502ef-0eb0-46fc-8ab8-781b95120d5f', 'international': False, 'base_badge_price': 60, 'country': 'United States', 'reg_station': None, 'extra_donation': 0, 'can_spam': False, 'attractions_opt_out': False, 'hotel_eligible': False, 'no_cellphone': False, 'amount_paid': 60, 'can_work_teardown': False, 'got_merch': False, 'birthdate': datetime.date(1982, 3, 9), 'found_how': '', 'last_name': 'Stewart', 'confirmed': None, 'got_staff_merch': False, 'ribbon': '', 'times_printed': 0, 'interests': '', 'paid': 254570300, 'amount_refunded': 0, 'city': 'Durham', 'nonshift_hours': 0, 'past_years': '', 'for_review': '', 'affiliate': '', 'hotel_pin': None, 'checked_in': None, 'address1': '414 Ganyard Farm Way', 'badge_num': 1142, 'print_pending': True, 'age_group': 259378497, 'requested_hotel_info': False, 'regdesk_info': '', 'badge_printed_name': 'Spirit Bear', 'extra_merch': '', 'first_name': 'Adam', 'legal_name': '', 'payment_method': None, 'placeholder': False, 'email': '[email protected]', 'address2': '', 'comped_reason': '', 'comments': '', 'id': 'a5bc780d-df90-427e-adcc-293a38f2e3c7', 'badge_type': 51352218, 'promo_code_id': None, 'region': 'North Carolina', 'can_work_setup': False, 'amount_extra': 0, 'watchlist_id': None, 'zip_code': '27703', 'ec_name': 'Test Person', 'group_id': None, 'shirt': 0, 'badge_status': 215389669, 'cellphone': '321-321-4321', 'num_event_shirts': 0, 'agreed_to_volunteer_agreement': False, 'notification_pref': 0, 'overridden_price': None, 'fursuiting': 102609242, 'admin_notes': ''}]]


IMPORTANT: This could have resulted in an attendee paying and not being marked as paid in the database. Definitely double check this.
Traceback (most recent call last):
 File "/app/plugins/uber/uber/models/types.py", line 189, in process_bind_param
   assert self.allow_unspecified or int(value) in self.choices
AssertionError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
 File "/app/env/lib/python3.4/site-packages/sqlalchemy/engine/base.py", line 1127, in _execute_context
   context = constructor(dialect, self, conn, *args)
 File "/app/env/lib/python3.4/site-packages/sqlalchemy/engine/default.py", line 693, in _init_compiled
   for key in compiled_params
 File "/app/env/lib/python3.4/site-packages/sqlalchemy/engine/default.py", line 693, in <genexpr>
   for key in compiled_params
 File "/app/env/lib/python3.4/site-packages/sqlalchemy/sql/type_api.py", line 1160, in process
   return process_param(value, dialect)
 File "/app/plugins/uber/uber/models/types.py", line 192, in process_bind_param
   value, self.choices))
ValueError: 0 not a valid option out of {}

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
 File "/app/plugins/uber/uber/decorators.py", line 358, in charge
   return func(self, session=session, payment_id=payment_id, stripeToken=stripeToken)
 File "/app/plugins/uber/uber/site_sections/preregistration.py", line 393, in prereg_payment
   session.commit()  # paranoia: really make sure we lock in marking taking payments in the database
 File "/app/env/lib/python3.4/site-packages/sqlalchemy/orm/session.py", line 943, in commit
   self.transaction.commit()
 File "/app/env/lib/python3.4/site-packages/sqlalchemy/orm/session.py", line 467, in commit
   self._prepare_impl()
 File "/app/env/lib/python3.4/site-packages/sqlalchemy/orm/session.py", line 447, in _prepare_impl
   self.session.flush()
 File "/app/env/lib/python3.4/site-packages/sqlalchemy/orm/session.py", line 2254, in flush
   self._flush(objects)
 File "/app/env/lib/python3.4/site-packages/sqlalchemy/orm/session.py", line 2380, in _flush
   transaction.rollback(_capture_exception=True)
 File "/app/env/lib/python3.4/site-packages/sqlalchemy/util/langhelpers.py", line 66, in __exit__
   compat.reraise(exc_type, exc_value, exc_tb)
 File "/app/env/lib/python3.4/site-packages/sqlalchemy/util/compat.py", line 187, in reraise
   raise value
 File "/app/env/lib/python3.4/site-packages/sqlalchemy/orm/session.py", line 2344, in _flush
   flush_context.execute()
 File "/app/env/lib/python3.4/site-packages/sqlalchemy/orm/unitofwork.py", line 391, in execute
   rec.execute(self)
 File "/app/env/lib/python3.4/site-packages/sqlalchemy/orm/unitofwork.py", line 556, in execute
   uow
 File "/app/env/lib/python3.4/site-packages/sqlalchemy/orm/persistence.py", line 181, in save_obj
   mapper, table, insert)
 File "/app/env/lib/python3.4/site-packages/sqlalchemy/orm/persistence.py", line 830, in _emit_insert_statements
   execute(statement, multiparams)
 File "/app/env/lib/python3.4/site-packages/sqlalchemy/engine/base.py", line 948, in execute
   return meth(self, multiparams, params)
 File "/app/env/lib/python3.4/site-packages/sqlalchemy/sql/elements.py", line 269, in _execute_on_connection
   return connection._execute_clauseelement(self, multiparams, params)
 File "/app/env/lib/python3.4/site-packages/sqlalchemy/engine/base.py", line 1060, in _execute_clauseelement
   compiled_sql, distilled_params
 File "/app/env/lib/python3.4/site-packages/sqlalchemy/engine/base.py", line 1132, in _execute_context
   None, None)
 File "/app/env/lib/python3.4/site-packages/sqlalchemy/engine/base.py", line 1413, in _handle_dbapi_exception
   exc_info
 File "/app/env/lib/python3.4/site-packages/sqlalchemy/util/compat.py", line 203, in raise_from_cause
   reraise(type(exception), exception, tb=exc_tb, cause=cause)
 File "/app/env/lib/python3.4/site-packages/sqlalchemy/util/compat.py", line 186, in reraise
   raise value.with_traceback(tb)
 File "/app/env/lib/python3.4/site-packages/sqlalchemy/engine/base.py", line 1127, in _execute_context
   context = constructor(dialect, self, conn, *args)
 File "/app/env/lib/python3.4/site-packages/sqlalchemy/engine/default.py", line 693, in _init_compiled
   for key in compiled_params
 File "/app/env/lib/python3.4/site-packages/sqlalchemy/engine/default.py", line 693, in <genexpr>
   for key in compiled_params
 File "/app/env/lib/python3.4/site-packages/sqlalchemy/sql/type_api.py", line 1160, in process
   return process_param(value, dialect)
 File "/app/plugins/uber/uber/models/types.py", line 192, in process_bind_param
   value, self.choices))
sqlalchemy.exc.StatementError: (builtins.ValueError) 0 not a valid option out of {} [SQL: 'INSERT INTO attendee (id, watchlist_id, group_id, promo_code_id, placeholder, first_name, last_name, legal_name, email, birthdate, age_group, international, zip_code, address1, address2, city, region, country, no_cellphone, ec_name, ec_phone, cellphone, requested_hotel_info, requested_accessibility_services, interests, found_how, comments, for_review, admin_notes, public_id, badge_num, badge_type, badge_status, ribbon, affiliate, shirt, num_event_shirts, can_spam, regdesk_info, extra_merch, got_merch, got_staff_merch, got_swadge, reg_station, confirmed, checked_in, paid, overridden_price, base_badge_price, amount_paid, amount_extra, extra_donation, payment_method, amount_refunded, badge_printed_name, staffing, agreed_to_volunteer_agreement, nonshift_hours, past_years, can_work_setup, can_work_teardown, hotel_eligible, hotel_pin, notification_pref, attractions_opt_out, print_pending, times_printed, comped_reason, fursuiting) VALUES (%(id)s, %(watchlist_id)s, %(group_id)s, %(promo_code_id)s, %(placeholder)s, %(first_name)s, %(last_name)s, %(legal_name)s, %(email)s, %(birthdate)s, %(age_group)s, %(international)s, %(zip_code)s, %(address1)s, %(address2)s, %(city)s, %(region)s, %(country)s, %(no_cellphone)s, %(ec_name)s, %(ec_phone)s, %(cellphone)s, %(requested_hotel_info)s, %(requested_accessibility_services)s, %(interests)s, %(found_how)s, %(comments)s, %(for_review)s, %(admin_notes)s, %(public_id)s, %(badge_num)s, %(badge_type)s, %(badge_status)s, %(ribbon)s, %(affiliate)s, %(shirt)s, %(num_event_shirts)s, %(can_spam)s, %(regdesk_info)s, %(extra_merch)s, %(got_merch)s, %(got_staff_merch)s, %(got_swadge)s, %(reg_station)s, %(confirmed)s, %(checked_in)s, %(paid)s, %(overridden_price)s, %(base_badge_price)s, %(amount_paid)s, %(amount_extra)s, %(extra_donation)s, %(payment_method)s, %(amount_refunded)s, %(badge_printed_name)s, %(staffing)s, %(agreed_to_volunteer_agreement)s, %(nonshift_hours)s, %(past_years)s, %(can_work_setup)s, %(can_work_teardown)s, %(hotel_eligible)s, %(hotel_pin)s, %(notification_pref)s, %(attractions_opt_out)s, %(print_pending)s, %(times_printed)s, %(comped_reason)s, %(fursuiting)s)'] [parameters: [{'ec_phone': '123-123-1234', 'staffing': False, 'requested_accessibility_services': False, 'got_swadge': False, 'public_id': '3e2502ef-0eb0-46fc-8ab8-781b95120d5f', 'international': False, 'base_badge_price': 60, 'country': 'United States', 'reg_station': None, 'extra_donation': 0, 'can_spam': False, 'attractions_opt_out': False, 'hotel_eligible': False, 'no_cellphone': False, 'amount_paid': 60, 'can_work_teardown': False, 'got_merch': False, 'birthdate': datetime.date(1982, 3, 9), 'found_how': '', 'last_name': 'Stewart', 'confirmed': None, 'got_staff_merch': False, 'ribbon': '', 'times_printed': 0, 'interests': '', 'paid': 254570300, 'amount_refunded': 0, 'city': 'Durham', 'nonshift_hours': 0, 'past_years': '', 'for_review': '', 'affiliate': '', 'hotel_pin': None, 'checked_in': None, 'address1': '414 Ganyard Farm Way', 'badge_num': 1142, 'print_pending': True, 'age_group': 259378497, 'requested_hotel_info': False, 'regdesk_info': '', 'badge_printed_name': 'Spirit Bear', 'extra_merch': '', 'first_name': 'Adam', 'legal_name': '', 'payment_method': None, 'placeholder': False, 'email': '[email protected]', 'address2': '', 'comped_reason': '', 'comments': '', 'id': 'a5bc780d-df90-427e-adcc-293a38f2e3c7', 'badge_type': 51352218, 'promo_code_id': None, 'region': 'North Carolina', 'can_work_setup': False, 'amount_extra': 0, 'watchlist_id': None, 'zip_code': '27703', 'ec_name': 'Test Person', 'group_id': None, 'shirt': 0, 'badge_status': 215389669, 'cellphone': '321-321-4321', 'num_event_shirts': 0, 'agreed_to_volunteer_agreement': False, 'notification_pref': 0, 'overridden_price': None, 'fursuiting': 102609242, 'admin_notes': ''}]]
@jmdawson
Copy link
Author

This occurs after filling out the form, clicking the button to go to the payment view, clicking on pay w/ card, filling out the stripe form, and clicking submit.

@kitsuta
Copy link
Collaborator

kitsuta commented Aug 10, 2019

Ack, right, this is related to magfest#3485 -- we need to add a new section under [integer_enums] called [[staff_event_shirts]], and an item under that section, because it currently can't have a default set but the database needs a value. It can say anything, but it should be equal to 0. E.g.,

[integer_enums]
# whatever other things we have set for integer enums
[[staff_event_shirts]]
"No event shirts" = 0

@jmdawson
Copy link
Author

[[staff_event_shirt]] but otherwise it's sorted now.

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

No branches or pull requests

2 participants