Example #1
0
def get_links(user, minDT=None, maxDT=None, client=None):
    if client is None:
        client = redis_client
    minTS = minDT if isinstance(minDT, int) else datetimeToUnixTimeInt(minDT) if minDT else ''
    maxTS = maxDT if isinstance(maxDT, int) else datetimeToUnixTimeInt(maxDT) if maxDT else ''
    res = scripts.avatar_event_links_get_links(user.id, minTS, maxTS, client=client)
    if res is None:
        # Execution failed
        return OrderedDict()
    return OrderedDict((eid, set(roles)) for eid, roles in res.iteritems())
Example #2
0
 def getBookingsByConfDate(self, fromDate = None, toDate = None, conferenceId = None, categoryId = None):
     if fromDate:
         minKey = str(datetimeToUnixTimeInt(fromDate))
     else:
         minKey = None
     if toDate:
         maxKey = str(datetimeToUnixTimeInt(toDate)) + 'a' # because '_' < 'a' is True
     else:
         maxKey = None
     return self._conferenceStartDateIndex.getBookings(minKey, maxKey, conferenceId, categoryId)
Example #3
0
    def changeConfStartDate(self, booking, oldDate, newDate):
        oldTimestamp = datetimeToUnixTimeInt(oldDate)
        newTimestamp = datetimeToUnixTimeInt(newDate)
        conference = booking.getConference()
        conferenceId = booking.getConference().getId()

        oldKey = str(oldTimestamp) + '_' + conferenceId
        newKey = str(newTimestamp) + '_' + conferenceId

        self._conferenceStartDateIndex.unindexBooking(booking, oldKey)
        self._conferenceStartDateIndex.indexBooking(booking, conference, newKey)
Example #4
0
    def changeConfStartDate(self, booking, oldDate, newDate):
        oldTimestamp = datetimeToUnixTimeInt(oldDate)
        newTimestamp = datetimeToUnixTimeInt(newDate)
        conference = booking.getConference()
        conferenceId = booking.getConference().getId()

        oldKey = str(oldTimestamp) + '_' + conferenceId
        newKey = str(newTimestamp) + '_' + conferenceId

        self._conferenceStartDateIndex.unindexBooking(booking, oldKey)
        self._conferenceStartDateIndex.indexBooking(booking, conference,
                                                    newKey)
Example #5
0
 def getBookingsBetween(self,
                        fromDate,
                        toDate,
                        tz='UTC',
                        conferenceId=None,
                        categoryId=None,
                        dateFormat=None):
     if fromDate:
         fromDate = datetimeToUnixTimeInt(fromDate)
     if toDate:
         toDate = datetimeToUnixTimeInt(toDate)
     return self._getBookingsBetweenTimestamps(fromDate, toDate, tz,
                                               conferenceId, categoryId,
                                               dateFormat)
Example #6
0
def get_links(user, minDT=None, maxDT=None, client=None):
    if client is None:
        client = redis_client
    minTS = minDT if isinstance(
        minDT, int) else datetimeToUnixTimeInt(minDT) if minDT else ''
    maxTS = maxDT if isinstance(
        maxDT, int) else datetimeToUnixTimeInt(maxDT) if maxDT else ''
    res = scripts.avatar_event_links_get_links(user.id,
                                               minTS,
                                               maxTS,
                                               client=client)
    if res is None:
        # Execution failed
        return OrderedDict()
    return OrderedDict((eid, set(roles)) for eid, roles in res.iteritems())
Example #7
0
    def getBookingsByConfDate(self, fromDate = None, toDate = None,
                              conferenceId = None, categoryId = None,
                              tz = None, dateFormat = None, grouped=True):
        if fromDate:
            minKey = str(datetimeToUnixTimeInt(fromDate))
        else:
            minKey = None
        if toDate:
            maxKey = str(datetimeToUnixTimeInt(toDate)) + 'a' # because '_' < 'a' is True
        else:
            maxKey = None

        if grouped:
            return self._conferenceStartDateIndex._getBookingsGroupedByStartDate(minKey, maxKey, conferenceId,
                                                                                     categoryId, tz, dateFormat)
        else:
            return self._conferenceStartDateIndex.getBookings(minKey, maxKey, conferenceId, categoryId)
Example #8
0
    def getBookingsByConfDate(self,
                              fromDate=None,
                              toDate=None,
                              conferenceId=None,
                              categoryId=None,
                              tz=None,
                              dateFormat=None,
                              grouped=True):
        if fromDate:
            minKey = str(datetimeToUnixTimeInt(fromDate))
        else:
            minKey = None
        if toDate:
            maxKey = str(datetimeToUnixTimeInt(
                toDate)) + 'a'  # because '_' < 'a' is True
        else:
            maxKey = None

        if grouped:
            return self._conferenceStartDateIndex._getBookingsGroupedByStartDate(
                minKey, maxKey, conferenceId, categoryId, tz, dateFormat)
        else:
            return self._conferenceStartDateIndex.getBookings(
                minKey, maxKey, conferenceId, categoryId)
Example #9
0
 def _conferenceToKeyStartDate(cls, conference):
     return str(datetimeToUnixTimeInt(
         conference.getStartDate())) + '_' + conference.getId()
Example #10
0
 def changeStartDate(self, booking, oldDate, newDate):
     oldTimestamp = datetimeToUnixTimeInt(oldDate)
     newTimestamp = datetimeToUnixTimeInt(newDate)
     self._startDateIndex.unindexBooking(booking, oldTimestamp)
     self._startDateIndex.indexBooking(booking, newTimestamp)
Example #11
0
 def changeModificationDate(self, booking, oldDate, newDate):
     oldTimestamp = datetimeToUnixTimeInt(oldDate)
     newTimestamp = datetimeToUnixTimeInt(newDate)
     self._modificationDateIndex.unindexBooking(booking, oldTimestamp)
     self._modificationDateIndex.indexBooking(booking, newTimestamp)
Example #12
0
 def getBookingsBetween(self, fromDate, toDate, tz = 'UTC', conferenceId = None, categoryId = None, dateFormat = None):
     if fromDate:
         fromDate = datetimeToUnixTimeInt(fromDate)
     if toDate:
         toDate = datetimeToUnixTimeInt(toDate)
     return self._getBookingsBetweenTimestamps(fromDate, toDate, tz, conferenceId, categoryId, dateFormat)
Example #13
0
 def changeStartDate(self, booking, oldDate, newDate):
     oldTimestamp = datetimeToUnixTimeInt(oldDate)
     newTimestamp = datetimeToUnixTimeInt(newDate)
     self._startDateIndex.unindexBooking(booking, oldTimestamp)
     self._startDateIndex.indexBooking(booking, newTimestamp)
Example #14
0
 def changeModificationDate(self, booking, oldDate, newDate):
     oldTimestamp = datetimeToUnixTimeInt(oldDate)
     newTimestamp = datetimeToUnixTimeInt(newDate)
     self._modificationDateIndex.unindexBooking(booking, oldTimestamp)
     self._modificationDateIndex.indexBooking(booking, newTimestamp)
Example #15
0
 def _conferenceToKeyStartDate(cls, conference):
     return str(datetimeToUnixTimeInt(conference.getStartDate())) + '_' + conference.getId()
Example #16
0
 def _dateToKey(cls, date):
     if date:
         return datetimeToUnixTimeInt(date)
     else:
         return None
Example #17
0
 def _dateToKey(cls, date):
     if date:
         return datetimeToUnixTimeInt(date)
     else:
         return None