fix log and sh/dx ordering issues.
authorDirk Koopman <djk@tobit.co.uk>
Wed, 3 Jun 2020 22:38:27 +0000 (23:38 +0100)
committerDirk Koopman <djk@tobit.co.uk>
Wed, 3 Jun 2020 22:38:27 +0000 (23:38 +0100)
Changes
perl/DXLogPrint.pm
perl/Spot.pm

diff --git a/Changes b/Changes
index 522eb7796373ff151fc71ec4758c7f2ab061b93f..e06371d6d212b60e2be2b4d7cfc1951d8e920ba0 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,5 +1,7 @@
 03Jun20=======================================================================
 1. Make sure that all possible regexes get passed across to the search engine.
+2. Fix out of order logging on sh/log queries spanning more than one month.
+3. Do not read backwards on sh/dx, reading forwards seems a 1/3 quicker. 
 02Jun20=======================================================================
 1. Fix the small whoopsie in sh/dx.
 01Jun20=======================================================================
index 9bb51f20a579a2e34ecf6220e5690ba7cd9e420a..0d99eb41804a740a9d0e95a18c13cabdf2a93b36 100644 (file)
@@ -18,9 +18,12 @@ use DXLog;
 use Julian;
 
 
-our $readback = `which tac`;
+our $readback = 1;
+if ($readback) {
+       $readback = `which tac`;
+} 
 chomp $readback;
-undef $readback;                               # yet another reason not to use the cloud!
+#undef $readback;                              # yet another reason not to use the cloud!
  
 
 use strict;
@@ -109,7 +112,7 @@ sub print
                return "show/$name: ${s}not found";
        } 
 
-       for (reverse @in) {
+       for (sort {$a <=> $b } @in) {
                my @line = split /\^/ ;
                push @out, print_item(\@line);
        
index 185711b5b428f1b3099b0def7030e4a7afd75f03..3d671d76ae0c90f20a54050b37498f98fc703120 100644 (file)
@@ -63,10 +63,9 @@ $filterdef = bless ([
 $totalspots = $hfspots = $vhfspots = 0;
 $use_db_for_search = 0;
 
-our $usetac = 1;
-our $readback;
+our $readback = 0;
 
-if ($usetac) {
+if ($readback) {
        $readback = `which tac`;
        chomp $readback;
 }
@@ -293,7 +292,7 @@ sub search
                return $main::dbh->spot_search($hint, $dayfrom, $dayto, $to-$from, $dxchan);
        }
 
-#      $expr =~ s/\$f(\d\d?)/\$ref->[$1]/g; # swap the letter n for the correct field name
+       #       $expr =~ s/\$f(\d\d?)/\$ref->[$1]/g; # swap the letter n for the correct field name
        #  $expr =~ s/\$f(\d)/\$spots[$1]/g;               # swap the letter n for the correct field name
   
 
@@ -313,16 +312,17 @@ sub search
        my @spots;
        my $recs;
        
-       for ($i = $count = 0; $count < $to && $i < $maxdays; ++$i) {    # look thru $maxdays worth of files only
+       for ($i = $count = 0; $count < $to && $i < $maxdays; ++$i) { # look thru $maxdays worth of files only
                last if $now->cmp($todate) <= 0;
                
                my $fn = $fp->fn($now->sub($i));
                if ($readback) {
                        dbg("Spot::search search using tac fn: $fn $i") if isdbg('search');
                        $fh = IO::File->new("$readback $fn |");
-               } else {
+               }
+               else {
                        dbg("Spot::search search fn: $fp->{fn} $i") if isdbg('search');
-                       $fh = $fp->open($now->sub($i));      # get the next file
+                       $fh = $fp->open($now->sub($i)); # get the next file
                }
                if ($fh) {
                        my $rec = 0;
@@ -343,9 +343,8 @@ sub search
                        return ("Spot search error", $@) if $@;
                }
        }
-   
-
-       return $readback ? @out : reverse @out;
+       @out = sort {$b->[2] <=> $a->[2]} @out if @out;
+       return @out;
 }
 
 # change a freq range->regular expression