Ejemplo n.º 1
0
def generateActivity(request):
	oNames = ['hari', 'gopal', 'ram', 'gita', 'rita', 'shyam', 'mina']
	for i in xrange(200):
		a = file("E:/College/lms_member.csv", 'r')
		ran = random.choice([j+1 for j in xrange(1930)])
		for j in xrange(ran):
			item = a.readline()
		container = item.split();
		stuid = container[len(container)-1]
		student = getstudent(stuid)
		operator = getoperator(oNames[random.choice([j for j in xrange(len(oNames))])])

		amount = random.choice([j for j in xrange(20)]) + 10

		if amount > student.balance:
			continue

		student.balance -= amount
		activ = Activity(student=student,atype='payment',operator=operator,
								details="For photocopy" if i%2 == 0 else "Canteen expense",amount=amount)
		activ.save()

		student.save()

		a.close()
	return HttpResponse("activities set")
Ejemplo n.º 2
0
def activityDeposit(request):
	oNames = ['hari', 'gopal', 'ram', 'gita', 'rita', 'shyam', 'mina']
	for i in xrange(50):
		a = file("E:/College/lms_member.csv", 'r')
		ran = random.choice([j+1 for j in xrange(1930)])
		for j in xrange(ran):
			item = a.readline()
		container = item.split();
		stuid = container[len(container)-1]
		student = getstudent(stuid)
		operator = getoperator(oNames[random.choice([j for j in xrange(len(oNames))])])

		amount = random.choice([j for j in xrange(50)]) + 10

		student.balance += amount
		activ = Activity(student=student,atype='deposit',operator=operator,
								details="amount deposited",amount=amount)
		activ.save()

		student.save()

		a.close()
	return HttpResponse("deposit done")