Skip to content

Commit

Permalink
Merge pull request #7340 from fjordllc/bug/report-learning-times-exte…
Browse files Browse the repository at this point in the history
…nsion-over-month

日報の学習時間が月を跨いだ時にも、(翌日)が表示されるようにする
  • Loading branch information
komagata authored Feb 15, 2024
2 parents b146b7b + 6a1fdec commit e21a1f7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/views/reports/_learning_times.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
ul.learning-times__items
- @report.learning_times.each do |learning_time|
li.learning-times__item
| #{l learning_time.started_at, format: :time_only}#{'(翌日)' if learning_time.started_at.day < learning_time.finished_at.day}#{l learning_time.finished_at, format: :time_only}
| #{l learning_time.started_at, format: :time_only}#{'(翌日)' if learning_time.started_at.to_date < learning_time.finished_at.to_date}#{l learning_time.finished_at, format: :time_only}
17 changes: 17 additions & 0 deletions test/system/reports_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,23 @@ class ReportsTest < ApplicationSystemTestCase
assert_text '00:30 〜 02:30'
end

test 'learning times when carrying over next month' do
visit_with_auth '/reports/new', 'komagata'
fill_in 'report_title', with: 'テスト日報'
fill_in 'report_description', with: '学習時間が月を跨いでいるパターン'
fill_in 'report_reported_on', with: Date.new(2024, 1, 31)

all('.learning-time')[0].all('.learning-time__started-at select')[0].select('22')
all('.learning-time')[0].all('.learning-time__started-at select')[1].select('00')
all('.learning-time')[0].all('.learning-time__finished-at select')[0].select('00')
all('.learning-time')[0].all('.learning-time__finished-at select')[1].select('00')

click_button '提出'

assert_text "2時間\n"
assert_text '22:00 〜 (翌日)00:00'
end

test 'learning times order' do
visit_with_auth '/reports/new', 'komagata'
fill_in 'report_title', with: 'テスト日報'
Expand Down

0 comments on commit e21a1f7

Please sign in to comment.