Commit graph

18 commits

Author SHA1 Message Date
Aurélien Delobelle c0b8430a12 Better scale management for order creation
+ Extends labels formatting of scale.
2017-05-19 17:40:06 +02:00
Aurélien Delobelle 06572f0bb5 Order create use Scale.
Order create view use WeekScale. No query improvements, only shorter
code.

Scale/ScaleMixin:
- Two methods directly relative to the Scale class move to... the Scale
  class.

- Fix order create on Chrome.
2017-04-13 14:11:44 +02:00
Aurélien Delobelle 3f4a1adbb9 Fewer queries on stats/scales + Fix
Scales:
- Fix #chunks when used with std_chunk=True (there was one too many at
  the beginning)
- Scale.end gives the end of the last chunk (instead of its start)
  So scale.begin -> scale.end gives the full range of the scale.

`kfet_day` now returns an aware datetime.

ScaleMixin:
- new method `get_by_chunks` which use only one query and ranks
  elements according to the scale. Elements are returned by a generator
  for each scale chunk (and all chunks are returned as a generator too).

ArticlesStatSales and AccountStatOperations use this new method to
avoid issuing #scale_chunks queries.

ArticleStat:
- fixed on Chrome
2017-04-12 18:03:31 +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
Aurélien Delobelle 1bb83ccdd7 simplify StatScale 2017-04-03 15:10:53 +02:00
Aurélien Delobelle b3a9ad8a96 clean mixin 2017-04-03 13:24:04 +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
Qwann 46f343b1ab la K-Fêt se réveille à 7h 2017-02-15 14:44:58 +01:00
Qwann 1c90608f6d some cleaning 2017-02-15 14:21:00 +01:00
Qwann 947de3b638 wrong months in 'last months' stats 2017-01-20 21:21:58 +01:00
Qwann e6854d7987 using strftime instead of a personnal function 2017-01-20 20:19:16 +01:00
Qwann bdbb252a05 Revert "first fixes"
This reverts commit 5877218af5.
2017-01-17 17:16:53 +01:00
Qwann 5877218af5 first fixes 2017-01-14 16:23:45 +01:00
Qwann ccf7c4a484 ma conso added 2016-12-20 22:46:38 +01:00
Qwann 83d49ad3a4 WIP articleCategory stat 2016-12-10 23:08:17 +01:00
Qwann 3a7ffefacf week & day stat 2016-12-09 21:45:34 +01:00