# Path: ctleweb/projtrack/models.py
# def get_name(self):
#     def __str__(self):
#     def __str__(self):
#     def __str__(self):
#     def __str__(self):
#     def __str__(self):
#     def __str__(self):
# def create_auth_token(sender, instance=None, created=False, **kwargs):
# class Department(models.Model):
#     class Meta:
# class Client(models.Model):
#     class Meta:
# class Type(models.Model):
#     class Meta:
# class Semester(models.Model):
#     class Meta:
# class CurrentSemester(models.Model):
#     class Meta:
# class Project(models.Model):
#     class Meta:


import os
from datetime import datetime
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist
from .models import User, Project, Client, Semester, Department, Type




class UserStats(object):
    def __init__(self, user):
        # try:
        #     self.user_object = User.objects.get(username=user)
        # except ObjectDoesNotExist:
        #     self.user_object = User.objects.get(pk=user)
        # except TypeError:
        self.user_object = user
        self.name = self.user_object.username
        self.projects_list = list(Project.objects.filter(users=self.user_object))
        self.projects_count = 0
        self.projects_hours = 0
        self.walk_in = 0

    def update_stats(self):
        self.projects_count = len(self.projects_list)
        for x in self.projects_list:
            self.projects_hours += x.hours
            if x.walk_in:
                self.walk_in += 1


class Report(object):
    def __init__(self, request):
        self.date = datetime.today().strftime("%m/%d/%Y")
        try:

# Path: ctleweb/projtrack/models.py
# def get_name(self):
#     def __str__(self):
#     def __str__(self):
#     def __str__(self):
#     def __str__(self):
#     def __str__(self):
#     def __str__(self):
# def create_auth_token(sender, instance=None, created=False, **kwargs):
# class Department(models.Model):
#     class Meta:
# class Client(models.Model):
#     class Meta:
# class Type(models.Model):
#     class Meta:
# class Semester(models.Model):
#     class Meta:
# class CurrentSemester(models.Model):
#     class Meta:
# class Project(models.Model):
#     class Meta:


# Path: ctleweb/projtrack/report_generator.py
import os
from datetime import datetime
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist
from .models import User, Project, Client, Semester, Department, Type





class UserStats(object):
    def __init__(self, user):
        # try:
        #     self.user_object = User.objects.get(username=user)
        # except ObjectDoesNotExist:
        #     self.user_object = User.objects.get(pk=user)
        # except TypeError:
        self.user_object = user
        self.name = self.user_object.username
        self.projects_list = list(Project.objects.filter(users=self.user_object))
        self.projects_count = 0
        self.projects_hours = 0
        self.walk_in = 0

    def update_stats(self):
        self.projects_count = len(self.projects_list)
        for x in self.projects_list:
            self.projects_hours += x.hours
            if x.walk_in:
                self.walk_in += 1


class Report(object):
    def __init__(self, request):
        self.date = datetime.today().strftime("%m/%d/%Y")
        try:

            self.semester = Semester.objects.get(pk=int(request['semester']))