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

WIP: Add details for TimeEntry activities

Mir Bhatiaf8c9dfdf5cf0
diff --git a/app/components/activities/item_component.html.erb b/app/components/activities/item_component.html.erb
index f974f68a834..aea4394666f 100644
--- a/app/components/activities/item_component.html.erb
+++ b/app/components/activities/item_component.html.erb
@@ -1,6 +1,6 @@
<li class="op-activity-list--item">
<div class="op-activity-list--item-title">
- <%= link_to @event.event_title.squish, @event.event_path %>
+ <%= link_to @event.event_title.squish, @event.journal.journable_type == 'TimeEntry' ? "/work_packages/#{@event.journal.journable.work_package_id}" : @event.event_path %>
<%= project_suffix %>
</div>
<%=
diff --git a/app/components/activities/item_component.rb b/app/components/activities/item_component.rb
index b07d57d4474..0ec3da5b834 100644
--- a/app/components/activities/item_component.rb
+++ b/app/components/activities/item_component.rb
@@ -38,6 +38,8 @@ class Activities::ItemComponent < ViewComponent::Base
@current_project = current_project
@display_user = display_user
@activity_page = activity_page
+
+ binding.pry
end
def project_suffix
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 398c1b43019..7c2c9eeb82d 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -989,7 +989,7 @@ en:
created_by_on_time_entry: "time logged by %{user} on %{datetime}"
created_on: "created on %{datetime}"
updated_by_on: "updated by %{user} on %{datetime}"
- updated_by_on_time_entry: "time log updated by %{user} on %{datetime}"
+ updated_by_on_time_entry: "time logged updated by %{user} on %{datetime}"
updated_on: "updated on %{datetime}"
parent_without_of: "Subproject"
parent_no_longer: "No longer subproject of"
diff --git a/modules/costs/app/models/time_entry.rb b/modules/costs/app/models/time_entry.rb
index 27e8dd44a39..615ca1a5d3e 100644
--- a/modules/costs/app/models/time_entry.rb
+++ b/modules/costs/app/models/time_entry.rb
@@ -33,7 +33,7 @@ class TimeEntry < ApplicationRecord
belongs_to :work_package
belongs_to :user
belongs_to :activity, class_name: 'TimeEntryActivity'
- belongs_to :rate, -> { where(type: %w[HourlyRate DefaultHourlyRate]) }, class_name: 'Rate'
+belongs_to :rate, -> { where(type: %w[HourlyRate DefaultHourlyRate]) }, class_name: 'Rate'
belongs_to :logged_by, class_name: 'User'
acts_as_customizable
@@ -57,6 +57,9 @@ class TimeEntry < ApplicationRecord
# TODO: move into service
before_save :update_costs
+ register_journal_formatted_fields(:decimal, 'hours')
+ register_journal_formatted_fields(:named_association, 'user_id')
+
def self.update_all(updates, conditions = nil, options = {})
# instead of a update_all, perform an individual update during work_package#move
# to trigger the update of the costs based on new rates