Ejemplo n.º 1
0
	def get_user_ratings(self, user):
		collection = self.rating_collection
		ratings = collection.find({'user' : user})

		modelled_rating_arr = []
		for rating in ratings:
			model_rating = Rating()
			model_rating.set_name(rating["subject_name"])
			model_rating.set_star(rating["star"])
			model_rating.set_date(rating["date"])
			model_rating.set_batch(rating["batch"])
			model_rating.set_username(rating["user"])
			model_rating.set_sem(rating["sem"])

			modelled_rating_arr.append(model_rating)
		return modelled_rating_arr
Ejemplo n.º 2
0
	def get_user_ratings_by_sem(self, user, semno):
		collection = self.rating_collection

		ratings = collection.find({"user":user, "sem":int(semno)})

		modelled_rating_arr = []
		for rating in ratings:
			model_rating = Rating()
			model_rating.set_name(rating["subject_name"])
			model_rating.set_star(rating["star"])
			model_rating.set_date(rating["date"])
			model_rating.set_batch(rating["batch"])
			model_rating.set_username(rating["user"])
			model_rating.set_sem(rating["sem"])

			modelled_rating_arr.append(model_rating)
		print modelled_rating_arr
		return modelled_rating_arr
Ejemplo n.º 3
0
	def get_all_ratings(self):
		collection = self.Rating_collection
		ratings = collection.find()

		modelled_rating_arr = []
		for rating in ratings:
			# model data from Rating
			
			# print Rating
			model_rating = Rating()
			model_rating.set_name(rating["subject_name"])
			model_rating.set_star(rating["star"])
			model_rating.set_date(rating["date"])
			model_rating.set_batch(rating["batch"])
			model_rating.set_batch(rating["user"])
			model_rating.set_batch(rating["sem"])
			
			# append modelled Rating to array
			modelled_rating_arr.append(model_rating)
		
		return modelled_rating_arr
Ejemplo n.º 4
0
	def get_ratings_by_batch(self, batch):
		print "in get by batch"
		collection = self.rating_collection
		ratings = collection.find({"batchname":batch})

		modelled_rating_arr = []
		for rating in ratings:
			# model data from Rating
			
			# print Rating
			model_rating = Rating()
			model_rating.set_name(rating["subject_name"])
			model_rating.set_star(rating["star"])
			model_rating.set_date(rating["date"])
			model_rating.set_batch(rating["batch"])
			model_rating.set_batch(rating["user"])
			model_rating.set_batch(rating["sem"])
			
			# append modelled Rating to array
			modelled_rating_arr.append(model_rating)

		return modelled_Rating_arr