Skip to content
This repository has been archived by the owner on Nov 9, 2024. It is now read-only.

Sort by time ignores date field #3

Open
jipis opened this issue Dec 25, 2018 · 2 comments
Open

Sort by time ignores date field #3

jipis opened this issue Dec 25, 2018 · 2 comments

Comments

@jipis
Copy link
Contributor

jipis commented Dec 25, 2018

Unfortunately, sorting by departure or arrival times, if searching across multiple dates, isn't useful. Times across two different dates are intermingled, sorted SOLELY by the time column. To wit:

$ python southwest.py -d BWI -a FLL -t 2018-12-29 2018-12-30 -m 0 -l -s depart -e toFLL
Processed 1/2
Processed 2/2
  flight  date        depart    arrive      fares  route               stops  duration
--------  ----------  --------  --------  -------  ----------------  -------  ----------
    3370  2018-12-29  06:15     08:55      278.98  [u'BWI', u'FLL']        0  02:40
     136  2018-12-30  06:20     09:00      213.98  [u'BWI', u'FLL']        0  02:40
    3988  2018-12-29  07:55     10:35      460.98  [u'BWI', u'FLL']        0  02:40
    6771  2018-12-30  08:50     11:35      298.98  [u'BWI', u'FLL']        0  02:45
    3937  2018-12-29  09:55     12:40      298.98  [u'BWI', u'FLL']        0  02:45
    3078  2018-12-29  10:50     13:30      298.98  [u'BWI', u'FLL']        0  02:40
    5980  2018-12-30  10:55     13:40      298.98  [u'BWI', u'FLL']        0  02:45
    4435  2018-12-30  13:00     15:40      298.98  [u'BWI', u'FLL']        0  02:40
    4481  2018-12-29  13:10     15:50      298.98  [u'BWI', u'FLL']        0  02:40
    5726  2018-12-30  15:25     18:05      298.98  [u'BWI', u'FLL']        0  02:40
    6722  2018-12-29  15:35     18:15      298.98  [u'BWI', u'FLL']        0  02:40
    5513  2018-12-30  16:40     19:20      298.98  [u'BWI', u'FLL']        0  02:40
    3094  2018-12-30  17:30     20:10      298.98  [u'BWI', u'FLL']        0  02:40
    5544  2018-12-29  17:35     20:15      298.98  [u'BWI', u'FLL']        0  02:40
    5462  2018-12-30  18:40     21:20      298.98  [u'BWI', u'FLL']        0  02:40
    3221  2018-12-29  19:10     21:50      213.98  [u'BWI', u'FLL']        0  02:40
    6818  2018-12-30  21:20     23:55      163.98  [u'BWI', u'FLL']        0  02:35
    3076  2018-12-29  21:50     00:25      163.98  [u'BWI', u'FLL']        0  02:35
    2617  2018-12-30  22:25     01:00      163.98  [u'BWI', u'FLL']        0  02:35
@redfern314
Copy link
Owner

Good point. So, you think the right behavior is to implicitly sort first by date, then by time? Or maybe you should be able to specify a primary and secondary sort column to do it explicitly?

@jipis
Copy link
Contributor Author

jipis commented Dec 25, 2018

Hrm... I just thought of the use case for it working as it does now: "I know I want to leave in the morning, but I don't care which day." :-/

I can see this working two different ways. Actually, it'll "work" the same both ways, just two different ways for the user to see it. Option one is as you said, primary and secondary sort, explicitly offered that way via arguments. So -s depart_time is as it works now and -s depart_date depart_time is as I was looking to have it done. The other is to give a name to each type of sort: -s depart_time vs -s depart_order or something like that. Under the hood, they'd work the same, though.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants