[ic] ups_cache table IC 5.4

Steve Graham icdev at mrlock.com
Mon Jan 23 17:14:34 EST 2006


At 03:33 PM 1/23/2006, you wrote:


>>Is there a setting for rounding the weights? This cache table is a 
>>great added feature by the way.
>
>
>I'm not sure if this is the correct solution for the QueryUPS.pm module.
>
>Add the following line with + seems to makes the correction in the table.
>
>sub calculate {
>         my ($mode, $weight, $row, $opt, $tagopt, $extra) = @_;
>
>+ $weight = int($weight+.5);
>
>         $opt->{service}         ||= $opt->{table};

Well, maybe this would work better:

sub calculate {
         my ($mode, $weight, $row, $opt, $tagopt, $extra) = @_;

+$weight = int($weight+.5);
+if ($weight < 1) {
  + $weight = 1;
+}

If there is a better solutions I would appreciate any insight.

Thanks,
Steve 



More information about the interchange-users mailing list