Skip to content

Commit

Permalink
Merge pull request #233 from oleksiyVeretiuk/configurable_working_day…
Browse files Browse the repository at this point in the history
…s_flag

Make working days flag configurable for signing and verification period
  • Loading branch information
leits committed Mar 26, 2019
2 parents 740634f + 1911dda commit 11511c0
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,9 @@ def _start_awarding(self):
award.admissionPeriod = {
'startDate': now,
'endDate': calculate_business_date(
now, self.VERIFY_ADMISSION_PROTOCOL_TIME, auction,
True, self.AWARDING_PERIODS_END_DATE_HOUR
start=now,
context=auction,
**award.ADMISSION_PERIOD_PARAMS
)
}
add_award_route_url(self.request, auction, award, awarding_type)
Expand Down
35 changes: 24 additions & 11 deletions openprocurement/auctions/core/plugins/awarding/v3_1/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,24 @@ def __acl__(self):
signingPeriod = ModelType(Period)
admissionPeriod = ModelType(Period)

VERIFY_AUCTION_PROTOCOL_TIME = timedelta(days=10)
CONTRACT_SIGNING_TIME = timedelta(days=40)
VERIFY_ADMISSION_PROTOCOL_TIME = timedelta(days=5)
AWARDING_PERIODS_END_DATE_HOUR = 18
VERIFICATION_PERIOD_PARAMS = {
'delta': timedelta(days=10),
'specific_hour': 18,
'working_days': True
}

SIGNING_PERIOD_PARAMS = {
'delta': timedelta(days=40),
'specific_hour': 18,
'working_days': False,
'result_is_working_day': True
}

ADMISSION_PERIOD_PARAMS = {
'delta': timedelta(days=5),
'specific_hour': 18,
'working_days': True
}

@serializable(serialized_name="verificationPeriod", serialize_when_none=False)
def award_verificationPeriod(self):
Expand All @@ -78,7 +92,9 @@ def award_verificationPeriod(self):
if not period.endDate:
auction = get_auction(self)
period.endDate = calculate_business_date(
period.startDate, self.VERIFY_AUCTION_PROTOCOL_TIME, auction, True, self.AWARDING_PERIODS_END_DATE_HOUR
start=period.startDate,
context=auction,
**self.VERIFICATION_PERIOD_PARAMS
)
return period.to_primitive()

Expand All @@ -90,11 +106,8 @@ def award_signingPeriod(self):
if not period.endDate:
auction = get_auction(self)
period.endDate = calculate_business_date(
period.startDate,
self.CONTRACT_SIGNING_TIME,
auction,
working_days=False,
specific_hour=self.AWARDING_PERIODS_END_DATE_HOUR,
result_is_working_day=True
start=period.startDate,
context=auction,
**self.SIGNING_PERIOD_PARAMS
)
return period.to_primitive()

0 comments on commit 11511c0

Please sign in to comment.