def post(self): tAgentQuery = Agent().all() tAgentList = tAgentQuery.fetch(100) agent = Agent() for agent in tAgentList: agent.agentOnline = False agent.put() self.response.out.write("Success")
def get(self): tAgentQuery = Agent().all() tAgentQuery.filter('agentOnline', True) tAgents = tAgentQuery.fetch(10) if (len(tAgents) > 0): self.response.out.write(str(len(tAgents))) else: self.response.out.write(str(0)) exit
def GetContext(self): tContext = {} if (self.IsUserAdmin()): tAgentsQuery = Agent().all() tAgentsQuery.order("agentNickName") tAgentsQuery.filter("agentIsEnabled", True) tAgents = tAgentsQuery.fetch(100) tAgent = Agent() for tAgent in tAgents: tAgent.__setattr__('agentGoldSupplyEocString', NumberToGp.ConvertIntToBet(tAgent.agentGoldSupplyEoc)) tAgent.__setattr__('agentGoldSupply07String', NumberToGp.ConvertIntToBet(tAgent.agentGoldSupply07)) tContext['agents'] = tAgents return tContext else: self.redirect("/")
def get(self): tAgent = Agent() tAgentsOnline = [] tCurrentTime = datetime.datetime.now() tIncrement = datetime.timedelta(minutes = -30) tTime = tIncrement + tCurrentTime tAgentQuery = Agent().all() tAgentQuery.filter("agentOnline", True) tAgentQuery.filter("agentLastActive <", tTime) tAgentsOnline = tAgentQuery.fetch(10) if (len(tAgentsOnline) > 0): for tAgent in tAgentsOnline: tAgent.agentOnline = False tAgent.put()
def GetContext(self): tContext = {} if (self.IsUserAdmin()): tAgentsQuery = Agent().all() tAgentsQuery.order("agentNickName") tAgentsQuery.filter("agentIsEnabled", True) tAgents = tAgentsQuery.fetch(100) tAgent = Agent() for tAgent in tAgents: tAgent.__setattr__( 'agentGoldSupplyEocString', NumberToGp.ConvertIntToBet(tAgent.agentGoldSupplyEoc)) tAgent.__setattr__( 'agentGoldSupply07String', NumberToGp.ConvertIntToBet(tAgent.agentGoldSupply07)) tContext['agents'] = tAgents return tContext else: self.redirect("/")
def GetContext(self): tContext = {} tAgent = Agent() tAgentHandler = AgentHandler() tOrders = [] tOrder = Order() tUser = self.USER tAgentQuery = Agent().all() tAgentQuery.filter('agentOnline', True) tAgents = tAgentQuery.fetch(100) if (len(tAgents) > 0): tContext['agentnum'] = len(tAgents) tContext['agents'] = tAgents try: tAgent = Agent().GetAgentByEmail(str(tUser.email())) except: pass if (tAgent.agentId == 'No Agent'): tAgent.agentCurrentCommission = 0.0 tAgent.agentTotalCommission = 0.0 tAgent.agentOrders = [] tAgent.agentId = str(tUser.email()) tAgent.agentGoldSupply = 0 tAgent.agentOnline = False tAgent.put() if (tAgent.agentGoldSupply == None): tAgent.agentGoldSupply = 0 tOrderQuery = PaOrder.all() tOrderQuery.filter("paDeliveryAgent", tAgent.agentId) tOrderQuery.order("-paDateDelivered") tOrdersRaw = tOrderQuery.fetch(50) tAgentDonorsQuery = DonorRecord.all() tAgentDonorsQuery.filter('donorAgent', tAgent.agentId) tAgentDonorsQuery.order('-donorDate') tAgentDonations = tAgentDonorsQuery.fetch(20) for o in tOrdersRaw: tOrder = o if (tOrder != None): tOrders.append(tOrder) #tGoldSupply = tAgent.agentGoldSupply logging.debug('Original eoc ' + str(tAgent.agentGoldSupplyEoc)) logging.debug('Original 07 ' + str(tAgent.agentGoldSupply07)) tEocString = NumberToGp.ConvertIntToBet(tAgent.agentGoldSupplyEoc) t07String = NumberToGp.ConvertIntToBet(tAgent.agentGoldSupply07) logging.debug('Stringed version eoc ' + tEocString) logging.debug('Stringed version 07 ' + t07String) #tAgent.__setattr__('agentGoldSupplyEocString', tEocString) #tAgent.__setattr__('agentGoldSupply07String', t07String) tContext['agent'] = tAgent tContext['gpeocstring'] = str(tEocString) tContext['gp07string'] = str(t07String) #tContext['agentgold'] = locale.format("%d", int(tGoldSupply), grouping = True) tContext['orders'] = tOrders tContext['agentcomm'] = locale.format("%0.2f", tAgent.agentCurrentCommission, grouping=True) tContext['agenttotal'] = locale.format("%0.2f", tAgent.agentTotalCommission, grouping=True) tContext['donations'] = tAgentDonations return tContext