Skip to content

Commit

Permalink
Rename reporting_date to reporting_end_date
Browse files Browse the repository at this point in the history
  • Loading branch information
inulty-dfe committed May 14, 2024
1 parent 5a71ff8 commit 6d6aa59
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class ProviderRecruitmentPerformanceReport < ApplicationRecord
belongs_to :provider
validates :cycle_week, :publication_date, presence: true

def reporting_date
def reporting_end_date
CycleTimetable.cycle_week_date_range(cycle_week).last.to_date
end
end
Expand Down
2 changes: 1 addition & 1 deletion app/views/provider_interface/reports/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<% end %>
<% report = provider.performance_reports.last %>
<ul class="govuk-list govuk-list--spaced">
<li><%= govuk_link_to("Weekly report for week ending #{report.reporting_date.to_fs(:govuk_date)}", provider_interface_reports_provider_recruitment_performance_report_path(provider.id)) %></li>
<li><%= govuk_link_to("Weekly report for week ending #{report.reporting_end_date.to_fs(:govuk_date)}", provider_interface_reports_provider_recruitment_performance_report_path(provider.id)) %></li>
</ul>
<% end %>
<% else %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
it { is_expected.to validate_presence_of :cycle_week }
end

describe '#reporting_date' do
describe '#reporting_end_date' do
it 'returns the date of the last day of the cycle week', time: Time.zone.local(2024, 6, 6) do
report = create(:provider_recruitment_performance_report, cycle_week: 35)
expect(report.reporting_date).to eq(Date.new(2024, 6, 2))
expect(report.reporting_end_date).to eq(Date.new(2024, 6, 2))
end
end
end

0 comments on commit 6d6aa59

Please sign in to comment.