From a35526a0b5b384483fdf275e4aa81408e2cd41b9 Mon Sep 17 00:00:00 2001 From: miruka Date: Sat, 30 Nov 2019 04:04:24 -0400 Subject: [PATCH] Show higher power-level room members first --- src/python/models/items.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/python/models/items.py b/src/python/models/items.py index e4ac064f..bb05bbd9 100644 --- a/src/python/models/items.py +++ b/src/python/models/items.py @@ -94,9 +94,10 @@ class Member(ModelItem): power_level: int = 0 def __lt__(self, other: "Member") -> bool: - name = self.display_name or self.user_id[1:] - other_name = other.display_name or other.user_id[1:] - return name.lower() < other_name.lower() + # Sort by name, but have members with higher power-level first + name = (self.display_name or self.user_id[1:]).lower() + other_name = (other.display_name or other.user_id[1:]).lower() + return (other.power_level, name) < (self.power_level, other_name) @property