Пример #1
0
    def recordEvent(cls, userKeyUrlsafe, entityKey1Urlsafe, entityKey2Urlsafe,
                    eventName):
        logging.info('Entered RECORD event')
        userKey = ndb.Key(urlsafe=userKeyUrlsafe)
        entityKey1 = None
        entityKey2 = None
        if entityKey1Urlsafe and entityKey1Urlsafe != '':
            entityKey1 = ndb.Key(urlsafe=entityKey1Urlsafe)
        if entityKey2Urlsafe and entityKey2Urlsafe != '':
            logging.info('E2US: ++++++ ' + str(entityKey2Urlsafe))
            entityKey2 = ndb.Key(urlsafe=entityKey2Urlsafe)

        todayPST = PST.convert(datetime.datetime.now())
        dayGMT = datetime.date(todayPST.year, todayPST.month, todayPST.day)

        qry = DayEventSummary.query(DayEventSummary.day == dayGMT,
                                    DayEventSummary.name == eventName)
        daySummaries = qry.fetch(1)
        daySummary = None
        if daySummaries:
            daySummary = daySummaries[0]

        if daySummary:
            daySummary.count = daySummary.count + 1
        else:
            daySummary = DayEventSummary(day=dayGMT, name=eventName)

        daySummary.put()
        r = ReportEvent(user=userKey,
                        refEntity1=entityKey1,
                        refEntity2=entityKey2,
                        time=datetime.datetime.now(),
                        name=eventName)
        r.put()
Пример #2
0
 def recordEvent(cls, userKeyUrlsafe, entityKey1Urlsafe, entityKey2Urlsafe, eventName):
     logging.info('Entered RECORD event')
     userKey = ndb.Key(urlsafe = userKeyUrlsafe)
     entityKey1 = None
     entityKey2 = None
     if entityKey1Urlsafe and entityKey1Urlsafe != '':
         entityKey1 = ndb.Key(urlsafe = entityKey1Urlsafe) 
     if entityKey2Urlsafe and entityKey2Urlsafe != '':
         logging.info('E2US: ++++++ ' + str(entityKey2Urlsafe))
         entityKey2 = ndb.Key(urlsafe = entityKey2Urlsafe)
     
     
     todayPST = PST.convert(datetime.datetime.now())
     dayGMT = datetime.date(todayPST.year, todayPST.month, todayPST.day) 
     
     qry = DayEventSummary.query( 
         DayEventSummary.day == dayGMT, 
         DayEventSummary.name == eventName )
     daySummaries = qry.fetch(1)
     daySummary = None
     if daySummaries:
         daySummary = daySummaries[0]
         
     if daySummary:
         daySummary.count = daySummary.count + 1
     else:
         daySummary = DayEventSummary(
             day=dayGMT, 
             name=eventName)
     
     daySummary.put()
     r = ReportEvent(user=userKey, 
                 refEntity1=entityKey1,
                 refEntity2=entityKey2,
                 time = datetime.datetime.now(),
                 name = eventName)
     r.put()
 def PSTupdated(self):
     return PST.convert(self.updated)
Пример #4
0
 def PSTlastView(self):
     return PST.convert(self.lastViewed)
Пример #5
0
 def PSTlastlogin(self):
     return PST.convert(self.lastLogin)
Пример #6
0
 def PSTlastView(self):
     return PST.convert(self.lastViewed)
Пример #7
0
 def PSTlastlogin(self):
     return PST.convert(self.lastLogin)
Пример #8
0
 def PSTupdated(self):
     return PST.convert(self.updated)
Пример #9
0
 def PSTdateEdited(self):
     return PST.convert(self.dateEdited)