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
- Loading branch information
1 parent
0811099
commit c6389e3
Showing
8 changed files
with
128 additions
and
109 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,37 @@ | ||
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 = "Red flag compute for specific country" | ||
|
||
def add_arguments(self, parser): | ||
parser.add_argument("country", nargs="+", type=str) | ||
|
||
def handle(self, *args, **options): | ||
country = options["country"][0] | ||
if country: | ||
country = str(country).upper() | ||
else: | ||
self.stderr.write("Country code is missing.") | ||
return | ||
|
||
country = Country.objects.get(country_code_alpha_2=country) | ||
|
||
self.stdout.write(f"Processing Red flag for {country.name}") | ||
|
||
tender_instance = 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 tender_instance: | ||
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
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.