|
@@ -297,6 +297,22 @@ class Activity < ApplicationRecord
|
297
|
297
|
ps.each(&:send_subgroup_notification)
|
298
|
298
|
end
|
299
|
299
|
|
|
300
|
+ # @return [Activity] the Activity that will start after this Activity. `nil` if no such Activity exists.
|
|
301
|
+ def next_in_group
|
|
302
|
+ group.activities
|
|
303
|
+ .where('start > ?', start)
|
|
304
|
+ .order(start: :asc)
|
|
305
|
+ .first
|
|
306
|
+ end
|
|
307
|
+
|
|
308
|
+ # @return [Activity] the Activity that started before this Activity. `nil` if no such Activity exists.
|
|
309
|
+ def previous_in_group
|
|
310
|
+ group.activities
|
|
311
|
+ .where('start < ?', start)
|
|
312
|
+ .order(start: :desc)
|
|
313
|
+ .first
|
|
314
|
+ end
|
|
315
|
+
|
300
|
316
|
private
|
301
|
317
|
|
302
|
318
|
# Assert that the deadline for participants to change the deadline, if any,
|