Commit 3b7b289d authored by Pierre Dittgen's avatar Pierre Dittgen
Browse files

Fix source rows count display

parent d616897d
...@@ -197,7 +197,7 @@ def build_ui_errors(errors): ...@@ -197,7 +197,7 @@ def build_ui_errors(errors):
return list(map(improve_err, errors)) return list(map(improve_err, errors))
def create_validata_ui_report(validata_core_report, schema_dict): def create_validata_ui_report(rows_count: int, validata_core_report, schema_dict):
"""Creates an error report easier to handle and display in templates: """Creates an error report easier to handle and display in templates:
- only one table - only one table
- errors are contextualized - errors are contextualized
...@@ -218,7 +218,7 @@ def create_validata_ui_report(validata_core_report, schema_dict): ...@@ -218,7 +218,7 @@ def create_validata_ui_report(validata_core_report, schema_dict):
# source dimension # source dimension
ui_report["table"]["col_count"] = len(headers) ui_report["table"]["col_count"] = len(headers)
ui_report["table"]["row_count"] = v_report.table["stats"]["rows"] ui_report["table"]["row_count"] = rows_count
# Computes column info from schema # Computes column info from schema
fields_dict = { fields_dict = {
...@@ -349,6 +349,7 @@ def validate(schema_instance: SchemaInstance, validata_resource: ValidataResourc ...@@ -349,6 +349,7 @@ def validate(schema_instance: SchemaInstance, validata_resource: ValidataResourc
# Parse source data once # Parse source data once
header, rows = validata_resource.extract_tabular_data() header, rows = validata_resource.extract_tabular_data()
rows_count = len(rows)
# Call validata_core with parsed data # Call validata_core with parsed data
validata_core_report = validata_core.validate( validata_core_report = validata_core.validate(
...@@ -397,7 +398,9 @@ def validate(schema_instance: SchemaInstance, validata_resource: ValidataResourc ...@@ -397,7 +398,9 @@ def validate(schema_instance: SchemaInstance, validata_resource: ValidataResourc
report_datetime = datetime.fromisoformat(validata_core_report["date"]).astimezone() report_datetime = datetime.fromisoformat(validata_core_report["date"]).astimezone()
# create ui_report # create ui_report
ui_report = create_validata_ui_report(validata_core_report, schema_instance.schema) ui_report = create_validata_ui_report(
rows_count, validata_core_report, schema_instance.schema
)
# Display report to the user # Display report to the user
validator_form_url = compute_validation_form_url( validator_form_url = compute_validation_form_url(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment