Skip to content

Commit

Permalink
OTWO-7286 Show 'Report Outdated' button when no analysis (#1795)
Browse files Browse the repository at this point in the history
  • Loading branch information
Priya5 authored Jul 30, 2024
1 parent 67df8b4 commit 65052d3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions app/models/project.rb
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ def after_undo(current_user)
remove_enlistments(current_user) if deleted?
end

def analysis_updated_or_project_created_time
best_analysis.nil? ? created_at : best_analysis.updated_on
end

class << self
def search_and_sort(query, sort, page)
sort_by = sort == 'relevance' ? nil : "by_#{sort}"
Expand Down
2 changes: 1 addition & 1 deletion app/views/projects/show/_header.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
- if current_user_is_admin?
|
= link_to bootstrap_icon('icon-legal', t('projects.header.job')), oh_admin_project_jobs_path(@project)
- if !current_user.nil? && !@project.best_analysis.nil? && @project.best_analysis.updated_on < 1.week.ago
- if current_user.present? && @project.analysis_updated_or_project_created_time < 1.week.ago
|
= link_to bootstrap_icon('icon-lock', t('projects.header.outdated')), report_outdated_project_path(@project), method: :put
.pull-right.no_padding#widgets
Expand Down

0 comments on commit 65052d3

Please sign in to comment.