MidwestFurryFandom / rams

RAMS Core - the core Registration and Management code
GNU Affero General Public License v3.0
2 stars 2 forks source link

One Day Badge numbering nonfunctional #179

Closed jmdawson closed 6 years ago

jmdawson commented 6 years ago

By default, whether I select One Day or a specific day when adding a one-day badge in the admin interface, the badge number is filled in as None.

This seems to then be retained when attempting to save the badge, causing a 500: `Traceback (most recent call last): File "/app/env/lib/python3.4/site-packages/sqlalchemy/engine/base.py", line 1182, in _execute_context context) File "/app/env/lib/python3.4/site-packages/sqlalchemy/engine/default.py", line 470, in do_execute cursor.execute(statement, parameters) psycopg2.DataError: invalid input syntax for integer: "None" LINE 4: ...ee.badge_type = 84680830 AND attendee.badge_num = 'None') AS... ^

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

Traceback (most recent call last): File "/app/env/lib/python3.4/site-packages/cherrypy/_cprequest.py", line 670, in respond response.body = self.handler() File "/app/env/lib/python3.4/site-packages/cherrypy/lib/encoding.py", line 220, in call self.body = self.oldhandler(*args, kwargs) File "/app/env/lib/python3.4/site-packages/cherrypy/_cpdispatch.py", line 60, in call return self.callable(*self.args, *self.kwargs) File "/app/plugins/uber/uber/decorators.py", line 238, in with_timing return func(args, kwargs) File "/app/plugins/uber/uber/decorators.py", line 229, in with_caching return func(*args, kwargs) File "/app/plugins/uber/uber/decorators.py", line 253, in with_session retval = func(*args, session=session, *kwargs) File "/app/plugins/uber/uber/decorators.py", line 387, in with_restrictions return func(args, kwargs) File "/app/plugins/uber/uber/decorators.py", line 349, in with_rendering result = func(*args, *kwargs) File "/app/plugins/uber/uber/decorators.py", line 29, in with_check return func(args, *kwargs) File "/app/plugins/uber/uber/site_sections/registration.py", line 97, in form message = check(attendee) File "/app/plugins/uber/uber/utils.py", line 122, in check message = validator(model) File "/app/plugins/uber/uber/model_checks.py", line 319, in dupe_badge_num if existing.count(): File "/app/env/lib/python3.4/site-packages/sqlalchemy/orm/query.py", line 3089, in count return self.from_self(col).scalar() File "/app/env/lib/python3.4/site-packages/sqlalchemy/orm/query.py", line 2843, in scalar ret = self.one() File "/app/env/lib/python3.4/site-packages/sqlalchemy/orm/query.py", line 2814, in one ret = self.one_or_none() File "/app/env/lib/python3.4/site-packages/sqlalchemy/orm/query.py", line 2784, in one_or_none ret = list(self) File "/app/env/lib/python3.4/site-packages/sqlalchemy/orm/query.py", line 2855, in iter return self._execute_and_instances(context) File "/app/env/lib/python3.4/site-packages/sqlalchemy/orm/query.py", line 2878, in _execute_and_instances result = conn.execute(querycontext.statement, self._params) File "/app/env/lib/python3.4/site-packages/sqlalchemy/engine/base.py", line 945, in execute return meth(self, multiparams, params) File "/app/env/lib/python3.4/site-packages/sqlalchemy/sql/elements.py", line 263, in _execute_on_connection return connection._execute_clauseelement(self, multiparams, params) File "/app/env/lib/python3.4/site-packages/sqlalchemy/engine/base.py", line 1053, in _execute_clauseelement compiled_sql, distilled_params File "/app/env/lib/python3.4/site-packages/sqlalchemy/engine/base.py", line 1189, in _execute_context context) File "/app/env/lib/python3.4/site-packages/sqlalchemy/engine/base.py", line 1402, 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 1182, in _execute_context context) File "/app/env/lib/python3.4/site-packages/sqlalchemy/engine/default.py", line 470, in do_execute cursor.execute(statement, parameters) sqlalchemy.exc.DataError: (psycopg2.DataError) invalid input syntax for integer: "None" LINE 4: ...ee.badge_type = 84680830 AND attendee.badge_num = 'None') AS... ^ [SQL: 'SELECT count() AS count_1 \nFROM (SELECT attendee.id AS attendee_id, attendee.watchlist_id AS attendee_watchlist_id, attendee.group_id AS attendee_group_id, attendee.placeholder AS attendee_placeholder, attendee.first_name AS attendee_first_name, attendee.last_name AS attendee_last_name, attendee.legal_name AS attendee_legal_name, attendee.email AS attendee_email, attendee.birthdate AS attendee_birthdate, attendee.age_group AS attendee_age_group, attendee.international AS attendee_international, attendee.zip_code AS attendee_zip_code, attendee.address1 AS attendee_address1, attendee.address2 AS attendee_address2, attendee.city AS attendee_city, attendee.region AS attendee_region, attendee.country AS attendee_country, attendee.no_cellphone AS attendee_no_cellphone, attendee.ec_name AS attendee_ec_name, attendee.ec_phone AS attendee_ec_phone, attendee.cellphone AS attendee_cellphone, attendee.interests AS attendee_interests, attendee.found_how AS attendee_found_how, attendee.comments AS attendee_comments, attendee.for_review AS attendee_for_review, attendee.admin_notes AS attendee_admin_notes, attendee.public_id AS attendee_public_id, attendee.badge_num AS attendee_badge_num, attendee.badge_type AS attendee_badge_type, attendee.badge_status AS attendee_badge_status, attendee.ribbon AS attendee_ribbon, attendee.affiliate AS attendee_affiliate, attendee.shirt AS attendee_shirt, attendee.can_spam AS attendee_can_spam, attendee.regdesk_info AS attendee_regdesk_info, attendee.extra_merch AS attendee_extra_merch, attendee.got_merch AS attendee_got_merch, attendee.reg_station AS attendee_reg_station, attendee.registered AS attendee_registered, attendee.checked_in AS attendee_checked_in, attendee.paid AS attendee_paid, attendee.overridden_price AS attendee_overridden_price, attendee.amount_paid AS attendee_amount_paid, attendee.amount_extra AS attendee_amount_extra, attendee.payment_method AS attendee_payment_method, attendee.amount_refunded AS attendee_amount_refunded, attendee.badge_printed_name AS attendee_badge_printed_name, attendee.staffing AS attendee_staffing, attendee.requested_depts AS attendee_requested_depts, attendee.assigned_depts AS attendee_assigned_depts, attendee.trusted_depts AS attendee_trusted_depts, attendee.nonshift_hours AS attendee_nonshift_hours, attendee.past_years AS attendee_past_years, attendee.can_work_setup AS attendee_can_work_setup, attendee.can_work_teardown AS attendee_can_work_teardown, attendee.print_pending AS attendee_print_pending, attendee.times_printed AS attendee_times_printed, attendee.comped_reason AS attendee_comped_reason \nFROM attendee \nWHERE attendee.badge_type = %(badge_type_1)s AND attendee.badge_num = %(badge_num_1)s) AS anon_1'] [parameters: {'badge_type_1': 84680830, 'badge_num_1': 'None'}]

`

kitsuta commented 6 years ago

Wow, it's literally trying to put in the string None. Working on this now.

kitsuta commented 6 years ago

I can't reproduce this 500 error. Adding an attendee via the admin interface works just fine. That being said, they don't actually have a badge number, so that's still a bug.

kitsuta commented 6 years ago

https://github.com/MidwestFurryFandom/rams/commit/03c64650c406dca818b911b06e94e9dc820733cd allows you to fix the problem with numbering. You just have to add ,'one_day_badge' to the list of preassigned_badge_types in config.

kitsuta commented 6 years ago

Here's your problem: image

When in at-con mode, for new attendees, the word "None" is literally printed into the badge numbering box. The system is trying to use this as the badge number, and failing at the DB level because we apparently don't have a non-number validation for badge numbers.

We'll definitely want to make it stop printing "None" in the textbox just because it's a null value (this is a quirk of Jinja2 that wasn't present in Django's templating engine), and in general we want to figure out how we want to handle the at-con interface for badge numbers, which is MAG-specific.

jmdawson commented 6 years ago

When you say MAG-Specific, do you mean, "We need to figure out what MFF wants the interface to be for assigning at-con badge numbers?"

kitsuta commented 6 years ago

Yeah. At MAG, we usually just use the 'omit badge number' box or pick up a badge and type its number into the input box. MFF's workflow is the inverse of that, so we'll want to figure out a better interface for them.

jmdawson commented 6 years ago

Per discussion with @ianlayton, a good system will be as follows:

  1. Leave the field blank
  2. Auto-populate the number on save

Obviously this requires not filling out the field w/ None in it (or making None roughly equivalent to 'fill this out w/ the next available number on save').