Skip to content

Commit

Permalink
Minor tag fixes plus comment down-scoring
Browse files Browse the repository at this point in the history
Got rid of some unnecessary warnings;  fixed a crash due to malformed
SQL; better logging;  and dramatically decreased the color level
in which comments appear (5=blue, 2+=indigo, rest violet).
  • Loading branch information
jamiemccarthy committed Sep 12, 2008
1 parent 46dd6b5 commit 1136dd6
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
1 change: 0 additions & 1 deletion plugins/FireHose/FireHose.pm
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ sub createItemFromComment {
my $comment = $self->getComment($cid);
my $text = $self->getCommentText($cid);
my $globjid = $self->getGlobjidCreate("comments", $cid);
my $score = constrain_score($comment->{points} + $comment->{tweak});

# Set initial popularity scores -- we'll be forcing a quick
# recalculation of them so these scores don't much matter.
Expand Down
10 changes: 7 additions & 3 deletions tagboxes/CommentScoreReason/CommentScoreReason.pm
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,11 @@ sub run_process {
my $tagnameid = $tag->{tagnameid};
my $reason = $self->{reason_tagnameid}{$tagnameid};
my $dir = 0;
if ($reason->{val} > 0 || $tagnameid == $self->{nodid} || $tagnameid == $self->{metanodid}) {
if ($reason && $reason->{val} > 0
|| $tagnameid == $self->{nodid} || $tagnameid == $self->{metanodid}) {
$dir = 1;
} elsif ($reason->{val} < 0 || $tagnameid == $self->{nixid} || $tagnameid == $self->{metanixid}) {
} elsif ($reason && $reason->{val} < 0
|| $tagnameid == $self->{nixid} || $tagnameid == $self->{metanixid}) {
$dir = -1;
}
if (!$dir) {
Expand Down Expand Up @@ -202,9 +204,11 @@ sub run_process {
my $new_karma_bonus = ($karma_bonus eq 'yes' && $keep_karma_bonus) ? 1 : 0;

$self->info_log("cid %d to score: %d, %s kb %d->%d, neediness %.1f",
$cid, $new_score, $reasons->{$current_reason_mode}{name}, $karma_bonus, $new_karma_bonus, $neediness);
$cid, $new_score, $reasons->{$current_reason_mode}{name}, ($karma_bonus eq 'yes' ? 1 : 0), $new_karma_bonus, $neediness);

if ($firehose) {
# If it's already in the hose, don't try to re-create it --
# that may cause unnecessary score recalculations.
my $fhid = $firehose->getFireHoseIdFromGlobjid($affected_id);
if (!$fhid) {
$fhid = $self->addCommentToHoseIfAppropriate($firehose,
Expand Down
6 changes: 2 additions & 4 deletions tagboxes/FireHoseScores/FireHoseScores.pm
Original file line number Diff line number Diff line change
Expand Up @@ -254,10 +254,8 @@ sub getStartingColorLevel {
my $comment = $self->getComment($target_id);
my $score = constrain_score($comment->{points} + $comment->{tweak});
if ($score >= 5) {
$color_level = 4;
} elsif ($score >= 4) {
$color_level = 5
} elsif ($score >= 1) {
$color_level = 5;
} elsif ($score >= 2) {
$color_level = 6
} else {
$color_level = 7;
Expand Down
2 changes: 1 addition & 1 deletion tagboxes/Top/Top.pm
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ sub init_tagfilters {
my $types = $self->getGlobjTypes();
$self->{filter_gtid} = [
map { $types->{$_} }
grep { $_ ne 'projects' }
grep { $_ !~ /^\d+$/ && $_ ne 'projects' }
keys %$types ];
}

Expand Down

0 comments on commit 1136dd6

Please sign in to comment.