-
Notifications
You must be signed in to change notification settings - Fork 156
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Flight schedule importer/exporter #194
Milestone
Comments
nabeelio
added a commit
that referenced
this issue
Feb 22, 2018
nabeelio
added a commit
that referenced
this issue
Feb 22, 2018
nabeelio
added a commit
that referenced
this issue
Mar 21, 2018
nabeelio
added a commit
that referenced
this issue
Mar 21, 2018
nabeelio
added a commit
that referenced
this issue
Mar 22, 2018
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
Import flights via CSV format, or export them. This CSV format is a bit more complicated than past formats.
Library
Tasks
app/Services/ImportService.php
service, All importers should go herephp artisan phpvms:import schedules /path/to/file.csv
)storage/importer
folderImporterTest.php
in/tests
directorydays
,subfleets
,fares
, andfields
columnsFlightRepository
injected for the insert/updatesFormat for file:
* not implemented yet
Days
The integers are for the days, starting from
0
, a Sunday. This is converted to a bitmask for storage, but that might be changed.Where this becomes tricky is supporting the different database types. It might not be worth the effort to do this with bitmasks, though, bitmasks are likely going to be faster than any wildcarded string match operations when the table is scanned.
See
app/Models/Enums/Days.php
for bit valuesSubfleets
The format for the subfleet column is either semicolon separated or space separated
or
Fares
Since the fare can be overridden on a per-flight basis, taking precedence over the fare on the subfleet or the fare itself, the format can be complicated. It needs to be quoted, and comma separated, with the fare class, and in parenthesis, the fields and their values. The fields are optional.
Example:
So the economy class,
Y
, for this flight, will have a price of $200, and cost $100. The first class fare,F
, only will override the price, with the other fields being derived from the subfleet. This takes the format of a query string, so we can more easily parse, either using some URL parsing tools, usingexplode()
on the;
character to determine all the different fare types, which can either be run through a URL parser, or just moreexplode()
calls to determine the column values.Can optionally be quoted.
See
app/Services/ImporterService::parseMultiColumnValues()
Fields
Set custom fields and values, similar to the above format:
Can optionally be quoted. This parser should be the same as the parser above.
See
app/Services/ImporterService::parseMultiColumnValues()
The text was updated successfully, but these errors were encountered: