-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add coherent.release_date check
- Loading branch information
1 parent
a17342d
commit 2ce8c47
Showing
2 changed files
with
65 additions
and
8 deletions.
There are no files selected for viewing
52 changes: 52 additions & 0 deletions
52
contracting_process/resource_level/coherent/release_date.py
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,52 @@ | ||
""" | ||
.. seealso:: | ||
:func:`pelican.util.checks.coherent_dates_check | ||
""" | ||
|
||
from pelican.util.checks import coherent_dates_check | ||
from pelican.util.getter import get_values | ||
|
||
version = 1.0 | ||
|
||
|
||
def calculate(item): | ||
first_dates = [] | ||
|
||
for first_path in ( | ||
# amendments_dates | ||
"tender.amendments.date", | ||
"awards.amendments.date", | ||
"contracts.amendments.date", | ||
# dates | ||
"awards.date", | ||
"contracts.dateSigned", | ||
"contracts.implementation.transactions.date", | ||
# milestones_dates | ||
"planning.milestones.dateModified", | ||
"planning.milestones.dateMet", | ||
"tender.milestones.dateModified", | ||
"tender.milestones.dateMet", | ||
"contracts.milestones.dateModified", | ||
"contracts.milestones.dateMet", | ||
"contracts.implementation.milestones.dateModified", | ||
"contracts.implementation.milestones.dateMet", | ||
# documents_dates | ||
"planning.documents.datePublished", | ||
"planning.documents.dateModified", | ||
"tender.documents.datePublished", | ||
"tender.documents.dateModified", | ||
"awards.documents.datePublished", | ||
"awards.documents.dateModified", | ||
"contracts.documents.datePublished", | ||
"contracts.documents.dateModified", | ||
"contracts.implementation.documents.datePublished", | ||
"contracts.implementation.documents.dateModified", | ||
): | ||
first_dates.extend(get_values(item, first_path)) | ||
|
||
second_dates = get_values(item, "date") | ||
|
||
pairs = [(first_date, second_date) for first_date in first_dates for second_date in second_dates] | ||
|
||
return coherent_dates_check(version, pairs) |
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