Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes behaviour of get_stations() returning query objects #99

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Changes in docs
heavelock committed Oct 12, 2017

Verified

This commit was signed with the committer’s verified signature.
michaelsproul Michael Sproul
commit e2936157625b51e8fd2bceef3450fbb5c776a582
10 changes: 5 additions & 5 deletions msnoise/api.py
Original file line number Diff line number Diff line change
@@ -316,22 +316,22 @@ def get_stations(session, all=False, net=None):
:type net: str
:param net: if set, limits the stations returned to this network

:rtype: list of :class:`msnoise.msnoise_table_def.Station`
:returns: list of :class:`~msnoise.msnoise_table_def.Station`
:rtype: :class:`sqlalchemy.orm.query.Query`
:returns: :class:`sqlalchemy.orm.query.Query` with desired stations
"""
q = session.query(Station)
if all:
if net is not None:
stations = q.filter(Station.net == net).order_by(Station.net).\
order_by(Station.sta).all()
order_by(Station.sta)
else:
stations = q.order_by(Station.net).order_by(Station.sta)
else:
stations = q.filter(Station.used == True).order_by(Station.net).\
order_by(Station.sta).all()
order_by(Station.sta)
if net is not None:
stations = stations.filter(Station.net == net).\
order_by(Station.net).order_by(Station.sta).all()
order_by(Station.net).order_by(Station.sta)
return stations