Code Monkey home page Code Monkey logo

Comments (1)

MorganLove avatar MorganLove commented on May 22, 2024

This also happens with a unique constraint on audit board ids, which is easier to fix on the front end by using uuidv4() instead of audit-board-${i + 1}.

But on the sample size endpoint we are also getting a failure due to a unique constraint on batch.id, which isn't getting passed from the front end:

 ERROR in app: Exception on /election/ebc3166e-a645-44c9-bbbf-4557b08e840a/audit/sample-size [POST]
Traceback (most recent call last):
  File "/Users/morgan/.local/share/virtualenvs/arlo-cgZpGxiy/lib/python3.7/site-packages/flask/app.py", line 2311, in wsgi_app
    response = self.full_dispatch_request()
  File "/Users/morgan/.local/share/virtualenvs/arlo-cgZpGxiy/lib/python3.7/site-packages/flask/app.py", line 1834, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/Users/morgan/.local/share/virtualenvs/arlo-cgZpGxiy/lib/python3.7/site-packages/flask/app.py", line 1737, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/Users/morgan/.local/share/virtualenvs/arlo-cgZpGxiy/lib/python3.7/site-packages/flask/_compat.py", line 36, in reraise
    raise value
  File "/Users/morgan/.local/share/virtualenvs/arlo-cgZpGxiy/lib/python3.7/site-packages/flask/app.py", line 1832, in full_dispatch_request
    rv = self.dispatch_request()
  File "/Users/morgan/.local/share/virtualenvs/arlo-cgZpGxiy/lib/python3.7/site-packages/flask/app.py", line 1818, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/Users/morgan/Desktop/votingworks/arlo/app.py", line 312, in samplesize_set
    election = get_election(election_id)
  File "/Users/morgan/Desktop/votingworks/arlo/app.py", line 44, in get_election
    return Election.query.filter_by(id = (election_id or '1')).one()
  File "/Users/morgan/.local/share/virtualenvs/arlo-cgZpGxiy/lib/python3.7/site-packages/sqlalchemy/orm/query.py", line 3282, in one
    ret = self.one_or_none()
  File "/Users/morgan/.local/share/virtualenvs/arlo-cgZpGxiy/lib/python3.7/site-packages/sqlalchemy/orm/query.py", line 3251, in one_or_none
    ret = list(self)
  File "/Users/morgan/.local/share/virtualenvs/arlo-cgZpGxiy/lib/python3.7/site-packages/sqlalchemy/orm/query.py", line 3324, in __iter__
    return self._execute_and_instances(context)
  File "/Users/morgan/.local/share/virtualenvs/arlo-cgZpGxiy/lib/python3.7/site-packages/sqlalchemy/orm/query.py", line 3346, in _execute_and_instances
    querycontext, self._connection_from_session, close_with_result=True
  File "/Users/morgan/.local/share/virtualenvs/arlo-cgZpGxiy/lib/python3.7/site-packages/sqlalchemy/orm/query.py", line 3361, in _get_bind_args
    mapper=self._bind_mapper(), clause=querycontext.statement, **kw
  File "/Users/morgan/.local/share/virtualenvs/arlo-cgZpGxiy/lib/python3.7/site-packages/sqlalchemy/orm/query.py", line 3339, in _connection_from_session
    conn = self.session.connection(**kw)
  File "/Users/morgan/.local/share/virtualenvs/arlo-cgZpGxiy/lib/python3.7/site-packages/sqlalchemy/orm/session.py", line 1124, in connection
    execution_options=execution_options,
  File "/Users/morgan/.local/share/virtualenvs/arlo-cgZpGxiy/lib/python3.7/site-packages/sqlalchemy/orm/session.py", line 1130, in _connection_for_bind
    engine, execution_options
  File "/Users/morgan/.local/share/virtualenvs/arlo-cgZpGxiy/lib/python3.7/site-packages/sqlalchemy/orm/session.py", line 408, in _connection_for_bind
    self._assert_active()
  File "/Users/morgan/.local/share/virtualenvs/arlo-cgZpGxiy/lib/python3.7/site-packages/sqlalchemy/orm/session.py", line 295, in _assert_active
    code="7s2a",
sqlalchemy.exc.InvalidRequestError: This Session's transaction has been rolled back due to a previous exception during flush. To begin a new transaction with this Session, first issue Session.rollback(). Original exception was: (sqlite3.IntegrityError) UNIQUE constraint failed: batch.id
[SQL: INSERT INTO batch (id, jurisdiction_id, name, num_ballots, storage_location, tabulator) VALUES (?, ?, ?, ?, ?, ?)]
[parameters: (('1', 'be63d6ff-3333-4557-8578-9666ab27b413', '1', 117, None, None), ('2', 'be63d6ff-3333-4557-8578-9666ab27b413', '2', 269, None, None), ('3', 'be63d6ff-3333-4557-8578-9666ab27b413', '3', 178, None, None), ('4', 'be63d6ff-3333-4557-8578-9666ab27b413', '4', 213, None, None), ('5', 'be63d6ff-3333-4557-8578-9666ab27b413', '5', 234, None, None), ('6', 'be63d6ff-3333-4557-8578-9666ab27b413', '6', 253, None, None), ('7', 'be63d6ff-3333-4557-8578-9666ab27b413', '7', 120, None, None), ('8', 'be63d6ff-3333-4557-8578-9666ab27b413', '8', 244, None, None), ('9', 'be63d6ff-3333-4557-8578-9666ab27b413', '9', 355, None, None), ('10', 'be63d6ff-3333-4557-8578-9666ab27b413', '10', 134, None, None))]
(Background on this error at: http://sqlalche.me/e/gkpj) (Background on this error at: http://sqlalche.me/e/7s2a)
127.0.0.1 - - [30/Aug/2019 14:14:14] "POST /election/ebc3166e-a645-44c9-bbbf-4557b08e840a/audit/sample-size HTTP/1.1" 500

I can't test further endpoints to see if they have similar issues until at least that one is fixed.

from arlo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.