Exemplo n.º 1
0
 def getMargin(self, batFirstScore, batSecondScore, batSecondWickets):
     answer = None
     runsDifference = batFirstScore - batSecondScore
     if runsDifference > 0:
         answer = "{0} {1}".format(runsDifference, TextUtils.getGrammaticalNumber(runsDifference, "run", "runs"))
     elif runsDifference < 0:
         wicketsInHand = 6 - batSecondWickets
         answer = "{0} {1}".format(wicketsInHand, TextUtils.getGrammaticalNumber(wicketsInHand, "wicket", "wickets"))
     return answer
Exemplo n.º 2
0
 def getResultText(self, innings1, innings2):
     difference = innings1.runs - innings2.runs
     if difference == 0:
         answer = "Match tied"
     elif difference > 0:
         answer = "{0} won by {1} {2}".format(innings1.teamName, difference, TextUtils.getGrammaticalNumber(difference, "run", "runs"))
     else:
         wicketsInHand = 6 - innings2.wickets
         answer = "{0} won by {1} {2}".format(innings2.teamName, wicketsInHand, TextUtils.getGrammaticalNumber(wicketsInHand, "wicket", "wickets"))
     return answer
Exemplo n.º 3
0
 def getResultText(self, innings1, innings2):
     difference = innings1.runs - innings2.runs
     if difference == 0:
         answer = "Match tied"
     elif difference > 0:
         answer = "{0} won by {1} {2}".format(
             innings1.teamName, difference,
             TextUtils.getGrammaticalNumber(difference, "run", "runs"))
     else:
         wicketsInHand = 6 - innings2.wickets
         answer = "{0} won by {1} {2}".format(
             innings2.teamName, wicketsInHand,
             TextUtils.getGrammaticalNumber(wicketsInHand, "wicket",
                                            "wickets"))
     return answer
Exemplo n.º 4
0
 def getStatusMessage(self, table):
     html = """
     <p class="statusMessage">{status}.</p>
     """
     if table.lastCompleteMatchDate is None:
         answer = ""
     elif self.allParams.get("archive", "no") == "yes":
         answer = ""
     else:
         if table.complete:
             message = "Final averages"
         else:
             dateStr = DateFormatter.formatDate(table.lastCompleteMatchDate,
                                                True, True)
             if table.toCome == 0:
                 template = "Includes all games up to and including {0}"
                 message = template.format(dateStr)
             else:
                 template = "Date of last game included: {0} ({1} {2} to come)"
                 message = template.format(
                     dateStr, table.toCome,
                     TextUtils.getGrammaticalNumber(table.toCome, "result",
                                                    "results"))
         answer = html.format(status=message)
     return answer
Exemplo n.º 5
0
 def getStatusMessage(self, table):
     html = """
     <p class="statusMessage">{status}.</p>
     """
     if table.lastCompleteMatchDate is None:
         answer = ""
     elif self.allParams.get("archive", "no") == "yes":
         answer = ""
     else:
         if table.complete:
             message = "Final table"
         else:
             dateStr = DateFormatter.formatDate(table.lastCompleteMatchDate, True, True)
             if table.toCome == 0:
                 template = "Includes all games up to and including {0}"
                 message = template.format(dateStr)
             else:
                 template = "Date of last game included: {0} ({1} {2} to come)"
                 message = template.format(dateStr, table.toCome, TextUtils.getGrammaticalNumber(table.toCome, "result", "results"))
         answer = html.format(status=message)
     return answer
Exemplo n.º 6
0
 def getDeductionReason(self, deduction):
     template = "{ded.reason} - {ded.points} {pointstext} deducted"
     answer = template.format(ded=deduction, pointstext=TextUtils.getGrammaticalNumber(deduction.points, "point", "points"))
     return answer
Exemplo n.º 7
0
 def getDeductionReason(self, deduction):
     template = "{ded.reason} - {ded.points} {pointstext} deducted"
     answer = template.format(ded=deduction,
                              pointstext=TextUtils.getGrammaticalNumber(
                                  deduction.points, "point", "points"))
     return answer