Update client/ayon_core/tools/utils/tasks_widget.py

Co-authored-by: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com>
This commit is contained in:
Aleks Berland 2025-10-30 11:40:48 -04:00 committed by GitHub
parent 9b09865209
commit aaefad12bb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -413,24 +413,14 @@ class TasksProxyModel(QtCore.QSortFilterProxyModel):
left_value = left.data(TASK_SORT_ROLE)
right_value = right.data(TASK_SORT_ROLE)
if left_value == right_value:
return super().lessThan(left, right)
# If values are strings, compare lexicographically
if isinstance(left_value, str) or isinstance(right_value, str):
left_str = "" if left_value is None else str(left_value)
right_str = "" if right_value is None else str(right_value)
return left_str < right_str
# Otherwise treat as numeric order; None goes last
if right_value is None:
return True
if left_value is None:
return False
try:
if left_value != right_value:
if left_value is None:
return False
if right_value is None:
return True
return left_value < right_value
except Exception:
return super().lessThan(left, right)
return super().lessThan(left, right)
class TasksWidget(QtWidgets.QWidget):