Commit Graph

124 Commits

Author SHA1 Message Date
thomas girod
3143d3d91a reorganize imports with ruff 2024-06-26 12:35:38 +02:00
Sli
ca27b89a8b Apply shellcheck on install_xapian.sh 2024-06-26 11:31:39 +02:00
Sli
5416d88c97 Upgrade dependencies and install xapian from sources 2024-06-24 13:26:58 +02:00
Skia
87295ad9b7
Galaxy improvements (#628)
* galaxy: improve logging and performance reporting

* galaxy: add a full galaxy state test

* galaxy: optimize user self score computation

* galaxy: add 'generate_galaxy_test_data' command for development at scale

* 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.

* 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

* galaxy: better docstrings

* 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

* core: populate: use a less ambiguous 'timezone.now()'

When running the tests around midnight, the day is changing, leading to some values being offset to the next day
depending on the timezone, and making some tests to fail. This ensure to use a less ambiguous `now` when populating
the database.

* 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.

* galaxy: tests: split Model and View for more efficient data usage

---------

Co-authored-by: maréchal <thgirod@hotmail.com>
2023-05-10 12:47:02 +02:00
thomas girod
ef968f3673
Better usage of cache for groups and clubs related operations (#634)
* Better usage of cache for group retrieval

* Cache clearing on object deletion or update

* replace signals by save and delete override

* add is_anonymous check in is_owned_by

Add in many is_owned_by(self, user) methods that user is not anonymous. Since many of those functions do db queries, this should reduce a little bit the load of the db.

* Stricter usage of User.is_in_group

Constrain the parameters that can be passed to the function to make sure only a str or an int can be used. Also force to explicitly specify if the group id or the group name is used.

* write test and correct bugs

* remove forgotten populate commands

* Correct test
2023-05-02 12:36:59 +02:00
thomas girod
96dede5077
Speed up tests (#638) 2023-05-02 11:00:23 +02:00
thomas girod
b5a40cfda9
Mise à jour de Black vers la version 23.3 (#629) 2023-04-22 15:32:31 +02:00
Julien Constant
8e7c025e47
[FIX] Broken link in readme and license fix (& update) (#591) 2023-04-04 18:39:45 +02:00
Skia
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
Thomas Girod
fe9e5ce861 integration of 3D secure v2 for eboutic bank payment 2022-11-30 22:52:56 +01:00
Thomas Girod
8b09ba2924 refonte de la boutique en ligne 2022-10-30 12:33:21 +01:00
lsacienne
ba6599fa56
Add of tests 2022-05-05 23:24:08 +02:00
tleb
be26e3df7f core: add ./manage.py check_front command and call it on runserver 2021-09-27 22:00:36 +02:00
f34f5fe693
Upgrade black and format accordingly 2020-08-27 15:59:42 +02:00
1256744f1b
documentation: add autoreload and build for documentation server 2019-11-20 17:03:18 +01:00
99c8d95443
django2.2: remove direct assignments to many-to-many fields 2019-10-08 22:46:37 +02:00
2a9b89fd2a
core: remove README wiki page that wasn't helpful and anyway broken with rst files 2019-10-08 11:12:22 +02:00
5c3c14ab37
core: wrap compilemessages to avoid compiling whole env and avoid crash at sphinx messages compilation 2019-10-08 00:59:00 +02:00
8809753108
documentation fix tests because of missing README.md 2019-10-07 23:51:37 +02:00
05e5008305
documentation: base structure for new documentation 2019-10-07 23:51:35 +02:00
358a625cc4
pedagogy: simplify and implement department system according to old database model 2019-06-18 10:56:05 +02:00
38f6c27983
pedagogy: tests for uv creation 2019-06-16 12:19:04 +02:00
ec33311715
pedagogy: basic display list of UV 2019-06-15 23:31:31 +02:00
5bf5d0277c
pedagogy: create view and form for UV
WARNING: A new group has been created, to be set by the infra team at deployment !!!
2019-06-15 17:01:25 +02:00
5ae7d10e84
Add unit tests for student cards and fix edge cases 2019-05-20 17:56:09 +02:00
654099067e
clubs: tests for adding mailings 2019-05-09 20:32:26 +02:00
72a4bde6a2 user: fix populate for dev and use native django function to fetch payment_method 2018-10-16 14:52:47 +02:00
cb58b00b6e
All: Apply Black coding rules 2018-10-05 21:52:55 +02:00
08de5dfe6a
Migration to django 1.11 2018-06-10 16:31:58 +02:00
Skia
0d3c34c155 core/models: refactor SithFile moving and add methods to manage filesystem
Signed-off-by: Skia <skia@libskia.so>
2018-04-16 18:35:00 +02:00
Skia
9b0b381fa3 core: make populate command more predictable (should fix the random failing test)
Signed-off-by: Skia <skia@libskia.so>
2017-10-14 13:51:50 +02:00
baa7be69e4
Better integration of wiki pages on clubs 2017-10-06 11:09:31 +02:00
939146bddd
Sync pages with club unix_name 2017-10-06 11:09:29 +02:00
fe69cbcee1
Add page for clubs and inactive clubs 2017-10-06 11:09:29 +02:00
Skia
cda89d66cd com: improve news page
Signed-off-by: Skia <skia@libskia.so>
2017-09-26 12:13:23 +02:00
Skia
4edb9a78c6 com: add agenda on news page
Signed-off-by: Skia <skia@libskia.so>
2017-09-01 12:22:38 +02:00
Skia
0d5595c683 core: add test for Markdown syntax
Signed-off-by: Skia <skia@libskia.so>
2017-08-24 16:30:46 +02:00
748e3ae326 Refactor and migration corrections 2017-08-15 13:57:49 +02:00
d60e14a303 Migration from old database 2017-08-15 13:57:49 +02:00
40927fa13d Add limit for ecocup recording 2017-08-15 13:57:49 +02:00
e7de8b2aec Format core 2017-06-13 10:04:13 +02:00
0af72500c6 Add some tests on counter 2017-06-07 18:36:26 +02:00
Skia
63acf588ca Add basic unfinished counter test 2017-06-07 18:36:26 +02:00
e59d769dac Doc for scss 2017-05-10 11:13:49 +02:00
d083a67725 Change year of license on some files 2017-05-10 10:49:34 +02:00
acef5be8b3 New lite home made scss processor 2017-05-10 10:49:34 +02:00
630fdf93a4 Refactoring for compilestatic 2017-05-10 10:49:34 +02:00
79c769351d Add simple way to compile scss files 2017-05-10 10:49:34 +02:00
Skia
a12b772587 Add some Eboutic tests 2017-05-01 19:39:28 +02:00
b5363c2987 Firsts tests for elections 2017-04-25 15:30:57 +02:00