From 4d9b6032da532bce9f0f27ee504fa2ff05eceb39 Mon Sep 17 00:00:00 2001 From: fukachan Date: Sat, 10 Nov 2001 08:50:41 +0000 Subject: change cost evaluation logic (numeric now) --- fml/lib/Mail/ThreadTrack/Print/Sort.pm | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'fml/lib/Mail/ThreadTrack') diff --git a/fml/lib/Mail/ThreadTrack/Print/Sort.pm b/fml/lib/Mail/ThreadTrack/Print/Sort.pm index a6ab1429..b2b22e3e 100644 --- a/fml/lib/Mail/ThreadTrack/Print/Sort.pm +++ b/fml/lib/Mail/ThreadTrack/Print/Sort.pm @@ -4,7 +4,7 @@ # All rights reserved. This program is free software; you can # redistribute it and/or modify it under the same terms as Perl itself. # -# $FML: Sort.pm,v 1.2 2001/11/09 12:08:46 fukachan Exp $ +# $FML: Sort.pm,v 1.3 2001/11/09 15:09:03 fukachan Exp $ # package Mail::ThreadTrack::Print::Sort; @@ -32,15 +32,19 @@ sub sort_thread_id $self->{ _cost } = $cost; @$thread_id_list = sort { - (defined($cost->{$b}) ? $cost->{$b} : '') - cmp - (defined($cost->{$a}) ? $cost->{$a} : '') + $cost->{$b} <=> $cost->{$a} } @$thread_id_list; return $thread_id_list; } +my $status_cost = { + open => ( 1 << 10 ), + analyzed => ( 1 << 9 ), +}; + + # Descriptions: # Arguments: $self $args # Side Effects: @@ -67,7 +71,8 @@ sub _calculate_age $age{ $tid } = $age; # evaluate cost hash table which is { $thread_id => $cost } - $cost{ $tid } = $rh->{ _status }->{ $tid }.'-'. $age; + my $status = $rh->{ _status }->{ $tid }; + $cost{ $tid } = $status_cost->{ $status } + $age; } return (\%age, \%cost); -- cgit v1.2.1