diff options
author | Sean Smith <ssmith@iol.unh.edu> | 2020-08-11 10:41:27 -0400 |
---|---|---|
committer | Sawyer Bergeron <sbergeron@iol.unh.edu> | 2020-11-09 21:52:23 +0000 |
commit | 986f474e540669fd9fb72810b3f31fa3f4c3e97a (patch) | |
tree | 7c3c27720c962577b88f7cccafac3f3b948ddab9 /src/analytics/models.py | |
parent | a45a7552146801154f2267fe7e8fae443605bfe3 (diff) |
Analytics changes
Signed-off-by: Sean Smith <ssmith@iol.unh.edu>
Change-Id: Iaea350b3042f9c866939a9d1a79bdef1e165c1a7
Signed-off-by: Sawyer Bergeron <sbergeron@iol.unh.edu>
Diffstat (limited to 'src/analytics/models.py')
-rw-r--r-- | src/analytics/models.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/analytics/models.py b/src/analytics/models.py new file mode 100644 index 0000000..10baa0c --- /dev/null +++ b/src/analytics/models.py @@ -0,0 +1,30 @@ +############################################################################## +# Copyright (c) 2020 Sean Smith and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +from django.db import models +from account.models import Lab + + +class ActiveVPNUser(models.Model): + """ Keeps track of how many VPN Users are connected to Lab """ + time_stamp = models.DateTimeField(auto_now_add=True) + lab = models.ForeignKey(Lab, on_delete=models.CASCADE, null=False) + active_users = models.IntegerField() + + @classmethod + def create(cls, lab_name, active_users): + """ + This creates an Active VPN Users entry from + from lab_name as a string + """ + + lab = Lab.objects.get(name=lab_name) + avu = cls(lab=lab, active_users=active_users) + avu.save() + return avu |