Skip to content

Commit

Permalink
Make limit on get_stop_times method optional
Browse files Browse the repository at this point in the history
  • Loading branch information
gsarrco committed Sep 29, 2023
1 parent fb50ea9 commit bdf11e9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions MuoVErsi/sources/GTFS/source.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def upload_stops_clusters_to_db(self, force=False) -> bool:
return True

def get_stop_times(self, stop: Station, line, start_time, day,
offset_times, count=False):
offset_times, count=False, limit=True):
cur = self.con.cursor()

route_name, route_id = line.split('-') if '-' in line else (line, '')
Expand Down Expand Up @@ -261,7 +261,8 @@ def get_stop_times(self, stop: Station, line, start_time, day,
params += (line,)

if not count:
params += (self.LIMIT, offset_times)
limit = self.LIMIT if limit else 100000
params += (limit, offset_times)

results = cur.execute(query, params).fetchall()

Expand Down
2 changes: 1 addition & 1 deletion MuoVErsi/sources/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def search_stops(self, name=None, lat=None, lon=None, page=1, limit=4, all_sourc
return stations, found

def get_stop_times(self, stop: Station, line, start_time, day,
offset_times, count=False):
offset_times, count=False, limit=True):
raise NotImplementedError

def get_stop_times_between_stops(self, dep_stop: Station, arr_stop: Station, line, start_time,
Expand Down
2 changes: 1 addition & 1 deletion MuoVErsi/sources/trenitalia.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def file_path(self):
return os.path.join(parent_dir, 'trenitalia.db')

def get_stop_times(self, stop: Station, line, start_time, day,
offset_times, count=False):
offset_times, count=False, limit=True):
day_start = datetime.combine(day, time(0))

if start_time == '':
Expand Down

0 comments on commit bdf11e9

Please sign in to comment.