mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
BOM: only fetch completed orders
This commit is contained in:
@@ -93,7 +93,7 @@ orderManagementModule.controller "AdminOrderMgmtCtrl", [
|
||||
api_error_msg = "You don't have an API key yet. An attempt was made to generate one, but you are currently not authorised, please contact your site administrator for access."
|
||||
|
||||
$scope.fetchOrders = ->
|
||||
dataFetcher("/api/orders?template=bulk_index").then (data) ->
|
||||
dataFetcher("/api/orders?template=bulk_index&q[completed_at_not_null]=true").then (data) ->
|
||||
$scope.resetOrders data
|
||||
|
||||
$scope.resetOrders = (data) ->
|
||||
|
||||
@@ -29,6 +29,26 @@ feature %q{
|
||||
page.should have_selector "h1.page-title", text: "Bulk Order Management"
|
||||
end
|
||||
|
||||
context "displaying the list of line items " do
|
||||
let!(:o1) { FactoryGirl.create(:order, state: 'complete', completed_at: Time.now ) }
|
||||
let!(:o2) { FactoryGirl.create(:order, state: 'complete', completed_at: Time.now ) }
|
||||
let!(:o3) { FactoryGirl.create(:order, state: 'address', completed_at: nil ) }
|
||||
let!(:li1) { FactoryGirl.create(:line_item, order: o1 ) }
|
||||
let!(:li2) { FactoryGirl.create(:line_item, order: o2 ) }
|
||||
let!(:li3) { FactoryGirl.create(:line_item, order: o3 ) }
|
||||
|
||||
before :each do
|
||||
visit '/admin/orders/bulk_management'
|
||||
end
|
||||
|
||||
it "displays a list of line items" do
|
||||
page.should have_selector "th.id", text: "ID", :visible => true
|
||||
page.should have_selector "td.id", text: li1.id.to_s
|
||||
page.should have_selector "td.id", text: li2.id.to_s
|
||||
page.should_not have_selector "td.id", text: li3.id.to_s
|
||||
end
|
||||
end
|
||||
|
||||
context "displaying individual columns" do
|
||||
let!(:o1) { FactoryGirl.create(:order, state: 'complete', completed_at: Time.now ) }
|
||||
let!(:o2) { FactoryGirl.create(:order, state: 'complete', completed_at: Time.now ) }
|
||||
@@ -39,12 +59,6 @@ feature %q{
|
||||
visit '/admin/orders/bulk_management'
|
||||
end
|
||||
|
||||
it "displays a list of line items" do
|
||||
page.should have_selector "th.id", text: "ID", :visible => true
|
||||
page.should have_selector "td.id", text: li1.id.to_s, :visible => true
|
||||
page.should have_selector "td.id", text: li2.id.to_s, :visible => true
|
||||
end
|
||||
|
||||
it "displays a column for user email" do
|
||||
page.should have_selector "th.email", text: "EMAIL", :visible => true
|
||||
page.should have_selector "td.email", text: o1.email, :visible => true
|
||||
|
||||
@@ -32,7 +32,7 @@ describe "AdminOrderMgmtCtrl", ->
|
||||
|
||||
describe "fetching orders", ->
|
||||
beforeEach ->
|
||||
httpBackend.expectGET("/api/orders?template=bulk_index").respond "list of orders"
|
||||
httpBackend.expectGET("/api/orders?template=bulk_index&q[completed_at_not_null]=true").respond "list of orders"
|
||||
|
||||
it "makes a standard call to dataFetcher", ->
|
||||
scope.fetchOrders()
|
||||
|
||||
Reference in New Issue
Block a user