Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Meeting model scope fixes (#17907)

Alexander Brandon Coles474eaf0949a5
diff --git a/modules/meeting/app/models/meeting.rb b/modules/meeting/app/models/meeting.rb
index 7c0878798d5..3052b993d9e 100644
--- a/modules/meeting/app/models/meeting.rb
+++ b/modules/meeting/app/models/meeting.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) the OpenProject GmbH
@@ -54,14 +56,13 @@ class Meeting < ApplicationRecord
scope :templated, -> { where(template: true) }
scope :not_templated, -> { where(template: false) }
- scope :cancelled, -> { where(state: :cancelled) }
- scope :not_cancelled, -> { where.not(id: cancelled) }
+ scope :not_cancelled, -> { where.not.cancelled }
scope :not_recurring, -> { where(recurring_meeting_id: nil) }
- scope :recurring, -> { where.not(id: not_recurring) }
+ scope :recurring, -> { where.not(recurring_meeting_id: nil) }
- scope :from_tomorrow, -> { where(["start_time >= ?", Date.tomorrow.beginning_of_day]) }
- scope :from_today, -> { where(["start_time >= ?", Time.zone.today.beginning_of_day]) }
+ scope :from_tomorrow, -> { where(start_time: Date.tomorrow.beginning_of_day..) }
+ scope :from_today, -> { where(start_time: Time.zone.today.beginning_of_day..) }
scope :upcoming, -> { where("start_time + (interval '1 hour' * duration) >= ?", Time.current) }
scope :past, -> { where("start_time + (interval '1 hour' * duration) < ?", Time.current) }