-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #255 from msusicky/develop
2.2.9
- Loading branch information
Showing
27 changed files
with
2,876 additions
and
1,587 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from datetime import date | ||
|
||
from flask import g | ||
from sqlalchemy import func | ||
|
||
from app import db | ||
from app.models import Import | ||
|
||
STATUS_FINISHED = 'FINISHED' | ||
|
||
|
||
def get_import_date(): | ||
""" | ||
Returns date of the last successful import. | ||
""" | ||
if 'import_date' not in g: | ||
last_date = db.session.query(func.max(Import.date)).filter(Import.status == STATUS_FINISHED).first()[0] | ||
g.import_date = date.today() if last_date is None else last_date | ||
|
||
return g.import_date | ||
|
||
|
||
def get_import_id(): | ||
""" | ||
Returns id of the last successful import. | ||
""" | ||
if 'import_id' not in g: | ||
last_id = db.session.query(func.max(Import.id)).filter(Import.status == STATUS_FINISHED).first()[0] | ||
g.import_id = -1 if last_id is None else last_id | ||
|
||
return g.import_id |
Oops, something went wrong.