Working in progress app

This commit is contained in:
2015-10-07 16:23:49 +02:00
parent a4f6470d3d
commit b540f5945e
5 changed files with 42 additions and 1 deletions
+1 -1
View File
@@ -67,7 +67,7 @@ module Users
# POST /user/lists/:id/order_products
def order_products
res = {}
unless active_list.present?
unless active_list.try(:active?)
res[:list_closed] = true
render json: res, status: 404
return
+1
View File
@@ -292,6 +292,7 @@ class List
return unless order.id
orders_placed_count = supplier.increment_orders_placed_count!
loaded_products = self.class.database.load_document product_orders.map{|po| po['product_id'] || po['product']}
#loaded_products = loaded_products.compact.include_relation(:product_category).select{|product| product.active? and product.product_category.try(:active?)}
product_orders.each do |product_order|
next unless product = loaded_products.find{|p| p.id == product_order['product_id'] or p.id == product_order['product']} # to get the price and current product name
quantity = product_order['quantity'].to_i
+6
View File
@@ -69,6 +69,12 @@ class ProductCategory
product_categories
end
def active?(time = Time.now)
return true unless time_zone = supplier.time_zone.presence # cannot do activity magic without the appropriate time zone
true
end
def to_client_format
return {} unless products.present?
{name: name, products: products.to_a.map{|p| p.as_json}}
+18
View File
@@ -0,0 +1,18 @@
require 'spec_helper'
describe "User lists", type: :request do
let(:supplier){ create :supplier }
let(:user){ create :user}
before do
supplier.add_employee(employee)
login_as employee, scope: :employee
end
it "works" do
supplier = create :supplier
get "/supplier/suppliers/#{supplier.id}.json"
api_response.data.relationships.product_categorie
included_section = api_response.included.find{|ih| ih['type'] == 'sections'}
included_section['relationships']['tables']['data'].should eq []
included_section['relationships']['section-areas']['data'].should eq []
end
end
+16
View File
@@ -10,6 +10,13 @@ Release todos:
- facebook api integration on homepage share picture and js
- Signup explanation better and link to current supplier when already
signed in
- Add got it button to bottom of supplier User info modal
- User move table alert flash_message
- When an employee schedule is added the color is not immediate taken
from the selected employee
- User app authorizations
- identity
- Add exception notifier
Supplier
--------
@@ -33,6 +40,8 @@ Supplier
- Change list table
- Set product_category day from false to true
- Go to list from dashboard (targetObject.targetObject stupidity)
- Click on the get Qr codes link from the section actions menus and
sections index page
- Product order check for product being active
- Add product_variant price_difference
@@ -47,6 +56,13 @@ User
the specs
- Kom in aanmerking voor vaste klanten acties!
- Add supplier info page
- Testing
- When there are new product orders, and the list is closed by the
supplier, and the user orders anyway, what happens?, also a security test
- Ordering a product
- Test for product being inactive
- Test for product's product category not active that moment
- Destroy authentication info button in settings page
Bugs
----