Skip to content

Commit

Permalink
Merge pull request #7769 from fjordllc/bug/incorrect-wip-report-submi…
Browse files Browse the repository at this point in the history
…ssion-status-message

WIP状態の日報を提出する際に入力内容にエラーがある場合のバグを解消
  • Loading branch information
komagata authored May 28, 2024
2 parents 4bad428 + e0de854 commit d4be2c2
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/controllers/reports_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ def create
end

def update
before_wip_status = @report.wip
set_wip
@report.practice_ids = nil if params[:report][:practice_ids].nil?
@report.assign_attributes(report_params)
Expand All @@ -66,6 +67,7 @@ def update
Newspaper.publish(:report_save, { report: @report })
redirect_to redirect_url(@report), notice: notice_message(@report), flash: flash_contents(@report)
else
@report.wip = before_wip_status
render :edit
end
end
Expand Down
19 changes: 19 additions & 0 deletions test/system/reports_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -735,4 +735,23 @@ def wait_for_watch_change
end
assert_equal '.file-input', find('textarea.a-text-input')['data-input']
end

test 'submit wip report with error' do
report = reports(:report9)
visit_with_auth "/reports/#{report.id}", 'sotugyou'

click_link '内容修正'
uncheck '学習時間は無し', allow_label_click: true
click_link '学習時間追加'

first('.learning-time').all('.learning-time__started-at select')[0].select('07')
first('.learning-time').all('.learning-time__started-at select')[1].select('30')
first('.learning-time').all('.learning-time__finished-at select')[0].select('07')
first('.learning-time').all('.learning-time__finished-at select')[1].select('30')

click_button '提出'
assert_text '学習時間は不正な値です'
assert_no_text 'この日報はすでに提出済みです。'
assert_button '提出'
end
end

0 comments on commit d4be2c2

Please sign in to comment.