$rec{hit_count} //= $db->count(
'email',
- "userid = '$rec{userid}' and sender like '$rec{sender}%'"
+ "userid = '$rec{userid}' and sender like '%$rec{sender}%'"
);
($rec{pattern}, $rec{domain}) = split /\@/, delete $rec{sender};
return 0 unless $count;
+ $count = 0;
+
my ($err, $errmsg) = $db->find($table, $condition);
croak "Unable to find $params{type} entries for $condition - $errmsg" if $err;
$db->lock('write', $table);
# Get all records for $userid and $type
- my $listrecs = $db->get($table, $condition);
+ my $listrecs = $db->get($table, $condition,'*', 'order by hit_count desc');
# Delete all of the list entries for this $userid and $type
my ($count, $msg) = $db->delete($table, $condition);