mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-01-05 20:46:14 +01:00
(feat) default order for the spaces/trainings list is set to descending by created_at
This commit is contained in:
parent
7dcfccb9ef
commit
adeb3acd79
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
## Next release
|
## Next release
|
||||||
|
|
||||||
|
- Improvement: default order for the spaces/trainings list is set to descending by created_at
|
||||||
|
|
||||||
## v6.3.35 2024 November 13
|
## v6.3.35 2024 November 13
|
||||||
|
|
||||||
- Fix a bug: unable to run rails db:migrate if the database is empty
|
- Fix a bug: unable to run rails db:migrate if the database is empty
|
||||||
|
@ -7,7 +7,7 @@ class API::SpacesController < API::APIController
|
|||||||
respond_to :json
|
respond_to :json
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@spaces = Space.includes(:space_image, :machines).where(deleted_at: nil)
|
@spaces = Space.includes(:space_image, :machines).where(deleted_at: nil).order(:created_at)
|
||||||
@spaces_indexed_with_parent = @spaces.index_with { |space| @spaces.find { |s| s.id == space.parent_id } }
|
@spaces_indexed_with_parent = @spaces.index_with { |space| @spaces.find { |s| s.id == space.parent_id } }
|
||||||
@spaces_grouped_by_parent_id = @spaces.group_by(&:parent_id)
|
@spaces_grouped_by_parent_id = @spaces.group_by(&:parent_id)
|
||||||
end
|
end
|
||||||
|
@ -5,7 +5,7 @@ class TrainingService
|
|||||||
class << self
|
class << self
|
||||||
# @param filters [ActionController::Parameters]
|
# @param filters [ActionController::Parameters]
|
||||||
def list(filters)
|
def list(filters)
|
||||||
trainings = Training.includes(:training_image, :plans, :machines)
|
trainings = Training.includes(:training_image, :plans, :machines).order(:created_at)
|
||||||
|
|
||||||
trainings = filter_by_disabled(trainings, filters)
|
trainings = filter_by_disabled(trainings, filters)
|
||||||
trainings = filter_by_public_page(trainings, filters)
|
trainings = filter_by_public_page(trainings, filters)
|
||||||
|
Loading…
Reference in New Issue
Block a user