Skip to content

Switch to new sortition-algorithms library#27

Open
foobacca wants to merge 26 commits intomainfrom
sort-alg
Open

Switch to new sortition-algorithms library#27
foobacca wants to merge 26 commits intomainfrom
sort-alg

Conversation

@foobacca
Copy link
Contributor

Switch to the refactored code in https://github.com/sortitionfoundation/sortition-algorithms

This also changes the UI a little, to fully separate out the CSV and GSheet UI elements. And the code is separate too - we now have separate classes for CSV and GSheet usage. There are lots of differences, so living with bits of duplication seems better than trying to munge them into one.

foobacca added 26 commits June 17, 2025 15:20
And change to use two tabs in the UI - one for CSV and one for Google
Sheets.

Note this commit has the CSV side working but not Google Sheets, and
still contains quite a bit of old broken code in script.py
and it is now the default tab you see.

Also

- added gui_log Singleton to make it easier to put messages in gui
- made names more consistent in HTML, JS and Python
- cleaned up all the old code in this commit.
As suggested by a deprecation warning and in this github issue:

pyinstaller/pyinstaller#3820
as python-mip 1.15 does not support ARM. Added comment to allow us to
reconsider once 1.16 is formally released.
Previously there was a bug in sortition-algorithms that meant changing
the `g_sheet_name` in the GSheetAdapter did not actually reset the
spreadsheet. This commit fixes it.

- bring in fixed version of sortition-algorithms library
- call the new method `set_g_sheet_name()`
With a few API changes

- gen_rem_tab is now `bool`, instead of the strings "on" or "off"
- we get a `RunReport` object back from a few calls and then use the
  method `report.as_html()` to get the HTML version of the report
And adapt to XYZDataSource pattern
Always store as a string, but with panel_size_num as a property for when
we need that.  Put all the handling of odd values in _set_panel_size() -
negative values and non-integer values will be resolved here. And then
use that everywhere.
And also actually tell the user when the writing to the spreadsheet has finished.
during selection and writing the selected and remaining people.

So that the app doesn't just appear to freeze.
- more errors caught by upgraded library
- use better library reports to show user what spreadsheet tabs were
  written to this run.
Previously, if you'd changed the spreadsheet, but not the settings in
the app, then the run button would stay enabled.
By actually stopping processing and ensuring we have some reasonable
messages after the error report from the library.
Rather than having two messages appear about asking for data as soon as
we start, we instead just show one message, and show the people tab
message when we get there. Also have the messages show what data we're
asking for and which tab is being read to fetch the data.
and other packages while I'm at it
and update the calls to be compatible.

Also update a few other packages
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant