Пример #1
0
def studentGrant(connDB,stude_id):

	program = data.grabStudentProgram(connDB, stude_id)		#tuple

	year = data.grabStudentYear(connDB,stude_id)

	plan = data.grabStudentPlan(connDB,stude_id)	

	formulaFee = data.grabFormulaFee(connDB, program)

	coursesRaw = data.grabStudentCourses(connDB, stude_id)

	normalUnits = data.grabNormalUnits(connDB, program)

	if year == 1 and "BA" in program: 		#accounts for first year students, since they have different weightings than upper years
		program = [("1st Year Arts"),]
	elif year == 1 and "BSC" in program:
		program = [("1st Year Science"),]

	programWeight = data.grabProgramWeight(connDB, program)

	BIU = data.grabBIU(connDB)

	for i in reversed(range(len(coursesRaw))):
		if coursesRaw[i] == None:
			courses = coursesRaw[:i]		#removes the None courses 

	creditsList = []
	for course_id in courses:
		creditsList.append(data.grabCourseCredits(connDB, course_id))			#tuple

	creditSum = 0.0
	for credit in creditsList:		#sum up all the credits that the student was enrolled 
		temp = credit[0]
		creditSum = creditSum + temp	#used to unpack the tuple


	if BIU == 0 or programWeight == 0:	#prevents totalBIU from being negative
		totalBIU = 0
	else:
		totalBIU = (BIU * programWeight) - formulaFee		

	proportion = creditSum / normalUnits

	grantGenerated = proportion * totalBIU

	return grantGenerated
Пример #2
0
def studentTuition(connDB, stude_id):			#pass in the student and calculate tuition of the student

	program = extractData.grabStudentProgram(connDB, stude_id)	

	coursesRaw = extractData.grabStudentCourses(connDB, stude_id)

	unitFee = extractData.grabUnitFees(connDB,program)

	for i in reversed(range(len(coursesRaw))):
		if coursesRaw[i] == None:			#eliminates the none courses
			courses = coursesRaw[:i]	
	
	creditsList = []
	for course_id in courses:		#finds the credits of each course that the student took
		creditsList.append(extractData.grabCourseCredits(connDB, course_id))
	
	creditSum = 0
	for credit in creditsList:		#sum up all the credits that the student was enrolled in
		creditSum = creditSum + (credit)	#used to unpack the tuple

	revenueGenerated = creditSum * unitFee		#formula to calculate revenue from each student

	return revenueGenerated