EduploneTest/types EduploneTestingEnvironment.py,1.6,1.7
"Fabian K." <[email protected]>
| Newsgroups | gmane.comp.web.zope.eduplone.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/eduplone/EduploneTest/types
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6137/EduploneTest/types
Modified Files:
EduploneTestingEnvironment.py
Log Message:
Added testIsRunning method to determine whether a test is running or not
Index: EduploneTestingEnvironment.py
===================================================================
RCS file: /cvsroot/eduplone/EduploneTest/types/EduploneTestingEnvironment.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** EduploneTestingEnvironment.py 7 Oct 2004 16:50:40 -0000 1.6
--- EduploneTestingEnvironment.py 10 Oct 2004 12:23:22 -0000 1.7
***************
*** 30,33 ****
--- 30,34 ----
from types import StringType, UnicodeType
+ from time import time
STRING_TYPES = [StringType, UnicodeType]
***************
*** 356,360 ****
return 0
-
def evalFreeTextAnswer(self, questionId, uAnswer):
""" """
--- 357,360 ----
***************
*** 364,370 ****
return uAnswer
-
-
-
def score_CalculateQuestion(self, questionId, userId):
""" calculates user-score for a single question
--- 364,367 ----
***************
*** 415,420 ****
return (float(questionScore)/float(len(possibleAnswers))) * correctAnswers
-
-
def score_CalculateTotal(self, userId):
""" calculates user-score for a single question """
--- 412,415 ----
***************
*** 424,429 ****
return totalscore
-
-
def getTotalAvailableScore(self):
""" sums up the available points """
--- 419,422 ----
***************
*** 436,439 ****
--- 429,446 ----
return str(TotalScore)
+ def testIsRunning(self):
+ """
+ Returns 1 if the test is running, 0 if not.
+ Uses start / stop times to evaluate.
+ """
+ current_time = time() ## time.time()
+ test_start_time = self.getStarttime().timeTime()
+ test_stop_time = self.getStoptime().timeTime()
+
+ if test_start_time < current_time < test_stop_time:
+ return 1
+ else:
+ return 0
+
def applyForTest(self):
"""
-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl