Commit graph

1597 commits

Author SHA1 Message Date
Ludovic Stephan de865c61aa Move container clearing 2017-04-14 11:36:52 -03:00
Aurélien Delobelle b0d35667b3 Merge branch 'master' into aureplop/kpsul_js_refactor 2017-04-14 15:56:44 +02:00
Ludovic Stephan 55b509b3dd Merge branch 'aureplop/fix_negative' into 'master'
Check negative on cancellation.

Closes #156

See merge request !223
2017-04-13 18:20:24 +02:00
Aurélien Delobelle 7db497d095 Less articles prices history
- Prices given with order_to_inventory are saved to db only if they are
  updated (it doesn't create a new price row each time)

Fixes #142.
2017-04-13 16:34:29 +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
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 e97e0081d7 Fewer queries on stats of an account balance.
- Remove labels, should be replaced to an anchor to the relative
  operation in history.
- Add select_related as necessary.
2017-04-11 23:13:54 +02:00
Aurélien Delobelle b5cc26bb1b Merge branch 'master' into aureplop/fewer_requests 2017-04-11 22:46:18 +02:00
Martin Pepin a725f8020c Merge branch 'aureplop/clean_channels' into 'master'
Aureplop/clean channels

Closes #67

See merge request !220
2017-04-11 00:42:08 +02:00
Aurélien Delobelle b357283f87 Merge branch 'master' into aureplop/clean_channels 2017-04-11 00:32:07 +02:00
Martin Pépin 40abe81402 Integrate the new settings workflow into vagrant 2017-04-10 23:01:19 +01:00
Martin Pépin a5fb162aaf New organisation of settings files
We reproduce what has been done here:
https://github.com/dissemin/dissemin

The following files can be found under `cof/settings/`
- `common.py`: the settings that are shared by all the environments we
  have + the secrets (see below).
- `dev.py`: the settings used by the vagrant VM for local development.
- `prod.py`: the production settings (for both www.cof.ens.fr and
  dev.cof.ens.fr)

There is also a notion of "secrets". Some settings like the `SECRET_KEY`
or the database's credentials are loaded from an untracked files called
`secret.py` in the same directory. This secrets are loaded by the common
settings file.
2017-04-10 23:01:19 +01:00
Martin Pepin a68002d0f6 Merge branch 'aureplop/fix_double_js' into 'master'
Fix stats on some browsers

See merge request !219
2017-04-10 23:59:02 +02:00
Martin Pepin 495c6ac3d1 Merge branch 'aureplop/kfet_config' into 'master'
Configuration utilisateur K-Fêt

See merge request !210
2017-04-10 21:14:37 +02:00
Ludovic Stephan 8c02e5da0c Trigger event on history itself 2017-04-10 15:40:29 -03:00
Ludovic Stephan 2eba6892a2 Revert "Change event triggered when canceling opes"
This reverts commit ce3d8aa6f7.
2017-04-10 15:34:57 -03:00
Ludovic Stephan ce3d8aa6f7 Change event triggered when canceling opes 2017-04-10 15:08:17 -03:00
Ludovic Stephan 84d478271b Compatibility changes on history.js 2017-04-10 12:34:43 -03:00
Ludovic Stephan cd0e4c6f3e Allow (basic) chaining on api_with_auth 2017-04-10 12:33:24 -03:00
Ludovic Stephan 983a55780f Add cancel_history event 2017-04-10 12:32:35 -03:00
Ludovic Stephan cfb39b1050 Better default options 2017-04-10 11:30:00 -03:00
Aurélien Delobelle c75b2946e3 Merge branch 'master' into aureplop/kpsul_js_refactor 2017-04-10 13:08:23 +02:00
Aurélien Delobelle 5d6012b6bd Fix kfet tests
- and add test for `kfet_config.subvention_cof`
2017-04-10 11:52:57 +02:00
Aurélien Delobelle c228416809 Subvention -> Réduction + units for kfet_config
- kfet_config gives "reduction_cof" as editable instead of
  "subvention_cof"
- this last one can still be accessed via kfet_config (computed from
  new "reduction_cof"
- add units to numeric values of kfet_config form
2017-04-10 11:36:06 +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 7fc07ac603 Merge branch 'Aufinal/clean_modelforest' into 'aureplop/kpsul_js_refactor'
Change ModelForest inner structure
- Intermediary model for nodes removed
- More descriptive ModelForest structure in constructor.structure, child_sort not defined in Python function anymore.
- More intuitive access to parent and children of nodes (e.g. article.category, category.articles...)

See merge request !215
2017-04-09 21:28:16 +02:00
Ludovic Stephan 323f019c0d Check if children is non empty 2017-04-09 13:35:01 -03:00
Aurélien Delobelle 6ce2f178bf Fewer requests on petit cours details management. 2017-04-09 17:57:11 +02:00
Aurélien Delobelle 3dc91e30bd Fewer requests on petit cours list management. 2017-04-09 17:51:40 +02:00
Aurélien Delobelle 8870b5ace2 Fewer queries on poll view 2017-04-09 17:37:15 +02:00
Ludovic Stephan 9ad208a171 Change child sort + bugfix grom prev commit 2017-04-09 12:30:15 -03:00
Ludovic Stephan 73fb3c419e Add stop check in traverse 2017-04-09 11:43:51 -03:00
Aurélien Delobelle 029d59e615 Enable authentication on KPsul websocket.
- PermConsumerMixin allows checking permissions on connection to a
  consumer.
- KPsul consumer uses this mixin to check if connecting user has the
  permission `kfet.is_team`.

Fixes #67.
2017-04-09 16:10:27 +02:00
Aurélien Delobelle 1e18c4043e Use last channels & co versions
- Use last official releases of channels, asgiref, daphne and
  asgi-redis packages.
- Customization of JsonWebsocketConsumer is now in kfet app through a
  custom class (and so, doesn't require anymore a forked version of channels).
- Clean kfet consumers code.
2017-04-09 15:47:16 +02:00
Aurélien Delobelle ebfe5c41d4 Fix stats on some browsers
- Delete double import in account_read template
- Syntax on account_read

Stats didn't show on Chrome (at least v57) cause of these.
2017-04-09 01:52:26 +02:00
Aurélien Delobelle e89ff68d3b add misisng import 2017-04-09 01:39:18 +02:00
Aurélien Delobelle 457ee64004 update migrations order 2017-04-08 18:38:47 +02:00
Aurélien Delobelle 784ba9bd10 Merge branch 'master' into aureplop/kfet_config 2017-04-08 18:36:28 +02:00
Aurélien Delobelle ce70269e7b Fewer requests on create/update spectaclerevente in bda admin.
- O(#participant) -> O(1) requests
2017-04-08 17:50:36 +02:00
Aurélien Delobelle 0750551d7c Fewer requests on participant admin create and updateviews.
- Fewer requests on choicesreventes and tabular inlines (of
  attributions)
- User and tirage cannot be updated if updating a participant instance.
- Tabular inlines are fixed:
  - the one which is used for spectacles with listing only propose
    choices in spectacle with listing
  - same with the other (spectacles without listing)
- Still does too much request (because of tabularinlines)
2017-04-08 17:16:33 +02:00
Aurélien Delobelle 6451f971bd AttributionForm in bda admin
- New attribution form issue less queries
- Spectacle and Participant are readonly if updating an attribution.

ReadOnlyMixin allows to set readonly fields only while updating an
object.
2017-04-08 16:11:42 +02:00
Aurélien Delobelle 15861824b6 Merge branch 'Aufinal/tabs' into 'master'
K-Fêt
- Détails d'un compte: historique et stats sont accessibles par des onglets.

See merge request !218
2017-04-08 14:41:36 +02:00
Aurélien Delobelle bbe6f41962 Fewer requests on descriptions and catalogue views 2017-04-08 13:44:21 +02:00
Aurélien Delobelle 98f355ed20 Fewer requests on unpaid view 2017-04-08 13:08:53 +02:00
Aurélien Delobelle 15d2faf8e1 Fewer requests on spectacles and participants list views 2017-04-08 13:01:05 +02:00