Audit Changes regarding audit_true field in scriptaudit models

This commit is contained in:
Ubuntu 2024-06-19 08:45:18 +00:00
parent 71b25755c8
commit 353fd2ae83
2 changed files with 64 additions and 63 deletions

View File

@ -161,6 +161,7 @@ def run_audit(msg):
id = script_id
))
print("STATUS AUDIT",status)
status.only_audit = True
# Blockchain
# if UserCredentialsForBlockchain.objects.filter(user=request.user).exists():
blockchain_obj = UserCredentialsForBlockchain.objects.get(user=user)

View File

@ -1,63 +1,63 @@
import uuid
from django.db import models
from centralisedFileSystem.models import Script
class States:
"""
All the possible states of the audit.
"""
PENDING = "PENDING"
STARTED = "STARTED"
SUCCESS = "SUCCESS"
FAILURE = "FAILURE"
RETRY = "RETRY"
REVOKED = "REVOKED"
# class AuditStatus(models.Model):
# STATUS = (
# ("N", "notstarted"),
# ("R", "running"),
# ("S", "success"),
# ("F", "failed"),
# )
# id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
# script = models.ForeignKey(
# Script, on_delete=models.CASCADE, related_name="audit_scripts_files"
# )
# script_audit_status = models.CharField(choices=STATUS, default="N", max_length=20)
class ScriptAuditModel(models.Model):
_STATES = tuple(((v, v) for k, v in States.__dict__.items() if k[:2] != "__"))
"""
PENDING (waiting for execution or unknown task id)
STARTED (task has been started)
SUCCESS (task executed successfully)
FAILURE (task execution resulted in exception)
RETRY (task is being retried)
REVOKED (task has been revoked)
"""
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
script = models.OneToOneField(
Script, on_delete=models.CASCADE, blank=False, null=False, related_name="script_audit"
)
celery_id = models.CharField(max_length=50, blank=False, null=True, editable=False)
last_call = models.DateTimeField(auto_now=True)
pre_audit_run = models.BooleanField(default=False)
status = models.CharField(max_length=10, blank=True, null=True, choices=_STATES)
results = models.CharField(max_length=200, blank=True, null=True)
retries = models.IntegerField(default=0)
expected_duration = models.CharField(max_length=30, blank=True, null=True)
number_of_pages = models.IntegerField(blank=True, null=True)
screenplay_language = models.CharField(max_length=50, blank=False, null=True)
dialogue_language = models.CharField(max_length=50, blank=False, null=True)
transaction_hash = models.CharField(max_length=200, blank=False, null=True)
bchain_privatekey = models.CharField(max_length=200, blank=False, null=True)
isfdx = models.BooleanField(default=False)
import uuid
from django.db import models
from centralisedFileSystem.models import Script
class States:
"""
All the possible states of the audit.
"""
PENDING = "PENDING"
STARTED = "STARTED"
SUCCESS = "SUCCESS"
FAILURE = "FAILURE"
RETRY = "RETRY"
REVOKED = "REVOKED"
# class AuditStatus(models.Model):
# STATUS = (
# ("N", "notstarted"),
# ("R", "running"),
# ("S", "success"),
# ("F", "failed"),
# )
# id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
# script = models.ForeignKey(
# Script, on_delete=models.CASCADE, related_name="audit_scripts_files"
# )
# script_audit_status = models.CharField(choices=STATUS, default="N", max_length=20)
class ScriptAuditModel(models.Model):
_STATES = tuple(((v, v) for k, v in States.__dict__.items() if k[:2] != "__"))
"""
PENDING (waiting for execution or unknown task id)
STARTED (task has been started)
SUCCESS (task executed successfully)
FAILURE (task execution resulted in exception)
RETRY (task is being retried)
REVOKED (task has been revoked)
"""
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
script = models.OneToOneField(
Script, on_delete=models.CASCADE, blank=False, null=False, related_name="script_audit"
)
celery_id = models.CharField(max_length=50, blank=False, null=True, editable=False)
last_call = models.DateTimeField(auto_now=True)
pre_audit_run = models.BooleanField(default=False)
status = models.CharField(max_length=10, blank=True, null=True, choices=_STATES)
results = models.CharField(max_length=200, blank=True, null=True)
retries = models.IntegerField(default=0)
expected_duration = models.CharField(max_length=30, blank=True, null=True)
number_of_pages = models.IntegerField(blank=True, null=True)
screenplay_language = models.CharField(max_length=50, blank=False, null=True)
dialogue_language = models.CharField(max_length=50, blank=False, null=True)
transaction_hash = models.CharField(max_length=200, blank=False, null=True)
bchain_privatekey = models.CharField(max_length=200, blank=False, null=True)
only_audit = models.BooleanField(null=True, blank=True)