Give every notification type its own row on the board
The shopfloor board grouped cards by display style alone, so every type set to grid landed inside the Recertification row and every carousel type inside Recognition's - under a heading naming somebody else's type. Setting Awareness to grid put awareness messages under "Recertification Required". Each type now gets a row of its own, titled by its own name, and rotation state is per row: two carousel rows advance on their own indexes instead of sharing one counter, and two grid rows page independently. For the other direction there is notificationtypes.boardcategory. Types sharing a category share one row under the category name, so Change, Awareness and Incident can sit together while Recognition and Recertification keep their own. Blank - the default - means a row of its own. The category is part of the grouping key along with the display style, since a category cannot merge a banner with a row of tiles. A card that names no employee now renders its message as the tile or card, rather than a placeholder face above a blank name, which is what a grid type like Awareness looked like before. The layout fingerprint that makes open kiosks reload now covers the category and the grace window, so a re-grouped board reaches screens that are already up.
This commit is contained in:
@@ -157,6 +157,13 @@ def _apply_display_fields(t, data):
|
||||
if ds not in _DISPLAY_STYLES:
|
||||
return "displaystyle must be one of: %s" % ", ".join(_DISPLAY_STYLES)
|
||||
t.displaystyle = ds
|
||||
if 'boardcategory' in data:
|
||||
category = (data.get('boardcategory') or '').strip()
|
||||
if len(category) > 50:
|
||||
return "boardcategory must be 50 characters or fewer"
|
||||
# Blank stores as NULL: "no category" is the absence of one, not the
|
||||
# empty-string category that every uncategorised type would share.
|
||||
t.boardcategory = category or None
|
||||
if 'gracewindowminutes' in data:
|
||||
raw = data.get('gracewindowminutes')
|
||||
raw = 0 if raw in (None, '') else raw
|
||||
@@ -178,11 +185,11 @@ def _config_version():
|
||||
reach pages that are already open."""
|
||||
types = NotificationType.query.order_by(NotificationType.notificationtypeid).all()
|
||||
parts = [
|
||||
"%s|%s|%s|%d|%d|%s|%s|%s|%d|%d" % (
|
||||
"%s|%s|%s|%d|%d|%s|%s|%s|%d|%d|%s" % (
|
||||
t.notificationtypeid, t.typecolor, t.displaystyle,
|
||||
int(bool(t.splitperemployee)), int(bool(t.showemployeephoto)),
|
||||
t.expirymode, t.expirydays, t.expiryhour, int(bool(t.isactive)),
|
||||
int(t.gracewindowminutes or 0),
|
||||
int(t.gracewindowminutes or 0), t.boardcategory or '',
|
||||
)
|
||||
for t in types
|
||||
]
|
||||
@@ -779,8 +786,11 @@ def get_shopfloor_notifications():
|
||||
'resolved': is_resolved,
|
||||
'typename': ntype.typename if ntype else None,
|
||||
'typecolor': ntype.typecolor if ntype else None,
|
||||
# Per-type display behavior the dashboard groups/renders by.
|
||||
# Per-type display behavior the dashboard groups/renders by. A
|
||||
# boardcategory puts several types in one row under that name;
|
||||
# blank gives the type a row of its own.
|
||||
'displaystyle': (ntype.displaystyle or 'standard') if ntype else 'standard',
|
||||
'boardcategory': (ntype.boardcategory or '') if ntype else '',
|
||||
}
|
||||
|
||||
# Employee info (photo only when the type wants it)
|
||||
|
||||
Reference in New Issue
Block a user