Apply suggestions from code review of branch live-scan-details

Co-authored-by: Joe Knapper <joe.knapper@glasgow.ac.uk>
This commit is contained in:
Julian Stirling 2026-07-04 21:52:31 +00:00
parent d25ebabc77
commit 543433f31e
2 changed files with 5 additions and 3 deletions

View file

@ -291,7 +291,7 @@ class SmartScanThing(OFMThing):
@lt.property @lt.property
def latest_scan_live_details(self) -> Optional[LiveScanDetails]: def latest_scan_live_details(self) -> Optional[LiveScanDetails]:
"""The details of any ongoing scan, or the previous scan if no san ongoing.""" """The details of any ongoing scan, or the previous scan if no scan ongoing."""
if self._latest_scan_live_details is None: if self._latest_scan_live_details is None:
return None return None
# Update image count and stitch timestamp if scan is ongoing. # Update image count and stitch timestamp if scan is ongoing.
@ -350,7 +350,7 @@ class SmartScanThing(OFMThing):
raise e raise e
finally: finally:
# Save some final details but not set to the base model until after # Save some final details but not set to the base model until after
# resetting valued and unlocking just in case somehow pydantic errors. # resetting values and unlocking in case of Pydantic errors.
final_image_count = ( final_image_count = (
self._scan_data.image_count if self._scan_data is not None else None self._scan_data.image_count if self._scan_data is not None else None
@ -499,7 +499,7 @@ class SmartScanThing(OFMThing):
self.logger.info("Stopping scan because it was cancelled.") self.logger.info("Stopping scan because it was cancelled.")
self._save_final_scan_data(scan_result="cancelled by user") self._save_final_scan_data(scan_result="cancelled by user")
if self.scan_data.image_count < MIN_IMAGES_TO_STITCH: if self.scan_data.image_count < MIN_IMAGES_TO_STITCH:
# If too few images to stitch then, return to the centre and report # If too few images to stitch then, return to the start and report
# cancelled # cancelled
self._return_to_starting_position() self._return_to_starting_position()
raise e raise e

View file

@ -163,6 +163,8 @@ export default {
return this.isDisabled || this.isBroken || (this.taskRunning && !this.canTerminate); return this.isDisabled || this.isBroken || (this.taskRunning && !this.canTerminate);
}, },
buttonLabel() { buttonLabel() {
// If the action is running (and can terminate) then show the cancel label, otherwise
// show the submit label.
return this.taskRunning && this.canTerminate ? this.cancelLabel : this.submitLabel; return this.taskRunning && this.canTerminate ? this.cancelLabel : this.submitLabel;
}, },
buttonClasses() { buttonClasses() {