diff --git a/app/models/my_module.rb b/app/models/my_module.rb index 10b4fbb5e..f8d726537 100644 --- a/app/models/my_module.rb +++ b/app/models/my_module.rb @@ -78,6 +78,7 @@ class MyModule < ApplicationRecord Time.current.utc + 1.day) end) scope :workflow_ordered, -> { order(workflow_order: :asc) } + scope :uncomplete, -> { where(state: 'uncompleted') } # A module takes this much space in canvas (x, y) in database WIDTH = 30 diff --git a/app/models/project.rb b/app/models/project.rb index 76ca7935b..2d5eedf3c 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -242,7 +242,7 @@ class Project < ApplicationRecord def notifications_count(user) res = 0 assigned_modules(user).find_each do |t| - res += 1 if t.is_overdue? || t.is_one_day_prior? + res += 1 if (t.is_overdue? || t.is_one_day_prior?) && !t.completed? end res end diff --git a/app/services/projects_overview_service.rb b/app/services/projects_overview_service.rb index a189488d4..082c0b589 100644 --- a/app/services/projects_overview_service.rb +++ b/app/services/projects_overview_service.rb @@ -65,6 +65,7 @@ class ProjectsOverviewService def fetch_records due_modules = MyModule.active + .uncomplete .overdue .or(MyModule.one_day_prior) .distinct diff --git a/app/views/projects/_notifications.html.erb b/app/views/projects/_notifications.html.erb index 78fba5cb7..590eaea47 100644 --- a/app/views/projects/_notifications.html.erb +++ b/app/views/projects/_notifications.html.erb @@ -3,7 +3,7 @@