File size: 2,380 Bytes
97f32ec
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
from django.db import models
import uuid
from admin_app.models import PaperWork

class Review(models.Model):
    STATUS_CHOICES = (
        ('ASSIGNED', 'Assigned'),
        ('SUBMITTED', 'Submitted'),
        ('CHANGES_REQUESTED', 'Changes Requested'),
        ('APPROVED', 'Approved'),
    )
    
    id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
    paperwork = models.ForeignKey(PaperWork, on_delete=models.CASCADE, related_name='reviews')
    status = models.CharField(max_length=20, choices=STATUS_CHOICES, default='ASSIGNED')
    comments = models.TextField(blank=True, null=True)
    created_at = models.DateTimeField(auto_now_add=True)
    updated_at = models.DateTimeField(auto_now=True)
    
    class Meta:
        verbose_name = 'Review'
        verbose_name_plural = 'Reviews'
        ordering = ['-created_at']

class Version(models.Model):
    id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
    paperwork = models.ForeignKey(PaperWork, on_delete=models.CASCADE, related_name='versions')
    version_no = models.PositiveIntegerField()
    submitted_at = models.DateTimeField(auto_now_add=True)
    pdf_path = models.CharField(max_length=255, blank=True, null=True)
    latex_path = models.CharField(max_length=255, blank=True, null=True)
    python_path = models.CharField(max_length=255, blank=True, null=True)
    docx_path = models.CharField(max_length=255, blank=True, null=True)
    ai_percent_self = models.FloatField(default=0.0)
    ai_percent_verified = models.FloatField(default=0.0, null=True, blank=True)
    
    class Meta:
        verbose_name = 'Version'
        verbose_name_plural = 'Versions'
        ordering = ['-version_no']

class Notification(models.Model):
    EVENT_CHOICES = (
        ('WORK_ASSIGNED', 'Work Assigned'),
        ('SUBMITTED', 'Submitted'),
        ('CHANGES_REQUESTED', 'Changes Requested'),
        ('APPROVED', 'Approved'),
    )
    
    id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
    event = models.CharField(max_length=20, choices=EVENT_CHOICES)
    paper = models.ForeignKey(PaperWork, on_delete=models.CASCADE, related_name='notifications')
    at = models.DateTimeField(auto_now_add=True)
    
    class Meta:
        verbose_name = 'Notification'
        verbose_name_plural = 'Notifications'
        ordering = ['-at']