Fixes for event stream and section view actions
This commit is contained in:
+6
-6
@@ -30,19 +30,19 @@ class List
|
||||
|
||||
view :active_by_table_id_view, type: :custom, map_function: %|function(doc){
|
||||
if(doc.ruby_class == 'List' && doc.state == 'active'){
|
||||
emit(doc.table_id, 1);
|
||||
emit(doc.table_id, 1);
|
||||
}
|
||||
}|, reduce_function: '_sum'
|
||||
|
||||
view :active_by_supplier_id_view, type: :custom, map_function: %|function(doc){
|
||||
if(doc.ruby_class == 'List' && doc.state == 'active'){
|
||||
emit(doc.supplier_id, 1);
|
||||
emit(doc.supplier_id, 1);
|
||||
}
|
||||
}|, reduce_function: '_sum'
|
||||
|
||||
view :active_by_section_id_view, type: :custom, map_function: %|function(doc){
|
||||
if(doc.ruby_class == 'List' && doc.state == 'active' && doc.section_id){
|
||||
emit(doc.section_id, 1);
|
||||
emit(doc.section_id, 1);
|
||||
}
|
||||
}|, reduce_function: '_sum'
|
||||
|
||||
@@ -50,7 +50,7 @@ class List
|
||||
if(doc.ruby_class == 'List' && doc.state == 'active'){
|
||||
emit([doc.supplier_id, doc.section_id], 1);
|
||||
}
|
||||
}], reduce_function: '_sum'
|
||||
}], 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){
|
||||
@@ -219,7 +219,7 @@ class List
|
||||
def approve_join_request_for_user!(user)
|
||||
if join_request_user_ids.include?(user.id)
|
||||
join_request_user_ids.delete(user.id)
|
||||
user.active_list_id = self.id
|
||||
user.active_list_id = self.id
|
||||
add_user(user)
|
||||
user.save
|
||||
self.is_dirty
|
||||
@@ -342,7 +342,7 @@ class List
|
||||
ho[:state] = order.state
|
||||
list_total += ho[:total_amount]
|
||||
h[:orders] << ho
|
||||
end
|
||||
end
|
||||
h[:total_amount] = list_total.round(2)
|
||||
@with_orders_as_json = h
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user