Skip to content

Commit

Permalink
Add special history component for epd and work lead
Browse files Browse the repository at this point in the history
  • Loading branch information
jadmsaadaot committed Dec 21, 2023
1 parent 5e6fcad commit 5f897e9
Show file tree
Hide file tree
Showing 8 changed files with 659 additions and 471 deletions.
15 changes: 15 additions & 0 deletions epictrack-api/src/api/services/work.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
from typing import Dict, List, Optional

import pandas as pd
from api.models.special_field import EntityEnum
from api.services.special_field import SpecialFieldService
from flask import current_app
from sqlalchemy import tuple_
from sqlalchemy.orm import aliased
Expand Down Expand Up @@ -243,6 +245,19 @@ def create_work(cls, payload, commit: bool = True):
if commit:
db.session.commit()
return work

@classmethod
def create_special_fields(cls, work: Work):
"""Create work special fields"""
work.flush()
work_epd_special_field_data = {
"entity": EntityEnum.WORK,
"entity_id": work.id,
"field_name": "responsible_epd_id",
"field_value": work.responsible_epd_id,
"active_from": work.created_at
}
SpecialFieldService.create_special_field_entry(work_epd_special_field_data)

@classmethod
def find_staff(cls, work_id: int, is_active) -> [Staff]:
Expand Down
Loading

0 comments on commit 5f897e9

Please sign in to comment.