Skip to content

Commit

Permalink
merged a168770784473035_auction_view_submissionMethodDetails
Browse files Browse the repository at this point in the history
  • Loading branch information
ktarasz committed Sep 27, 2016
2 parents ae7ae17 + 8b92e36 commit 9fc09b7
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 9 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
}

setup(name='openprocurement.api',
version='2.3.18',
version='2.3.23',
description='openprocurement.api',
long_description=README,
classifiers=[
Expand Down
4 changes: 2 additions & 2 deletions src/openprocurement/api/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ def calc_auction_end_time(bids, start):
return start + bids * BIDDER_TIME + SERVICE_TIME + AUCTION_STAND_STILL_TIME


def rounding_shouldStartAfter(start_after, tender, use_from=datetime(2016, 6, 1, tzinfo=TZ)):
def rounding_shouldStartAfter(start_after, tender, use_from=datetime(2016, 7, 16, tzinfo=TZ)):
if (tender.enquiryPeriod and tender.enquiryPeriod.startDate or get_now()) > use_from and not (SANDBOX_MODE and tender.submissionMethodDetails and u'quick' in tender.submissionMethodDetails):
midnigth = datetime.combine(start_after.date(), time(0, tzinfo=start_after.tzinfo))
if start_after > midnigth:
Expand Down Expand Up @@ -1036,7 +1036,7 @@ def validate_cpv_group(items, *args):
edit_role = (blacklist('status', 'procurementMethodType', 'lots', 'owner_token', 'owner', '_attachments', 'revisions', 'date', 'dateModified', 'doc_id', 'tenderID', 'bids', 'documents', 'awards', 'questions', 'complaints', 'auctionUrl', 'auctionPeriod', 'awardPeriod', 'procurementMethod', 'awardCriteria', 'submissionMethod', 'mode', 'cancellations') + schematics_embedded_role)
view_role = (blacklist('owner_token', '_attachments', 'revisions') + schematics_embedded_role)
listing_role = whitelist('dateModified', 'doc_id')
auction_view_role = whitelist('tenderID', 'dateModified', 'bids', 'items', 'auctionPeriod', 'minimalStep', 'auctionUrl', 'features', 'lots')
auction_view_role = whitelist('tenderID', 'dateModified', 'bids', 'items', 'auctionPeriod', 'minimalStep', 'auctionUrl', 'features', 'lots', 'submissionMethodDetails',)
auction_post_role = whitelist('bids')
auction_patch_role = whitelist('auctionUrl', 'bids', 'lots')
enquiries_role = (blacklist('owner_token', '_attachments', 'revisions', 'bids', 'numberOfBids') + schematics_embedded_role)
Expand Down
6 changes: 4 additions & 2 deletions src/openprocurement/api/tests/auction.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# -*- coding: utf-8 -*-
import unittest
from datetime import timedelta

from openprocurement.api.models import get_now
from openprocurement.api.tests.base import BaseTenderWebTest, test_tender_data, test_features_tender_data, test_bids, test_lots, test_organization

auction_test_tender_data = test_tender_data.copy()
auction_test_tender_data['submissionMethodDetails'] = 'test submissionMethodDetails'

class TenderAuctionResourceTest(BaseTenderWebTest):
#initial_data = tender_data
initial_data = auction_test_tender_data
initial_status = 'active.tendering'
initial_bids = test_bids

Expand Down Expand Up @@ -54,6 +55,7 @@ def test_get_tender_auction(self):
self.assertNotEqual(auction, self.initial_data)
self.assertIn('dateModified', auction)
self.assertIn('minimalStep', auction)
self.assertIn('submissionMethodDetails', auction)
self.assertNotIn("procuringEntity", auction)
self.assertNotIn("tenderers", auction["bids"][0])
self.assertEqual(auction["bids"][0]['value']['amount'], self.initial_bids[0]['value']['amount'])
Expand Down
15 changes: 11 additions & 4 deletions src/openprocurement/api/validation.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from openprocurement.api.models import get_now
from openprocurement.api.models import get_now, SANDBOX_MODE
from schematics.exceptions import ModelValidationError, ModelConversionError
from openprocurement.api.utils import apply_data_patch, update_logging_context

Expand Down Expand Up @@ -165,10 +165,17 @@ def validate_tender_auction_data(request):
data = {}
if request.method == 'POST':
now = get_now().isoformat()
if tender.lots:
data['lots'] = [{'auctionPeriod': {'endDate': now}} if i.id == lot_id else {} for i in tender.lots]
if (SANDBOX_MODE and tender.submissionMethodDetails and tender.submissionMethodDetails in [u'quick(mode:no-auction)', u'quick(mode:fast-forward)']):
if tender.lots:
data['lots'] = [{'auctionPeriod': {'startDate': now, 'endDate': now}} if i.id == lot_id else {} for i in tender.lots]
else:
data['auctionPeriod'] = {'startDate': now, 'endDate': now}
else:
data['auctionPeriod'] = {'endDate': now}
if tender.lots:
data['lots'] = [{'auctionPeriod': {'endDate': now}} if i.id == lot_id else {} for i in tender.lots]
else:
data['auctionPeriod'] = {'endDate': now}

request.validated['data'] = data


Expand Down

0 comments on commit 9fc09b7

Please sign in to comment.