This repository has been archived by the owner on Dec 13, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- [x] Refactor delete_dataset task - [x] Define constants directory in covidadmin - [x] Upgrade sentry-sdk to 1.3.0 in requirements file manually - [x] Refactor visualization APIView - [x] Add tasks to delete redundant buyers and suppliers - [x] Rename GET parameters - [x] Transform country_code to uppercase before filtering - [x] Use raw_delete instead of delete in delete buyers - [x] Migration changes for goods_services and tender - [x] Scheduling delete buyers and suppliers task - [x] Fix GoodServices error in test
- Loading branch information
Showing
42 changed files
with
272 additions
and
174 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Generated by Django 3.2.4 on 2021-07-23 04:00 | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('country', '0034_auto_20210505_1156'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='tender', | ||
name='buyer', | ||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='tenders', to='country.buyer'), | ||
), | ||
migrations.AlterField( | ||
model_name='tender', | ||
name='supplier', | ||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='tenders', to='country.supplier'), | ||
), | ||
] |
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,21 @@ | ||
# Generated by Django 3.2.4 on 2021-07-23 04:01 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('country', '0035_tender_buyer_protect'), | ||
] | ||
|
||
operations = [ | ||
migrations.RemoveField( | ||
model_name='goodsservices', | ||
name='buyer', | ||
), | ||
migrations.RemoveField( | ||
model_name='goodsservices', | ||
name='supplier', | ||
), | ||
] |
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,16 @@ | ||
from celery import Celery | ||
|
||
from country.models import Buyer, Tender | ||
|
||
app = Celery() | ||
|
||
|
||
@app.task(name="delete_redundant_buyers") | ||
def delete_redundant_buyers(country_code): | ||
buyer_ids = [ | ||
buyer_id["buyer_id"] | ||
for buyer_id in Tender.objects.filter(country__country_code_alpha_2=country_code).values("buyer_id").distinct() | ||
] | ||
buyers_to_delete = Buyer.objects.filter(country__country_code_alpha_2=country_code).exclude(id__in=buyer_ids) | ||
buyers_to_delete._raw_delete(buyers_to_delete.db) | ||
return "Done" |
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,20 @@ | ||
from celery import Celery | ||
|
||
from country.models import Supplier, Tender | ||
|
||
app = Celery() | ||
|
||
|
||
@app.task(name="delete_redundant_suppliers") | ||
def delete_redundant_suppliers(country_code): | ||
supplier_ids = [ | ||
supplier_id["supplier_id"] | ||
for supplier_id in Tender.objects.filter(country__country_code_alpha_2=country_code) | ||
.values("supplier_id") | ||
.distinct() | ||
] | ||
suppliers_to_delete = Supplier.objects.filter(country__country_code_alpha_2=country_code).exclude( | ||
id__in=supplier_ids | ||
) | ||
suppliers_to_delete._raw_delete(suppliers_to_delete.db) | ||
return "Done" |
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 @@ | ||
default = "covid19" |
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
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
Oops, something went wrong.