本文整理汇总了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]