Commit graph

55 commits

Author SHA1 Message Date
Christopher Neugebauer
b323c0eb25 Cart reservation durations now take the residual from the last reservation duration into account. 2016-10-06 12:12:50 -07:00
Christopher Neugebauer
fc81f107ed When setting quantities on products, only raise errors if they’re due to changes made during the current call to set_quantities.
Fixes #54
2016-09-15 16:33:19 +10:00
Christopher Neugebauer
3517bdd281 Makes sure that discounts always apply to the most expensive product in the cart first. Adds test to that effect.
Fixes #88.
2016-09-15 16:01:49 +10:00
Christopher Neugebauer
2658c2ccde Improves the error message when per_user_limit on category is breached.
Fixes #80
2016-09-13 13:33:20 +10:00
Christopher Neugebauer
1c239c361f Propagates the per_user_limit category error to the products, rather than the category.
Fixes #79.
2016-09-13 13:20:02 +10:00
Christopher Neugebauer
64ca477cb8 Fixes flake8 snafus 2016-09-02 11:43:27 +10:00
Christopher Neugebauer
3d635521eb CartController now uses BatchController memoisation 2016-05-01 14:56:51 +10:00
Christopher Neugebauer
c6fdfa496e Replaces CategoryController.attach_user_remainders with user_remainders 2016-04-30 20:30:44 +10:00
Christopher Neugebauer
941caa30d9 Replaces ProductController.attach_user_remainders with ProductController.user_remainders 2016-04-30 20:30:21 +10:00
Christopher Neugebauer
b40505117f Fixes flake8 errors arising from rebase 2016-04-29 11:22:56 +10:00
Christopher Neugebauer
135f2fb47b Refactors discounts validation in terms of available_discounts 2016-04-29 11:16:40 +10:00
Christopher Neugebauer
4eff8194f9 Reduces CartController re-loading when batching operations 2016-04-29 11:16:40 +10:00
Christopher Neugebauer
6d52a4c18f More low-hanging query optimisations 2016-04-29 11:11:26 +10:00
Christopher Neugebauer
4fb569d935 Does more select_related and bulk_create calls 2016-04-29 11:10:20 +10:00
Christopher Neugebauer
a79ad3520e Puts attach_remainders on ProductController and CategoryController, eliminating the need to query each product and category separately. 2016-04-29 11:09:34 +10:00
Christopher Neugebauer
587e6e20b2 Adds an operations_batch context manager that allows batches of modifying operations to be nested. Closes #44. 2016-04-29 11:08:45 +10:00
Christopher Neugebauer
162db24817 Flake8 fixes 2016-04-29 11:08:45 +10:00
Christopher Neugebauer
71de0df5dc Makes DiscountController a class and puts available_discounts inside it 2016-04-29 11:08:42 +10:00
Christopher Neugebauer
145fd057ac Breaks out flag-handling code into flag.py and FlagController 2016-04-29 11:07:52 +10:00
Christopher Neugebauer
3f1be0e14e Rearchitected condition processing such that multiple conditions are processed by the database, in bulk. Closes #42. 2016-04-29 11:06:58 +10:00
Christopher Neugebauer
cbecbf9a41 Tidies up some docs 2016-04-25 18:50:09 +10:00
Christopher Neugebauer
fd751b4ea1 Removes print statement 2016-04-25 18:32:36 +10:00
Christopher Neugebauer
b709da97f1 Checks that required category constraints are met before letting you check out your cart.
Closes #35
2016-04-25 17:13:58 +10:00
Christopher Neugebauer
a69d3f051e Makes cart amendment methods fail if the cart is no longer active.
Closes #16
2016-04-25 17:13:11 +10:00
Christopher Neugebauer
63dfd353c1 Replaces active/released flags in Cart with a single int flag. Closes #41 2016-04-25 15:36:55 +10:00
Christopher Neugebauer
c0b0ae780d Removes confusingness from cart.py 2016-04-25 13:20:48 +10:00
Christopher Neugebauer
875f736d67 Consolidates models.py into a directory module. 2016-04-22 15:06:24 +10:00
Christopher Neugebauer
c24b9ee213 Makes EnablingConditionBase a minimal reification of an abstract base model FlagBase, replaces enablingconditionbase with flagbase where possible, and fixes method names and documentation 2016-04-12 08:42:22 +10:00
Christopher Neugebauer
8e95bb7469 flake8 fixes 2016-04-07 13:26:25 +10:00
Christopher Neugebauer
53413388e0 Optimises queries through simplifying repeated queries and select_related use 2016-04-06 22:59:00 +10:00
Christopher Neugebauer
40bc5985f4 Propagates the error messages up from enabling condition testing 2016-04-06 15:47:09 +10:00
Christopher Neugebauer
39b130811c Removes superfluous test 2016-04-06 15:46:49 +10:00
Christopher Neugebauer
c8c16072ba fix_simple_errors() now removes exhausted vouchers from the voucher set. 2016-04-06 14:02:23 +10:00
Christopher Neugebauer
0d57da8d6f Makes apply_voucher() idempotent, adds _test_voucher to validate_cart, and updates tests. 2016-04-06 14:02:22 +10:00
Christopher Neugebauer
6f28c20b70 Factors _test_voucher() method into CartController 2016-04-06 14:02:22 +10:00
Christopher Neugebauer
7d97d2d2de Adds fix_simple_errors to cart - it zeroes out unavailable products. Adds test that it does that. 2016-04-06 14:02:22 +10:00
Christopher Neugebauer
f5d9458d1a Adds a validation based on available_products to validate_cart, and a test based on simple enabling conditions 2016-04-06 10:22:44 +10:00
Christopher Neugebauer
a4d684f444 Raises limits errors in the right parts of the form 2016-04-03 15:25:39 +10:00
Christopher Neugebauer
7609965883 flake8 compliance 2016-04-03 13:21:57 +10:00
Christopher Neugebauer
eab1deff77 Removes set_quantity and add_to_cart from CartController, and factors it into a test controller for testing 2016-04-03 10:07:59 +10:00
Christopher Neugebauer
312fffd137 Adds negative quantity tests to _test_limits, and removes _set_quantity_old. 2016-04-03 10:07:59 +10:00
Christopher Neugebauer
e3ec128147 Factors limits testing in set_quantities into _test_limits() 2016-04-02 20:12:27 +11:00
Christopher Neugebauer
1e7a2abc7f Refactors testing of enabling conditions so that they are done in bulk in ConditionsController, rather than one product at a time. 2016-04-02 18:18:06 +11:00
Christopher Neugebauer
1c6dc12781 Replaces user_can_add_within_limit with user_quantity_remaining 2016-04-02 18:17:18 +11:00
Christopher Neugebauer
576dddcaad Adds user_quantity_remaining to CategoryController 2016-04-02 18:17:18 +11:00
Christopher Neugebauer
39021cd3dd Adds set_quantities, refactors set_quantity in terms of set_quantities 2016-04-02 18:16:29 +11:00
Christopher Neugebauer
cf85af7719 Adds refund function, adds tests, makes sure that refunds are obeyed elsewhere in the codebase 2016-03-27 21:04:10 +11:00
Christopher Neugebauer
2d5cd622c5 Makes it invalid for a user to re-enter a voucher code they already have. 2016-03-26 19:47:01 +11:00
Christopher Neugebauer
c41a9cadff recalculate_discounts now uses the available_discounts function from controllers.discount. 2016-03-26 13:33:23 +11:00
Christopher Neugebauer
8e6364d02a Fixes bug where discount quantity applied to all users rather than specific user. Adds test case. 2016-03-25 12:50:34 +11:00