Skip to content

Commit

Permalink
Fixed changing status
Browse files Browse the repository at this point in the history
  • Loading branch information
kroman0 committed Jan 25, 2016
1 parent 7cf1198 commit 643cd17
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion openprocurement/tender/openua/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ def numberOfBids(self):
def next_check(self):
now = get_now()
checks = []
if self.status == 'active.tendering' and self.tenderPeriod.endDate and not any([i.status == 'accepted' for i in self.complaints]):
if self.status == 'active.tendering' and self.tenderPeriod.endDate and not any([i.status in ['pending', 'accepted'] for i in self.complaints]):
checks.append(self.tenderPeriod.endDate.astimezone(TZ))
elif not self.lots and self.status == 'active.awarded':
standStillEnds = [
Expand Down
6 changes: 3 additions & 3 deletions openprocurement/tender/openua/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def check_bids(request):
tender = request.validated['tender']
if tender.lots:
[setattr(i, 'status', 'unsuccessful') for i in tender.lots if i.numberOfBids < 2]
if set([i.status for i in tender.lots]) == set(['unsuccessful']):
if not set([i.status for i in tender.lots]).difference(set(['unsuccessful', 'cancelled'])):
tender.status = 'unsuccessful'
else:
if tender.numberOfBids < 2:
Expand All @@ -41,15 +41,15 @@ def check_bids(request):
def check_status(request):
tender = request.validated['tender']
now = get_now()
if not tender.lots and tender.status == 'active.tendering' and tender.tenderPeriod.endDate <= now and not any([i.status == 'accepted' for i in tender.complaints]):
if not tender.lots and tender.status == 'active.tendering' and tender.tenderPeriod.endDate <= now and not any([i.status in ['pending', 'accepted'] for i in tender.complaints]):
LOGGER.info('Switched tender {} to {}'.format(tender['id'], 'active.auction'),
extra=context_unpack(request, {'MESSAGE_ID': 'switched_tender_active.auction'}))
tender.status = 'active.auction'
check_bids(request)
if tender.numberOfBids < 2 and tender.auctionPeriod:
tender.auctionPeriod.startDate = None
return
elif tender.lots and tender.status == 'active.tendering' and tender.tenderPeriod.endDate <= now and not any([i.status == 'accepted' for i in tender.complaints]):
elif tender.lots and tender.status == 'active.tendering' and tender.tenderPeriod.endDate <= now and not any([i.status in ['pending', 'accepted'] for i in tender.complaints]):
LOGGER.info('Switched tender {} to {}'.format(tender['id'], 'active.auction'),
extra=context_unpack(request, {'MESSAGE_ID': 'switched_tender_active.auction'}))
tender.status = 'active.auction'
Expand Down

0 comments on commit 643cd17

Please sign in to comment.