diff --git a/cope2n-api/fwd_api/api/accuracy_view.py b/cope2n-api/fwd_api/api/accuracy_view.py index 9f32f42..5dc12f5 100644 --- a/cope2n-api/fwd_api/api/accuracy_view.py +++ b/cope2n-api/fwd_api/api/accuracy_view.py @@ -394,7 +394,7 @@ class AccuracyViewSet(viewsets.ViewSet): paginator = Paginator(reports, page_size) - page = paginator.get_page(page_number) + page = paginator.get_page(page_number).order_by('created_at') data = [] for report in page: diff --git a/cope2n-api/fwd_api/utils/accuracy.py b/cope2n-api/fwd_api/utils/accuracy.py index 3ba1efd..de1f8d4 100644 --- a/cope2n-api/fwd_api/utils/accuracy.py +++ b/cope2n-api/fwd_api/utils/accuracy.py @@ -130,10 +130,38 @@ class MonthReportAccumulate: self.accumulate(report) return True + def clear(self): + self.month = None + self.total = { + 'subs': "+", + 'extraction_date': "Subtotal ()", + 'total_images': 0, + 'images_quality': { + 'successful': 0, + 'successful_percent': 0, + 'bad': 0, + 'bad_percent': 0 + }, + 'average_accuracy_rate': { + 'imei': IterAvg(), + 'purchase_date': IterAvg(), + 'retailer_name': IterAvg() + }, + 'average_processing_time': { + 'imei': IterAvg(), + 'invoice': IterAvg() + }, + 'usage': { + 'imei':0, + 'invoice': 0 + } + } + self.data = [] + def __call__(self): - self.total["images_quality"]["successful_percent"] += self.total["images_quality"]["successful"]/self.total["total_images"] if self.total["total_images"] else 0 - self.total["images_quality"]["bad_percent"] += self.total["images_quality"]["bad"]/self.total["total_images"] if self.total["total_images"] else 0 total = copy.deepcopy(self.total) + total["images_quality"]["successful_percent"] = total["images_quality"]["successful"]/total["total_images"] if total["total_images"] else 0 + total["images_quality"]["bad_percent"] = total["images_quality"]["bad"]/total["total_images"] if total["total_images"] else 0 total["average_accuracy_rate"]["imei"] = total["average_accuracy_rate"]["imei"]() total["average_accuracy_rate"]["purchase_date"] = total["average_accuracy_rate"]["purchase_date"]() total["average_accuracy_rate"]["retailer_name"] = total["average_accuracy_rate"]["retailer_name"]() diff --git a/cope2n-fe/package.json b/cope2n-fe/package.json index 314d175..5de650b 100644 --- a/cope2n-fe/package.json +++ b/cope2n-fe/package.json @@ -2,7 +2,7 @@ "name": "sbt-ui", "version": "0.1.0", "scripts": { - "start": "NODE_ENV=development vite --host", + "start": "NODE_ENV=development npm run extract && npm run compile && vite --host", "build": "NODE_ENV=production npm run extract && npm run compile && tsc && vite build", "serve": "vite preview", "extract": "lingui extract --clean", diff --git a/cope2n-fe/src/request/report.ts b/cope2n-fe/src/request/report.ts index 2b65a48..53d0773 100644 --- a/cope2n-fe/src/request/report.ts +++ b/cope2n-fe/src/request/report.ts @@ -96,8 +96,10 @@ export async function downloadReport(report_id: string) { let filename = "report.xlsx"; try { let basename = response.headers['content-disposition'].split('filename=')[1].split('.')[0]; - let extension = response.headers['content-disposition'].split('.')[1].split(';')[0]; - filename = `${basename}.${extension}` + if (basename.charAt(0) === '_') { + basename = basename.substring(1); + } + filename = `${basename}.xlsx` } catch(err) { console.log(err); } diff --git a/docker-compose-dev.yml b/docker-compose-dev.yml index 2ff79e2..44f8c94 100755 --- a/docker-compose-dev.yml +++ b/docker-compose-dev.yml @@ -84,12 +84,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: bash -c "tail -f > /dev/null" + # 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: bash -c "tail -f > /dev/null" minio: image: minio/minio diff --git a/document-classification-kv-demo b/document-classification-kv-demo new file mode 160000 index 0000000..220954c --- /dev/null +++ b/document-classification-kv-demo @@ -0,0 +1 @@ +Subproject commit 220954c5c6bfed15e93e26b2adacf28ff8b75baf