本文整理匯總了Python中DatabaseController.getStudentSchoolsList方法的典型用法代碼示例。如果您正苦於以下問題:Python DatabaseController.getStudentSchoolsList方法的具體用法?Python DatabaseController.getStudentSchoolsList怎麽用?Python DatabaseController.getStudentSchoolsList使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類DatabaseController
的用法示例。
在下文中一共展示了DatabaseController.getStudentSchoolsList方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: getGeneralOpenDaysAndTimesDetails
# 需要導入模塊: import DatabaseController [as 別名]
# 或者: from DatabaseController import getStudentSchoolsList [as 別名]
def getGeneralOpenDaysAndTimesDetails(personId, personType):
openingDaysAndTimes = []
openingTimes = []
listOfSchools = []
if personType == "Teacher":
listOfSchools = DatabaseController.getTeacherSchoolsList(personId)
elif personType == "Student":
listOfSchools = DatabaseController.getStudentSchoolsList(personId)
allSchoolDetailsList = []
for eachSchool in listOfSchools:
allSchoolDetailsList.append(getSchoolOpeningHours(eachSchool[0]))
index = 0
while index < allSchoolDetailsList.__len__():
if index == 0:
openingDaysAndTimes = allSchoolDetailsList[index][1]
openingTimes = allSchoolDetailsList[index][2]
else:
openingDaysAndTimesAtIndex = allSchoolDetailsList[index][1]
openingTimesAtIndex = allSchoolDetailsList[index][2]
for innerIndex in range(0, 7):
storedTimeId = openingDaysAndTimes[innerIndex].timeId
currentTimeId = openingDaysAndTimesAtIndex[innerIndex].timeId
# Only perform checks if there is a time id to compare against
if currentTimeId > 0:
if storedTimeId == 0:
# No previous record stored for this weekday - add it to the openingTimes list
openingDaysAndTimes[innerIndex].timeId = openingDaysAndTimesAtIndex[innerIndex].timeId
timeIndex = 0
foundTime = False
while timeIndex < openingTimesAtIndex.__len__() and foundTime == False:
if openingTimesAtIndex[timeIndex].timeId == currentTimeId:
openingTimes.append(openingTimesAtIndex[timeIndex])
foundTime = True
timeIndex += 1
else:
# Get the time object matched to both the stored day and the current day to be compared
timeIndex = 0
foundTime = False
while timeIndex < openingTimes.__len__() and foundTime == False:
if storedTimeId == openingTimes[timeIndex].timeId:
storedTimeObject = openingTimes[timeIndex]
foundTime = True
timeIndex += 1
timeIndex = 0
foundTime = False
while timeIndex < openingTimesAtIndex.__len__() and foundTime == False:
if currentTimeId == openingTimesAtIndex[timeIndex].timeId:
currentTimeObject = openingTimesAtIndex[timeIndex]
foundTime = True
timeIndex += 1
# Compare the times of each object - set the earliest start time and latest end time if required
storedStartTime = int(storedTimeObject.startTime[0:storedTimeObject.startTime.index(":")])
storedEndTime = int(storedTimeObject.endTime[0:storedTimeObject.endTime.index(":")])
currentStartTime = int(currentTimeObject.startTime[0:currentTimeObject.startTime.index(":")])
currentEndTime = int(currentTimeObject.endTime[0:storedTimeObject.endTime.index(":")])
if storedStartTime > currentStartTime:
storedTimeObject.startTime = currentTimeObject.startTime
if storedEndTime < currentEndTime:
storedTimeObject.endTime = currentTimeObject.endTime
index += 1
# Now determine the earliest start time, the latest end time and the list of open day indexes
dayHoursAndIndexes = determineTimetabledHoursAndIndexes(openingDaysAndTimes, openingTimes)
listOfOpenDayIndexes = dayHoursAndIndexes[0]
earliestStartTime = dayHoursAndIndexes[1]
latestEndTime = dayHoursAndIndexes[2]
return [listOfOpenDayIndexes, earliestStartTime, latestEndTime, openingDaysAndTimes, openingTimes]