Skip to content

Commit

Permalink
Fix html report bug.
Browse files Browse the repository at this point in the history
Signed-off-by: Caroline Russell <[email protected]>
  • Loading branch information
cerrussell committed Aug 5, 2024
1 parent 8d62db5 commit 369bf57
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions custom_json_diff/bom_diff_template.j2
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
<th style="text-align: center; width: 46%">{{ bom_1 }}</th>
<th style="text-align: center; width: 46%">{{ bom_2 }}</th>
</tr>
{% if not (diff_apps_1 or diff_apps_2 or diff_frameworks_1 or diff_frameworks_2 or diff_lib_1 or diff_lib_2 or diff_other_1 or diff_other_2 or diff_vdrs_1 or diff_vdrs_2) %}
{% if diff_status == 0 %}
<tr>
<td colspan="3" style="text-align: center">No differences found.</td>
</tr>
Expand Down Expand Up @@ -432,7 +432,7 @@
Components
</th>
</tr>
{% if not (common_apps or common_frameworks or common_lib or common_other) %}
{% if not (common_apps or common_frameworks or common_lib or common_other or common_services or common_deps or common_vdrs) %}
<tr>
<td colspan="2" style="text-align: center">No commonalities.</td>
</tr>
Expand Down
5 changes: 3 additions & 2 deletions custom_json_diff/custom_diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def compare_dicts(options: Options) -> Tuple[int, FlatDicts | BomDicts, FlatDict
return 1, json_1_data, json_2_data


def export_html_report(outfile: str, diffs: Dict, j1: BomDicts, j2: BomDicts, options: Options) -> None:
def export_html_report(outfile: str, diffs: Dict, j1: BomDicts, j2: BomDicts, options: Options, status: int) -> None:
if options.report_template:
template_file = options.report_template
else:
Expand Down Expand Up @@ -92,6 +92,7 @@ def export_html_report(outfile: str, diffs: Dict, j1: BomDicts, j2: BomDicts, op
stats=stats_summary,
comp_only=options.comp_only,
metadata=metadata_results,
diff_status=status,
)
with open(outfile, "w", encoding="utf-8") as f:
f.write(report_result)
Expand Down Expand Up @@ -178,7 +179,7 @@ def report_results(status: int, diffs: Dict, options: Options, j1: BomDicts | No
return
if options.bom_diff:
report_file = options.output.replace(".json", "") + ".html"
export_html_report(report_file, diffs, j1, j2, options) # type: ignore
export_html_report(report_file, diffs, j1, j2, options, status) # type: ignore


def sort_dict_lists(result: Dict, sort_keys: List[str]) -> Dict:
Expand Down
2 changes: 1 addition & 1 deletion custom_json_diff/custom_diff_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ def compare_date(dt1: str, dt2: str, comparator: str):

def compare_vdr_new_versions(vdr_1: BomVdr, vdr_2: BomVdr) -> bool:
return all((vdr_1.affects == vdr_2.affects,
compare_date(vdr_1.updated, vdr_2.updated, "<"),
(not vdr_1.updated or compare_date(vdr_1.updated, vdr_2.updated, "<=")),
compare_bom_refs(vdr_1.bom_ref, vdr_2.bom_ref)))


Expand Down

0 comments on commit 369bf57

Please sign in to comment.