fix the last 5 minute dups
authorminima <minima>
Sat, 12 Oct 2002 23:04:56 +0000 (23:04 +0000)
committerminima <minima>
Sat, 12 Oct 2002 23:04:56 +0000 (23:04 +0000)
add DXCC chosing to sh/vhftable and sh/hftable

Changes
cmd/Commands_en.hlp
cmd/show/hfstats.pl
cmd/show/hftable.pl
cmd/show/vhfstats.pl
cmd/show/vhftable.pl
perl/Filter.pm
perl/Messages
perl/Prefix.pm
perl/Spot.pm

diff --git a/Changes b/Changes
index 594582970b1fc94106738167e366f7dfc070942e..e6cab4615ccad0cf7cdfbb7a2e37a5da5c5f1686 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,3 +1,10 @@
+12Oct02=======================================================================
+1. attempt to improve the "check back for 5 minutes to see if this spot is 
+the same as a previous one but for the time spotted" dupe check.
+2. improve the sh/vhftable and sh/hftable commands to allow you to enquire
+by dxcc country (using the relevant prefixes or dxcc country numbers).
+[note to translators, I have changed the help text and Messages tags for
+stat*].
 07Oct02=======================================================================
 1. fix problem with (invalid) callsigns starting with '0' (zero) eg 0f6ira.
 03Oct02=======================================================================
index 41ec14416c74a7549976978e6f03a8f8abd0a752..4058c8c72f3ebe833cbc8278caef4a4d37d2a09b 100644 (file)
@@ -1763,8 +1763,18 @@ all the filters set - for all the various categories.
 === 0^SHOW/HFSTATS^Show the HF DX Statistics for last 31 days 
 Show the HF DX spots breakdown by band for the last 31 days
 
-=== 0^SHOW/HFTABLE^Show the HF DX Spotter Table for your country
-Show the HF DX Spotter table for your country for the last 31 days
+=== 0^SHOW/HFTABLE [prefix ...]^Show the HF DX Spotter Table
+Show the HF DX Spotter table for the list of prefixes for the last 31 days,
+if there are no prefixes then it will show the table for your country.
+
+Remember that some countries have more than one "DXCC country" in them
+(eg G :-), to show them (assuming you are not in G already which is
+specially treated in the code) you must list all the relevant prefixes
+
+  sh/hftable g gm gd gi gj gw gu 
+
+Note that the prefixes are converted into country codes so you don't have
+to list all possible prefixes for each country.
 
 === 8^SHOW/HOPS <call> [ann|spots|route|wcy|wwv]^Show the hop counts for a node
 This command shows the hop counts set up for a node. You can specify
@@ -2014,8 +2024,18 @@ the prefixes or callsigns that you specify.
 === 0^SHOW/VHFSTATS^Show the VHF DX Statistics for last 31 days
 Show the VHF DX spots breakdown by band for the last 31 days
 
-=== 0^SHOW/VHFTABLE^Show the VHF DX Spotter Table for your country
-Show the VHF DX Spotter table for your country for the last 31 days
+=== 0^SHOW/VHFTABLE [prefix ...]^Show the VHF DX Spotter Table
+Show the VHF DX Spotter table for the list of prefixes for the last 31 days,
+if there are no prefixes then it will show the table for your country.
+
+Remember that some countries have more than one "DXCC country" in them
+(eg G :-), to show them (assuming you are not in G already which is
+specially treated in the code) you must list all the relevant prefixes
+
+  sh/vhftable g gm gd gi gj gw gu 
+
+Note that the prefixes are converted into country codes so you don't have
+to list all possible prefixes for each country.
 
 === 0^SHOW/WCY^Show last 10 WCY broadcasts
 === 0^SHOW/WCY <n>^Show last <n> WCY broadcasts
index 63a3b56c1eaa0532f92d7f7db3dfecbcdd5bc297..547882d1490fa84c995774c47a1645b15c6dca0c 100644 (file)
@@ -35,17 +35,19 @@ for ($i = 0; $i < $days; $i++) {
 my @out;
 my @tot;
 
-push @out, $self->msg('stathf');
-push @out, sprintf "%11s|%6s|%5s|%5s|%5s|%5s|%5s|%5s|%5s|%5s|%5s|", qw(Date Total 160m 80m 40m 30m 20m 17m 15m 12m 10m);
+push @out, $self->msg('stathf', cldate(time));
+push @out, sprintf "%6s|%6s|%5s|%5s|%5s|%5s|%5s|%5s|%5s|%5s|%5s|%5s|", qw(Date Total 160m 80m 60m 40m 30m 20m 17m 15m 12m 10m);
 foreach my $ref (@in) {
        my $linetot = 0;
-       foreach my $j (3..11) {
+       foreach my $j (4..13) {
                $tot[$j] += $ref->[$j];
                $tot[0] += $ref->[$j];
                $linetot += $ref->[$j];
        }
-       push @out, join '|', sprintf("%11s|%6d", $ref->[0]->as_string, $linetot), map {$_ ? sprintf("%5d", $_) : '     '} @$ref[3..11], "";
+       my $date = $ref->[0]->as_string;
+       $date =~ s/-\d+$//;
+       push @out, join '|', sprintf("%6s|%6d", $date, $linetot), map {$_ ? sprintf("%5d", $_) : '     '} @$ref[4..13], "";
 }
-push @out, join '|', sprintf("%11s|%6d", 'Total', $tot[0]), map {$_ ? sprintf("%5d", $_) : '     '} @tot[3..11], "";
+push @out, join '|', sprintf("%6s|%6d", 'Total', $tot[0]), map {$_ ? sprintf("%5d", $_) : '     '} @tot[4..13], "";
 
 return (1, @out);
index abd04b0065d165d17d15dbc38eca62ea29b85b68..c7fee473f02c897eecc4dab939f08b236f6931ac 100644 (file)
@@ -13,8 +13,14 @@ my $days = 31;
 my @dxcc;
 my $limit = 100;
 
-push @dxcc, (61..67) if $self->dxcc >= 61 && $self->dxcc < 67;
-push @dxcc, $self->dxcc unless @dxcc;
+if ($line) {
+       my @pref = split /[\s,]+/, $line;
+       push @dxcc, Prefix::to_ciz('nc', @pref);
+       return (1, $self->msg('e27', $line)) unless @dxcc;
+} else {
+       push @dxcc, (61..67) if $self->dxcc >= 61 && $self->dxcc < 67;
+       push @dxcc, $self->dxcc unless @dxcc;
+}
 
 my $now = Julian::Day->new(time())->sub(1);
 my %list;
@@ -34,7 +40,7 @@ for ($i = 0; $i < $days; $i++) {
                next unless grep $l[2] eq $_, @dxcc;
                my $ref = $list{$l[0]} || [0,0,0,0,0,0,0,0,0,0];
                my $j = 1;
-               foreach my $item (@l[3..11]) {
+               foreach my $item (@l[4..13]) {
                        $ref->[$j] += $item;
                        $ref->[0] += $item;
                        $j++;
@@ -48,14 +54,14 @@ my @out;
 my @tot;
 my $nocalls;
 
-push @out, $self->msg('stathft', join(',', @dxcc));
-push @out, sprintf "%10s|%4s|%4s|%4s|%4s|%4s|%4s|%4s|%4s|%4s|%4s|", qw(Callsign Tot 160m 80m 40m 30m 20m 17m 15m 12m 10m);
+push @out, $self->msg('stathft', join(',', @dxcc), cldate(time));
+push @out, sprintf "%10s|%4s|%4s|%4s|%4s|%4s|%4s|%4s|%4s|%4s|%4s|%4s", qw(Callsign Tot 160m 80m 60m 40m 30m 20m 17m 15m 12m 10m);
 
 for (sort {$list{$b}->[0] <=> $list{$a}->[0] || $a cmp $b} keys %list) {
        my $ref = $list{$_};
        $nocalls++;
        my @list = (sprintf "%10s", $_);
-       foreach my $j (0..10) {
+       foreach my $j (0..11) {
                my $r = $ref->[$j];
                if ($r) {
                        $tot[$j] += $r;
index b3f1a0780b51d216d895ca5eca95bc85cde73ecd..b3584b59cadd971f20d35a4a2840b55cd8be8611 100644 (file)
@@ -35,17 +35,17 @@ for ($i = 0; $i < $days; $i++) {
 my @out;
 my @tot;
 
-push @out, $self->msg('statvhf');
+push @out, $self->msg('statvhf', cldate(time));
 push @out, sprintf "%11s|%6s|%5s|%5s|%5s|%5s|%5s|%5s|%5s|%5s|%5s|", qw(Date Total 6m 4m 2m 70cm 23cm 13cm 9cm 6cm 3cm);
 foreach my $ref (@in) {
        my $linetot = 0;
-       foreach my $j (12..14,16..21) {
+       foreach my $j (14..16,18..23) {
                $tot[$j] += $ref->[$j];
                $tot[0] += $ref->[$j];
                $linetot += $ref->[$j];
        }
-       push @out, join('|', sprintf("%11s|%6d", $ref->[0]->as_string, $linetot), map {$_ ? sprintf("%5d", $_) : '     '} @$ref[12..14,16..21]) . '|';
+       push @out, join('|', sprintf("%11s|%6d", $ref->[0]->as_string, $linetot), map {$_ ? sprintf("%5d", $_) : '     '} @$ref[14..16,18..23]) . '|';
 }
-push @out, join('|', sprintf("%11s|%6d", 'Total', $tot[0]), map {$_ ? sprintf("%5d", $_) : '     '} @tot[12..14,16..21]) . '|';
+push @out, join('|', sprintf("%11s|%6d", 'Total', $tot[0]), map {$_ ? sprintf("%5d", $_) : '     '} @tot[14..16,18..23]) . '|';
 
 return (1, @out);
index 61193a846462d329c5b3b085ee63d20ad5bc0efc..d41838f665891b7c7cda64e6b552c5d1c44e13e5 100644 (file)
@@ -13,8 +13,14 @@ my $days = 31;
 my @dxcc;
 my $limit = 100;
 
-push @dxcc, (61..67) if $self->dxcc >= 61 && $self->dxcc < 67;
-push @dxcc, $self->dxcc unless @dxcc;
+if ($line) {
+       my @pref = split /[\s,]+/, $line;
+       push @dxcc, Prefix::to_ciz('nc', @pref);
+       return (1, $self->msg('e27', $line)) unless @dxcc;
+} else {
+       push @dxcc, (61..67) if $self->dxcc >= 61 && $self->dxcc < 67;
+       push @dxcc, $self->dxcc unless @dxcc;
+}
 
 my $now = Julian::Day->new(time())->sub(1);
 my %list;
@@ -34,7 +40,7 @@ for ($i = 0; $i < $days; $i++) {
                next unless grep $l[2] eq $_, @dxcc;
                my $ref = $list{$l[0]} || [0,0,0,0,0,0,0,0,0,0];
                my $j = 1;
-               foreach my $item (@l[12..14, 16..22]) {
+               foreach my $item (@l[14..16, 18..23]) {
                        $ref->[$j] += $item;
                        $ref->[0] += $item;
                        $j++;
@@ -48,7 +54,7 @@ my @out;
 my @tot;
 my $nocalls;
 
-push @out, $self->msg('statvhft', join ',', @dxcc);
+push @out, $self->msg('statvhft', join(',', @dxcc), cldate(time));
 push @out, sprintf "%10s|%4s|%4s|%4s|%4s|%4s|%4s|%4s|%4s|%4s|%4s|", qw(Callsign Tot 6m 4m 2m 70cm 23cm 13cm 9cm 6cm 3cm);
 
 for (sort {$list{$b}->[0] <=> $list{$a}->[0] || $a cmp $b} keys %list) {
index bf7ff65c18a24c82df8eb4c45e7c7e7695b2e04d..66c3ff7acb2aceb64b1a1ec1265c2cda8d94bcf3 100644 (file)
@@ -490,24 +490,10 @@ sub parse
                                                        }
                                                        $s .= "(" . join(' || ', @t) . ")";
                                                } elsif ($fref->[1] =~ /^n[ciz]$/ ) {    # for DXCC, ITU, CQ Zone    
-                                                       my @n;
                                                        my $cmd = $fref->[1];
-                                                       foreach my $v (@val) {
-                                                               if ($v =~ /^\d+$/) {    
-                                                                       push @n, $v unless grep $_ eq $v, @n;
-                                                               } else {
-                                                                       my @pre = Prefix::extract($v);
-                                                                       return ('numpre', $dxchan->msg('e27', $_)) unless @pre;
-                                                                       shift @pre;
-                                                                       foreach my $p (@pre) {
-                                                                               my $n = $p->dxcc if $cmd eq 'nc' ;
-                                                                               $n = $p->itu if $cmd eq 'ni' ;
-                                                                               $n = $p->cq if $cmd eq 'nz' ;
-                                                                               push @n, $n unless grep $_ eq $n, @n;
-                                                                       }
-                                                               }
-                                                       }
-                                                       $s .= "(" . join(' || ', map {"\$r->[$fref->[2]]==$_"} @n) . ")";
+                                                       my @pre = Prefix::to_ciz($cmd, @val);
+                                                       return ('numpre', $dxchan->msg('e27', $_)) unless @pre;
+                                                       $s .= "(" . join(' || ', map {"\$r->[$fref->[2]]==$_"} @pre) . ")";
                                                } elsif ($fref->[1] eq 'r') {
                                                        my @t;
                                                        for (@val) {
index 463a048dbc94152212a5def005599ecd7fd2156c..3829d2ebd73938d2c629eb804d43cee1bb0b391e 100644 (file)
@@ -255,10 +255,10 @@ package DXM;
                                sqra => 'Cluster QRA Locator$_[0], DON\'T FORGET TO CHANGE YOUR DXVars.pm',
                                sorry => 'Sorry',
                                spf1 => 'spoof: creating new user $_[0]',
-                               stathf => 'HF DX Spot Stats, last 31 days',
-                               stathft => 'HF DX Spot Stats, last 31 days for DXCC $_[0]',
-                               statvhf => 'VHF+ DX Spot Stats, last 31 days',
-                               statvhft => 'VHF+ DX Spot Stats, last 31 days for DXCC $_[0]',
+                               stathf => 'HF DX Spot Stats, last 31 days from $_[0]',
+                               stathft => 'HF DX Spot Stats, last 31 days from $_[1] for DXCC $_[0]',
+                               statvhf => 'VHF+ DX Spot Stats, last 31 days from $_[0]',
+                               statvhft => 'VHF+ DX Spot Stats, last 31 days from $_[1] for DXCC $_[0]',
                                statdx => 'Total DX Spots last 31 days',
                                sun => 'Location                              dd/mm/yyyy Rise   Set',
                                sun_with_azel => 'Location                              dd/mm/yyyy Rise   Set      Azim   Elev',
index 10559711961130312a3829198c64bce1daa6372f..246dbb659eb2d53ead8a74d78c110140aec01cb9 100644 (file)
@@ -363,6 +363,37 @@ L1:                for ($n = 0; $n < @parts; $n++) {
        return @out;
 }
 
+#
+# turn a list of prefixes / dxcc numbers into a list of dxcc/itu/zone numbers
+#
+# nc = dxcc
+# ni = itu
+# nz = zone
+#
+
+sub to_ciz
+{
+       my $cmd = shift;
+       my @out;
+       
+       foreach my $v (@_) {
+               if ($v =~ /^\d+$/) {    
+                       push @out, $v unless grep $_ eq $v, @out;
+               } else {
+                       my @pre = Prefix::extract($v);
+                       return () unless @pre;
+                       shift @pre;
+                       foreach my $p (@pre) {
+                               my $n = $p->dxcc if $cmd eq 'nc' ;
+                               $n = $p->itu if $cmd eq 'ni' ;
+                               $n = $p->cq if $cmd eq 'nz' ;
+                               push @out, $n unless grep $_ eq $n, @out;
+                       }
+               }
+       }
+       return @out;
+}
+
 my %valid = (
                         lat => '0,Latitude,slat',
                         long => '0,Longitude,slong',
index 2863a449d54adbd4ae33bf6411a8e52cc0286101..9b67cc5fb54f3a7d9e562e8247fc46c40b2ca29e 100644 (file)
@@ -97,8 +97,9 @@ sub init
 {
        mkdir "$dirprefix", 0777 if !-e "$dirprefix";
        $fp = DXLog::new($dirprefix, "dat", 'd');
-       $statp = DXLog::new($dirprefix, "cys", 'd');
-       system("rm -f $main::data/$dirprefix/2001/*.bys");
+       $statp = DXLog::new($dirprefix, "dys", 'd');
+       system("rm -f $main::data/$dirprefix/200?/*.bys");
+       system("rm -f $main::data/$dirprefix/200?/*.cys");
 }
 
 sub prefix
@@ -303,7 +304,11 @@ sub dup
 
        # dump if too old
        return 2 if $d < $main::systime - $dupage;
+       
+       # turn the time into minutes (should be already but...)
+       $d = int ($d / 60);
+       $d *= 60;
+
        $freq = sprintf "%.1f", $freq;       # normalise frequency
        $call = substr($call, 0, 12) if length $call > 12;
        chomp $text;
@@ -332,33 +337,13 @@ sub genstats($)
        my $date = shift;
        my $in = $fp->open($date);
        my $out = $statp->open($date, 'w');
-       my @freq = (
-                               [0, Bands::get_freq('160m')],
-                               [1, Bands::get_freq('80m')],
-                               [2, Bands::get_freq('40m')],
-                               [3, Bands::get_freq('30m')],
-                               [4, Bands::get_freq('20m')],
-                               [5, Bands::get_freq('17m')],
-                               [6, Bands::get_freq('15m')],
-                               [7, Bands::get_freq('12m')],
-                               [8, Bands::get_freq('10m')],
-                               [9, Bands::get_freq('6m')],
-                               [10, Bands::get_freq('4m')],
-                               [11, Bands::get_freq('2m')],
-                               [12, Bands::get_freq('220')],
-                               [13, Bands::get_freq('70cm')],
-                               [14, Bands::get_freq('23cm')],
-                               [15, Bands::get_freq('13cm')],
-                               [16, Bands::get_freq('9cm')],
-                               [17, Bands::get_freq('6cm')],
-                               [18, Bands::get_freq('3cm')],
-                               [19, Bands::get_freq('12mm')],
-                               [20, Bands::get_freq('6cm')],
-                          );
+       my @freq;
        my %list;
        my @tot;
        
        if ($in && $out) {
+               my $i = 0;
+               @freq = map {[$i++, Bands::get_freq($_)]} qw(136khz 160m 80m 60m 40m 30m 20m 17m 15m 12m 10m 6m 4m 2m 220 70cm 23cm 13cm 9cm 6cm 3cm 12mm 6mm);
                while (<$in>) {
                        chomp;
                        my ($freq, $by, $dxcc) = (split /\^/)[0,4,6];
@@ -375,7 +360,6 @@ sub genstats($)
                        }
                }
 
-               my $i;
                for ($i = 0; $i < @freq+2; $i++) {
                        $tot[$i] ||= 0;
                }