def put_proficiency(self, cont, prof, question_data):
		holder=str(self.default_rw).strip('[]')
		prof = Proficiency(student_magic_number = self.magic,
								question_type = cont, 
								proficiency = float(prof),
								last_problem = question_data["typ"],
								last_problem_level = float(question_data["lev"]),
								right_wrong = holder 
							)
		prof.put()
Esempio n. 2
0
  def get(self):     
	"""

	This method retrieves Congressional data. It is not necessary for 
	an unrelated client app for authoring quizzes.

	"""
	from models import Proficiency
	self.this_app = Proficiency.get_by_key_name(APP_NAME)
	if self.this_app is None: # First initialization
	    self.this_app = Proficiency(name = APP_NAME)
	    db.put(self.this_app)
	self.save = []
	bills = self.get_top_bills()
	for bill in bills: self.update_bill(bill)
	db.put(self.save) # save new bills to datastore in one trip
	return
Esempio n. 3
0
def addProf():
    """
    Add a single proficiency.

    Query params expected:
    1. category
    2. label
    3. description
    4. rating

    Optional params:
    1. icon
    2. iconColour
    """

    expectedParams = ['category', 'label', 'description', 'rating']
    optionalParams = ['icon', 'iconColour']

    if not all(request.json.get(item) for item in expectedParams):
        return abort(400)

    json = request.json
    prof = Proficiency(
        category=json.get('category'),
        icon=json.get('icon') if json.get('icon') else None,
        iconColour=json.get('iconColour') if json.get('iconColour') else None,
        label=json.get('label'),
        description=json.get('description'),
        rating=json.get('rating')
    )

    try:
        db.session.add(prof)
        db.session.commit()
    except:
        db.session.rollback()
        return abort(500)

    db.session.close()
    return jsonify(simpleMsgResp("Your record has been sucesfully inserted."))
	def get_student_proficiency(self, magic, cont):
		return Proficiency.all().filter('student_magic_number =', str(magic)).filter('question_type =', cont).order('-time')