Пример #1
0
	def update_stats(self):
	  save = []
	  self.fixture_offset = Setting.get_by_key_name('fixture_offset') 
	  if self.fixture_offset.status != "update_stats":
		   logging.warning('Update Stats Job Hit Twice In A Row')
		   print "error -- current status: ", self.fixture_offset.status
		   return False
	  (this_account, this_user, this_quiz_taker) = memcache.get('current_fixture')
	  logging.info('Updating User Stats for User %s', this_user.unique_identifier)
	  from quiztaker.methods import ProficiencyLevels
	  pl = ProficiencyLevels()
	  pl.set_for_user(this_quiz_taker)
	  from accounts.methods import Awards
	  awards = Awards()
	  # check for new awards
	  new_awards = awards.check_all(this_quiz_taker)
	  from accounts.methods import Sponsorships
	  sponsorships = Sponsorships()
	  # check for new sponsorships, both personal and business
	  new_sponsorships = sponsorships.check_user(this_user)
	  self.fixture_offset.value += 1
	  self.fixture_offset.status = "create_account"
	  save.append(self.fixture_offset)
	  db.put(self.fixture_offset)
	  return new_awards, new_sponsorships
Пример #2
0
Файл: rpc.py Проект: jamslevy/PQ
  def set_levels(self, *args):
	from utils.appengine_utilities.sessions import Session
  	self.session = Session()
  	if not self.session['user']: return "Not Logged In"
  	from quiztaker.methods import ProficiencyLevels
  	from model.user import QuizTaker
  	pl = ProficiencyLevels()
  	return pl.set_for_user( QuizTaker.get_by_key_name(self.session['user'].unique_identifier) )
Пример #3
0
Файл: rpc.py Проект: jamslevy/PQ
 def update_user_stats(self):
     from quiztaker.methods import ProficiencyLevels
     pl = ProficiencyLevels()
     from model.quiz import QuizTaker
     qt = QuizTaker.get_by_key_name(self.session['user'].unique_identifier)
     logging.info('Updating Level Stats for User %s', qt.unique_identifier)
     saved_stats = pl.set_for_user(qt)
     logging.info(len(saved_stats)) 
     if len(saved_stats) < 2: return False
     print "OK"
     return "OK"