Skip to content

Commit

Permalink
default vote style to minus-zero
Browse files Browse the repository at this point in the history
  • Loading branch information
codersquid committed Apr 23, 2014
1 parent a578120 commit 5e81823
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions symposion/reviews/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ class Votes(object):
(MINUS_ZERO, u"−0 — Weak proposal, but I will not argue strongly against acceptance."),
(MINUS_ONE, u"−1 — Serious issues and I will argue to reject this proposal."),
]

CSS_LOOKUP = {
PLUS_ONE: "plus-one",
PLUS_ZERO: "plus-zero",
MINUS_ZERO: "minus-zero",
MINUS_ONE: "minus-one",
}

VOTES = Votes()


Expand Down Expand Up @@ -168,13 +176,9 @@ def delete(self):
super(Review, self).delete()

def css_class(self):
return {
self.VOTES.PLUS_ONE: "plus-one",
self.VOTES.PLUS_ZERO: "plus-zero",
self.VOTES.MINUS_ZERO: "minus-zero",
self.VOTES.MINUS_ONE: "minus-one",
}[self.vote]

# default to "minus-zero" style in the event our database has incorrectly encoded the vote
return self.VOTES.CSS_LOOKUP.get(self.vote, "minus-zero")

@property
def section(self):
return self.proposal.kind.section.slug
Expand All @@ -195,12 +199,8 @@ class Meta:
unique_together = [("proposal", "user")]

def css_class(self):
return {
self.VOTES.PLUS_ONE: "plus-one",
self.VOTES.PLUS_ZERO: "plus-zero",
self.VOTES.MINUS_ZERO: "minus-zero",
self.VOTES.MINUS_ONE: "minus-one",
}[self.vote]
# default to "minus-zero" style in the event our database has incorrectly encoded the vote
return self.VOTES.CSS_LOOKUP.get(self.vote, "minus-zero")


class ProposalResult(models.Model):
Expand Down

0 comments on commit 5e81823

Please sign in to comment.