Commit graph

252 commits

Author SHA1 Message Date
Ludovic Stephan 20d635137c Merge remote-tracking branch 'origin/aureplop/kpsul_js_refactor' into Aufinal/refactor_history 2017-04-24 11:30:01 -03:00
Ludovic Stephan b2a5dfd682 Move permission check 2017-04-14 12:51:58 -03:00
Ludovic Stephan 100686457b Change select_related for future compatibility 2017-04-14 12:47:15 -03:00
Ludovic Stephan b544d6c5b3 Better alignment 2017-04-14 12:45:38 -03:00
Ludovic Stephan 659b20891e Add filter to cancel_opes 2017-04-14 12:43:59 -03:00
Aurélien Delobelle b0d35667b3 Merge branch 'master' into aureplop/kpsul_js_refactor 2017-04-14 15:56:44 +02:00
Aurélien Delobelle 9668f1d1ec Account: check_negative() -> update_negative() 2017-04-13 15:48:13 +02:00
Aurélien Delobelle 18425b82c2 Check negative on cancellation.
- Like perform operations, cancel_operations can add/remove an account
  from negative accounts system.
- Balances checks are now performed against real_balance instead of
  balance.
  So if someone with a balance_offset go, for real, to positive land (ie even
  without taking into account the balance offset), its account is removed from
  the negative system.
- Fix bug on real_balance when negative exists but balance_offset is
  not set.

Fixes #156.
2017-04-13 15:15:59 +02:00
Ludovic Stephan 47da80f21c Add related objects 2017-04-09 23:24:50 -03:00
Ludovic Stephan 5e8752632c Add index for Day objects 2017-04-09 21:50:47 -03:00
Ludovic Stephan 688d5bba29 Adapt history to new structure 2017-04-09 17:54:37 -03:00
Ludovic Stephan 051231a031 Merge remote-tracking branch 'origin/aureplop/kpsul_js_refactor' into Aufinal/refactor_history 2017-04-09 16:47:05 -03:00
Aurélien Delobelle e89ff68d3b add misisng import 2017-04-09 01:39:18 +02:00
Aurélien Delobelle 784ba9bd10 Merge branch 'master' into aureplop/kfet_config 2017-04-08 18:36:28 +02:00
Ludovic Stephan df47bedae1 Change ModelForest inner structure 2017-04-05 22:10:21 -03:00
Aurélien Delobelle e4dd434608 no longer use model_to_dict
- fix cof status on k-psul
2017-04-05 23:33:45 +02:00
Aurélien Delobelle e4ccd88dfd Merge branch 'master' into aureplop/kpsul_js_refactor 2017-04-05 23:18:33 +02:00
Ludovic Stephan 8d13c0a4bb Add fetch method 2017-04-05 10:59:59 -03:00
Ludovic Stephan 290d4ecb6e Merge branch 'Aufinal/refactor_articles' into Aufinal/refactor_history 2017-04-05 10:03:30 -03:00
Aurélien Delobelle 42728e58be Merge branch 'master' into qwann/k-fet/category_addcost 2017-04-05 14:57:26 +02:00
Ludovic Stephan e051631a34 Use WebSocket classes 2017-04-05 09:28:32 -03:00
Ludovic Stephan 840010b63f Merge remote-tracking branch 'origin/aureplop/kpsul_js_refactor' into Aufinal/refactor_articles 2017-04-05 09:03:59 -03:00
Aurélien Delobelle 6be6202b3f few cleans 2017-04-05 04:26:50 +02:00
Aurélien Delobelle efbcde163b clean some js
- clean buttons code on account and checkout
- merge CheckoutRead and kpsul_checkout_data views (the first won)

APIModelObject interface
- add url_create, url_update, url_update_for
- rename url_object_for and url_object to url_read_for and url_read
2017-04-05 03:43:51 +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
Aurélien Delobelle 714903210c Add kfet_config tests
- KFetConfig `set` method now takes model instance instead of their pk
  for this type of entries.
- Add tests for KFetConfig class: tests against types currently used by
  kfet app (duration, modelinstance, decimal).
- These tests are located in `kfet/tests/test_config.py`. We should
  separate tests suites by file like this, considering what they are about.
- KFetConfig method `set_many` renamed to `set` (because it also updates
  only one).
2017-04-04 17:05:55 +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
Ludovic Stephan 07290f6fec Merge branch 'Aufinal/refactor_articles' into Aufinal/refactor_history 2017-04-03 21:00:12 -03: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 b91edc9c7d Merge remote-tracking branch 'origin/aureplop/kpsul_js_refactor' into Aufinal/refactor_articles 2017-04-03 20:03:58 -03:00
Aurélien Delobelle 9d2298a089 Merge branch 'master' into aureplop/kpsul_js_refactor
Not chill.
2017-04-04 00:51:49 +02:00
Aurélien Delobelle ce2a05766d Add set_many methods to kfet_config
- Fix addcost updates (from K-Psul)
2017-04-03 23:06:47 +02:00
Ludovic Stephan f46ba0dd6c Merge branch 'master' into Aufinal/inventaires 2017-04-03 16:01:51 -03:00
Aurélien Delobelle 85caa6b058 Use django-djconfig for kfet app.
Old configuration(/settings), based on Settings model, system is
deleted: SettingsForm, Settings.
New system use `django-djconfig` module.

- `kfet.config` module provides `kfet_config` to access configuration concerning
kfet app.
- Views, forms, models, etc now use this object to retrieve conf values.
- Views no longer add config values to context, instead templates use
  `kfet_config` provided by a new context_processor.
- Enhance list and update views of settings.
- Fix: settings can directly be used without having to visit a specific
  page...

Misc
- Delete some py2/3 imports
- Delete unused imports in kfet.models and kfet.views
- Some PEP8 compliance
2017-04-03 20:32:16 +02: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