Skip to content

Commit

Permalink
common utility to switch auction status (#120)
Browse files Browse the repository at this point in the history
* use common utility to switch auction status

* fix versions

* fix statement complexity

* fix erron in status switching
  • Loading branch information
vmotso authored and leits committed Dec 11, 2018
1 parent 30c4461 commit ae472f2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
15 changes: 7 additions & 8 deletions openprocurement/auctions/dgf/utils.py
Expand Up @@ -6,11 +6,12 @@
check_auction_status
)
from openprocurement.auctions.core.utils import (
cleanup_bids_for_cancelled_lots, check_complaint_status,
remove_draft_bids,
context_unpack,
get_now,
TZ,
check_complaint_status,
cleanup_bids_for_cancelled_lots,
get_now,
remove_draft_bids,
log_auction_status_change
)
from openprocurement.auctions.core.interfaces import IAuctionManager

Expand Down Expand Up @@ -45,20 +46,18 @@ def check_status(request):
for complaint in award.complaints:
check_complaint_status(request, complaint, now)
if not auction.lots and auction.status == 'active.tendering' and auction.tenderPeriod.endDate <= now:
LOGGER.info('Switched auction {} to {}'.format(auction['id'], 'active.auction'),
extra=context_unpack(request, {'MESSAGE_ID': 'switched_auction_active.auction'}))
auction.status = 'active.auction'
remove_draft_bids(request)
check_bids(request)
log_auction_status_change(request, auction, auction.status)
if auction.numberOfBids < 2 and auction.auctionPeriod:
auction.auctionPeriod.startDate = None
return
elif auction.lots and auction.status == 'active.tendering' and auction.tenderPeriod.endDate <= now:
LOGGER.info('Switched auction {} to {}'.format(auction['id'], 'active.auction'),
extra=context_unpack(request, {'MESSAGE_ID': 'switched_auction_active.auction'}))
auction.status = 'active.auction'
remove_draft_bids(request)
check_bids(request)
log_auction_status_change(request, auction, auction.status)
[setattr(i.auctionPeriod, 'startDate', None) for i in auction.lots if i.numberOfBids < 2 and i.auctionPeriod]
return
elif not auction.lots and auction.status == 'active.awarded':
Expand Down
2 changes: 1 addition & 1 deletion versions.cfg
Expand Up @@ -19,7 +19,7 @@ translationstring = 1.3
venusian = 1.0
waitress = 0.8.9
zc.recipe.egg = 2.0.3
zope.deprecation = 4.1.1
zope.deprecation = 4.3.0
zope.interface = 4.1.1

# Required by:
Expand Down

0 comments on commit ae472f2

Please sign in to comment.