Feature #19885
closedRaise time entries comments limit to 1024
Added by Future Link Corporation pkgsrc team about 9 years ago. Updated almost 9 years ago.
0%
Description
See: source:/trunk/app/models/time_entry.rb#L42
The comments
field in the time_entries
table is defined as having a length of 1024 characters:
Click to expand @time_entries@ table definition...Click to expand @time_entries@ table definition...
mysql> DESCRIBE time_entries; +-------------+---------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +-------------+---------------+------+-----+---------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | project_id | int(11) | NO | MUL | NULL | | | user_id | int(11) | NO | MUL | NULL | | | issue_id | int(11) | YES | MUL | NULL | | | hours | float | NO | | NULL | | | comments | varchar(1024) | YES | | NULL | | | activity_id | int(11) | NO | MUL | NULL | | | spent_on | date | NO | | NULL | | | tyear | int(11) | NO | | NULL | | | tmonth | int(11) | NO | | NULL | | | tweek | int(11) | NO | | NULL | | | created_on | datetime | NO | MUL | NULL | | | updated_on | datetime | NO | | NULL | | +-------------+---------------+------+-----+---------+----------------+ 13 rows in set (0.01 sec)
Yet, user comments are truncated at 255:
Click to expand patch...Click to expand patch...
--- app/models/time_entry.rb.orig 2015-05-17 13:01:37.000000000 -0400 +++ app/models/time_entry.rb 2015-05-19 13:39:52.875843900 -0400 @@ -37,9 +37,9 @@ :author_key => :user_id, :scope => joins(:project).preload(:project) - validates_presence_of :user_id, :activity_id, :project_id, :hours, :spent_on + validates_presence_of :user_id, :activity_id, :project_id, :hours, :spent_on, :comments validates_numericality_of :hours, :allow_nil => true, :message => :invalid - validates_length_of :comments, :maximum => 255, :allow_nil => true + validates_length_of :comments, :maximum => 1024, :allow_nil => false validates :spent_on, :date => true before_validation :set_project_if_nil validate :validate_time_entry
Let's not do that. :)
Note: This patch (partly) makes the comment field mandatory. That might not be what you want. It would be nice to have a way to require this field without patching the application though. :)
Related issues
Updated by Future Link Corporation pkgsrc team about 9 years ago
- Copied to Feature #19886: Raise wiki edits comments limit to 1024 added
Updated by Future Link Corporation pkgsrc team about 9 years ago
Here is a patch for source:/trunk/app/views/timelog/_form.html.erb as well:
Click to expand patch...Click to expand patch...
--- app/views/timelog/_form.html.erb.orig 2015-05-17 13:01:37.000000000 -0400 +++ app/views/timelog/_form.html.erb 2015-05-19 13:45:35.876821092 -0400 @@ -17,7 +17,7 @@ </p> <p><%= f.text_field :spent_on, :size => 10, :required => true %><%= calendar_for('time_entry_spent_on') %></p> <p><%= f.text_field :hours, :size => 6, :required => true %></p> - <p><%= f.text_field :comments, :size => 100, :maxlength => 255 %></p> + <p><%= f.text_field :comments, :size => 100, :required => true, :maxlength => 1024 %></p> <p><%= f.select :activity_id, activity_collection_for_select_options(@time_entry), :required => true %></p> <% @time_entry.custom_field_values.each do |value| %> <p><%= custom_field_tag_with_label :time_entry, value %></p>
Again, noting that we're making the field mandatory, which might not be what you want (POLA).
Updated by Toshi MARUYAMA about 9 years ago
- Status changed from New to Needs feedback
"comments" of "time_entries" is defined as 255.
source:tags/3.0.3/db/migrate/032_create_time_entries.rb#L8
I think you changed manually.
Updated by Future Link Corporation pkgsrc team about 9 years ago
Yes, you are correct. We did. Can that field be made longer by default? The length of 255 characters is rather short and doesn't allow for detailed time entries.
Updated by Future Link Corporation pkgsrc team about 9 years ago
The diff you referenced doesn't apply to the time entries comment
field.
Updated by Toshi MARUYAMA about 9 years ago
Updated by Future Link Corporation pkgsrc team about 9 years ago
Updated by Toshi MARUYAMA about 9 years ago
- Tracker changed from Patch to Feature
- Status changed from Needs feedback to New
Because there is no completed patch, I change tracker.
Updated by Jean-Philippe Lang almost 9 years ago
- Subject changed from Comment field length for time entries is unnecessarily short to Raise time entries comments limit to 1024
- Status changed from New to Closed
- Assignee set to Jean-Philippe Lang
- Resolution set to Fixed
Limit raised to 1024 in r14621.