Commit 625e0e68 authored by jago's avatar jago

- Fixed traffic light sweeper

parent 02b9d7b4
...@@ -355,6 +355,7 @@ ad_proc -public im_sla_ticket_solution_time_sweeper { ...@@ -355,6 +355,7 @@ ad_proc -public im_sla_ticket_solution_time_sweeper {
the limit is set to 100 by default. the limit is set to 100 by default.
} { } {
ns_log Notice "im_sla_ticket_solution_time_sweeper: starting" ns_log Notice "im_sla_ticket_solution_time_sweeper: starting"
set traffic_light_limit [expr $limit * 1000]
# Make sure that only one thread is calculating at a time # Make sure that only one thread is calculating at a time
if {[nsv_incr intranet_sla_management sweeper_p] > 1} { if {[nsv_incr intranet_sla_management sweeper_p] > 1} {
...@@ -374,7 +375,7 @@ ad_proc -public im_sla_ticket_solution_time_sweeper { ...@@ -374,7 +375,7 @@ ad_proc -public im_sla_ticket_solution_time_sweeper {
# Catch errors calculating the green/yellow/red status of tickets # Catch errors calculating the green/yellow/red status of tickets
if {[catch { if {[catch {
append result [im_sla_ticket_traffic_light_sweeper_helper -debug_p $debug_p -ticket_id $ticket_id -limit $limit] append result [im_sla_ticket_traffic_light_sweeper_helper -debug_p $debug_p -ticket_id $ticket_id -limit $traffic_light_limit]
} err_msg]} { } err_msg]} {
ns_log Error "im_sla_ticket_solution_time_sweeper: traffic light status: Found error: $err_msg" ns_log Error "im_sla_ticket_solution_time_sweeper: traffic light status: Found error: $err_msg"
append result "<pre>$err_msg</pre>" append result "<pre>$err_msg</pre>"
...@@ -393,6 +394,7 @@ ad_proc -public im_sla_ticket_solution_time_sweeper { ...@@ -393,6 +394,7 @@ ad_proc -public im_sla_ticket_solution_time_sweeper {
ad_proc -public im_sla_ticket_traffic_light_sweeper_helper { ad_proc -public im_sla_ticket_traffic_light_sweeper_helper {
{-debug_p 0} {-debug_p 0}
{-ticket_id ""} {-ticket_id ""}
{-limit ""}
} { } {
Calculates the green/yellow/red status of tickets depending on Calculates the green/yellow/red status of tickets depending on
solution time and SLA parameters. solution time and SLA parameters.
...@@ -453,6 +455,10 @@ ad_proc -public im_sla_ticket_traffic_light_sweeper_helper { ...@@ -453,6 +455,10 @@ ad_proc -public im_sla_ticket_traffic_light_sweeper_helper {
" "
} }
if {"" != $limit && 0 != $limit} {
append open_tickets_sql "\t\t\tLIMIT $limit\n"
}
# --------------------------------------- # ---------------------------------------
# Load the list of sla_parameters into a hash per sla_id # Load the list of sla_parameters into a hash per sla_id
# #
...@@ -485,8 +491,6 @@ ad_proc -public im_sla_ticket_traffic_light_sweeper_helper { ...@@ -485,8 +491,6 @@ ad_proc -public im_sla_ticket_traffic_light_sweeper_helper {
} }
} }
# ad_return_complaint 1 "value_fields=$value_fields<br>[array get max_resolution_hours_hash]"
# --------------------------------------- # ---------------------------------------
# Loop through all open tickets and check for the SLA parameters of their SLA # Loop through all open tickets and check for the SLA parameters of their SLA
# #
...@@ -517,7 +521,6 @@ ad_proc -public im_sla_ticket_traffic_light_sweeper_helper { ...@@ -517,7 +521,6 @@ ad_proc -public im_sla_ticket_traffic_light_sweeper_helper {
foreach field $value_fields { foreach field $value_fields {
set cmd "set $field \$${field}_hash(\$key)" set cmd "set $field \$${field}_hash(\$key)"
eval $cmd eval $cmd
# ad_return_complaint 1 "cmd=$cmd<br>field=[expr "\$$field"]<br> mx=$max_resolution_hours_hash($key)"
} }
# This breaks out of the foreach perm $permutations loop # This breaks out of the foreach perm $permutations loop
set found_p 1 set found_p 1
...@@ -559,16 +562,14 @@ ad_proc -public im_sla_ticket_traffic_light_sweeper_helper { ...@@ -559,16 +562,14 @@ ad_proc -public im_sla_ticket_traffic_light_sweeper_helper {
where project_id = :ticket_id where project_id = :ticket_id
" "
} }
} }
ns_log Notice "im_sla_ticket_traffic_light_sweeper_helper: finished" ns_log Notice "im_sla_ticket_traffic_light_sweeper_helper: finished"
return $color return
} }
ad_proc -public im_sla_ticket_solution_time_sweeper_helper { ad_proc -public im_sla_ticket_solution_time_sweeper_helper {
{-debug_p 0} {-debug_p 0}
{-ticket_id ""} {-ticket_id ""}
......
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