Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Show "full-day" events correctly

Klaus Zanders07ea7f8a0d73
diff --git a/modules/costs/app/components/time_tracking/time_entry_event_component.html.erb b/modules/costs/app/components/time_tracking/time_entry_event_component.html.erb
index fc78640574a..463dccf5257 100644
--- a/modules/costs/app/components/time_tracking/time_entry_event_component.html.erb
+++ b/modules/costs/app/components/time_tracking/time_entry_event_component.html.erb
@@ -2,8 +2,13 @@
<div class="calendar-time-entry-event--content">
<div class="calendar-time-entry-event-content-dates">
- <%= time_entry.start_timestamp.strftime("%H:%M") %>-<%= time_entry.end_timestamp.strftime("%H:%M") %>
- (<%= time_entry.hours %>)
+ <%= l(time_entry.spent_on) %>
+ <%- if time_entry.has_start_and_end_time? %>
+ <%= time_entry.start_timestamp.strftime("%H:%M") %>-<%= time_entry.end_timestamp.strftime("%H:%M") %>
+ (<%= time_entry.hours %>)
+ <%- else %>
+ <%= time_entry.hours %>)
+ <%- end %>
</div>
<div class="calendar-time-entry-event--content-subject-line"><%= time_entry.work_package.subject %></div>
<div class="calendar-time-entry-event--content-project-name"><%= time_entry.project.name %></div>
diff --git a/modules/costs/app/models/time_entry.rb b/modules/costs/app/models/time_entry.rb
index c0ab8b203b5..552d007f068 100644
--- a/modules/costs/app/models/time_entry.rb
+++ b/modules/costs/app/models/time_entry.rb
@@ -147,6 +147,10 @@ class TimeEntry < ApplicationRecord
(user_id == usr.id && usr.allowed_in_project?(:view_own_hourly_rate, project))
end
+ def has_start_and_end_time?
+ start_time.present?
+ end
+
def start_timestamp # rubocop:disable Metrics/AbcSize
return nil if start_time.blank?
return nil if time_zone.blank?