Fix: #103
This commit is contained in:
parent
f7dadf2cb6
commit
580f099200
@ -260,10 +260,13 @@ def create_billing_report(report_id, **kwargs):
|
||||
report.average_OCR_time = {"invoice": None, "imei": None,
|
||||
"invoice_count": None, "imei_count": None, "avg": None}
|
||||
report.status = "Ready"
|
||||
detail_file_name = "detail_" + report.report_id + ".xlsx"
|
||||
dashboard_file_name = "overview_" + report.report_id + ".xlsx"
|
||||
report.S3_file_name = os.path.join("report", report.report_id, detail_file_name)
|
||||
report.S3_dashboard_file_name = os.path.join("report", report.report_id, dashboard_file_name)
|
||||
report.save()
|
||||
data_workbook = dict2xlsx(billing_data, _type='billing_report')
|
||||
local_workbook = save_workbook_file(
|
||||
report.report_id + ".xlsx", report, data_workbook)
|
||||
local_workbook = save_workbook_file(detail_file_name, report, data_workbook)
|
||||
s3_key = save_report_to_S3(report.report_id, local_workbook)
|
||||
except IndexError as e:
|
||||
print(e)
|
||||
|
@ -34,7 +34,8 @@ class Command(BaseCommand):
|
||||
"imei_number": [],
|
||||
"retailername": "",
|
||||
"purchase_date": "",
|
||||
"sold_to_party": ""
|
||||
"sold_to_party": "",
|
||||
"invoice_no": ""
|
||||
}
|
||||
|
||||
images = SubscriptionRequestFile.objects.filter(request=request, file_category=FileCategory.Origin.value)
|
||||
@ -46,7 +47,7 @@ class Command(BaseCommand):
|
||||
if request.predict_result.get("status", 200) != 200:
|
||||
raise AttributeError(f"Failed request: {request.request_id}")
|
||||
|
||||
for field in ['retailername', 'purchase_date', 'imei_number']:
|
||||
for field in ['retailername', 'purchase_date', 'imei_number', 'invoice_no']:
|
||||
if image.feedback_result[field] is not None and ((field == 'imei_number' and len(image.feedback_result[field]) > 0 and image.feedback_result[field][0] == user_feedback) or image.feedback_result[field] == user_feedback):
|
||||
is_match = True
|
||||
|
||||
@ -65,10 +66,11 @@ class Command(BaseCommand):
|
||||
"imei_number": [],
|
||||
"retailername": "",
|
||||
"purchase_date": "",
|
||||
"sold_to_party": ""
|
||||
"sold_to_party": "",
|
||||
"invoice_no": ""
|
||||
}
|
||||
|
||||
if image.doc_type == "invoice" and field in ['retailername', 'purchase_date']:
|
||||
if image.doc_type == "invoice" and field in ['retailername', 'purchase_date', 'invoice_no']:
|
||||
if _reviewed_result:
|
||||
_reviewed_result[field] = reviewed_result
|
||||
_reviewed_result["imei_number"] = []
|
||||
@ -79,11 +81,14 @@ class Command(BaseCommand):
|
||||
"retailername": None,
|
||||
"sold_to_party": None,
|
||||
"purchase_date": None,
|
||||
"imei_number": [reviewed_result]
|
||||
"imei_number": [reviewed_result],
|
||||
"invoice_no": None
|
||||
} if _reviewed_result else None
|
||||
image.reviewed_result = _reviewed_result
|
||||
if reason:
|
||||
image.reason = reason
|
||||
else:
|
||||
image.reason = ""
|
||||
if counter:
|
||||
image.counter_measures = counter
|
||||
image.save()
|
||||
|
@ -584,7 +584,7 @@ def extract_report_detail_list(report_detail_list, lower=False, in_percent=True)
|
||||
def format_datetime_for_report_detail(ocr_extraction_date):
|
||||
naived_time = timezone.make_naive(ocr_extraction_date)
|
||||
ocr_extraction_date = timezone.make_aware(value=naived_time, timezone=timezone.get_current_timezone())
|
||||
format_to_date = '%Y/%m/%d'
|
||||
format_to_date = '%Y-%m-%d'
|
||||
ocr_extraction_date = ocr_extraction_date.strftime(format_to_date)
|
||||
return ocr_extraction_date
|
||||
|
||||
@ -755,8 +755,8 @@ def create_billing_data(subscription_requests):
|
||||
_sub = map_subsidiary_short_to_long(request.redemption_id[:2])
|
||||
redemption_id = request.redemption_id
|
||||
|
||||
format_to_time = '%Y/%m/%d %H:%M'
|
||||
format_to_date = '%Y/%m/%d'
|
||||
format_to_time = '%Y-%m-%d %H:%M'
|
||||
format_to_date = '%Y-%m-%d'
|
||||
format_to_month = '%B %Y'
|
||||
naive_created_time = timezone.make_naive(request.created_at)
|
||||
rq_created_at = timezone.make_aware(value=naive_created_time, timezone=timezone.get_current_timezone())
|
||||
|
@ -59,6 +59,16 @@ const ReportTable: React.FC = () => {
|
||||
},
|
||||
width: 110,
|
||||
},
|
||||
{
|
||||
title: 'Report Type',
|
||||
dataIndex: 'Report Type',
|
||||
key: 'Report Type',
|
||||
render: (_, record) => {
|
||||
const reportType = record["Report Type"];
|
||||
const uppercasedReportType = reportType.charAt(0).toUpperCase() + reportType.slice(1);
|
||||
return <>{uppercasedReportType}</>;
|
||||
},
|
||||
},
|
||||
{
|
||||
title: 'Start Date',
|
||||
dataIndex: 'Start Date',
|
||||
@ -172,7 +182,7 @@ const ReportTable: React.FC = () => {
|
||||
},
|
||||
},
|
||||
{
|
||||
title: 'Average Processing Time (ms)',
|
||||
title: 'Average Processing Time (seconds)',
|
||||
dataIndex: 'Avg. OCR Processing Time',
|
||||
key: 'Avg. OCR Processing Time',
|
||||
render: (_, record) => {
|
||||
|
@ -89,12 +89,12 @@ services:
|
||||
depends_on:
|
||||
db-sbt:
|
||||
condition: service_started
|
||||
# command: sh -c "chmod -R 777 /app; sleep 5; python manage.py collectstatic --no-input &&
|
||||
# python manage.py makemigrations &&
|
||||
# python manage.py migrate &&
|
||||
# python manage.py compilemessages &&
|
||||
# gunicorn fwd.asgi:application -k uvicorn.workers.UvicornWorker --timeout 300 -b 0.0.0.0:9000" # pre-makemigrations on prod
|
||||
command: "sleep infinity"
|
||||
command: sh -c "chmod -R 777 /app; sleep 5; python manage.py collectstatic --no-input &&
|
||||
python manage.py makemigrations &&
|
||||
python manage.py migrate &&
|
||||
python manage.py compilemessages &&
|
||||
gunicorn fwd.asgi:application -k uvicorn.workers.UvicornWorker --timeout 300 -b 0.0.0.0:9000" # pre-makemigrations on prod
|
||||
# command: "sleep infinity"
|
||||
|
||||
minio:
|
||||
image: minio/minio
|
||||
@ -179,8 +179,8 @@ services:
|
||||
- ./cope2n-api:/app
|
||||
|
||||
working_dir: /app
|
||||
# command: sh -c "celery -A fwd_api.celery_worker.worker worker -l INFO -c 5"
|
||||
command: bash -c "tail -f > /dev/null"
|
||||
command: sh -c "celery -A fwd_api.celery_worker.worker worker -l INFO -c 5"
|
||||
# command: bash -c "tail -f > /dev/null"
|
||||
|
||||
# Back-end persistent
|
||||
db-sbt:
|
||||
|
Loading…
Reference in New Issue
Block a user