Commit 1b01393372cbb35373dc7b5935994b929b4b542e
1 parent
f338f7a5
Update get_document_index_by_id
Because it was working properly only for Quinta broker
Showing
1 changed file
with
6 additions
and
2 deletions
@@ -442,10 +442,14 @@ def get_complaint_index_by_complaintID(data, complaintID): | @@ -442,10 +442,14 @@ def get_complaint_index_by_complaintID(data, complaintID): | ||
442 | 442 | ||
443 | 443 | ||
444 | def get_document_index_by_id(data, document_id): | 444 | def get_document_index_by_id(data, document_id): |
445 | + if not data: | ||
446 | + return 0 | ||
445 | for index, element in enumerate(data): | 447 | for index, element in enumerate(data): |
446 | if element['title'] == document_id: | 448 | if element['title'] == document_id: |
447 | - return index | ||
448 | - raise IndexError | 449 | + break |
450 | + else: | ||
451 | + index += 1 | ||
452 | + return index | ||
449 | 453 | ||
450 | 454 | ||
451 | def generate_test_bid_data(tender_data): | 455 | def generate_test_bid_data(tender_data): |
Please
register
or
login
to post a comment