def _basic_query(self, user_id, start=None, end=None, timestamps=False): q = self.session.query(TicketCurrentStatus) q = q.filter_by(handler_id=user_id) if start is not None: if timestamps: start, end = convert_range_to_datetime(start, end) q = self._range_filter(q, start, end) return q
def get_delegated_query(self, user_id, start=None, end=None, timestamps=False): q = self.session.query(TicketCurrentStatus) q = q.filter_by(changed_by_id=user_id) if start is not None: if timestamps: start, end = convert_range_to_datetime(start, end) q = self._range_filter(q, start, end) q = q.filter(TicketCurrentStatus.status != "closed") q = q.filter(TicketCurrentStatus.handler_id != user_id) return q
def get_accessible(self, user_id, start=None, end=None, timestamps=False): q = self.session.query(CaseCurrentStatus) q = q.filter(CaseUser.case_id == CaseCurrentStatus.case_id) q = q.filter(CaseUser.user_id == user_id) if start is not None: if timestamps: start, end = convert_range_to_datetime(start, end) q = self._range_filter(q, start, end) q = q.filter(CaseCurrentStatus.status != 'closed') return q.all()
def get_current_status_range(self, start, end, timestamps=False): if timestamps: start, end = convert_range_to_datetime(start, end) q = self.session.query(CaseCurrentStatus) q = self._range_filter(q, start, end) return q.all()