Commit graph

1309 commits

Author SHA1 Message Date
Aurélien Delobelle
afdb08b424 Fewer db requests with AccountNegative handling.
- AccountNegative use new AccountNegativeManager which select_related
  account, cofprofile and user for instances accessed via
  AccountNegative.objects.
- Compute sum of negatives with python instead of an SQL statement
  (since we already got the data with a previous query).
- Fix bug on account property `real_balance` (happened if
  an account has a relative AccountNegative instance but balance_offset
  to NULL).

- More compliant to PEP8
2017-04-06 19:07:13 +02:00
Aurélien Delobelle
f8b71b604c Fewer db accesses on transfers list view.
- Add select_related for `from_acc`, `to_acc` and `group.valid_by`.
- 2 requests instead of (3 * #transfers)
2017-04-06 18:42:00 +02:00
Aurélien Delobelle
709d421b2c Add custom Manager for Account model.
- When Account model is queried with Account.objects, it always add
  .select_related('cofprofile_user', 'negative').
- Eg benefits: history doesn't do anymore one request by account to
  fill the account filter.

Important

Using this workaround (systemically append select_related) can be
dangerous normally, however a certain number of properties in
cofprofile and user are frequently used (as firstname or lastname), and
the benefits seems greater.
2017-04-06 18:23:27 +02:00
Aurélien Delobelle
33cee05884 initial checkout selected
Result is the same result but:
- auto-select go to javascript
- 1 less request for KPsulCheckoutForm

- delete debug messages
- some PEP8
2017-04-06 16:45:44 +02:00
Aurélien Delobelle
56fa70e495 fewer calls on account_read view 2017-04-06 14:38:25 +02:00
Aurélien Delobelle
c9019c4eb4 Get debug toolbar with ajax calls
- Add django-debug-panel module to pip development dependencies
- Enable debug toolbar on ajax calls by using the "Django Debug Panel"
  extension for... Chrome.

For further informations about:
- django module, see https://github.com/recamshak/django-debug-panel
- Chrome extension, see https://github.com/recamshak/chrome-django-panel
2017-04-06 14:36:25 +02:00
Aurélien Delobelle
1302adf156 globally fewer db requests 2017-04-06 14:15:03 +02:00
Aurélien Delobelle
f57bab8ae9 createopes use only bulk_create
createopes script:
- more than 6x faster
- only bulk_create is used instead of create or save
- correctly create editions (~5% of created operations)
- ratio of withdrawals go from ~10% to ~5%
2017-04-06 13:33:40 +02:00
Ludovic Stephan
5e68fcf315 Merge branch 'aureplop/hotfix' into 'master'
Aureplop/hotfix

See merge request !214
2017-04-06 00:32:29 +02:00
Aurélien Delobelle
4b2e20e728 created_at required with default 2017-04-06 00:31:04 +02:00
Aurélien Delobelle
e2d7192b23 fix perform opes after account reset 2017-04-06 00:11:41 +02:00
Aurélien Delobelle
c849306a32 fix kfet home template 2017-04-06 00:00:53 +02:00
Aurélien Delobelle
ebf948d042 Merge branch 'qwann/k-fet/category_addcost' into 'master'
K-Fêt - Majorations
- Seulement les catégories préalablement sélectionnées sont majorées le 
le cas échéant.
- Pour modifier cette sélection, suivre le lien "Catégories" depuis la
liste des articles.

Fixes #149

See merge request !189
2017-04-05 15:52:15 +02:00
Aurélien Delobelle
3ee9de93d9 few improvements on article category
- add verbose names to ArticleCategory fields
- add button to view categories list from articles list
- fix article_update template in form validation
- improve interface for articlecategory_update
- revert vanished urls (happened in merge with master...)
2017-04-05 15:34:28 +02:00
Aurélien Delobelle
42728e58be Merge branch 'master' into qwann/k-fet/category_addcost 2017-04-05 14:57:26 +02:00
Martin Pepin
fe66a6ef6b Merge branch 'aureplop/fix_stats' into 'master'
Stats K-Fêt - Python side

See merge request !208
2017-04-05 00:41:47 +02:00
Martin Pépin
85ba44c231 Tests the redirection using the appropriate method 2017-04-04 23:31:24 +01:00
Qwann
7350006990 PEP8 2017-04-04 21:48:17 +02:00
Qwann
ba11aa49db categories are updatable 2017-04-04 21:36:02 +02:00
Aurélien Delobelle
dc07b072ab Flatten scale args in GET params of stats urls
- get_scale_args method of ScaleMixin retrieves useful GET params for
  Scale object instanciation (by default from request.GET)
- it takes into account the type of the scale arg
- prefix used for GET param can be modified in stats_manifest funcs and
  ScaleMixin
2017-04-04 20:12:21 +02:00
Aurélien Delobelle
885e40fd05 cleaner scales
- References to `Stat` in `Scale` objects are deleted (because scales
  are independent of stats)
- KFET_WAKES_UP_AT is now a time object insted of an hour
- Proper use of date, datetime, timedelta, etc (django.utils.timezone
  provides neither datetime nor timedelta)
2017-04-04 18:11:15 +02:00
Qwann
72615bf400 small fixes 2017-04-04 16:57:17 +02:00
Aurélien Delobelle
278459e80f typo....... 2017-04-04 11:05:49 +02:00
Aurélien Delobelle
0405eee7a7 Merge branch 'Aufinal/inventaires' into 'master'
K-Fêt - Création d'inventaires
- Amélioration de l'interface
- Ajout de colonnes intermédiaires pour faciliter le calcul
- Ajout d'indication de conflits possibles avec les opérations en cours
- Résolution semi-automatique de ces conflits

Closes #141

See merge request !200
2017-04-04 10:59:09 +02:00
Martin Pépin
b383923d49 Merge branch 'Kerl/test_stats' into aureplop/fix_stats 2017-04-04 09:39:26 +01:00
Aurélien Delobelle
7989a07b5f cleaner fix 2017-04-04 01:36:19 +02:00
Aurélien Delobelle
df467767f4 fix default GET param 'types' on operations stats 2017-04-04 01:29:19 +02:00
Martin Pépin
f13d1072c7 Add simple tests for the stat views
We check that we can get all the stats views with the appropriate
permissions.
2017-04-03 23:21:42 +01:00
Ludovic Stephan
51acb4e00a Use new WS class 2017-04-03 16:05:18 -03:00
Ludovic Stephan
32474a6865 Don't update input when unchecking 2017-04-03 16:03:22 -03:00
Ludovic Stephan
f46ba0dd6c Merge branch 'master' into Aufinal/inventaires 2017-04-03 16:01:51 -03:00
Aurélien Delobelle
b3418db33d Merge branch 'Aufinal/edit_migration' into 'master'
Migrations oubliées

See merge request !209
2017-04-03 20:58:00 +02:00
Ludovic Stephan
5607d7c9a4 Migration pour kfet_forms 2017-04-03 15:54:02 -03:00
Ludovic Stephan
ad2c8537e3 Add Runpython (oops) 2017-04-03 15:50:18 -03:00
Aurélien Delobelle
10d2b58fa7 clean some comments
- fix: error if actions are empty in balance stats
2017-04-03 17:06:32 +02:00
Aurélien Delobelle
6d2e150aa0 clean align 2017-04-03 16:56:44 +02:00
Aurélien Delobelle
903da795ab clean kfet statistic.js
- no longer dictToArray where it isn't necessary (because already an
  array)
- fix chart height:
  - previous charts were causing bugs
  - height is fixed (even with window resizing)
- clean whitespaces
2017-04-03 16:53:28 +02:00
Ludovic Stephan
40da3bc299 Listen on input 2017-04-03 11:21:05 -03:00
Ludovic Stephan
b113a57b74 Fix update function 2017-04-03 11:20:56 -03:00
Aurélien Delobelle
87bc90ec8b Begin/end balance stat graph
- Anytime begin at account creation datetime
- Others doesn't take care of account creation
- Add check to avoid to bug on actions list length
2017-04-03 16:07:31 +02:00
Aurélien Delobelle
769c37634d delete debug msg 2017-04-03 15:43:56 +02:00
Aurélien Delobelle
1bb83ccdd7 simplify StatScale 2017-04-03 15:10:53 +02:00
Aurélien Delobelle
7dc233c0e2 Merge branch 'Aufinal/editions' into 'master'
K-Fêt
- Fix: Les éditions ne touchent plus la caisse
- Fix: Seuls les achats sont possibles sur LIQ

See merge request !198
2017-04-03 14:39:53 +02:00
Aurélien Delobelle
b157ffac4c Merge branch 'Aufinal/kfet_forms' into 'master'
K-Fêt
- Affichage des formulaires amélioré

See merge request !203
2017-04-03 13:40:41 +02:00
Aurélien Delobelle
b3a9ad8a96 clean mixin 2017-04-03 13:24:04 +02:00
Aurélien Delobelle
d97a7be819 stats: fix begin of balances graphs
- graph begin at first operation or later
2017-04-03 03:15:07 +02:00
Aurélien Delobelle
c01de558e1 Clean Article stats
kfet.statistic
- delete no longer used defs
- new mixin - ScaleMixin
  - get scale args from GET params
  - chunkify querysets according to a scale

Article stats
- use SingleResumeStat for manifest
- use ScaleMixin for sales
- update urls
- update permission required: teamkfet

Account stats
- update permission required: teamkfet
- operations use ScaleMixin
- fix manifests urls
2017-04-03 03:12:52 +02:00
Aurélien Delobelle
f585247224 Refactor Account Operations stats
K-Fêt - Statistics

New base class - StatScale
- create scale, given chunk size (timedelta), start and end times
- get labels of
- get start and end datetimes of chunks

DayStatScale: Scale whose chunks interval is 1 day
WeekStatScale: same with 1 week
MonthStatScale: same with 1 month

AccountStatOperationList: manifest of operations stats of an account
- renamed from AccountStatLastAll
- updated according to SingleResumeStat

AccountStatOperation:
- renamed from AccountStatLast
- remove scale logic with use of StatScale objects
- used scale is given by `scale` and `scale_args` GET params
- add filter on operations types with `types` GET param

AccountStatLast(Day,Week,Month) are deleted ("merged" in
AccountStatOperation)
2017-04-03 00:40:52 +02:00
Aurélien Delobelle
31261fd376 set height canvas graph & fix graph display 2017-04-02 23:38:42 +02:00
Aurélien Delobelle
6ebea6557c Merge branch 'Aufinal/graph_size' into aureplop/fix_stats 2017-04-02 23:19:34 +02:00