示例#1
0
def main():
	batch=None
	username=raw_input("Username >>>")
	pwd=getpass.getpass("Password >>>")
	with open('TeacherRecords.txt') as readTeacherFile:
		jsonData1=json.load(readTeacherFile)
		for i in range(len(jsonData1)):
			if jsonData1[i]['username']==username and jsonData1[i]['password']==pwd :
				batch=jsonData1[i]['batch']
				print "\n",jsonData1[i]['name']," -Batch ",batch,"\n","Access Granted"
				if jsonData1[i]['is_Marks_Updated']=="False":
					print "Reminder to upload the latest test marks"
				break
		if batch==None:
			print "Access Denied"
			print "Username or password or both are incorrect!!!Please try again"
			return
	while True:
		print "\n1. See the list of students in ur batch"
		print "2. Upload marks of the Latest Test"
		print "3. Modify marks of individual student"
		print "0. Quit"
		choice=input(">>>")
		obj=TeacherInterface()
		if choice==1:
			obj.showListOfStudents(batch)

		elif choice==2:
			obj.uploadMarks(batch)

		elif choice==3:
			obj.modifyMarks(batch)

		elif choice==0:
			break

		else:
			Error.showError()
示例#2
0
			datadict={'name':jsonDataSorted[i]['name'],'marks':jsonDataSorted[i]['marks'],"batch":jsonDataSorted[i]['batch']}
			listObj.append(datadict)
		json.dump(listObj,open('MarkSheet.txt','w'))
		jsonDataSorted=json.load(open('MarkSheet.txt'))
		open('MarkSheet.txt','w').write(json.dumps(jsonDataSorted,indent=4))
		os.system('MarkSheet.txt')


def AdmInterface(choice):
	AdmObj=Administrator()
	if choice==2:
		AdmObj.startNewTest()    #upload marks for all the students
	elif choice==3:
		AdmObj.reMapping()       #Shuffle students and allot them batches

while(True):
	print "\nPress 1 to Access the Coaching Students Database"	
	print "Press 2 to start a new test(give reminders to teachers)"
	print "Press 3 for Batch Allotment"
	print "Press 0 to exit"
	choicefour=input(">>>")
	if choicefour==1:
		coachingtemp.accessStuData()
	elif choicefour==2 or choicefour==3:
		AdmInterface(choicefour)
	elif choicefour==0:
		break
	else:
		Error.showError()