Fixed RecordHit to update last_hit
[clearscm.git] / maps / lib / MAPS.pm
index 5802aa5..c61a4da 100644 (file)
@@ -311,8 +311,7 @@ sub AddLog(%) {
   my (%params) = @_;
 
   # Some email senders are coming in mixed case. We don't want that
-  $params{pattern} = $params{pattern} ? lc $params{pattern} : '';
-  $params{domain}  = $params{domain}  ? lc $params{domain}  : '';
+  $params{sender} = $params{sender} ? lc $params{sender} : '';
 
   $params{timestamp} = UnixDatetime2SQLDatetime(scalar(localtime));
 
@@ -1067,18 +1066,20 @@ 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}";
+  my $condition = "userid='$rec{userid}' and type='$rec{type}' and sequence='$rec{sequence}'";
 
-  return $db->modify(
-    table     => $table,
-    condition => $condition,
-    %rec,
-  );
+  # 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
 
 sub ResequenceList(%) {