Esempio n. 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())
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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())
Esempio n. 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)
Esempio n. 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)
Esempio n. 9
0
 def _conferenceToKeyStartDate(cls, conference):
     return str(datetimeToUnixTimeInt(
         conference.getStartDate())) + '_' + conference.getId()
Esempio n. 10
0
 def changeStartDate(self, booking, oldDate, newDate):
     oldTimestamp = datetimeToUnixTimeInt(oldDate)
     newTimestamp = datetimeToUnixTimeInt(newDate)
     self._startDateIndex.unindexBooking(booking, oldTimestamp)
     self._startDateIndex.indexBooking(booking, newTimestamp)
Esempio n. 11
0
 def changeModificationDate(self, booking, oldDate, newDate):
     oldTimestamp = datetimeToUnixTimeInt(oldDate)
     newTimestamp = datetimeToUnixTimeInt(newDate)
     self._modificationDateIndex.unindexBooking(booking, oldTimestamp)
     self._modificationDateIndex.indexBooking(booking, newTimestamp)
Esempio n. 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)
Esempio n. 13
0
 def changeStartDate(self, booking, oldDate, newDate):
     oldTimestamp = datetimeToUnixTimeInt(oldDate)
     newTimestamp = datetimeToUnixTimeInt(newDate)
     self._startDateIndex.unindexBooking(booking, oldTimestamp)
     self._startDateIndex.indexBooking(booking, newTimestamp)
Esempio n. 14
0
 def changeModificationDate(self, booking, oldDate, newDate):
     oldTimestamp = datetimeToUnixTimeInt(oldDate)
     newTimestamp = datetimeToUnixTimeInt(newDate)
     self._modificationDateIndex.unindexBooking(booking, oldTimestamp)
     self._modificationDateIndex.indexBooking(booking, newTimestamp)
Esempio n. 15
0
 def _conferenceToKeyStartDate(cls, conference):
     return str(datetimeToUnixTimeInt(conference.getStartDate())) + '_' + conference.getId()
Esempio n. 16
0
 def _dateToKey(cls, date):
     if date:
         return datetimeToUnixTimeInt(date)
     else:
         return None
Esempio n. 17
0
 def _dateToKey(cls, date):
     if date:
         return datetimeToUnixTimeInt(date)
     else:
         return None