Skip to content

Commit

Permalink
Added checks on rules of the fifth day
Browse files Browse the repository at this point in the history
  • Loading branch information
Zitrax committed Aug 29, 2009
1 parent 34c3b93 commit 39a9568
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions fpc.py
Expand Up @@ -138,12 +138,30 @@ def isFPX(self):
"""Page marked with FPX template"""
return len(re.findall(FpxR,self.page.get()))

def rulesOfFifthDay(self):
"""Check if any of the rules of the fifth day can be applied"""
if self.daysOld() < 5:
return False

self.countVotes()

# First rule of the fifth day
if self._support <= 1:
return True

# Second rule of the fifth day
if self._support >= 10 and self._oppose == 0:
return True


def closePage(self):
"""
Will add the voting results to the page if it is finished.
If it was, True is returned else False
"""
if not self.isDone():
fifthDay = self.rulesOfFifthDay()

if not fifthDay and not self.isDone():
wikipedia.output("\"%s\" is still active, ignoring" % self.cutTitle(),toStdout=True)
return False

Expand Down Expand Up @@ -185,8 +203,8 @@ def closePage(self):
# Add the featured status to the header
new_text = re.sub(r'(===.*)(===)',r"\1%s\2" % (", featured" if self.isFeatured() else ", not featured"), new_text)

self.commit(old_text,new_text,self.page,"Closing for review (%d support, %d oppose, %d neutral, featured=%s)" %
(self._support,self._oppose,self._neutral,"yes" if self.isFeatured() else "no"))
self.commit(old_text,new_text,self.page,"Closing for review (%d support, %d oppose, %d neutral, featured=%s) (FifthDay=%s)" %
(self._support,self._oppose,self._neutral,"yes" if self.isFeatured() else "no", fifthDay))

return True

Expand Down

0 comments on commit 39a9568

Please sign in to comment.