-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tracking pull request to merge release-2.11.0 to master (#2634)
* new input field for organization details - IDIR only * TFRS - new input field for organization details - IDIR only#2579 * removing supplier type migration * reverting back the change * Fix: Discrepency in latest_report id 2667 * fix: renamed migration and order to fix merge error * adding edrms in detail and compliance report page. making part3supplier default selected. * removing comment * fix to disappear edrms from bceid side * removing edrms value from bceid side --------- Co-authored-by: jig-patel <[email protected]> Co-authored-by: Prashanth <[email protected]> Co-authored-by: Alex Zorkin <[email protected]> Co-authored-by: Your Name <[email protected]>
- Loading branch information
1 parent
06f401c
commit 5a2dcc2
Showing
16 changed files
with
515 additions
and
311 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Generated by Django 3.2.20 on 2023-10-10 22:21 | ||
|
||
from django.db import migrations, models | ||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('api', '0008_auto_20230718_0104'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='organization', | ||
name='edrms_record', | ||
field=models.CharField(blank=True, max_length=100, null=True), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import collections | ||
|
||
from django.db import migrations, transaction | ||
|
||
|
||
def update_report_fields(apps, schema_editor): | ||
ComplianceReport = apps.get_model('api', 'compliancereport') | ||
for report in ComplianceReport.objects.filter(supplements__isnull=False): | ||
with transaction.atomic(): | ||
ancestor = report | ||
root = None | ||
latest = None | ||
while ancestor.supplements is not None: | ||
ancestor = ancestor.supplements | ||
|
||
visited = [] | ||
id_traversal = {} | ||
to_visit = collections.deque([ancestor.id]) | ||
i = 1 | ||
|
||
while len(to_visit) > 0: | ||
current_id = to_visit.popleft() | ||
|
||
# break loops | ||
if current_id in visited: | ||
continue | ||
visited.append(current_id) | ||
|
||
current = ComplianceReport.objects.get(id=current_id) | ||
|
||
if current.supplements is None: | ||
root = current | ||
latest = current | ||
# don't count non-supplement reports (really should just be the root) | ||
if current.supplements is not None and \ | ||
not current.status.fuel_supplier_status_id == "Deleted": | ||
latest = current | ||
i += 1 | ||
id_traversal[current_id] = i | ||
for descendant in current.supplemental_reports.order_by('create_timestamp').all(): | ||
to_visit.append(descendant.id) | ||
|
||
for compliance_id, traversal in id_traversal.items(): | ||
ComplianceReport.objects.filter(id=int(compliance_id)) \ | ||
.update(latest_report=latest, root_report=root, traversal=traversal) | ||
for report in ComplianceReport.objects.filter(supplements__isnull=True, latest_report__isnull=True): | ||
ComplianceReport.objects.filter(id=report.id) \ | ||
.update(latest_report=report, root_report=report) | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
('api', '0009_organization_edrms_record'), | ||
] | ||
|
||
operations = [ | ||
migrations.RunPython(update_report_fields, reverse_code=migrations.RunPython.noop), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,4 +61,7 @@ resources: | |
memory: 400Mi | ||
limits: | ||
cpu: 320m | ||
memory: 800Mi | ||
memory: 800Mi | ||
|
||
clustering: | ||
forceBoot: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.