Let a site choose the order its board rows run in

Rows ran in display-style order and then alphabetically, so what led the screen
was an accident of styling and the alphabet - a new type called Awareness
landed above Recertification for no better reason than the letter A.

Each type now carries a board position, lowest first, set on the Notification
Types page. The migration seeds Recognition at 10 and Recertification at 20 and
leaves everything else at 100, so an existing board keeps the order sites
already expect. Steps of ten leave room to slot a row in without renumbering
the rest.

A row shared by several types sits wherever its earliest-ordered type puts it,
so a category moves as a unit.
This commit is contained in:
cproudlock
2026-08-08 14:20:35 -04:00
parent adb8542018
commit 442a631557
6 changed files with 208 additions and 3 deletions

View File

@@ -89,6 +89,13 @@ class NotificationType(db.Model):
# displaystyle - a banner and a tile row cannot be the same row.
boardcategory = db.Column(db.String(50), nullable=True)
# Where this type's row sits on the shopfloor board, low first. A site
# decides what leads the screen - recognition above recertification above
# the rest - rather than inheriting an alphabetical or by-style accident.
# Rows sharing a category sort by the lowest order among their types.
boardorder = db.Column(db.Integer, nullable=False,
server_default='100', default=100)
def __repr__(self):
return f"<NotificationType {self.typename}>"
@@ -107,7 +114,8 @@ class NotificationType(db.Model):
'showemployeephoto': bool(self.showemployeephoto),
'displaystyle': self.displaystyle or 'standard',
'gracewindowminutes': int(self.gracewindowminutes or 0),
'boardcategory': self.boardcategory or ''
'boardcategory': self.boardcategory or '',
'boardorder': int(self.boardorder if self.boardorder is not None else 100)
}