Commit 63e59bd2 by Nguyen Vo Huy Hoang

Update report and fixbug

parent eb548d7e
Pipeline #1553 canceled with stages
in 0 seconds
......@@ -25,6 +25,8 @@ module TimelogHelper
def activity_collection_for_select_options(time_entry=nil, project=nil)
project ||= time_entry.try(:project)
project ||= @project
issue = @issue
issue ||= time_entry.issue
if project.nil?
activities = TimeEntryActivity.shared.active
else
......@@ -37,24 +39,24 @@ module TimelogHelper
else
collection << [ "--- #{l(:actionview_instancetag_blank_option)} ---", '' ] unless activities.detect(&:is_default)
end
collection += case @issue&.tracker&.name
collection += case issue&.tracker&.name
when 'Task'
if @issue.is_task_with_target?
if issue.is_task_with_target?
activities.collect { |a| [a.name, a.id] if a.is_task_with_target? }
elsif @issue.parent&.tracker&.name == 'User story'
activities.collect { |a| [a.name, a.id] if a.name[0,1].to_i != 0 && @issue.subject.include?(a.name[0, 2]) }
elsif issue.parent&.tracker&.name == 'User story'
activities.collect { |a| [a.name, a.id] if a.name[0,1].to_i != 0 && issue.subject.include?(a.name[0, 2]) }
else
activities.collect { |a| [a.name, a.id] if a.is_activity_for_task? }
end
when 'Test'
if @issue.parent&.tracker&.name == 'User story'
activities.collect { |a| [a.name, a.id] if a.name[0,1].to_i != 0 && @issue.subject.include?(a.name[0, 2]) }
if issue.parent&.tracker&.name == 'User story'
activities.collect { |a| [a.name, a.id] if a.name[0,1].to_i != 0 && issue.subject.include?(a.name[0, 2]) }
else
activities.collect { |a| [a.name, a.id] if a.is_activity_for_task? }
end
when 'Bug'
if @issue.parent&.tracker&.name == 'User story'
activities.collect { |a| [a.name, a.id] if a.name[0,1].to_i != 0 && @issue.subject.include?(a.name[0, 2]) }
if issue.parent&.tracker&.name == 'User story'
activities.collect { |a| [a.name, a.id] if a.name[0,1].to_i != 0 && issue.subject.include?(a.name[0, 2]) }
else
activities.collect { |a| [a.name, a.id] if a.is_activity_for_task? }
end
......
......@@ -144,7 +144,7 @@
</div>
<% end %>
<% if @issue.tracker.name != 'User story' && @safe_attributes.include?('estimated_hours') %>
<% if @safe_attributes.include?('estimated_hours') && !@issue.nil? && @issue.tracker.name != 'User story' %>
<li><%= context_menu_link "#{l(:field_estimated_hours)}", '#', :onclick => "showModal('bulk_update_estimation', '350px'); return false;" %></li>
<div id="bulk_update_estimation" style="display:none;">
<h3 class="title"><%= "#{l(:field_estimated_hours)}" %></h3>
......@@ -152,7 +152,11 @@
<% if @safe_attributes.include?('estimated_hours') %>
<p>
<label for='issue_estimated_hours'><%= l(:field_estimated_hours) %></label>
<%= text_field_tag 'issue[estimated_hours]', '', :value => (@issue ? @issue.estimated_hours : nil), :size => 10 %>
<%= text_field_tag 'issue[estimated_hours]', '', :value => (@issue ? @issue.estimated_hours : nil), :size => 21 %>
</p>
<p>
<label for='issue_notes' style='margin-right: 58px;'><%= l(:field_notes) %></label>
<%= text_area_tag 'issue[notes]', '', :value => nil, rows: 5, cols: 20 %>
</p>
<% end %>
<p class="buttons">
......
......@@ -8,7 +8,7 @@
<% total = 0 -%>
<% @report.periods.each do |period| -%>
<% sum = sum_hours(select_hours(hours_for_value, @report.columns, period.to_s)); total += sum -%>
<td class="hours"><%= html_hours(format_hours(sum)) if sum > 0 %></td>
<td class="hours" style="<%= 'color: red;' if sum != 8 && @report.columns == 'day' && level == 0 %>"><%= if sum > 0 then html_hours(format_hours(sum)) elsif level == 0 then 'N/A' end%></td>
<% end -%>
<td class="hours"><%= html_hours(format_hours(total)) if total > 0 %></td>
</tr>
......
......@@ -134,7 +134,7 @@ prj_pack[:odr_issues].each do |issue_pack|
</td>
<% end %>
<td>
<%= select_tag "new_time_entry["+issue_id.to_s+"][0][activity_id]", options_for_select(activities,activity_default) %>
<%= select_tag "new_time_entry["+issue_id.to_s+"][0][activity_id]", options_for_select(activities.sort_by { |w| issue.subject.include?(w[0][0,2]) ? 0 : 1},activity_default) %>
</td>
<td>
<% if issue.new_statuses_allowed_to(User.current).length == 0 then %>
......@@ -229,7 +229,7 @@ prj_pack[:odr_issues].each do |issue_pack|
</td>
<% end %>
<td>
<%= select_tag "time_entry["+hour_id.to_s+"][activity_id]", options_for_select(activities, hour.activity_id), :required => true %>
<%= select_tag "time_entry["+hour_id.to_s+"][activity_id]", options_for_select(activities.sort_by { |w| issue.subject.include?(w[0][0,2]) ? 0 : 1}, hour.activity_id), :required => true %>
</td>
<td>
<% if issue.new_statuses_allowed_to(User.current).length == 0 then %>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment