From bd6ea31741c339e295df02884dbdb6801cda49c1 Mon Sep 17 00:00:00 2001 From: Andrew DeFaria Date: Wed, 18 Aug 2021 13:52:46 -0700 Subject: [PATCH] Fixed RecordHit to update last_hit --- maps/bin/maps | 3 ++- maps/lib/MAPS.pm | 12 +++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/maps/bin/maps b/maps/bin/maps index 8ff35a7..17047f4 100755 --- a/maps/bin/maps +++ b/maps/bin/maps @@ -206,9 +206,10 @@ sub ProcessMsgs ($$$) { ($onlist, $rec) = OnNulllist $sender; if ($onlist) { - #$log->msg("Nulllisting $sender - Rule: $rule:$sequence/$hit_count"); $log->msg("Nulllisting $sender - Rule: " . formatRule($rec)); + Nulllist $sender, $rec->{sequence}, $rec->{hit_count}; + next; } # if diff --git a/maps/lib/MAPS.pm b/maps/lib/MAPS.pm index b66b64e..c61a4da 100644 --- a/maps/lib/MAPS.pm +++ b/maps/lib/MAPS.pm @@ -1066,13 +1066,19 @@ sub ReadMsg($) { sub RecordHit(%) { my (%rec) = @_; - CheckParms(['userid', 'type', 'sequence', ], \%rec); - - my $current_date = UnixDatetime2SQLDatetime(scalar(localtime)); + CheckParms(['userid', 'type', 'sequence'], \%rec); my $table = 'list'; my $condition = "userid='$rec{userid}' and type='$rec{type}' and sequence='$rec{sequence}'"; + # We don't need these fields in %rec as we are not updating them + delete $rec{sequence}; + delete $rec{type}; + delete $rec{userid}; + + # We are, however, updating last_hit + $rec{last_hit} = UnixDatetime2SQLDatetime(scalar(localtime)); + return $db->modify($table, $condition, %rec); } # RecordHit -- 2.17.1