Skip to content

Commit

Permalink
Merge branch 'a342594055523082_complaints_off'
Browse files Browse the repository at this point in the history
  • Loading branch information
kroman0 committed Jun 20, 2017
2 parents 01ed8a4 + edc51c7 commit 9e2bb8f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
}

setup(name='openprocurement.api',
version='2.3.59',
version='2.3.60.1',
description='openprocurement.api',
long_description=README,
classifiers=[
Expand Down
5 changes: 5 additions & 0 deletions src/openprocurement/api/migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -734,6 +734,7 @@ def update_doc_url(document):

results = registry.db.iterview('tenders/all', 2 ** 10, include_docs=True)
docs = []
count = 0
for i in results:
changed = False
doc = i.doc
Expand All @@ -743,11 +744,15 @@ def update_doc_url(document):
if update_doc_url(document):
changed = True
if changed:
doc['dateModified'] = get_now().isoformat()
docs.append(doc)
if len(docs) >= 2 ** 7:
registry.db.update(docs)
count += len(docs)
docs = []
if docs:
registry.db.update(docs)
count += len(docs)

LOGGER.info("Migrated {} objects.".format(count))
LOGGER.info("Migration complete.")
6 changes: 5 additions & 1 deletion src/openprocurement/api/tests/migration.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
import unittest

from openprocurement.api.models import Tender
from openprocurement.api.models import Tender, get_now
from openprocurement.api.migration import migrate_data, get_db_schema_version, set_db_schema_version, SCHEMA_VERSION
from openprocurement.api.tests.base import BaseWebTest, test_tender_data
from email.header import Header
Expand Down Expand Up @@ -768,8 +768,10 @@ def test_migrate_from23to24(self):
self.app.app.registry.docservice_url = 'http://localhost.ds'
u = Tender(test_tender_data)
u.tenderID = "UA-X"
u.dateModified = get_now().isoformat()
u.store(self.db)
tender_raw = self.db.get(u.id)
date_modified_before = tender_raw['dateModified']
bid = {"id": "1b4da15470e84c4d948a5d1660d29776"}
bid["documents"] = [
{
Expand Down Expand Up @@ -829,6 +831,8 @@ def test_migrate_from23to24(self):
migrated= self.db.get(u.id)
migrated_bid = migrated['bids'][0]

self.assertGreater(migrated['dateModified'], date_modified_before)

# url should be corrected
self.assertIn("/tenders/{}/bids/1b4da15470e84c4d948a5d1660d29776/documents/1801ca2749bd40b0944e58adc3e09c46?download=a65ef5c688884931aed1a472620d3a00".format(u.id), migrated_bid['documents'][0]['url'])
self.assertIn("/tenders/{}/bids/1b4da15470e84c4d948a5d1660d29776/documents/f3e5470b76f84c66a89fd52ed871f645?download=d48723d7b4014599ac8d94fb0ac958b4".format(u.id), migrated_bid['documents'][1]['url'])
Expand Down
3 changes: 2 additions & 1 deletion src/openprocurement/api/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,8 @@ def check_tender_status(request):
tender.status = 'unsuccessful'
if tender.contracts and tender.contracts[-1].status == 'active':
tender.status = 'complete'
check_ignored_claim(tender)
if tender.procurementMethodType == "belowThreshold":
check_ignored_claim(tender)


def add_next_award(request):
Expand Down

0 comments on commit 9e2bb8f

Please sign in to comment.