@@ -26,24 +26,23 @@ def loadOpts():
2626def generateDefaultOpts ():
2727 print ("generated opts" )
2828 fileString = """
29- ioForm : %H:%M:%S %d.%m.%Y
30- pathTime : ./times/
31- autoClockOut : 00:00:00
32- autoClockLim : 04:30:00
33- usernameFile : usernameFile.txt
34- adminPass : 1234
35- seasons : Build,Competition
36- BuildStart : 00:00:00 06.01.2018
37- BuildLeave : 23:59:59 20.02.2018
38- BuildHrs/Wk : 8
39- BuildHrsRqd : 54
40- CompetitionStart : 00:00:00 21.02.2018
41- CompetitionLeave : 23:59:59 14.04.2018
42- CompetitionHrs/Wk : 6
43- posTitle : Student,Mentor,Adult
44- posJobs : Programmer,Mechanic,Media
45-
46- """
29+ ioForm : %H:%M:%S %d.%m.%Y
30+ pathTime : ./times/
31+ autoClockOut : 00:00:00
32+ autoClockLim : 04:30:00
33+ usernameFile : usernameFile.txt
34+ adminPass : 1234
35+ seasons : Build,Competition
36+ BuildStart : 00:00:00 06.01.2018
37+ BuildLeave : 23:59:59 20.02.2018
38+ BuildHrs/Wk : 8
39+ BuildHrsRqd : 54
40+ CompetitionStart : 00:00:00 21.02.2018
41+ CompetitionLeave : 23:59:59 14.04.2018
42+ CompetitionHrs/Wk : 6
43+ posTitle : Student,Mentor,Adult
44+ posJobs : Programmer,Mechanic,Media
45+ """
4746 os .chdir (os .path .dirname (__file__ ))
4847 with open ("opts.txt" , "w" ) as file :
4948 file .write (fileString .strip ().replace ("\t " , "" ))
@@ -282,7 +281,11 @@ def calcUserData(name):
282281 userdata = name + "'s TimeData\n "
283282 userdata += "Total Time: " + str (calcUserTime (name )// 3600 )
284283 for season in opts ["seasons" ]:
285- userdata += "\n " + season + " Time: " + str (calcSeasonTime (name , season , ignoreCheck = True )[1 ]// 3600 )
284+ try :
285+ if opts [season + "Start" ] and opts [season + "Leave" ]:
286+ userdata += "\n " + season + " Time: " + str (calcSeasonTime (name , season , ignoreCheck = True )[1 ]// 3600 )
287+ except KeyError :
288+ print ("Season \" " + season "\" does not exist in opts.txt! Please give it a " + season "Start and " + season + "Leave time value!" )
286289
287290 return userdata
288291
0 commit comments