Skip to content
This repository has been archived by the owner on Nov 14, 2021. It is now read-only.

Commit

Permalink
Merge pull request #121 from the-scouts/ce-check
Browse files Browse the repository at this point in the history
  • Loading branch information
AA-Turner authored Sep 24, 2021
2 parents 6f60078 + 34b26e3 commit 81e09f5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
9 changes: 6 additions & 3 deletions compass/core/_scrapers/role_detail.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ def get_roles_detail(client: Client, role_number: int, /) -> ci.MemberRolePopup:
'role_status': '...',
'line_manager_number': ...,
'line_manager': '...',
'ce_check': datetime.datetime(...),
'ce_check_valid': bool,
'ce_check_date': datetime.datetime(...),
'disclosure_check': '...',
'references': '...',
'appointment_panel_approval': '...',
Expand All @@ -104,7 +105,8 @@ def get_roles_detail(client: Client, role_number: int, /) -> ci.MemberRolePopup:
fields: dict[str, str] = {k: v.value for k, v in inputs.items() if v.value is not None}

line_manager_number, line_manager_name = _extract_line_manager(inputs["ctl00$workarea$cbo_p2_linemaneger"])
ce_check = fields.get("ctl00$workarea$txt_p2_cecheck", "") # CE (Confidential Enquiry) Check
ce_check_raw = fields.get("ctl00$workarea$txt_p2_cecheck", "") # CE (Confidential Enquiry) Check
ce_check_date = parse_date(ce_check_raw) if ce_check_raw != "Pending" else None
disclosure_check, disclosure_date = _extract_disclosure_date(fields.get("ctl00$workarea$txt_p2_disclosure", ""))

approval_values = {row[1][0].get("data-app_code"): row[1][0].get("data-db") for row in tree.xpath("//tr[@class='trProp']")}
Expand All @@ -125,7 +127,8 @@ def get_roles_detail(client: Client, role_number: int, /) -> ci.MemberRolePopup:
line_manager_number=line_manager_number,
line_manager=line_manager_name,
review_date=parse_date(fields.get("ctl00$workarea$txt_p2_review", "")),
ce_check=parse_date(ce_check) if ce_check != "Pending" else None, # TODO if CE check date != current date then is valid
ce_check_valid=ce_check_date < datetime.date.today() if ce_check_date else False,
ce_check_date=ce_check_date,
disclosure_check=disclosure_check,
disclosure_date=disclosure_date,
references=references_codes.get(fields.get("ctl00$workarea$cbo_p2_referee_status", "")),
Expand Down
3 changes: 2 additions & 1 deletion compass/core/schemas/member.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ class MemberRoleDetail(MemberBase, MemberRoleBase):
line_manager: Optional[str] = None

# Approval information
ce_check: Optional[datetime.date] # Optional for Closed roles - e.g. #499, role closed 1976, or if Pending
ce_check_valid: bool
ce_check_date: Optional[datetime.date] # Optional for Closed roles - e.g. #499, role closed 1976, or if Pending
disclosure_check: Optional[TYPES_DISCLOSURES_APPOINTMENT]
disclosure_date: Optional[datetime.date]
references: Optional[TYPES_REFERENCES] = None
Expand Down

0 comments on commit 81e09f5

Please sign in to comment.