Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Master with core #84

Open
wants to merge 52 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
60290a1
Move award views to core.plugins
oleksiyVeretiuk Mar 14, 2018
0ba2213
Delete financial award views
oleksiyVeretiuk Mar 14, 2018
bd123dc
Move functionality of awarding in core.plugins
oleksiyVeretiuk Mar 14, 2018
f632760
Move constants used in awarding in core.plugins
oleksiyVeretiuk Mar 14, 2018
f40eefd
Move part of functionality in next_check in core.plugins and use cont…
oleksiyVeretiuk Mar 14, 2018
cceb249
Create adapters and make includeme
oleksiyVeretiuk Mar 14, 2018
20c49d1
Use content_configurator in views
oleksiyVeretiuk Mar 14, 2018
b77e5ec
Update setup.py
oleksiyVeretiuk Mar 14, 2018
89d8fed
Update tests.ini
oleksiyVeretiuk Mar 14, 2018
2630740
Move contract views to core.plugins
oleksiyVeretiuk Mar 15, 2018
71d3e7b
Move constants to core.constants
oleksiyVeretiuk Mar 15, 2018
f81c18d
Fix imports
oleksiyVeretiuk Mar 15, 2018
e5d90dc
Move models(Item, Document, Complaint) to core.models
oleksiyVeretiuk Mar 15, 2018
cfa2e5a
Move functionality to core.plugins
oleksiyVeretiuk Mar 15, 2018
001d67a
Fix migration
oleksiyVeretiuk Mar 15, 2018
21aafb4
Fix constants
oleksiyVeretiuk Mar 21, 2018
eac5ecc
Update buildout.cfg
leits Mar 22, 2018
d11d1b2
Update buildout.cfg
leits Mar 22, 2018
c7ae76e
Fix imports
oleksiyVeretiuk Mar 22, 2018
91772a3
Merge branch 'prozoro_sale_with_module_awarding' of https://github.co…
oleksiyVeretiuk Mar 22, 2018
5778921
Move auction tests to blank use existed mixins from core
oleksiyVeretiuk Mar 22, 2018
66c617c
Move bidder tests to blank use existed mixins from core
oleksiyVeretiuk Mar 22, 2018
0719a2e
Refactor cancellation. Use existed mixins from core
oleksiyVeretiuk Mar 22, 2018
e6b4f80
Move chronograph tests to blank, use existed mixins from core
oleksiyVeretiuk Mar 22, 2018
c25b90c
Refactor complaint tests. Use existed mixins from core
oleksiyVeretiuk Mar 22, 2018
f18c8bb
Add init file
oleksiyVeretiuk Mar 22, 2018
54a20f6
Move document tests to blank, use existed mixins from core
oleksiyVeretiuk Mar 22, 2018
450e210
Move lot tests to blanks.
oleksiyVeretiuk Mar 22, 2018
8894101
Move migration tests to blanks
oleksiyVeretiuk Mar 22, 2018
0feb4ce
Use mixins for question tests
oleksiyVeretiuk Mar 22, 2018
f3d25ef
Move tender tests to blanks
oleksiyVeretiuk Mar 22, 2018
0b20e26
Move tests to core.plugins awarding tests
oleksiyVeretiuk Mar 23, 2018
6e64a12
Merge pull request #77 from oleksiyVeretiuk/prozoro_sale_with_module_…
leits Mar 23, 2018
75c559c
Move contracts test to core.plugins. Use existed mixins
oleksiyVeretiuk Mar 23, 2018
c0ed521
localize returned from calculate_business_date datetime
oleksiyVeretiuk Mar 27, 2018
7cc81a8
Fix dep
Mar 27, 2018
09b1ea6
Merge branch 'a575713297138754_ea_core' of https://github.com/prozorr…
oleksiyVeretiuk Mar 27, 2018
287685e
Fix tests. Fix validation according to new cornice
oleksiyVeretiuk Mar 27, 2018
05d8b6e
Fix import
oleksiyVeretiuk Mar 27, 2018
a08a936
Use constant for renderer error
oleksiyVeretiuk Mar 28, 2018
9da3d42
Update buildout.cfg
oleksiyVeretiuk Mar 28, 2018
a7bf647
Fix tests
oleksiyVeretiuk Mar 28, 2018
7e21392
Update cornice version
oleksiyVeretiuk Mar 28, 2018
8092160
Merge pull request #78 from oleksiyVeretiuk/prozoro_sale_with_module_…
leits Mar 28, 2018
1cb8a34
Fix imports
oleksiyVeretiuk Mar 30, 2018
97fdaaa
Merge pull request #80 from oleksiyVeretiuk/a575713297138754_ea_core
leits Apr 2, 2018
d13f379
Use imports from right module
oleksiyVeretiuk Apr 2, 2018
9c02b3b
Merge pull request #81 from oleksiyVeretiuk/a575713297138754_ea_core
leits Apr 2, 2018
329ce89
Pull ea_core to master
oleksiyVeretiuk Apr 4, 2018
fc1e1b1
Update travis
oleksiyVeretiuk Apr 4, 2018
2044872
Use direct path to views in plugins
oleksiyVeretiuk Apr 5, 2018
c0b3090
Remove constants for view locations
oleksiyVeretiuk Apr 5, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ cache:
directories:
- eggs
before_install:
- pip install setuptools==7.0
- python2 bootstrap.py
install:
- bin/buildout -N
Expand Down
10 changes: 7 additions & 3 deletions buildout.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ eggs =
nose


[remotes]
gh=https://github.com/
[email protected]:

[sources]
openprocurement.api = git https://github.com/prozorro-sale/openprocurement.api.git
openprocurement.auctions.flash = git https://github.com/prozorro-sale/openprocurement.auctions.flash.git
openprocurement.auctions.core = git https://github.com/prozorro-sale/openprocurement.auctions.core.git
openprocurement.api = git ${remotes:gh}openprocurement/openprocurement.api.git pushurl=${remotes:gh_push}openprocurement/openprocurement.api.git branch=ea_core_master
openprocurement.auctions.core = git ${remotes:gh}openprocurement/openprocurement.auctions.core.git pushurl=${remotes:gh_push}openprocurement/openprocurement.auctions.core.git branch=a499878011598746_separating_awarding
openprocurement.auctions.flash = git ${remotes:gh}openprocurement/openprocurement.auctions.flash.git pushurl=${remotes:gh_push}openprocurement/openprocurement.auctions.flash.git branch=a499878011598746_separating_awarding
2 changes: 1 addition & 1 deletion docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import os
from datetime import timedelta, datetime

from openprocurement.api.models import get_now
from openprocurement.api.utils import get_now
import openprocurement.auctions.dgf.tests.base as base_test
from openprocurement.auctions.flash.tests.base import PrefixedRequestClass
from openprocurement.auctions.dgf.tests.base import test_auction_data as base_test_auction_data, test_bids, test_financial_bids
Expand Down
21 changes: 21 additions & 0 deletions openprocurement/auctions/dgf/adapters.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# -*- coding: utf-8 -*-
from openprocurement.auctions.core.adapters import AuctionConfigurator
from openprocurement.auctions.dgf.models import (
DGFOtherAssets,
DGFFinancialAssets
)
from openprocurement.auctions.core.plugins.awarding.v2_1.adapters import (
AwardingV2_1ConfiguratorMixin
)


class AuctionDGFOtherAssetsConfigurator(AuctionConfigurator,
AwardingV2_1ConfiguratorMixin):
name = 'Auction Dgf Configurator'
model = DGFOtherAssets


class AuctionDGFFinancialAssetsConfigurator(AuctionConfigurator,
AwardingV2_1ConfiguratorMixin):
name = 'Auction Dgf Configurator'
model = DGFFinancialAssets
15 changes: 3 additions & 12 deletions openprocurement/auctions/dgf/constants.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from datetime import datetime, timedelta
from openprocurement.api.models import TZ, ORA_CODES
from openprocurement.api.constants import TZ
from openprocurement.api.models.auction_models.models import ORA_CODES


def read_json(name):
Expand All @@ -25,20 +26,10 @@ def read_json(name):
#time constants
DGF_ID_REQUIRED_FROM = datetime(2017, 1, 1, tzinfo=TZ)
DGF_DECISION_REQUIRED_FROM = datetime(2017, 1, 1, tzinfo=TZ)
CLASSIFICATION_PRECISELY_FROM = datetime(2017, 7, 19, tzinfo=TZ)
MINIMAL_EXPOSITION_REQUIRED_FROM = datetime(2017, 11, 17, tzinfo=TZ)
DGF_ADDRESS_REQUIRED_FROM = datetime(2018, 2, 9, tzinfo=TZ)

#codes
CAVPS_CODES = read_json('cav_ps.json')
CPVS_CODES = read_json('cpvs.json')
DGF_ADDRESS_REQUIRED_FROM = datetime(2020, 2, 8, tzinfo=TZ)

ORA_CODES[0:0] = ["UA-IPN", "UA-FIN"]

NUMBER_OF_BIDS_TO_BE_QUALIFIED = 2

#code units
CPV_NON_SPECIFIC_LOCATION_UNITS = ('45', '48', '50', '51', '55', '60', '63', '64',
'65', '66', '71', '72', '73', '75', '76', '77',
'79', '80', '85', '90', '92', '98')
CAV_NON_SPECIFIC_LOCATION_UNITS = ('07', '08')
53 changes: 53 additions & 0 deletions openprocurement/auctions/dgf/includeme.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
from pyramid.interfaces import IRequest
from openprocurement.auctions.dgf.models import (
IDgfAuction,
DGFOtherAssets,
DGFFinancialAssets
)
from openprocurement.auctions.dgf.adapters import (
AuctionDGFOtherAssetsConfigurator,
AuctionDGFFinancialAssetsConfigurator
)
from openprocurement.auctions.core.plugins.awarding.v2_1.adapters import (
AwardingNextCheckV2_1
)
from openprocurement.api.interfaces import (
IContentConfigurator,
IAwardingNextCheck
)


def includeme_other(config):
config.add_auction_procurementMethodType(DGFOtherAssets)

config.scan('openprocurement.auctions.dgf.views.other')

# Register adapters
config.registry.registerAdapter(
AuctionDGFOtherAssetsConfigurator,
(IDgfAuction, IRequest),
IContentConfigurator
)
config.registry.registerAdapter(
AwardingNextCheckV2_1,
(IDgfAuction, ),
IAwardingNextCheck
)


def includeme_financial(config):
config.add_auction_procurementMethodType(DGFFinancialAssets)

config.scan('openprocurement.auctions.dgf.views.financial')

# Register Adapters
config.registry.registerAdapter(
AuctionDGFFinancialAssetsConfigurator,
(IDgfAuction, IRequest),
IContentConfigurator
)
config.registry.registerAdapter(
AwardingNextCheckV2_1,
(IDgfAuction, ),
IAwardingNextCheck
)
55 changes: 8 additions & 47 deletions openprocurement/auctions/dgf/migration.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
# -*- coding: utf-8 -*-
import logging
from openprocurement.api.models import get_now, TZ
from openprocurement.api.utils import get_now
from openprocurement.api.traversal import Root
from barbecue import chef
from uuid import uuid4

from openprocurement.auctions.core.plugins.awarding.v2_1.migration import (
migrate_awarding_1_0_to_awarding_2_1
)

LOGGER = logging.getLogger(__name__)
SCHEMA_VERSION = 1
Expand All @@ -23,7 +26,9 @@ def set_db_schema_version(db, version):


def migrate_data(registry, destination=None):
if registry.settings.get('plugins') and 'auctions.dgf' not in registry.settings['plugins'].split(','): # pragma: no cover
existing_plugins = (dgf in registry.settings['plugins'].split(',') for dgf in
('auctions.dgf.other', 'auctions.dgf.financial'))
if registry.settings.get('plugins') and not any(existing_plugins):
return
cur_version = get_db_schema_version(registry.db)
if cur_version == SCHEMA_VERSION:
Expand All @@ -49,51 +54,7 @@ def __init__(self, registry):
docs = []
for i in results:
auction = i.doc
if auction['procurementMethodType'] not in ['dgfOtherAssets', 'dgfFinancialAssets'] \
or auction['status'] not in ['active.qualification', 'active.awarded'] \
or 'awards' not in auction:
continue

now = get_now().isoformat()
awards = auction["awards"]
award = [a for a in awards if a['status'] in ['active', 'pending']][0]
award_create_date = award['complaintPeriod']['startDate']
award.update({
'verificationPeriod': {
'startDate': award_create_date,
'endDate': award_create_date
},
'paymentPeriod': {
'startDate': award_create_date,
},
'signingPeriod': {
'startDate': award_create_date,
}
})

if award['status'] == 'pending':
award['status'] = 'pending.payment'

elif award['status'] == 'active':
award['paymentPeriod']['endDate'] = now

awarded_bids = set([a['bid_id'] for a in awards])
sorted_bids = chef(auction['bids'], auction.get('features'), [], True)
filtered_bids = [bid for bid in sorted_bids if bid['id'] not in awarded_bids]

for bid in filtered_bids:
award = {
'id': uuid4().hex,
'bid_id': bid['id'],
'status': 'pending.waiting',
'date': award_create_date,
'value': bid['value'],
'suppliers': bid['tenderers'],
'complaintPeriod': {
'startDate': award_create_date
}
}
awards.append(award)
migrate_awarding_1_0_to_awarding_2_1(auction)

model = registry.auction_procurementMethodTypes.get(auction['procurementMethodType'])
if model:
Expand Down
Loading