From 353fd2ae83a697805d456f721135df3a30c6da38 Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Wed, 19 Jun 2024 08:45:18 +0000 Subject: [PATCH] Audit Changes regarding audit_true field in scriptaudit models --- .../management/commands/custom_runserver.py | 1 + kitchen_counter/scriptAudit/models.py | 126 +++++++++--------- 2 files changed, 64 insertions(+), 63 deletions(-) diff --git a/kitchen_counter/conversion/management/commands/custom_runserver.py b/kitchen_counter/conversion/management/commands/custom_runserver.py index 07e4176..4281afc 100755 --- a/kitchen_counter/conversion/management/commands/custom_runserver.py +++ b/kitchen_counter/conversion/management/commands/custom_runserver.py @@ -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) diff --git a/kitchen_counter/scriptAudit/models.py b/kitchen_counter/scriptAudit/models.py index 99c79cf..548ddae 100755 --- a/kitchen_counter/scriptAudit/models.py +++ b/kitchen_counter/scriptAudit/models.py @@ -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) \ No newline at end of file +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)