Commit Graph

103 Commits

Author SHA1 Message Date
imperosol
7ca1afe529 Make core.User inherit from AbstractUser instead of AbstractBaseUser 2024-11-20 17:24:56 +01:00
imperosol
c2efc969d0 refactor populate.py 2024-11-10 02:59:43 +01:00
thomas girod
d16a207a83
Add more Ruff rules (#891)
* ruff: apply rule F

* ruff: apply rule E

* ruff: apply rule SIM

* ruff: apply rule TCH

* ruff: apply rule ERA

* ruff: apply rule PLW

* ruff: apply rule FLY

* ruff: apply rule PERF

* ruff: apply rules FURB & RUF
2024-10-15 11:36:26 +02:00
thomas girod
0eaa20e09d fix localdate issues 2024-10-03 00:25:22 +02:00
thomas girod
dd07c374d7 convert uploaded images to webp 2024-09-01 19:05:54 +02:00
thomas girod
07b625d4aa Rewrite documentation with MkDocs 2024-07-21 00:56:58 +02:00
thomas girod
cfc19434d0 ruff rules UP008 and UP009 2024-07-08 15:37:09 +02:00
thomas girod
aa07fa9207 faster tests 2024-07-04 14:03:19 +02:00
thomas girod
3143d3d91a reorganize imports with ruff 2024-06-26 12:35:38 +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
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
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
8809753108
documentation fix tests because of missing README.md 2019-10-07 23:51:37 +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
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
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
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
Skia
83deae5964 Apply GPLv3 to Sith, and add header to every concerned file 2017-04-24 17:51:12 +02:00
Skia
254126fd79 Add last unread function 2017-02-06 20:20:39 +01:00
Skia
ff77df3646 Add basic right management to forum. Need to test it! 2017-01-21 04:51:37 +01:00
Skia
ea52462217 Add Forum 2017-01-21 03:42:06 +01:00
Skia
83555a3640 Add preferences and improve weekmail 2017-01-15 22:58:38 +01:00
Skia
9d1eaed625 Make some weekmail views 2017-01-15 22:58:37 +01:00
Skia
c6422fdd30 Add SYNTAX.md 2016-12-26 01:42:45 +01:00
Skia
1dd28672b0 Add Markdown test to populate 2016-12-26 01:36:07 +01:00
e17fd22a37 Fix populate after rebase 2016-12-25 20:24:18 +01:00