From b9a2e491f71eafc8d181313297c51a827a1f6359 Mon Sep 17 00:00:00 2001 From: Joseph Dudley Date: Tue, 26 Nov 2019 15:39:16 +0000 Subject: [PATCH] Users can debrief early Addresses #209 --- app/views/iterations/show.html.erb | 9 +++++++-- test/system/debriefs_test.rb | 6 ++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/app/views/iterations/show.html.erb b/app/views/iterations/show.html.erb index 2b67701..4136962 100644 --- a/app/views/iterations/show.html.erb +++ b/app/views/iterations/show.html.erb @@ -42,7 +42,7 @@
Every two weeks <% if policy(@iteration).create? %> - (Only visible to project contributors) +
(Only visible to project contributors) <% end %>
@@ -74,7 +74,12 @@ Debrief
- Due <%= with_default(@iteration.planned_debrief_date, formatter: :friendly_date) %> + Due <%= with_default(@iteration.planned_debrief_date, formatter: :friendly_date) %>
+ <% if @iteration.planned_debrief_date.future? %> + Finished learning? <%= link_to 'Debrief early', new_project_iteration_debrief_path(@project, @iteration), class: 'link' %> + <% else %> + Overdue! <%= link_to 'Add a debrief', new_project_iteration_debrief_path(@project, @iteration), class: 'link' %> + <% end %>
<% else %>
diff --git a/test/system/debriefs_test.rb b/test/system/debriefs_test.rb index 2b6194b..7e1f506 100644 --- a/test/system/debriefs_test.rb +++ b/test/system/debriefs_test.rb @@ -21,6 +21,12 @@ class DebriefsTest < ApplicationSystemTestCase visit new_project_iteration_debrief_path(@project, @iteration) assert_text('New debrief') end + + test 'contributors can debrief early' do + Membership.last.update(role: :contributor) + visit project_iteration_path(@project, @iteration) + assert_text('Debrief early') + end test 'contributors can view debriefs' do @debrief.save!