Commit graph

199 commits

Author SHA1 Message Date
Aurélien Delobelle 0ed70eb0a7 PEP8
No improvement.
2017-04-06 20:30:23 +02:00
Aurélien Delobelle 026fba867d Fewer db requests on home view.
- 1 request instead of (2 + #articles)
2017-04-06 19:44:16 +02:00
Aurélien Delobelle 2731d4630f Fewer requests on accounts groups.
- Saves two queries.

(4 prefetch where done, replaced by 2 prefetchs (whose 1 with 2
selected_related))
2017-04-06 19:25:23 +02:00
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 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
Qwann 7350006990 PEP8 2017-04-04 21:48:17 +02:00
Qwann ba11aa49db categories are updatable 2017-04-04 21:36:02 +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 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
Ludovic Stephan f46ba0dd6c Merge branch 'master' into Aufinal/inventaires 2017-04-03 16:01:51 -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 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 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 1ee993e1e1 Add permission check to AccountStatBalance
Only connected user can get its balance data
2017-04-02 17:14:36 +02:00
Aurélien Delobelle 87b9db520f Refactor py base stats and account balance stats
New mixin: PkUrlMixin
- use with SingleObjectMixin standard django mixin (used by
  DetailView...)
- `get_object` use field declared in `pk_url_kwarg` to get... the object

SingleResumeStat
- clean (part of) py code

AccountStatBalanceList
- renamed from `AccountStatBalanceAll`
- url modified
- add permission checking (only the connected user can get balance
  stats manifest)
- clean py code

AccountStatBalance
- cleaner filtering management
- merge urls using this class
- clean py code
2017-04-02 17:03:20 +02:00
Aurélien Delobelle e8fdd083aa delete unused class-views 2017-04-02 05:34:34 +02:00
Ludovic Stephan 271654b447 No need for intermediate error reporting 2017-04-01 08:47:09 -03:00
Ludovic Stephan ccf5f80685 Merge remote-tracking branch 'origin/master' into Aufinal/editions 2017-04-01 02:43:19 -03:00
Ludovic Stephan aa29621c7c Prevents special opes on LIQ 2017-03-31 18:28:03 -03:00
Ludovic Stephan 1d8e084a19 websocket update when addcost 2017-03-31 14:37:00 -03:00
Ludovic Stephan 3b793dc726 Add first improvements for inventory 2017-03-28 23:47:41 -03:00
Ludovic Stephan f645121fb1 Add error when editing LIQ 2017-03-25 10:39:53 -03:00
Ludovic Stephan 44fbc92893 Merge branch 'master' of git.eleves.ens.fr:cof-geek/gestioCOF into Aufinal/editions 2017-03-24 21:07:32 -03:00
Ludovic Stephan d7740e66fe adapt code to is_checkout removal 2017-03-24 20:52:49 -03:00
Qwann de724a2c0d PEP8 for perform_operation 2017-03-17 19:53:23 +01:00
Qwann fcc2ab8810 frontend working 2017-03-17 19:17:36 +01:00
Ludovic Stephan 3793863bab Merge remote-tracking branch 'origin/k-fet' into Aufinal/merge_k-fet 2017-03-15 22:58:54 -03:00
Qwann d0938dfae7 Merge branch 'k-fet' into qwann/k-fet/category_addcost 2017-03-11 15:10:04 +01:00
Qwann ee6de35627 category addcost added 2017-03-10 18:29:15 +01:00
Qwann f52aba8ca6 Merge branch 'k-fet' into qwann/k-fet/home 2017-03-05 19:21:20 +01:00
Aurélien Delobelle 95b129e396 resolved merge conflict in kfet views imports 2017-02-25 02:00:56 +01:00
Evarin 0fcb29252b Frontend tout en JS 2017-02-15 21:01:54 +01:00
Qwann 1c90608f6d some cleaning 2017-02-15 14:21:00 +01:00
Aurélien Delobelle 2e8fc45a1b Merge branch 'Aufinal/own_password' into 'k-fet'
Changement de son propre mot de passe

Permet à un K-Fêteux (disposant de la permission `kfet.is_team`) de modifier son propre mot de passe sur la page `account/XXX/edit`.

Accessoirement, la fonction `account_update` est maintenant conforme à PEP8.

Fix #121

See merge request !148
2017-02-13 16:32:40 +01:00
Ludovic Stephan 46e9e82da8 move account save 2017-02-13 12:19:47 -02:00
Qwann 9cae3ad0bd Merge branch 'k-fet' into qwann/k-fet/stats 2017-02-13 14:37:29 +01:00
Aurélien Delobelle db4786abf8 Merge branch 'manet/correction-commandes' into 'k-fet'
Manet/correction commandes

- Fix création de commandes (fournisseur)

Fix #97
See merge request !128
2017-02-11 22:00:45 +01:00
Qwann a4fdb99267 Revert "WS : quand la K-Fêt est ouverte ?"
This reverts commit ce9f717f06.
2017-02-08 12:42:07 +01:00
Qwann ce9f717f06 WS : quand la K-Fêt est ouverte ? 2017-01-27 21:46:21 +01:00
Qwann 0ac1eaf414 fixing decimal_issue 2017-01-27 13:08:50 +01:00
Qwann 5cedabf5a8 Merge branch 'qwann/k-fet/stats' into qwann/k-fet/home 2017-01-27 12:15:47 +01:00