Feature #10314

Make the only enabled activity in a project the default one for time entry

Added by Fayez Naccache about 9 years ago. Updated almost 9 years ago.

Status:NewStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Time tracking
Target version:-
Resolution:

Description

Example: In administration, if we have 4 activities (A, B, C, D) and A by default,
If activity C is the only one we can set in a project, so when submitting time entry we have to choose C as activity although it is the only choice in the combobox.

The field is compulsory so it is disturbing to set C as activity wherever we input time.

History

#1 Updated by Bo Hansen almost 9 years ago

I agree. Maybe the best solution would be to allow setting a default activity per project?

Here's a simple patch which removes blank field if only one activity is present:

diff --git a/app/helpers/timelog_helper.rb b/app/helpers/timelog_helper.rb
index 6be6c58..04ac1bc 100644
--- a/app/helpers/timelog_helper.rb
+++ b/app/helpers/timelog_helper.rb
@@ -49,7 +49,8 @@ module TimelogHelper
     if time_entry && time_entry.activity && !time_entry.activity.active?
       collection << [ "--- #{l(:actionview_instancetag_blank_option)} ---", '' ]
     else
-      collection << [ "--- #{l(:actionview_instancetag_blank_option)} ---", '' ] unless activities.detect(&:is_default)
+      collection << [ "--- #{l(:actionview_instancetag_blank_option)} ---", '' ] unless activities.detect(&:is_default) ||
+                                                                                        activities.count == 1
     end
     activities.each { |a| collection << [a.name, a.id] }
     collection

#2 Updated by Etienne Massip almost 9 years ago

  • Category changed from Issues to Time tracking

Also available in: Atom PDF