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] Visualization views test with model create * [x] modified red flag import using only country code * [x] Fixes test case in management command * [x] Refactored red flag command * [x] Check for invalid country code * [x] Refactored buyer and supplier filter api * [x] Country map view refactored
- Loading branch information
1 parent
4f352c8
commit eadbd8e
Showing
25 changed files
with
385 additions
and
285 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,40 @@ | ||
from django.core.management.base import BaseCommand | ||
|
||
from country.models import Country, Tender | ||
from country.tasks import clear_redflag, process_redflag, process_redflag6, process_redflag7 | ||
|
||
|
||
class Command(BaseCommand): | ||
help = "Compute red flag for specific country" | ||
|
||
def add_arguments(self, parser): | ||
parser.add_argument("country", nargs="+", type=str) | ||
|
||
def handle(self, *args, **options): | ||
country_code = options["country"][0] | ||
country_code = str(country_code).upper() | ||
country_list = Country.objects.exclude(country_code_alpha_2="gl").values_list( | ||
"country_code_alpha_2", flat=True | ||
) | ||
|
||
if country_code not in country_list: | ||
self.stderr.write("Country code is invalid.") | ||
return | ||
|
||
country = Country.objects.get(country_code_alpha_2=country_code) | ||
|
||
self.stdout.write(f"Processing Red flag for {country.name}") | ||
|
||
country_tenders = Tender.objects.filter( | ||
country_id=country.id, supplier__isnull=False, buyer__isnull=False | ||
).values("id", "buyer__buyer_name", "supplier__supplier_name", "supplier__supplier_address") | ||
|
||
for tender in country_tenders: | ||
tender_id = tender["id"] | ||
self.stdout.write("Created task for id :" + str(tender_id)) | ||
clear_redflag.apply_async(args=(tender_id,), queue="covid19") | ||
process_redflag6.apply_async(args=(tender_id,), queue="covid19") | ||
process_redflag7.apply_async(args=(tender_id,), queue="covid19") | ||
process_redflag.apply_async(args=(tender_id,), queue="covid19") | ||
|
||
self.stdout.write("Done") |
This file was deleted.
Oops, something went wrong.
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.