end of day commit
This commit is contained in:
@@ -44,6 +44,12 @@ class List
|
||||
}
|
||||
}|, reduce_function: '_sum'
|
||||
|
||||
view :active_for_supplier_and_section_view, type: :custom, map_function: %[function(doc){
|
||||
if(doc.ruby_class == 'List' && doc.state == 'active'){
|
||||
emit([doc.supplier_id, doc.section_id], 1);
|
||||
}
|
||||
}], reduce_function: '_sum'
|
||||
|
||||
view :for_user_view, type: :custom, map_function: %|function(doc){
|
||||
if(doc.ruby_class == 'List' && doc.user_ids && doc.user_ids.length){
|
||||
doc.user_ids.forEach(function(uid){
|
||||
@@ -77,6 +83,11 @@ class List
|
||||
database.view(active_by_section_id_view(key: section_id, reduce: false, include_docs: true))
|
||||
end
|
||||
|
||||
# Return all currently active orders for a given section
|
||||
def self.active_for_supplier_and_section(supplier, section_id, options = {})
|
||||
database.view(active_for_supplier_and_section_view(key: [supplier.id, section_id], reduce: false, include_docs: true))
|
||||
end
|
||||
|
||||
def self.active_for_table(table_id, options = {})
|
||||
database.view(active_by_table_id_view(options.reverse_merge(key: table_id, reduce: false, include_docs: true)))
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user