]> git.donarmstrong.com Git - infobot.git/commitdiff
- half-assed attempt to move over to new sql functions
authordms <dms@c11ca15a-4712-0410-83d8-924469b57eb5>
Sun, 24 Nov 2002 13:01:56 +0000 (13:01 +0000)
committerdms <dms@c11ca15a-4712-0410-83d8-924469b57eb5>
Sun, 24 Nov 2002 13:01:56 +0000 (13:01 +0000)
- 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

index 7b1ac1446010d76c9d3aebb3593cf1004e4a7419..5da983d4357c6e5fafca4e1d002526f5e1e46645 100644 (file)
@@ -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: