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

[32811] Remove 24h time entries time limit for now

Oliver Günther32c9b9e3ff69
diff --git a/app/contracts/time_entries/base_contract.rb b/app/contracts/time_entries/base_contract.rb
index d72e774280a..140678c473e 100644
--- a/app/contracts/time_entries/base_contract.rb
+++ b/app/contracts/time_entries/base_contract.rb
@@ -56,9 +56,7 @@ module TimeEntries
attribute :activity_id do
validate_activity_active
end
- attribute :hours do
- validate_day_limit
- end
+ attribute :hours
attribute :comments
attribute_alias :comments, :comment
@@ -98,14 +96,6 @@ module TimeEntries
errors.add :activity_id, :inclusion if model.activity_id && !assignable_activities.exists?(model.activity_id)
end
- def validate_day_limit
- return unless model.spent_on && model.hours
-
- if hours_extending_day_limit?
- errors.add :hours, :day_limit
- end
- end
-
def work_package_invisible?
model.work_package.nil? || !model.work_package.visible?(user)
end
@@ -113,11 +103,5 @@ module TimeEntries
def work_package_not_in_project?
model.work_package && model.project != model.work_package.project
end
-
- def hours_extending_day_limit?
- existing_sum = TimeEntry::Scopes::OfUserAndDay.fetch(model.user, model.spent_on, excluding: model).sum(:hours)
-
- existing_sum + model.hours > 24
- end
end
end
diff --git a/spec/contracts/time_entries/shared_contract_examples.rb b/spec/contracts/time_entries/shared_contract_examples.rb
index 3f4307acb0d..9adb4868eb8 100644
--- a/spec/contracts/time_entries/shared_contract_examples.rb
+++ b/spec/contracts/time_entries/shared_contract_examples.rb
@@ -205,8 +205,8 @@ shared_examples_for 'time entry contract' do
context 'if more than 24 hours are booked for a day' do
let(:time_entry_day_sum) { 24 - time_entry_hours + 1 }
- it 'is invalid' do
- expect_valid(false, hours: %i(day_limit))
+ it 'is valid' do
+ expect_valid(true)
end
end