Add media computer track stat and last print

This commit is contained in:
Tanner Collin 2023-04-26 20:47:02 +00:00
parent 03056d559f
commit 9224c546a9
2 changed files with 32 additions and 0 deletions

View File

@ -1473,6 +1473,18 @@ class ProtocoinViewSet(Base):
) )
utils.log_transaction(tx) 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) return Response(200)
except OperationalError: except OperationalError:
self.printer_report(request, pk) self.printer_report(request, pk)

View File

@ -359,6 +359,26 @@ export function Home(props) {
} trigger={<a>[more]</a>} /> } trigger={<a>[more]</a>} />
</p> </p>
<p>
Media computer: {getTrackStat('PROTOGRAPH1')} <Popup content={
<React.Fragment>
<p>
Last use:<br />
{getTrackLast('PROTOGRAPH1')}<br />
{getTrackAgo('PROTOGRAPH1')}<br />
by {getTrackName('PROTOGRAPH1')}
</p>
<p>
Last print:<br />
{getTrackLast('LASTLARGEPRINT')}<br />
{getTrackAgo('LASTLARGEPRINT')}<br />
by {getTrackName('LASTLARGEPRINT')}
</p>
</React.Fragment>
} trigger={<a>[more]</a>} />
</p>
<p>ORD2 printer: {printer3dStat('ord2')}</p> <p>ORD2 printer: {printer3dStat('ord2')}</p>
<p>ORD3 printer: {printer3dStat('ord3')}</p> <p>ORD3 printer: {printer3dStat('ord3')}</p>