Skip to content

Commit

Permalink
cambios tareas padres ahora se muestran
Browse files Browse the repository at this point in the history
  • Loading branch information
Rafael Calleja committed Jul 22, 2011
1 parent 5711d9a commit d897118
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 26 deletions.
Binary file not shown.
Binary file not shown.
7 changes: 4 additions & 3 deletions redmine_dnoise_workload/app/views/work_load/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pos_background = (16 * (8 - @gantt.date_from.to_date.cwday ))-1
</div>
</div>
<div class="header_content_bottom">
<% form_tag({:controller => 'work_load', :action => 'show', :project_id => @project, :month => params[:month], :year => params[:year], :months => params[:months]}, :method => :get, :id => 'query_form') do %>
<% form_tag({:controller => 'work_load', :action => 'show', :project_id => @project, :month => params[:month], :year => params[:year], :months => params[:months]}, :method => :get, :id => 'query_form', :class => 'content_form') do %>
<div class="header_content_bottom_left">
<div class="buttons">
<label>Rango / Range</label>
Expand Down Expand Up @@ -223,13 +223,13 @@ end %>
sum = 0
TimeEntry.find(:all, :conditions => ["issue_id = #{issue.id}"]).each do |h| sum+=h.hours end
total_rem_by_user[user.id] = sum
calculos[issue.id] = CalculosTareas.new(issue.id, issue.start_date, issue.due_date, issue.estimated_hours, sum, issue.done_ratio, issue.priority_id, @fecha_actual)
calculos[issue.id] = CalculosTareas.new(issue.id, issue.start_date, issue.due_date, issue.estimated_hours, sum, issue.done_ratio, issue.priority_id, @fecha_actual, @utils.issue_is_parent(issue) )
workload_by_user[user.id].push(calculos[issue.id].dias_y_time_restantes)
len = 37 - ( issue.id.to_s.length - 1 )
if (params[:show_issues] == "1") then %>

<div class="user_each_hours" id="_<%=issue.id%>">
<span class="tarea<%=calculos[issue.id].getTiming()%>"><a href="/issues/<%=issue.id%>" title="nombre de la tarea relativa a #<%=issue.id%>" class="tareas">#<%=issue.id%></a>&nbsp;<%=(issue.subject.length > len ) ? issue.subject[0, len] : issue.subject%></span>
<span class="<%= (@utils.issue_is_parent(issue)) ? 'tarea5' : "tarea#{calculos[issue.id].getTiming()}" %>"><a href="/issues/<%=issue.id%>" title="#<%=issue.id%>" class="tareas">#<%=issue.id%></a>&nbsp;<%=(issue.subject.length > len ) ? issue.subject[0, len] : issue.subject%></span>
<div class="info_widget">
<div class="proyecto">
<span><strong><%=Project.find(issue.project_id).name%></strong></span>
Expand Down Expand Up @@ -501,6 +501,7 @@ end %>
<span class="retard" title="leyenda">Retraso /<br />Delay</span>
<span class="retard2" title="leyenda">Mucho retraso /<br />Delay</span>
<span class="no_time" title="leyenda">Sin timing /<br />No timing</span>
<span class="father" title="leyenda">Tarea Padre (no suma) /<br />Parent task (does not add up)</span>
</div>
<span class="blue">Tiempo dedicado / Time spent</span>
<span class="gray">Pasado / Past</span>
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 5 additions & 13 deletions redmine_dnoise_workload/assets/javascripts/redmine_plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,24 +65,16 @@ jQuery(".user").each(function(i){
jQuery(".user_each_hours").mouseenter(function(event) {
jQuery(this).css('font-weight', 'bold');
var id_tarea = jQuery(this).attr('id');
jQuery('.workload').filter('.tarea').filter('.'+id_tarea).each(function(){
jQuery(this).css('margin-bottom', '1px');
jQuery(this).css('padding-top', '1px');
jQuery(this).css('border', '1px solid #ccc');
jQuery(this).css('background', '#ebebec');

});
var i = jQuery('.workload.tarea.'+id_tarea);
i.css({'margin-bottom':'1px','padding-top' : '1px', 'border': '1px solid #ccc','background': '#ebebec' });

});

jQuery(".user_each_hours").mouseleave(function() {
jQuery(this).css('font-weight', 'normal');
var id_tarea = jQuery(this).attr('id');
jQuery('.workload').filter('.tarea').filter('.'+id_tarea).each(function(){
jQuery(this).css('margin-bottom', '2px');
jQuery(this).css('padding-top', '2px');
jQuery(this).css('border', '0px solid #ccc');
jQuery(this).css('background', 'transparent');
});
var i = jQuery('.workload.tarea.'+id_tarea);
i.css( { 'margin-bottom' : '2px', 'padding-top' : '2px', 'border' : '0px solid #ccc', 'background' : 'transparent' } );
});


Expand Down
13 changes: 8 additions & 5 deletions redmine_dnoise_workload/assets/stylesheets/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
.controller-work_load .user .user_each_hours span.tarea2 { float:left; background:url(../images/on_time.png) no-repeat left; padding-left:30px; height:15px; max-width:265px; width:auto; color:#666;}
.controller-work_load .user .user_each_hours span.tarea3 { float:left; background:url(../images/retard2.png) no-repeat left; padding-left:30px; height:15px; max-width:265px; width:auto; color:#666;}
.controller-work_load .user .user_each_hours span.tarea4 { float:left; background:url(../images/retard.png) no-repeat left; padding-left:30px; height:15px; max-width:265px; width:auto; color:#666;}
.controller-work_load .user .user_each_hours span.tarea5 { float:left; background:url(../images/tarea_padre.png) no-repeat left; padding-left:30px; height:15px; max-width:265px; width:auto; color:#666;}
.controller-work_load .user .user_each_hours span.tarea_remanente { float:left; background:url(../images/clock.png) no-repeat left; padding-left:30px; height:15px; max-width:265px; width:auto; color:#666;}


Expand All @@ -105,18 +106,18 @@
.controller-work_load .workload.tarea span.tarea_u { float:left; background:url(../images/tarea12_border.png) repeat-y left; padding-left:30px; height:11px; width:100%; text-indent:-9999px;}
.controller-work_load .workload.tarea span.tarea_u.total { float:left; background:url(../images/tarea12.png) repeat-y left; padding-left:30px; height:25px; width:100%; text-indent:-9999px;}

.controller-work_load .legend {width: 1100px; float:left; height:95px; font-size:12px; color:#666666; height: auto;}
.controller-work_load .hours_graph { background:url(../images/legend.gif) no-repeat left; float:left; text-indent:-9999px; width: 39%; height:45px; margin-bottom:15px;}
.controller-work_load .timing_graph { float:left; width: 56%; height:45px; margin-bottom:30px;}
.controller-work_load .legend {width: 80%; float:left; height:95px; font-size:12px; color:#666666; height: auto;}
.controller-work_load .hours_graph { background:url(../images/legend.gif) no-repeat left; float:left; text-indent:-9999px; width: 30%; height:45px; margin-bottom:15px;}
.controller-work_load .timing_graph { float:left; width: 66%; height:45px; margin-bottom:30px;}
.controller-work_load .timing_graph .title { width:100%; float:left; margin-bottom:10px;}
.controller-work_load .timing_graph .perfect { width:80px; float:left; padding-left:20px; background: url(../images/perfect.png) no-repeat left;}
.controller-work_load .timing_graph .normal { width:80px; float:left; padding-left:20px; background: url(../images/on_time.png) no-repeat left;}
.controller-work_load .timing_graph .retard { width:80px; float:left; padding-left:20px; background: url(../images/retard2.png) no-repeat left;}
.controller-work_load .timing_graph .retard2 { width: 100px; float:left; padding-left:20px; background: url(../images/retard.png) no-repeat left;}
.controller-work_load .timing_graph .no_time { width:80px; float:left; padding-left:20px; background: url(../images/clock.png) no-repeat left;}
.controller-work_load .timing_graph .father { width:170px; float:left; padding-left:20px; background: url(../images/tarea_padre.png) no-repeat left;}
.controller-work_load .tareas {float:left;}


.controller-work_load .blue { background:url(../images/tarea9_border.png) no-repeat left; padding-left:40px; float:left; margin-bottom:5px; width:20%; min-width:100px;}
.controller-work_load .gray { background:url(../images/tarea10_border.png) no-repeat left; padding-left:40px; float:left;margin-bottom:5px; width:14%;}

Expand All @@ -133,6 +134,8 @@
.controller-work_load .info_widget .tarea3 span strong {background:url(../images/retard2.png) no-repeat left; padding-left:20px;}
.controller-work_load .info_widget .tarea4 {font-size:12px; margin-bottom:3px; width:100%;}
.controller-work_load .info_widget .tarea4 span strong {background:url(../images/retard.png) no-repeat left; padding-left:20px;}
.controller-work_load .info_widget .tarea5 {font-size:12px; margin-bottom:3px; width:100%;}
.controller-work_load .info_widget .tarea5 span strong {background:url(../images/tarea_padre.png) no-repeat left; padding-left:20px;}
.controller-work_load .info_widget .proyecto {font-size: 12px; margin-bottom: 3px; width: 100%;}
.controller-work_load .info_widget .tarea_remanente {font-size:12px; margin-bottom:3px; width:100%;}
.controller-work_load .info_widget .tarea_remanente span strong {background:url(../images/clock.png) no-repeat left; padding-left:20px;}
Expand All @@ -151,7 +154,7 @@
.controller-work_load .info_widget .percent .percent_text { float:left; margin-left:15px; }
.controller-work_load .info_widget .dcr {font-size:11px; margin-bottom:3px; width:100%; float:left; margin-top:10px;}

.controller-work_load form {width:100%; float:left;}
.controller-work_load form.content_form {width:100%; float:left;}
.controller-work_load .blank {background:transparent !important;}

/* ESTILOS PARA EL CALENDARIO */
Expand Down
13 changes: 10 additions & 3 deletions redmine_dnoise_workload/lib/calculos_tareas.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ class CalculosTareas
attr_accessor :id, :finicio, :ffin, :factual, :fcierre, :hasignadas, :hdedicadas, :realizado, :priority, :duracion_tarea, :dias_restantes, :percent_dedicado, :eficacia_actual, :horas_dias, :difftiempo, :diffhoras, :hrestantes, :hdias_restantes, :start_date, :horas_dias_realizadas, :dias_trabajados, :dias_y_time_restantes,:percent_dias_dedicado, :percent_horas_dedicado, :dias_trabajados_virtuales
@datetools = nil

def initialize(id, finicio, ffin, hasignadas, hdedicadas, realizado, priority, factual = 0)
def initialize(id, finicio, ffin, hasignadas, hdedicadas, realizado, priority, factual = 0, parent = false)
@datetools = DateTools.new
@id = id
@finicio = finicio.to_date.strftime("%Y-%m-%d")
@ffin = ffin.to_date.strftime("%Y-%m-%d")
@factual = (factual == 0 ) ? DateTime.now.strftime("%Y-%m-%d") : factual.to_date.strftime("%Y-%m-%d")
@parent = parent

if (@finicio.to_time > @factual.to_time ) then
@start_date = @finicio
Expand Down Expand Up @@ -35,6 +36,7 @@ def initialize(id, finicio, ffin, hasignadas, hdedicadas, realizado, priority, f

@dias_azules = {}
@dias_grises = {}
@dias_restar = {}
@hdias_restantes = @datetools.stimated_days(@hrestantes, @dias_restantes);
if @dias_trabajados_virtuales > 0 then
#@hdias_restantes = @datetools.stimated_days(@hrestantes, @dias_restantes - @dias_trabajados_virtuales + 1);
Expand Down Expand Up @@ -177,7 +179,9 @@ def get_load_by_day(dia)
if @dias_azules.length > 0 && @dias_azules.include?(dia) then
return '_a'
end

if(@dias_restar.include?(dia))then
return (dia.to_time < @factual.to_time ) ? @dias_restar[dia].round : ( @dias_restar[dia].round == 0 ) ? 1 : ( @dias_restar[dia].round > 8 ) ? 8 : @dias_restar[dia].round
end
if(@dias_y_time_restantes.include?(dia))then
return (dia.to_time < @factual.to_time ) ? @dias_y_time_restantes[dia].round : ( @dias_y_time_restantes[dia].round == 0 ) ? 1 : ( @dias_y_time_restantes[dia].round > 8 ) ? 8 : @dias_y_time_restantes[dia].round
end
Expand All @@ -194,7 +198,10 @@ def TimeDaysIssues(num_dias, horas_al_dia, start_date)
day = @datetools.add_commercial_days(start_date, i)
if( day.to_time >= @finicio.to_time && day.to_time <= @ffin.to_time && horas_al_dia > 0 ) then
#dias_y_time[day] = (@dias_azules.include?(day) ) ? 0 : horas_al_dia
dias_y_time[day] = horas_al_dia
dias_y_time[day] = (@parent == false) ? horas_al_dia : 0
if @parent == true then
@dias_restar[day] = horas_al_dia
end
end
}
return dias_y_time
Expand Down
10 changes: 8 additions & 2 deletions redmine_dnoise_workload/lib/list_user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ def getIssuesOpened(user_id, date_end)

def getIssuesOpenedWihtout(user_id, date_end)
date_end = date_end.to_date.strftime("%Y-%m-%d") if date_end.respond_to?(:to_date)
#return Issue.find_all_by_status_id(@openstatus, :joins => :project, :conditions => [ " start_date < '#{date_end}' AND assigned_to_id = #{user_id} AND projects.status = 1" ] )
return Issue.find_all_by_status_id(@openstatus, :joins => :project, :conditions => [ "assigned_to_id = #{user_id} AND projects.status = 1 AND estimated_hours IS NULL" ] )
end

Expand All @@ -39,10 +38,17 @@ def issue_have_work(issue, day)
return false
end

def issue_is_parent(issue)
if (issue.id.nil? || issue.root_id.nil? ) then
return false
end
return (issue.id == issue.root_id && issue.parent_id.nil? && issue.children.count > 0 )
end

def getIssuesOpenedEntreFechas(user_id, start_date, date_end )
date_end = date_end.to_date.strftime("%Y-%m-%d") if date_end.respond_to?(:to_date)
start_date = start_date.to_date.strftime("%Y-%m-%d") if start_date.respond_to?(:to_date)
return Issue.find_all_by_status_id( @openstatus ,:joins => :project, :conditions => [ " due_date <= '#{date_end}' AND start_date >= '#{start_date}' AND assigned_to_id = #{user_id} AND start_date IS NOT NULL AND due_date IS NOT NULL AND estimated_hours IS NOT NULL AND projects.status = 1" ] )
return Issue.find_all_by_status_id( @openstatus ,:joins => :project, :conditions => [ " ( due_date <= '#{date_end}' OR start_date >= '#{start_date}') AND assigned_to_id = #{user_id} AND start_date IS NOT NULL AND due_date IS NOT NULL AND estimated_hours IS NOT NULL AND projects.status = 1" ], :order => 'root_id asc, id asc' )
end


Expand Down

0 comments on commit d897118

Please sign in to comment.