Update Insider Auction models and views for auction substatuses#45
Update Insider Auction models and views for auction substatuses#45Scandie wants to merge 7 commits intoopenprocurement:productionfrom
Conversation
|
|
||
| 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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
blacklist імпортовано, але не використовується
| auction.bids = [] | ||
| auction.status = 'cancelled' | ||
|
|
||
| def cancel_lot(self, cancellation=None): |
There was a problem hiding this comment.
if auction.status == 'active.auction' and all ... > if 'active.auction' in auction.status and all ...
There was a problem hiding this comment.
Пропоную то все винести в окрему функцію, або у валідатор і змінити самі views з використанням валідатору, щоб не копіювати кучу коду, якщо таке можливо звичайно.
…4_active.auction_substatuses
| QUICK_DUTCH_PERIOD = timedelta(minutes=10) | ||
|
|
||
| TENDER_PERIOD_STATUSES = ['active.tendering', 'active.auction'] | ||
| TENDER_PERIOD_STATUSES = [ |
There was a problem hiding this comment.
Я б ці підстатуси розідлив. Бо 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: |
| from openprocurement.auctions.dgf.views.financial.tender_document import ( | ||
| FinancialAuctionDocumentResource, | ||
| ) | ||
| from openprocurement.auctions.insider.constants import TENDER_PERIOD_STATUSES |
| auction.bids = [] | ||
| auction.status = 'cancelled' | ||
|
|
||
| def cancel_lot(self, cancellation=None): |
There was a problem hiding this comment.
Пропоную то все винести в окрему функцію, або у валідатор і змінити самі views з використанням валідатору, щоб не копіювати кучу коду, якщо таке можливо звичайно.
|
|
||
| """ | ||
| auction = self.request.validated['auction'] | ||
| if self.request.validated['auction_status'] in TENDER_PERIOD_STATUSES: |
There was a problem hiding this comment.
Знову ж таки валідатор.
| @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: |
There was a problem hiding this comment.
Хіба тобі потрібна константа TENDER_PERIOD_STATUSES, коли в тебе є https://github.com/openprocurement/openprocurement.auctions.core/pull/27/files#diff-5553f0cc7a26748bc279b460b148bef5R6
There was a problem hiding this comment.
@yarsanich, не знав як логічно виділити групу статусів, за яких в кожній з процедур можна робити GET запити до аукціону.
…29667_add_recomposed_status Add recomposed status and expand tests
…nit_tests_update Unit tests update
No description provided.