Commit graph

5 commits

Author SHA1 Message Date
Kevin Morris
a29701459c
feat: add Decision column to TUVote
In preparation for allowing TUs to change their votes on proposals,
we need a way to track what users vote for.

Without this, the vote decisions are stored within the related
TU_VoteInfo record, decoupled from the user who made the vote.

That being the case meant we cannot actually change a vote, because
we can't figure out what TU_VoteInfo decision columns to decrement
when the vote has changed.

You may be wondering why we aren't removing the decision columns out
of TU_VoteInfo with the advent of this new column. The reason being:
previous votes are all calculated off of the TU_VoteInfo columns, so
without a manual DB rework, relocating them to the user-related vote
records would break outcomes of old proposals. So, the plan is:
we'll solely use this column for votes from this point on to track
what decision a user made internally, which will open up TUs changing
their decision.

In addition, this migration resets all running proposals:
- all votes are deleted
- time is reset to Start when migration is run

This was necessary to put running proposals into a state that can
take advantage of the new revote system.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2022-03-07 22:35:52 -08:00
Kevin Morris
7f6c23d4cb
housekeep: centralize datetime generation
Signed-off-by: Kevin Morris <kevr@0cost.org>
2022-01-18 07:31:04 -08:00
Kevin Morris
012dd24fd8
housekeep(fastapi): rewrite test_tu_vote with fixtures
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-12-01 00:28:39 -08:00
Kevin Morris
fa43f6bc3e
change(aurweb): add parallel tests and improve aurweb.db
This change utilizes pytest-xdist to perform a multiproc test
run and reworks aurweb.db's code. We no longer use a global
engine, session or Session, but we now use a memo of engines
and sessions as they are requested, based on the PYTEST_CURRENT_TEST
environment variable, which is available during testing.

Additionally, this change strips several SQLite components
out of the Python code-base.

SQLite is still compatible with PHP and sharness tests, but
not with our FastAPI implementation.

More changes:
------------
- Remove use of aurweb.db.session global in other code.
- Use new aurweb.db.name() dynamic db name function in env.py.
- Added 'addopts' to pytest.ini which utilizes multiprocessing.
    - Highly recommended to leave this be or modify `-n auto` to
      `-n {cpu_threads}` where cpu_threads is at least 2.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-17 01:34:59 -08:00
Kevin Morris
0c1241f8bb add TUVote SQLAlchemy ORM model
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-06-11 22:14:38 -07:00