init
This commit is contained in:
41
analytics/models.py
Normal file
41
analytics/models.py
Normal file
@ -0,0 +1,41 @@
|
||||
from django.db import models
|
||||
from django.contrib.auth.models import User
|
||||
from course.models import Course
|
||||
from schedule.models import Lesson
|
||||
from instructor.models import Instructor
|
||||
from student.models import Student
|
||||
|
||||
class CourseAnalytics(models.Model):
|
||||
course = models.ForeignKey(Course, on_delete=models.CASCADE)
|
||||
total_students = models.IntegerField(default=0)
|
||||
average_progress = models.DecimalField(max_digits=5, decimal_places=2, default=0)
|
||||
completion_rate = models.DecimalField(max_digits=5, decimal_places=2, default=0)
|
||||
revenue = models.DecimalField(max_digits=10, decimal_places=2, default=0)
|
||||
created_at = models.DateTimeField(auto_now_add=True)
|
||||
updated_at = models.DateTimeField(auto_now=True)
|
||||
|
||||
def __str__(self):
|
||||
return f"Аналитика курса {self.course.title}"
|
||||
|
||||
class InstructorAnalytics(models.Model):
|
||||
instructor = models.ForeignKey(Instructor, on_delete=models.CASCADE)
|
||||
total_lessons = models.IntegerField(default=0)
|
||||
total_students = models.IntegerField(default=0)
|
||||
average_rating = models.DecimalField(max_digits=3, decimal_places=2, default=5.00)
|
||||
completion_rate = models.DecimalField(max_digits=5, decimal_places=2, default=0)
|
||||
created_at = models.DateTimeField(auto_now_add=True)
|
||||
updated_at = models.DateTimeField(auto_now=True)
|
||||
|
||||
def __str__(self):
|
||||
return f"Аналитика инструктора {self.instructor}"
|
||||
|
||||
class StudentAnalytics(models.Model):
|
||||
student = models.ForeignKey(Student, on_delete=models.CASCADE)
|
||||
total_lessons = models.IntegerField(default=0)
|
||||
attendance_rate = models.DecimalField(max_digits=5, decimal_places=2, default=0)
|
||||
average_grade = models.DecimalField(max_digits=3, decimal_places=2, default=0)
|
||||
created_at = models.DateTimeField(auto_now_add=True)
|
||||
updated_at = models.DateTimeField(auto_now=True)
|
||||
|
||||
def __str__(self):
|
||||
return f"Аналитика студента {self.student}"
|
Reference in New Issue
Block a user