Skip to content

Commit

Permalink
Fixed tender complaints rules
Browse files Browse the repository at this point in the history
  • Loading branch information
kroman0 committed Feb 2, 2016
1 parent f4e8afa commit f45cd7b
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 26 deletions.
6 changes: 4 additions & 2 deletions openprocurement/tender/openua/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@
embedded_lot_role, default_lot_role,
)
from openprocurement.tender.openua.interfaces import ITenderUA
from openprocurement.tender.openua.utils import calculate_business_date
from openprocurement.tender.openua.utils import (
calculate_business_date, BLOCK_COMPLAINT_STATUS,
)

edit_role_ua = edit_role + blacklist('enquiryPeriod', 'status')

Expand Down Expand Up @@ -303,7 +305,7 @@ def numberOfBids(self):
def next_check(self):
now = get_now()
checks = []
if self.status == 'active.tendering' and self.tenderPeriod.endDate and not any([i.status in ['pending', 'accepted'] for i in self.complaints]):
if self.status == 'active.tendering' and self.tenderPeriod.endDate and not any([i.status in BLOCK_COMPLAINT_STATUS for i in self.complaints]):
checks.append(self.tenderPeriod.endDate.astimezone(TZ))
elif not self.lots and self.status == 'active.awarded':
standStillEnds = [
Expand Down
20 changes: 0 additions & 20 deletions openprocurement/tender/openua/tests/complaint.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,6 @@ def test_create_tender_complaint(self):
self.assertIn('id', complaint)
self.assertIn(complaint['id'], response.headers['Location'])

tender = self.db.get(self.tender_id)
tender['status'] = 'active.awarded'
tender['awardPeriod'] = {'endDate': '2014-01-01'}
self.db.save(tender)

response = self.app.patch_json('/tenders/{}/complaints/{}?acc_token={}'.format(self.tender_id, complaint['id'], self.tender_token), {"data": {
"status": "answered"
}}, status=422)
Expand Down Expand Up @@ -161,11 +156,6 @@ def test_create_tender_complaint(self):
self.assertEqual(response.content_type, 'application/json')
self.assertEqual(response.json['errors'][0]["description"], "Can't update complaint in current (resolved) status")

response = self.app.get('/tenders/{}'.format(self.tender_id))
self.assertEqual(response.status, '200 OK')
self.assertEqual(response.content_type, 'application/json')
self.assertEqual(response.json['data']["status"], 'active.awarded')

self.set_status('unsuccessful')

response = self.app.post_json('/tenders/{}/complaints'.format(
Expand Down Expand Up @@ -415,11 +405,6 @@ def test_create_tender_complaint(self):
self.assertIn('id', complaint)
self.assertIn(complaint['id'], response.headers['Location'])

tender = self.db.get(self.tender_id)
tender['status'] = 'active.awarded'
tender['awardPeriod'] = {'endDate': '2014-01-01'}
self.db.save(tender)

response = self.app.patch_json('/tenders/{}/complaints/{}?acc_token={}'.format(self.tender_id, complaint['id'], self.tender_token), {"data": {
"status": "answered"
}}, status=422)
Expand Down Expand Up @@ -453,11 +438,6 @@ def test_create_tender_complaint(self):
self.assertEqual(response.content_type, 'application/json')
self.assertEqual(response.json['errors'][0]["description"], "Can't update complaint in current (resolved) status")

response = self.app.get('/tenders/{}'.format(self.tender_id))
self.assertEqual(response.status, '200 OK')
self.assertEqual(response.content_type, 'application/json')
self.assertEqual(response.json['data']["status"], 'active.awarded')

self.set_status('unsuccessful')

response = self.app.post_json('/tenders/{}/complaints'.format(
Expand Down
2 changes: 0 additions & 2 deletions openprocurement/tender/openua/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ def check_complaint_status(request, complaint):
complaint.status = 'ignored'
elif complaint.status == 'answered':
complaint.status = complaint.resolutionType
elif complaint.status == 'satisfied':
complaint.status = 'resolved'


def check_status(request):
Expand Down
4 changes: 2 additions & 2 deletions openprocurement/tender/openua/views/complaint.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def collection_post(self):
"""Post a complaint
"""
tender = self.context
if tender.status not in ['active.enquiries', 'active.tendering']:
if tender.status != 'active.tendering':
self.request.errors.add('body', 'data', 'Can\'t add complaint in current ({}) tender status'.format(tender.status))
self.request.errors.status = 403
return
Expand Down Expand Up @@ -73,7 +73,7 @@ def patch(self):
"""Post a complaint resolution
"""
tender = self.request.validated['tender']
if tender.status not in ['active.enquiries', 'active.tendering', 'active.auction', 'active.qualification', 'active.awarded']:
if tender.status != 'active.tendering':
self.request.errors.add('body', 'data', 'Can\'t update complaint in current ({}) tender status'.format(tender.status))
self.request.errors.status = 403
return
Expand Down

0 comments on commit f45cd7b

Please sign in to comment.