Coverage for backend/django/core/auxiliary/models/ProcessPath.py: 78%

18 statements  

« prev     ^ index     » next       coverage.py v7.10.7, created at 2026-07-22 05:22 +0000

1from django.db import models 

2 

3from flowsheetInternals.unitops.models import SimulationObject 

4from core.managers import AccessControlManager, AllFlowsheetStatesManager 

5class ProcessPath(models.Model): 

6 flowsheet_state = models.ForeignKey("FlowsheetState", on_delete=models.CASCADE, related_name="ProcessPaths") 

7 highlight = models.BooleanField(default=False, blank=True) 

8 pathwayObjects = models.ManyToManyField(SimulationObject, related_name="ProcessPath") 

9 

10 created_at = models.DateTimeField(auto_now_add=True) 

11 objects = AccessControlManager() 

12 all_states = AllFlowsheetStatesManager() 

13 

14 

15 

16 class Meta: 

17 ordering = ['created_at'] 

18 

19 

20 @classmethod 

21 def create(cls, flowsheet_state: "FlowsheetState", pathwayObjects: list[SimulationObject]) -> "ProcessPath": 

22 processPath = ProcessPath(flowsheet_state=flowsheet_state) 

23 processPath.save() 

24 processPath.pathwayObjects.set(pathwayObjects) 

25 

26 return processPath