feat(csv-import): Enhance CSV import functionality with new modules and tests
- Added support for new CSV import modules: sleep and vitals_baseline, expanding the import capabilities. - Implemented backend logic for handling CSV imports related to sleep and vitals baseline, including error handling and data processing. - Updated frontend components to include new modules in the CSV import interface, improving user experience. - Introduced unit tests for the new import functionalities to ensure reliability and correctness. - Enhanced existing CSV analysis features to accommodate the new modules, ensuring consistent behavior across the application.
This commit is contained in:
1 parent
b4cc3cb934
commit
26ab11eb7b
14 files changed
+1261
-340
No files matched your search
@@ -328,6 +328,14 @@ def _check_module_feature_access(pid: str, module: str) -> None:
|
||||
403,
|
||||
f"Limit erreicht (Gewichtseinträge): {access.get('used')}/{access.get('limit')}",
|
||||
)
|
||||
elif module == "activity":
|
||||
access = check_feature_access(pid, "activity_entries")
|
||||
log_feature_usage(pid, "activity_entries", access, "csv_universal_import")
|
||||
if not access["allowed"]:
|
||||
raise HTTPException(
|
||||
403,
|
||||
f"Limit erreicht (Aktivitätseinträge): {access.get('used')}/{access.get('limit')}",
|
||||
)
|
||||
|
||||
|
||||
@router.post("/import")
|
||||
@@ -383,12 +391,6 @@ async def csv_import_execute(
|
||||
exec_module = m["module"]
|
||||
resolved_module = exec_module
|
||||
|
||||
if exec_module == "activity":
|
||||
raise HTTPException(
|
||||
501,
|
||||
"Aktivitäts-CSV über den Universal-Importer ist noch nicht freigeschaltet "
|
||||
"(Training-Type-Mapping). Bitte weiterhin /api/activity/import nutzen.",
|
||||
)
|
||||
if not get_module_definition(exec_module):
|
||||
raise HTTPException(
|
||||
400,
|
||||
@@ -492,6 +494,9 @@ async def csv_import_execute(
|
||||
elif resolved_module == "weight":
|
||||
for _ in range(ne):
|
||||
increment_feature_usage(pid, "weight_entries")
|
||||
elif resolved_module == "activity":
|
||||
for _ in range(ne):
|
||||
increment_feature_usage(pid, "activity_entries")
|
||||
|
||||
return {
|
||||
"success": True,
|
||||
|
||||
Reference in new issue
Block a user