def get_trips_to_improve(self, user_uuid): # pick trips which we would like to improve # will make usage of canonical trip class # returns a list of trips implementing Trip interface, could be basic E_Mission_Trips or canonical # TODO: Stubbed out returning all move trips in order to allow tests to pass return ti.TripIterator(user_uuid, ["recommender", "get_improve"], t.Canonical_E_Mission_Trip)
def get_alternative_for_trip(trip): # User Utility Pipeline calls this to get alternatve trips for one original trip (_id) try: ti = ecti.TripIterator(trip.trip_id, ["alternatives", "get_alternatives"], ect.Alternative_Trip) return ti except ecfm.AlternativesNotFound: return []
def get_alternative_for_trips(trip_it): # User Utility Pipeline calls this to get alternatve trips for one original trip (_id) alternatives = [] tripCnt = 0 for _trip in trip_it: logging.debug("Considering trip with id %s " % _trip.trip_id) tripCnt = tripCnt + 1 try: ti = ecti.TripIterator(_trip.trip_id, ["alternatives", "get_alternatives"], ect.Alternative_Trip) alternatives.append(ti) except ecfm.AlternativesNotFound: alternatives.append([]) logging.debug("tripCnt = %d, alternatives cnt = %d" % (tripCnt, len(alternatives))) return alternatives
def get_trips_for_alternatives(self, user_uuid): return ti.TripIterator(user_uuid, ["trips", "get_no_alternatives_past_month"])
def get_training_trips(self, user_id): return ti.TripIterator(user_id, ["utility", "get_training"], ecwt.E_Mission_Trip)