From 6fc9191943cad96ab17f89d115ebaf0e2638346a Mon Sep 17 00:00:00 2001 From: dms Date: Sun, 24 Nov 2002 13:01:56 +0000 Subject: [PATCH] - half-assed attempt to move over to new sql functions - disabled modified_by - requested_by could exist when requested_count == 0. fixed. git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk/blootbot@703 c11ca15a-4712-0410-83d8-924469b57eb5 --- src/Modules/Factoids.pl | 41 +++++++++++++++++++---------------------- 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/src/Modules/Factoids.pl b/src/Modules/Factoids.pl index 7b1ac14..5da983d 100644 --- a/src/Modules/Factoids.pl +++ b/src/Modules/Factoids.pl @@ -22,7 +22,9 @@ sub CmdFactInfo { return; } - my %factinfo = &dbGetColNiceHash("factoids", "*", "factoid_key=".&dbQuote($faqtoid)); + my %factinfo = &sqlSelectRowHash("factoids", "*", + { factoid_key => $faqtoid } + ); # factoid does not exist. if (scalar (keys %factinfo) <= 1) { @@ -63,7 +65,8 @@ sub CmdFactInfo { } # modified: - if ($factinfo{'modified_by'}) { + # disabled for the time being... it's misleading/useless info. + if (0 && $factinfo{'modified_by'}) { $string = "last modified"; my $time = $factinfo{'modified_time'}; @@ -75,14 +78,8 @@ sub CmdFactInfo { } } - my @x; - foreach (split ",", $factinfo{'modified_by'}) { - /\!/; - push(@x, $`); - } - $string .= "by ".&IJoin(@x); + $string .= " by ".(split ",", $factinfo{'modified_by'})[0]; - $i++; push(@array,$string); } @@ -98,24 +95,24 @@ sub CmdFactInfo { $string .= "\002". $requested_count. "\002 ". &fixPlural("time", $requested_count); } - } - $string .= ", " if ($string ne ""); + my $requested_by = $factinfo{'requested_by'}; + $requested_by =~ /\!/; + $string .= "last by $`"; - my $requested_by = $factinfo{'requested_by'}; - $requested_by =~ /\!/; - $string .= "last by $`"; - - my $requested_time = $factinfo{'requested_time'}; - if ($requested_time) { - if (time() - $requested_time > 60*60*24*7) { - $string .= " at \037". scalar(gmtime $requested_time). "\037"; - } else { - $string .= ", ".&Time2String(time() - $requested_time)." ago"; + my $requested_time = $factinfo{'requested_time'}; + if ($requested_time) { + if (time() - $requested_time > 60*60*24*7) { + $string .= " at \037". scalar(localtime $requested_time). "\037"; + } else { + $string .= ", ".&Time2String(time() - $requested_time)." ago"; + } } + } else { + $string = "has not been requested yet"; } - push(@array,$string); + push(@array, $string); } # locked: -- 2.39.2