Commit graph

907 commits

Author SHA1 Message Date
Aurélien Delobelle c11c3f84ed clean big tables forms 2017-05-19 16:42:26 +02:00
Aurélien Delobelle 4344b7d537 chrome support 2017-05-19 15:13:27 +02:00
Aurélien Delobelle 0995f712ca clean hover/focus/disabled btn 2017-05-19 14:48:57 +02:00
Aurélien Delobelle ecce2fda21 Merge branch 'master' into aureplop/clean_scroll 2017-05-19 14:08:57 +02:00
Aurélien Delobelle 51dca32d05 shorter transitions 2017-05-19 14:01:13 +02:00
Aurélien Delobelle ae27065626 Group permissions select multiple -> checkboxes
- Add handler for CheckboxSelectMultiple in form_field_snippet.html.
- Add template filter "widget_type" to get widget class name.
- Group permissions selection becomes easier.
2017-05-19 13:42:41 +02:00
Aurélien Delobelle e9073e2265 Improve multiple select inputs
+ Group edition form gains success message, is prettier
+ Fix: K-Fêt prefix for group name on this form
2017-05-18 21:41:23 +02:00
Aurélien Delobelle 1a661c1fd3 revert 2017-05-18 20:29:29 +02:00
Aurélien Delobelle 5776c81764 Clean navbar + content_center only
- Add css transitions on buttons + navbar links.
- Clean css of navbar.
- Clean templates with only centered form/content.
- Page opened when login as generic team user close itself (only for
  non-CAS users).
- A message is added when generic team user connects.
- Fix extra space on right when messages are prompted.
2017-05-18 20:17:05 +02:00
Aurélien Delobelle 914d2ca870 Add last statement update support.
K-Psul
- Add handler for checkout data (balance update)
- New statements are sent through ws, and display live on K-Psul.
2017-05-18 13:33:53 +02:00
Aurélien Delobelle 24b9aaae39 Revert template literals use
They were adding spaces at some places.
2017-05-16 18:47:26 +02:00
Aurélien Delobelle cb0c0be8a2 filters on ws for khistory
- fix filters on ws khistory updates
- add filters for transfers against accounts
2017-05-16 18:08:40 +02:00
Aurélien Delobelle 02a015e633 fix data sent to ws by perform_transfers 2017-05-16 17:08:51 +02:00
Aurélien Delobelle bacc079778 Merge branch 'master' into aureplop/kpsul_js_refactor 2017-05-16 16:48:12 +02:00
Aurélien Delobelle bc71e1628a keep eslint quiet 2017-05-16 12:27:39 +02:00
Ludovic Stephan 6a6fc38ead Add selection reset to cancel_opes 2017-05-15 21:10:39 -03:00
Ludovic Stephan 43e772363e Extend history options 2017-05-15 19:29:12 -03:00
Ludovic Stephan 93c8844b3f typo 2017-05-15 19:28:24 -03:00
Ludovic Stephan c2da055b60 Remove duplicate ws updates 2017-05-15 18:59:18 -03:00
Aurélien Delobelle 95a8b484e0 Merge branch 'Aufinal/fix_history' into 'master'
Fix asynchronous calls with resetSettings

See merge request !229
2017-05-15 23:43:28 +02:00
Ludovic Stephan 647b32e727 Move displayAddcost function 2017-05-15 17:52:49 -03:00
Ludovic Stephan ac33e6302e Fix addExistingPurchase + few other bugs 2017-05-15 17:39:33 -03:00
Ludovic Stephan ad42687293 Fix tranfers page 2017-05-15 15:27:46 -03:00
Ludovic Stephan f4cb1e2e83 Add opesonly option 2017-05-15 14:17:58 -03:00
Martin Pepin 6871945dcd Merge branch 'aureplop/fix_perms' into 'master'
Fix UserGroupForm

Closes #161

See merge request !228
2017-05-15 11:29:33 +02:00
Ludovic Stephan bf0e345301 Fix asynchronous calls with resetSettings
The `resetSettings` function now returns the ajax object, allowing to
chain other calls to it, e.g. the `getHistory` function.
2017-05-14 23:50:09 -03:00
Ludovic Stephan c12c705f8b Bind ForestDisplay to initial data 2017-05-14 20:18:31 -03:00
Aurélien Delobelle e0b1db1e1e more robust tests 2017-05-14 22:19:25 +02:00
Ludovic Stephan 31b742fdb7 Move ws update to respective classes 2017-05-14 17:19:09 -03:00
Martin Pepin 5d8427e601 Merge branch 'aureplop/fewer_requests' into 'master'
Moins de requêtes

See merge request !217
2017-05-12 21:13:35 +02:00
Aurélien Delobelle 4ac7b30bdd Fix UserGroupForm + tests for this form.
- Non-K-Fêt group membership is no longer erased by the account edit
  form.
- Add some tests to ensure proposed choices in this form corresponds to
  K-Fêt groups + test case for #161.

Fixes #161
2017-05-12 16:55:18 +02:00
Aurélien Delobelle b1e46792c8 (little) cleaning of order_create view 2017-05-10 13:11:47 +02:00
Aurélien Delobelle b0e7ebfbc5 fix typo + pep8 + del future imports 2017-05-10 12:49:14 +02:00
Ludovic Stephan 5c5fc6da1b Merge branch 'aureplop/less_prices_history' into 'master'
Less articles prices history

Closes #142

See merge request !224
2017-04-25 14:32:18 +02:00
Ludovic Stephan 8b8a3f8a25 Update button in history 2017-04-24 14:46:16 -03:00
Ludovic Stephan 16dbfed977 Add chidren div in display 2017-04-24 14:12:03 -03:00
Ludovic Stephan 5096e5f129 Adapt ArticleManager 2017-04-24 13:25:18 -03:00
Ludovic Stephan 46ac82fd27 Adapt history to changes 2017-04-24 13:25:07 -03:00
Ludovic Stephan e283439ebc Create ForestDisplay class
- Store templates, container and data
- All display functions removed from ModelForest
2017-04-24 13:21:56 -03:00
Ludovic Stephan 20d635137c Merge remote-tracking branch 'origin/aureplop/kpsul_js_refactor' into Aufinal/refactor_history 2017-04-24 11:30:01 -03:00
Aurélien Delobelle 739990cdb6 Add total boxes to new inventory view + fix/clean
- Add total boxes in cellar and bar to new inventory view.
- On this view, table is "minified".
- Revert background color for some templates.
- Clean some margin (responsively).
- Clean tab pills on account read.
2017-04-22 01:17:23 +02:00
Aurélien Delobelle 2eee8f58aa Merge branch 'master' into aureplop/fewer_requests 2017-04-17 20:45:01 +02:00
Aurélien Delobelle ce23eece6a Fix display on small screen devices.
- Remove useless margin on small screens.
- Better pills display on small screens.
- Revert to transparent background for section title.
2017-04-15 13:03:01 +02:00
Aurélien Delobelle ea81ab7b25 Few display improvements.
- Current day remains on the screen on history.
- Message for generic team user connection is sended only if user is
  connecting from a k-fet url.
- Less contrast on history.
2017-04-15 12:36:11 +02: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
Ludovic Stephan 034a661444 Tweaks on kfet.js 2017-04-14 12:12:43 -03:00
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
Aurélien Delobelle 0a21858b33 Use css for scroll positionning
- Better rendering on scroll on pages with a left block
(- It removes the warning on Firefox about scroll positionning)
2017-04-14 13:08:03 +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
Aurélien Delobelle b357283f87 Merge branch 'master' into aureplop/clean_channels 2017-04-11 00:32:07 +02: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
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
Qwann be8d249ed7 remove useless code 2017-04-10 17:47:39 +02: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
Qwann e0b0a53112 stupidness removed 2017-04-10 17:18:43 +02:00
Qwann cb9ba76a4f small fixes 2017-04-10 16:47:13 +02: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
Qwann 5c6a73c597 kfet_open uses moment.js 2017-04-09 20:54:30 +02:00
Qwann 15873085e1 small fixes 2017-04-09 20:01:52 +02:00
Ludovic Stephan 323f019c0d Check if children is non empty 2017-04-09 13:35:01 -03: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 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
Ludovic Stephan 4a6bfd5e3d Better button distinction 2017-04-07 12:58:03 -03:00
Qwann e18c2c698c new migration 2017-04-07 17:52:44 +02:00
Qwann deb0d4de1e moving migration again 2017-04-07 17:23:41 +02:00
Ludovic Stephan 052e7b2b6e Move navigation to content-left 2017-04-07 12:17:36 -03:00
Qwann 531a4611d3 Merge branch 'master' into qwann/k-fet/kfet_open 2017-04-07 17:11:48 +02:00
Ludovic Stephan e26668e5eb Add tabs to account_read 2017-04-06 21:17:47 -03:00
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 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 9ba13a81ee Adapt add_to_container + small improvements 2017-04-06 00:10:39 -03:00
Ludovic Stephan 23d19545a7 Add back root_sort 2017-04-05 22:23:56 -03:00
Ludovic Stephan df47bedae1 Change ModelForest inner structure 2017-04-05 22:10:21 -03: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 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 ed0a82ed5d Add no_trigramme option 2017-04-05 16:51:17 -03:00
Qwann ef8fec89fe migration renamed 2017-04-05 17:50:49 +02:00
Qwann a5671fdf4c Merge branch 'master' into qwann/k-fet/kfet_open 2017-04-05 17:40:19 +02:00
Ludovic Stephan 5c422e892a Add children fo traverse callback 2017-04-05 12:31:19 -03:00
Ludovic Stephan f57c292184 Rename history var 2017-04-05 12:13:24 -03:00
Ludovic Stephan 508e7ec23f Change traverse and find behavior 2017-04-05 12:00:39 -03:00
Ludovic Stephan 88f7ea941d Move selection logic to another class 2017-04-05 11:26:33 -03:00
Ludovic Stephan 8d13c0a4bb Add fetch method 2017-04-05 10:59:59 -03: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
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 7ec7ed2696 Rename History class 2017-04-05 09:53:12 -03:00
Ludovic Stephan e051631a34 Use WebSocket classes 2017-04-05 09:28:32 -03:00
Ludovic Stephan 360c442a4e Remove useless class 2017-04-05 09:24:27 -03:00
Ludovic Stephan 1761c5f1bd Change fromAPI logic 2017-04-05 09:13:00 -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
Ludovic Stephan a29de134f1 Move focus ; move is_low_stock to method 2017-04-05 08:58:46 -03:00
Aurélien Delobelle 2e0de75471 kpsul - fix account balance ukf 2017-04-05 13:18:01 +02:00
Aurélien Delobelle 6be6202b3f few cleans 2017-04-05 04:26:50 +02:00
Aurélien Delobelle f1aaad7317 Better jquery ajax calls management
It becomes the same as the original jQuery ajax object.
For example, callbacks can be queued.
get_by_apipk and from_API of ModelObject returns the ajax object.

Example (js):
Account.get_by_apipk('AAA')
    .done(function (data) {
        console.log(data)
    })
    .fail( () => console.log('cool') )
    ...
    .done( ...
2017-04-05 04:05:31 +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
Ludovic Stephan 3b9affb3f3 Add focus methods 2017-04-04 20:18:53 -03:00
Ludovic Stephan 9c559d9ec3 Add articles reset to kpsul.reset 2017-04-04 19:54:03 -03:00
Ludovic Stephan 021937a38e Small bugfixes 2017-04-04 19:52:12 -03:00
Ludovic Stephan cb28b928c4 Remove articleSelect from _env 2017-04-04 19:42:30 -03: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
Ludovic Stephan e5791efe4d Remove last traces of old articles 2017-04-04 19:41:15 -03:00
Ludovic Stephan 05156f37c6 Update addExistingPurchase 2017-04-04 19:34:22 -03: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
Aurélien Delobelle ddd71c7ac1 add missing __init__ 2017-04-04 17:29:54 +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