From 9224c546a97563a2e802756a5ff58b972c2f85b8 Mon Sep 17 00:00:00 2001 From: Tanner Collin Date: Wed, 26 Apr 2023 20:47:02 +0000 Subject: [PATCH] Add media computer track stat and last print --- apiserver/apiserver/api/views.py | 12 ++++++++++++ webclient/src/Home.js | 20 ++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/apiserver/apiserver/api/views.py b/apiserver/apiserver/api/views.py index cdb5fe2..d6c2ddc 100644 --- a/apiserver/apiserver/api/views.py +++ b/apiserver/apiserver/api/views.py @@ -1473,6 +1473,18 @@ class ProtocoinViewSet(Base): ) utils.log_transaction(tx) + track = cache.get('track', {}) + + devicename = 'LASTLARGEPRINT' + first_name = username.split('.')[0].title() + + track[devicename] = dict( + time=time.time(), + username=username, + first_name=first_name, + ) + cache.set('track', track) + return Response(200) except OperationalError: self.printer_report(request, pk) diff --git a/webclient/src/Home.js b/webclient/src/Home.js index 3b68d39..ccaee22 100644 --- a/webclient/src/Home.js +++ b/webclient/src/Home.js @@ -359,6 +359,26 @@ export function Home(props) { } trigger={[more]} />

+

+ Media computer: {getTrackStat('PROTOGRAPH1')} +

+ Last use:
+ {getTrackLast('PROTOGRAPH1')}
+ {getTrackAgo('PROTOGRAPH1')}
+ by {getTrackName('PROTOGRAPH1')} +

+ +

+ Last print:
+ {getTrackLast('LASTLARGEPRINT')}
+ {getTrackAgo('LASTLARGEPRINT')}
+ by {getTrackName('LASTLARGEPRINT')} +

+ + } trigger={[more]} /> +

+

ORD2 printer: {printer3dStat('ord2')}

ORD3 printer: {printer3dStat('ord3')}