Fix bug in HistoryItem.get_finished_label_text

This commit is contained in:
Micah Lee 2019-01-19 19:33:36 -08:00
parent 862a0dc067
commit a0c3a276ec
No known key found for this signature in database
GPG Key ID: 403C2657CD994F73

View File

@ -40,12 +40,11 @@ class HistoryItem(QtWidgets.QWidget):
def cancel(self): def cancel(self):
pass pass
def get_finished_label_text(self, started_ts): def get_finished_label_text(self, started):
""" """
When an item finishes, returns a string displaying the start/end datetime range. When an item finishes, returns a string displaying the start/end datetime range.
started is a datetime object. started is a datetime object.
""" """
started = datetime.fromtimestamp(started_ts)
ended = datetime.now() ended = datetime.now()
if started.year == ended.year and started.month == ended.month and started.day == ended.day: if started.year == ended.year and started.month == ended.month and started.day == ended.day:
if started.hour == ended.hour and started.minute == ended.minute: if started.hour == ended.hour and started.minute == ended.minute:
@ -111,7 +110,7 @@ class ShareHistoryItem(HistoryItem):
self.common.format_seconds(time.time() - self.started)) self.common.format_seconds(time.time() - self.started))
# Change the label # Change the label
self.label.setText(self.get_finished_label_text(self.started)) self.label.setText(self.get_finished_label_text(self.started_dt))
else: else:
elapsed = time.time() - self.started elapsed = time.time() - self.started