Commit Graph

16 Commits

Author SHA1 Message Date
eaec9cbf22 galaxy: tests: split Model and View for more efficient data usage 2023-05-10 12:16:09 +02:00
1f2bbff2d5 write more extensive documentation
- add documentation to previously documented classes and functions and refactor some of the documented one, in accordance to the PEP257 and ReStructuredText standards ;
- add some type hints ;
- use a NamedTuple for the `Galaxy.compute_users_score` method instead of a raw tuple. Also change a little bit the logic in the function which call the latter ;
- add some additional parameter checks on a few functions ;
- change a little bit the logic of the log level setting for the galaxy related commands.
2023-05-10 12:16:09 +02:00
6328b0c9e9 galaxy: use bulk_create whenever possible
This is a big performance gain, especially for the tests.

Examples:

----

`./manage.py test galaxy.tests.GalaxyTest.test_full_galaxy_state`

Measurements averaged over 3 run on *my machine*™:
Before: 2min15s
After: 1m41s

----

`./manage.py generate_galaxy_test_data --user-pack-count 1`

Before: 48s
After: 25s

----

`./manage.py rule_galaxy` (for 600 citizen, corresponding to 1 user-pack)

Before: 14m4s
After: 12m34s
2023-05-10 12:15:19 +02:00
bb365e4ee5 galaxy: better docstrings 2023-05-10 12:15:19 +02:00
90e34a8795 galaxy: template: make the galaxy graph work and be usable with a lot of stars
- Display focused star and its connections clearly
- Display star label faintly by default for other stars to avoid overloading the graph
- Hide non-focused lanes
- Avoid clicks on non-highlighted, too far stars
- Make the canva adapt its width to initial screen size, doesn't work dynamically
2023-05-10 12:15:19 +02:00
31093fff43 galaxy: big refactor
Main changes:
  - Multiple Galaxy objects can now exist at the same time in DB. This allows for ruling a new galaxy while still
    displaying the old one.
  - The criteria to quickly know whether a user is a possible citizen is now a simple query on picture count. This
    avoids a very complicated query to database, that could often result in huge working memory load. With this change,
    it should be possible to run the galaxy even on a vanilla Postgres that didn't receive fine tuning for the Sith's
    galaxy.
2023-05-10 12:15:19 +02:00
1aa3bb8cc4 galaxy: add 'generate_galaxy_test_data' command for development at scale 2023-05-10 12:15:19 +02:00
d3c2e5ab6f galaxy: optimize user self score computation 2023-05-10 12:15:19 +02:00
1d30f3d656 galaxy: add a full galaxy state test 2023-05-10 12:15:19 +02:00
827d001b1e galaxy: improve logging and performance reporting 2023-05-10 12:15:19 +02:00
96dede5077 Speed up tests (#638) 2023-05-02 11:00:23 +02:00
b5a40cfda9 Mise à jour de Black vers la version 23.3 (#629) 2023-04-22 15:32:31 +02:00
5ea181829e Edited unit tests
This test caused a breach in security due to the alert block displaying sensitive data.
2023-03-08 20:47:59 +01:00
05febc60bd Merge branch 'master' into taiste 2023-03-04 16:35:41 +01:00
b7f20fed6c Galaxy (#575)
Co-authored-by: Skia <florent.jacquet@eshard.com>
2023-03-02 15:11:23 +01:00
585923c827 Add galaxy (#562)
* style.scss: lint

* style.scss: add 'th' padding

* core: populate: add much more data for development

* Add galaxy
2023-02-07 12:08:25 +01:00