Skip to content

Commit

Permalink
Merge d1b3056 into 44c2503
Browse files Browse the repository at this point in the history
  • Loading branch information
bdmbdsm committed Sep 24, 2018
2 parents 44c2503 + d1b3056 commit 25103bd
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions openprocurement/auctions/flash/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
remove_draft_bids,
check_bids
)
from openprocurement.auctions.core.interfaces import IAuctionManager

PKG = get_distribution(__package__)
LOGGER = getLogger(PKG.project_name)

Expand Down Expand Up @@ -104,6 +106,7 @@ def check_status_flash(request):

def check_auction_status(request):
auction = request.validated['auction']
adapter = request.registry.getAdapter(auction, IAuctionManager)
now = get_now()
if auction.lots:
if any([i.status in auction.block_complaint_status and i.relatedLot is None for i in auction.complaints]):
Expand Down Expand Up @@ -161,7 +164,7 @@ def check_auction_status(request):
extra=context_unpack(request,
{'MESSAGE_ID': 'switched_lot_cancelled'},
{'LOT_ID': lot.id}))
auction.status = 'cancelled'
adapter.pendify_auction_status('cancelled')
elif not statuses.difference(set(['unsuccessful', 'cancelled'])):
LOGGER.info('Switched lot %s of auction %s to %s',
lot.id,
Expand All @@ -170,7 +173,7 @@ def check_auction_status(request):
extra=context_unpack(request,
{'MESSAGE_ID': 'switched_lot_unsuccessful'},
{'LOT_ID': lot.id}))
auction.status = 'unsuccessful'
adapter.pendify_auction_status('unsuccessful')
elif not statuses.difference(set(['complete', 'unsuccessful', 'cancelled'])):
LOGGER.info('Switched lot %s of auction %s to %s',
lot.id,
Expand All @@ -179,7 +182,7 @@ def check_auction_status(request):
extra=context_unpack(request,
{'MESSAGE_ID': 'switched_lot_complete'},
{'LOT_ID': lot.id}))
auction.status = 'complete'
adapter.pendify_auction_status('complete')
else:
pending_complaints = any([
i.status in auction.block_complaint_status
Expand All @@ -204,17 +207,17 @@ def check_auction_status(request):
'Switched auction %s to %s', auction.id, 'unsuccessful', extra=context_unpack(
request, {
'MESSAGE_ID': 'switched_auction_unsuccessful'}))
auction.status = 'unsuccessful'
adapter.pendify_auction_status('unsuccessful')
if not pending_complaints and not pending_awards_complaints and stand_still_time_expired \
and last_award_status == 'unsuccessful':
LOGGER.info(
'Switched auction %s to %s', auction.id, 'unsuccessful', extra=context_unpack(
request, {
'MESSAGE_ID': 'switched_auction_unsuccessful'}))
auction.status = 'unsuccessful'
adapter.pendify_auction_status('unsuccessful')
if auction.contracts and auction.contracts[-1].status == 'active':
LOGGER.info(
'Switched auction %s to %s', auction.id, 'unsuccessful', extra=context_unpack(
request, {
'MESSAGE_ID': 'switched_auction_complete'}))
auction.status = 'complete'
adapter.pendify_auction_status('complete')

0 comments on commit 25103bd

Please sign in to comment.