Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 1.3.1

- Make timer session comments optional

# 0.1.1

- Add feedback for overlapping time entries.
Expand Down
8 changes: 7 additions & 1 deletion app/components/timer_session_entry_component.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@
<br>
<% end %>
</td>
<td class="w-20"><%= timer_session_entry.comments %></td>
<td class="w-20">
<% if timer_session_entry.comments.present? %>
<%= timer_session_entry.comments %>
<% else %>
<i><%= t(:no_comment) %></i>
<% end %>
</td>
<td><%= timer_session_entry.formated_session_time %></td>
<td><%= format_worked_hours(timer_session_entry.recorded_hours) %></td>
<td class="timer-session-table-actions">
Expand Down
5 changes: 0 additions & 5 deletions app/models/finished_timer_session_validator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ def validate(record)
@record = record

validate_start_and_end_present
validate_comment_present
validate_minimal_duration
validate_day_limit
validate_session_limit
Expand All @@ -25,10 +24,6 @@ def validate_start_and_end_present
@record.errors.add(:timer_end, :blank) if @record.timer_end.blank?
end

def validate_comment_present
@record.errors.add(:comments, :blank) if @record.comments.blank?
end

def validate_issues_selected
@record.errors.add(:issue_id, :no_selection) if @record.issues.count.zero?
end
Expand Down
1 change: 1 addition & 0 deletions config/locales/de.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ de:
no_selection: mindestens ein Issue muss gewählt sein
invalid: ein oder mehrere Issues müssen gewählt sein
button_continue: Weitermachen
no_comment: Kein Kommentar
timer_sessions:
filters:
filter: Filter
Expand Down
1 change: 1 addition & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ en:
no_selection: at least one issue must be selected
invalid: one or more issues do not exist
button_continue: Continue
no_comment: No comment
timer_sessions:
filters:
filter: Filter
Expand Down
2 changes: 1 addition & 1 deletion test/functional/time_tracker_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def setup
timer_start: Time.zone.now,
timer_end: Time.zone.now + 1.hours,
comments: nil,
issue_ids: ['1']
issue_ids: []
} }, xhr: true
assert_response 422
end
Expand Down
8 changes: 4 additions & 4 deletions test/system/timer_sessions_management_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@ class TimerSessionsManagementTest < ApplicationSystemTestCase
login_user('admin', 'admin')
User.current = User.find(1)
# User.current.preference.update(time_zone: 'Tijuana')
@timer_sessions = FactoryBot.create_list(:timer_session, 3,
:with_issues,
:with_time_entries,
user: User.current)
@timer_sessions = FactoryBot.create_list(:timer_session, 3, :with_issues, :with_time_entries, user: User.current)
@timer_sessions.first.update!(comments: nil)
visit timer_sessions_path
end

test 'index' do
@timer_sessions.each do |timer_session|
assert has_content?(timer_session.comments)
end

assert has_content?(I18n.t(:no_comment))
end

test 'index - does not raise error when rendering time entries on same date' do
Expand Down
2 changes: 1 addition & 1 deletion test/unit/timer_session_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class TimerSessionTest < ActiveSupport::TestCase
test 'comment_present' do
assert @timer_session.valid?
@timer_session.comments = nil
assert_not @timer_session.valid?
assert @timer_session.valid?
end

test 'issues_selected' do
Expand Down