A little quick code cleanup.
This commit is contained in:
parent
055824b778
commit
ff024459ce
|
@ -47,6 +47,20 @@ class SpecReferenceCache(SpiffworkflowBaseDBModel):
|
|||
is_executable = db.Column(db.Boolean()) # either 'process' or 'decision'
|
||||
is_primary = db.Column(db.Boolean())
|
||||
|
||||
@classmethod
|
||||
def from_spec_reference(cls, ref):
|
||||
return cls(
|
||||
identifier=ref.identifier,
|
||||
display_name=ref.display_name,
|
||||
process_model_id=ref.process_model_id,
|
||||
type=ref.type,
|
||||
file_name=ref.file_name,
|
||||
has_lanes=ref.has_lanes,
|
||||
is_executable=ref.is_executable,
|
||||
is_primary=ref.is_primary,
|
||||
relative_path=ref.relative_path,)
|
||||
|
||||
|
||||
class SpecReferenceSchema(Schema):
|
||||
"""FileSchema."""
|
||||
|
||||
|
|
|
@ -234,17 +234,7 @@ class SpecFileService(FileSystemService):
|
|||
def update_process_cache(ref: SpecReference) -> None:
|
||||
process_id_lookup = SpecReferenceCache.query.filter_by(identifier=ref.identifier).first()
|
||||
if process_id_lookup is None:
|
||||
process_id_lookup = SpecReferenceCache(
|
||||
identifier=ref.identifier,
|
||||
display_name=ref.display_name,
|
||||
process_model_id=ref.process_model_id,
|
||||
type=ref.type,
|
||||
file_name=ref.file_name,
|
||||
has_lanes=ref.has_lanes,
|
||||
is_executable=ref.is_executable,
|
||||
is_primary=ref.is_primary,
|
||||
relative_path=ref.relative_path,
|
||||
)
|
||||
process_id_lookup = SpecReferenceCache.from_spec_reference(ref)
|
||||
db.session.add(process_id_lookup)
|
||||
else:
|
||||
if ref.relative_path != process_id_lookup.relative_path:
|
||||
|
|
Loading…
Reference in New Issue