Explorar el Código

fixed karma a bit

Christoph Berg hace 21 años
padre
commit
a8da117891
Se han modificado 2 ficheros con 8 adiciones y 2 borrados
  1. 5 0
      docs/Changelog
  2. 3 2
      modules/Pisg/HTMLGenerator.pm

+ 5 - 0
docs/Changelog

@@ -1,3 +1,8 @@
+pisg (0.65) - ??
+   Christoph:
+   * Karma didn't work well with nick aliases. It's still far from perfect,
+     though (thanks to Nico for the test log).
+
 pisg (0.64) - Thu Feb, 24th 2005
 pisg (0.64) - Thu Feb, 24th 2005
    Morten:
    Morten:
    * Updated translations:
    * Updated translations:

+ 3 - 2
modules/Pisg/HTMLGenerator.pm

@@ -1857,8 +1857,9 @@ sub _karma
     my %karma;
     my %karma;
 
 
     foreach my $thing (sort keys %{ $self->{stats}->{karma} }) {
     foreach my $thing (sort keys %{ $self->{stats}->{karma} }) {
+        my $Thing = lc(is_nick($thing) || $thing); # FIXME: this is ugly
         foreach my $nick (keys %{ $self->{stats}->{karma}{$thing} }) {
         foreach my $nick (keys %{ $self->{stats}->{karma}{$thing} }) {
-            $karma{$thing} += $self->{stats}->{karma}{$thing}{$nick};
+            $karma{$Thing} += $self->{stats}->{karma}{$thing}{$nick};
         }
         }
     }
     }
 
 
@@ -1883,7 +1884,7 @@ sub _karma
     my $pos = 0;
     my $pos = 0;
     foreach my $thing (@goodpos) {
     foreach my $thing (@goodpos) {
         my $class = ($pos++ == 0) ? 'hirankc' : 'rankc';
         my $class = ($pos++ == 0) ? 'hirankc' : 'rankc';
-        my $Thing = $self->_format_word(is_nick($thing) || $thing);
+        my $Thing = $self->_format_word(is_nick($thing) || $thing); # ugliness #2
         _html("<tr><td class=\"$class\">$pos</td>");
         _html("<tr><td class=\"$class\">$pos</td>");
         _html("<td class=\"hicell\">$Thing</td>");
         _html("<td class=\"hicell\">$Thing</td>");
         _html("<td class=\"hicell\">$karma{$thing}</td>");
         _html("<td class=\"hicell\">$karma{$thing}</td>");