Browse Source

Tweak Dashboard upcoming-query

...to keep an activity until it's ended, if available.
Maarten van den Berg 7 years ago
parent
commit
0d2ec67f8f
1 changed files with 1 additions and 1 deletions
  1. 1 1
      app/controllers/dashboard_controller.rb

+ 1 - 1
app/controllers/dashboard_controller.rb

@@ -5,7 +5,7 @@ class DashboardController < ApplicationController
5 5
     @upcoming = current_person
6 6
       .participants
7 7
       .joins(:activity)
8
-      .where('activities.start >= ?', DateTime.now)
8
+      .where('activities.end >= ? OR (activities.end IS NULL AND activities.start >= ?)', DateTime.now, DateTime.now)
9 9
       .order('activities.start ASC')
10 10
       .paginate(page: params[:upage], per_page: 10)
11 11
     @user_organized = @upcoming