Пример #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_sponsorships(self, *args):
	from utils.appengine_utilities.sessions import Session
  	self.session = Session()
  	if not self.session['user']: return "Not Logged In"
  	from accounts.methods import Sponsorships
  	sponsorships = Sponsorships()
  	return sponsorships.check_user(self.session['user'])
Пример #3
0
Файл: rpc.py Проект: jamslevy/PQ
 def update_user_sponsorships(self):          
     """
     
     Since sponsorships are now turned off, this has been disabled.
     
     
     """
     
     print "OK"
     return "OK"
     
     from accounts.methods import Sponsorships
     sponsorships = Sponsorships()
     # check for new sponsorships, both personal and business
     logging.info('Updating Sponsorships for User %s', self.session['user'].unique_identifier) 
     new_sponsorships = sponsorships.check_user(self.session['user'])
     if new_sponsorships > 0: self.session['flash_msg'] = 'new_sponsorship'
     print "OK"
     return "OK"