feat: the machine is chosen at sign-in, per session (Dropstar's third round, item 12)
Some checks failed
Build and deploy / Validate source (push) Successful in 5s
Build and deploy / Integration suite on a real stack (push) Failing after 2m32s
Build and deploy / Secret scan and release gate (push) Successful in 5s
Build and deploy / Publish images (push) Has been skipped
Some checks failed
Build and deploy / Validate source (push) Successful in 5s
Build and deploy / Integration suite on a real stack (push) Failing after 2m32s
Build and deploy / Secret scan and release gate (push) Successful in 5s
Build and deploy / Publish images (push) Has been skipped
After signing in, the Kanban asks "Em qual máquina você está?": required
for the operator, optional for Gestão and Administrador ("Não estou em
máquina"), never for the other profiles. The session keeps it until it
ends or is changed from the header, where the machine shows in green;
one person on two computers runs two machines. Someone else already on
the machine is a warning, not a refusal.
Operators see the whole board (no more per-machine filter). From Arte
conferida they pull any card, which becomes their machine's (a machine
that does not print its product refuses it); they move only their
machine's cards, and the others show without drag or buttons. Their
cards and their machine's row in Imprimindo are outlined in green. The
history records the machine with the person: "Imprimindo · Thales ·
máquina2". Usuários shows who is on each machine now, read-only; the old
operator/machine assignment is no longer read.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -165,6 +165,10 @@ ADMINS = ('superadmin', 'admin')
|
||||
COORDINATION = ('gestao',)
|
||||
MANAGERS = ADMINS + COORDINATION
|
||||
RELEASERS = ('revisor', 'admin', 'superadmin')
|
||||
# Who is asked "Em qual máquina você está?" after signing in (Dropstar, 2026-10-30):
|
||||
# the operator must answer; Gestão and the administrators may say they are on
|
||||
# none. The other profiles are never asked.
|
||||
MACHINE_QUESTION = {'operador': 'required', 'gestao': 'optional', 'admin': 'optional'}
|
||||
MOVERS = MANAGERS + tuple(MOVES)
|
||||
|
||||
|
||||
@@ -194,14 +198,17 @@ def signed_in(request: Request):
|
||||
raise HTTPException(401, 'Entre no Kanban.')
|
||||
digest = hashlib.sha256(token.encode()).hexdigest()
|
||||
with connect() as c:
|
||||
row = c.execute('''SELECT o.id,o.email,o.name,o.role FROM dtf_local.operator_sessions s
|
||||
row = c.execute('''SELECT o.id,o.email,o.name,o.role,s.machine_answered,m.id AS machine_id,m.name AS machine_name
|
||||
FROM dtf_local.operator_sessions s
|
||||
JOIN dtf_local.operators o ON o.email=s.username AND o.active
|
||||
LEFT JOIN dtf_local.machines m ON m.id=s.machine_id
|
||||
WHERE s.token_hash=%s AND s.expires_at>now()''', (digest,)).fetchone()
|
||||
if row:
|
||||
row['machines'] = [str(r['machine_id']) for r in c.execute(
|
||||
'SELECT machine_id FROM dtf_local.operator_machines WHERE operator_id=%s', (row['id'],)).fetchall()]
|
||||
if not row:
|
||||
raise HTTPException(401, 'Sua sessão expirou. Entre de novo.')
|
||||
# The machine this session works on (item 12), or None.
|
||||
machine_id, machine_name = row.pop('machine_id'), row.pop('machine_name')
|
||||
row['machine'] = {'id': str(machine_id), 'name': machine_name} if machine_id else None
|
||||
row['session'] = digest
|
||||
request.state.operator = row
|
||||
return row
|
||||
|
||||
|
||||
Reference in New Issue
Block a user