Skip to content

Commit cf1d3a0

Browse files
committed
add usage thin usage stat for metalab projects
1 parent 6a7acb0 commit cf1d3a0

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

docs/THINGS.md

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ $ curl https://metalab.at/things/usage/prusaxl -H "X-TOKEN: XXX" -XPOST -d 'user
3232
* `LOGOUT`, user stopped using a machine
3333
* `USAGE_MEMBER`, user used the machine for X seconds, for a member
3434
* `USAGE_NONMEMBER`, user used the machine for X seconds, for a non-member
35+
* `USAGE_METALAB`, user used the machine for X seconds, for a metalab infra project
3536

3637
Additionally, supply `usage_seconds=` as an integer for `USAGE_` kinds.
3738

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Generated by Django 3.2.20 on 2024-03-09 21:15
2+
3+
from django.db import migrations
4+
from django.db import models
5+
6+
7+
class Migration(migrations.Migration):
8+
9+
dependencies = [
10+
('things', '0007_alter_thingevent_usage_seconds'),
11+
]
12+
13+
operations = [
14+
migrations.AlterField(
15+
model_name='thingevent',
16+
name='kind',
17+
field=models.CharField(choices=[('LOGIN', 'Login'), ('LOGOUT', 'Logout'), ('USAGE_MEMBER', 'Zeit (Member)'), ('USAGE_NONMEMBER', 'Zeit (Nicht-Member)'), ('USAGE_METALAB', 'Zeit (für Metalab)')], db_index=True, max_length=32),
18+
),
19+
]

things/models.py

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ class Kind(models.TextChoices):
3838
LOGOUT = ("LOGOUT", "Logout")
3939
USAGE_MEMBER = ("USAGE_MEMBER", "Zeit (Member)")
4040
USAGE_NONMEMBER = ("USAGE_NONMEMBER", "Zeit (Nicht-Member)")
41+
USAGE_METALAB = ("USAGE_METALAB", "Zeit (für Metalab)")
4142

4243
thing = models.ForeignKey(Thing, on_delete=models.PROTECT)
4344
user = models.ForeignKey(

0 commit comments

Comments
 (0)