diff --git a/modules/meeting/app/controllers/work_package_meetings_tab_controller.rb b/modules/meeting/app/controllers/work_package_meetings_tab_controller.rb index 5dfe89179aac..2f95ca80ecf8 100644 --- a/modules/meeting/app/controllers/work_package_meetings_tab_controller.rb +++ b/modules/meeting/app/controllers/work_package_meetings_tab_controller.rb @@ -132,7 +132,7 @@ def get_agenda_items_of_work_package(direction) .includes(:meeting) .where(meeting_id: Meeting.not_templated.visible(current_user)) .where(work_package_id: @work_package.id) - .reorder(sort_clause(direction)) + .order(sort_clause(direction)) comparison = direction == :past ? "<" : ">=" agenda_items.where("meetings.start_time + (interval '1 hour' * meetings.duration) #{comparison} ?", Time.zone.now) diff --git a/modules/meeting/app/forms/meeting_agenda_item/meeting_form.rb b/modules/meeting/app/forms/meeting_agenda_item/meeting_form.rb index cd44d1fedb88..1e9778be0623 100644 --- a/modules/meeting/app/forms/meeting_agenda_item/meeting_form.rb +++ b/modules/meeting/app/forms/meeting_agenda_item/meeting_form.rb @@ -45,7 +45,7 @@ class MeetingAgendaItem::MeetingForm < ApplicationForm MeetingAgendaItems::CreateContract .assignable_meetings(User.current) .where("meetings.start_time + (interval '1 hour' * meetings.duration) >= ?", Time.zone.now) - .reorder("meetings.start_time ASC") + .order("meetings.start_time") .includes(:project) .each do |meeting| select.option( diff --git a/modules/meeting/app/models/meeting.rb b/modules/meeting/app/models/meeting.rb index 8d3bf6814a05..265df7658197 100644 --- a/modules/meeting/app/models/meeting.rb +++ b/modules/meeting/app/models/meeting.rb @@ -50,10 +50,6 @@ class Meeting < ApplicationRecord has_many :sections, dependent: :destroy, class_name: "MeetingSection" has_many :agenda_items, dependent: :destroy, class_name: "MeetingAgendaItem" - default_scope do - order("#{Meeting.table_name}.start_time DESC") - end - scope :templated, -> { where(template: true) } scope :not_templated, -> { where(template: false) } diff --git a/modules/meeting/app/models/structured_meeting.rb b/modules/meeting/app/models/structured_meeting.rb index 22a6b59874eb..50399b621409 100644 --- a/modules/meeting/app/models/structured_meeting.rb +++ b/modules/meeting/app/models/structured_meeting.rb @@ -38,7 +38,7 @@ class StructuredMeeting < Meeting def calculate_agenda_item_time_slots current_time = start_time MeetingAgendaItem.transaction do - changed_items = agenda_items.includes(:meeting_section).reorder("meeting_sections.position", :position).map do |top| + changed_items = agenda_items.includes(:meeting_section).order("meeting_sections.position", :position).map do |top| start_time = current_time current_time += top.duration_in_minutes&.minutes || 0.minutes end_time = current_time diff --git a/modules/meeting/spec/features/recurring_meetings/recurring_meeting_crud_spec.rb b/modules/meeting/spec/features/recurring_meetings/recurring_meeting_crud_spec.rb index ad4e95347e54..35291cc7378d 100644 --- a/modules/meeting/spec/features/recurring_meetings/recurring_meeting_crud_spec.rb +++ b/modules/meeting/spec/features/recurring_meetings/recurring_meeting_crud_spec.rb @@ -95,7 +95,7 @@ show_page.create_from_template date: "01/07/2025 01:30 PM" wait_for_reload - expect(page).to have_current_path project_meeting_path(project, Meeting.reorder(id: :asc).last) + expect(page).to have_current_path project_meeting_path(project, Meeting.last) show_page.visit! diff --git a/modules/meeting/spec/features/structured_meetings/structured_meeting_crud_spec.rb b/modules/meeting/spec/features/structured_meetings/structured_meeting_crud_spec.rb index fb52588d6d33..26157cb91054 100644 --- a/modules/meeting/spec/features/structured_meetings/structured_meeting_crud_spec.rb +++ b/modules/meeting/spec/features/structured_meetings/structured_meeting_crud_spec.rb @@ -307,7 +307,7 @@ fill_in "Title", with: "Some title" click_on "Create meeting" - new_meeting = StructuredMeeting.reorder(id: :asc).last + new_meeting = StructuredMeeting.last expect(page).to have_current_path "/projects/#{project.identifier}/meetings/#{new_meeting.id}" # check for copied agenda items