Skip to content

Commit

Permalink
Add initial structure pk to summary (#1051)
Browse files Browse the repository at this point in the history
- Add structure PK
- Change section title to "Initial structure properties"
- Add structure UUID
- Update summary test
- Fix bug in exit status check logic
  • Loading branch information
edan-bainglass authored Jan 5, 2025
1 parent f792d36 commit 4ea95f1
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/aiidalab_qe/app/result/components/summary/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def generate_report_text(self, report_dict):
def generate_failure_report(self):
"""Generate a html for reporting the failure of the `QeAppWorkChain`."""
process_node = self.fetch_process_node()
if not process_node and process_node.exit_status:
if not (process_node and process_node.exit_status):
return
final_calcjob = self._get_final_calcjob(process_node)
env = Environment()
Expand Down Expand Up @@ -177,6 +177,8 @@ def _generate_report_parameters(self):
"creation_time_relative": relative_time(qeapp_wc.ctime),
"modification_time": format_time(qeapp_wc.mtime),
"modification_time_relative": relative_time(qeapp_wc.mtime),
"structure_pk": initial_structure.pk,
"structure_uuid": initial_structure.uuid,
"formula": initial_structure.get_formula(),
"num_atoms": len(initial_structure.sites),
"space_group": "{} ({})".format(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,14 @@
</ul>
</div>
<div class="summary-table" id="structure-properties">
<h2>Structure properties</h2>
<h2>Initial structure properties</h2>
<ul>
<li>
<strong>Structure PK:</strong> {{ structure_pk }}
</li>
<li>
<strong>Structure UUID:</strong> {{ structure_uuid }}
</li>
<li>
<strong>Chemical formula:</strong> {{ formula }}
</li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,16 @@
</table>
</div>
<div class="summary-table" id="structure-properties">
<h2>Structure properties</h2>
<h2>Initial structure properties</h2>
<table>
<tr>
<td>Structure PK</td>
<td>{{ structure_pk }}</td>
</tr>
<tr>
<td>Structure UUID</td>
<td>{{ structure_uuid }}</td>
</tr>
<tr>
<td>Chemical formula</td>
<td>{{ formula }}</td>
Expand Down
2 changes: 2 additions & 0 deletions tests/test_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ def test_summary_report(data_regression, generate_qeapp_workchain):
"creation_time_relative",
"modification_time",
"modification_time_relative",
"structure_pk",
"structure_uuid",
):
report_parameters.pop(key)
data_regression.check(report_parameters)
Expand Down

0 comments on commit 4ea95f1

Please sign in to comment.