Skip to content

Update Insider Auction models and views for auction substatuses#45

Open
Scandie wants to merge 7 commits intoopenprocurement:productionfrom
Scandie:a448140157209084_active.auction_substatuses
Open

Update Insider Auction models and views for auction substatuses#45
Scandie wants to merge 7 commits intoopenprocurement:productionfrom
Scandie:a448140157209084_active.auction_substatuses

Conversation

@Scandie
Copy link
Copy Markdown
Contributor

@Scandie Scandie commented Jan 12, 2018

No description provided.


from openprocurement.api.utils import calculate_business_date
from openprocurement.api.models import get_now, Value, Period, TZ, SANDBOX_MODE
from openprocurement.api.models import get_now, Value, Period, TZ, SANDBOX_MODE, schematics_embedded_role
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

schematics_embedded_role імпортовано, але не використовується

from schematics.types.compound import ModelType
from schematics.exceptions import ValidationError
from schematics.transforms import whitelist
from schematics.transforms import blacklist, whitelist
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blacklist імпортовано, але не використовується

auction.bids = []
auction.status = 'cancelled'

def cancel_lot(self, cancellation=None):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Що змінилося у cancel_lot?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if auction.status == 'active.auction' and all ... > if 'active.auction' in auction.status and all ...

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Пропоную то все винести в окрему функцію, або у валідатор і змінити самі views з використанням валідатору, щоб не копіювати кучу коду, якщо таке можливо звичайно.

@coveralls
Copy link
Copy Markdown

coveralls commented Jan 18, 2018

Coverage Status

Coverage increased (+2.8%) to 93.817% when pulling 48440fc on Scandie:a448140157209084_active.auction_substatuses into 3e1c03d on openprocurement:production.

QUICK_DUTCH_PERIOD = timedelta(minutes=10)

TENDER_PERIOD_STATUSES = ['active.tendering', 'active.auction']
TENDER_PERIOD_STATUSES = [
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Я б ці підстатуси розідлив. Бо active.tendering наприклад - це статус процедури, а active.auction.dutch то є підстатус аукціону. А константа за це відповідає одна TENDER_PREIOD_STATUSES не дуже логічно.

"""
if self.request.authenticated_role == 'bid_owner':
return {'data': self.request.context.serialize('view')}
if self.request.validated['auction_status'] in TENDER_PERIOD_STATUSES:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Винеси у валідатор.

from openprocurement.auctions.dgf.views.financial.tender_document import (
FinancialAuctionDocumentResource,
)
from openprocurement.auctions.insider.constants import TENDER_PERIOD_STATUSES
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused import.

auction.bids = []
auction.status = 'cancelled'

def cancel_lot(self, cancellation=None):
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Пропоную то все винести в окрему функцію, або у валідатор і змінити самі views з використанням валідатору, щоб не копіювати кучу коду, якщо таке можливо звичайно.


"""
auction = self.request.validated['auction']
if self.request.validated['auction_status'] in TENDER_PERIOD_STATUSES:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Знову ж таки валідатор.

@Scandie
Copy link
Copy Markdown
Contributor Author

Scandie commented Feb 22, 2018

@json_view(permission='auction')
def collection_get(self):
if self.request.validated['auction_status'] not in ['active.tendering', 'active.auction']:
if self.request.validated['auction_status'] not in TENDER_PERIOD_STATUSES:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Хіба тобі потрібна константа TENDER_PERIOD_STATUSES, коли в тебе є https://github.com/openprocurement/openprocurement.auctions.core/pull/27/files#diff-5553f0cc7a26748bc279b460b148bef5R6

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yarsanich, не знав як логічно виділити групу статусів, за яких в кожній з процедур можна робити GET запити до аукціону.

Scandie pushed a commit to Scandie/openprocurement.auctions.insider that referenced this pull request May 9, 2018
…29667_add_recomposed_status

Add recomposed status and expand tests
Scandie pushed a commit to Scandie/openprocurement.auctions.insider that referenced this pull request Jul 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants