1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-18 07:52:23 +01:00

(feat) sort order lists by created at date

This commit is contained in:
Du Peng 2022-09-13 16:11:27 +02:00
parent 7cb691f6f9
commit 7673c1f814

View File

@ -17,7 +17,7 @@ class Orders::OrderService
orders = orders.where(statistic_profile_id: current_user.statistic_profile.id)
end
orders = orders.where.not(state: 'cart') if current_user.member?
orders = orders.order(updated_at: filters[:page].present? ? filters[:sort] : 'DESC')
orders = orders.order(created_at: filters[:page].present? ? filters[:sort] : 'DESC')
orders = orders.page(filters[:page]).per(ORDERS_PER_PAGE) if filters[:page].present?
{
data: orders,