Skip to content

Commit

Permalink
replaced datetime w/ timezone + renamed Gherkin > Normative
Browse files Browse the repository at this point in the history
  • Loading branch information
rw-bsi committed Jan 17, 2024
1 parent f61a92f commit d09fb3a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion migrations/0002_ifcauthoringtool_ifcmodel_and_more.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name='ifcvalidationtask',
name='type',
field=models.CharField(choices=[('SYNTAX', 'STEP Physical File Syntax'), ('SCHEMA', 'Schema (Express language)'), ('MVD', 'Model View Definitions'), ('BSDD', 'Requirements per bSDD Classification'), ('INFO', 'Parse Info'), ('PREREQ', 'Prerequisites'), ('NORMATIVE_IA', 'Normative Rules - Implementer Agreements (IA)'), ('NORMATIVE_IP', 'Gherkin Rules - Informal Propositions (IP)'), ('INDUSTRY', 'Industry Practices (TBC)')], db_index=True, help_text='Type of the Validation Task.', max_length=25),
field=models.CharField(choices=[('SYNTAX', 'STEP Physical File Syntax'), ('SCHEMA', 'Schema (Express language)'), ('MVD', 'Model View Definitions'), ('BSDD', 'Requirements per bSDD Classification'), ('INFO', 'Parse Info'), ('PREREQ', 'Prerequisites'), ('NORMATIVE_IA', 'Normative Rules - Implementer Agreements (IA)'), ('NORMATIVE_IP', 'Normative Rules - Informal Propositions (IP)'), ('INDUSTRY', 'Industry Practices (TBC)')], db_index=True, help_text='Type of the Validation Task.', max_length=25),
),
migrations.CreateModel(
name='IfcModelInstance',
Expand Down
18 changes: 9 additions & 9 deletions models.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import threading
import datetime

from django.db import models
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.utils import timezone
from deprecated import deprecated

local = threading.local()
Expand Down Expand Up @@ -102,7 +102,7 @@ def save(self, *args, **kwargs):
self.created_by = user
else:
self.updated_by = user
self.updated = datetime.datetime.now()
self.updated = timezone.now()

super().save(*args, **kwargs)

Expand Down Expand Up @@ -512,23 +512,23 @@ def has_final_status(self):
def mark_as_initiated(self):

self.status = self.Status.INITIATED
self.started = datetime.datetime.now()
self.started = timezone.now()
self.progress = 0
self.save()

def mark_as_completed(self, reason):

self.status = self.Status.COMPLETED
self.status_reason = reason
self.completed = datetime.datetime.now()
self.completed = timezone.now()
self.progress = 100
self.save()

def mark_as_failed(self, reason):

self.status = self.Status.FAILED
self.status_reason = reason
self.completed = datetime.datetime.now()
self.completed = timezone.now()
self.save()


Expand All @@ -548,7 +548,7 @@ class Type(models.TextChoices):
PARSE_INFO = 'INFO', 'Parse Info'
PREREQUISITES = 'PREREQ', 'Prerequisites'
NORMATIVE_IA = 'NORMATIVE_IA', 'Normative Rules - Implementer Agreements (IA)'
NORMATIVE_IP = 'NORMATIVE_IP', 'Gherkin Rules - Informal Propositions (IP)'
NORMATIVE_IP = 'NORMATIVE_IP', 'Normative Rules - Informal Propositions (IP)'
INDUSTRY_PRACTICES = 'INDUSTRY', 'Industry Practices (TBC)'

class Status(models.TextChoices):
Expand Down Expand Up @@ -656,23 +656,23 @@ def duration(self):
def mark_as_initiated(self):

self.status = self.Status.INITIATED
self.started = datetime.datetime.now()
self.started = timezone.now()
self.progress = 0
self.save()

def mark_as_completed(self, reason):

self.status = self.Status.COMPLETED
self.status_reason = reason
self.ended = datetime.datetime.now()
self.ended = timezone.now()
self.progress = 100
self.save()

def mark_as_failed(self, reason):

self.status = self.Status.FAILED
self.status_reason = reason
self.ended = datetime.datetime.now()
self.ended = timezone.now()
self.save()

def mark_as_skipped(self, reason):
Expand Down

0 comments on commit d09fb3a

Please sign in to comment.