Skip to content

Commit

Permalink
code cleanup
Browse files Browse the repository at this point in the history
fixed when $35 agent fee was applied to Concept's premium;
removed ambiguous date terms from string prior to parsing using datefinder;
cleaned up some duplicate html code in the email module to reduce redundancy and improve clarity.
  • Loading branch information
Samlant committed Jan 22, 2024
1 parent d0f7324 commit 2e4ea93
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 16 deletions.
6 changes: 3 additions & 3 deletions app/model/email/email.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ class EmailHandler:
username: Optional[str] = None
img_sig_url: Optional[str] = None
attachments_list: Optional[list] = None
greeting_style: str = "font-size=14px;color:#1F3864;"
body_style: str = "font-size=14px;color:#1F3864;"
greeting_style: str = "font-size:14px;color:#1F3864;"
body_style: str = "font-size:14px;color:#1F3864;"
salutation_style: str = (
"margin:0in;font-size:14px;font-family:Calibri,sans-serif;color:#1F3864;"
)
username_style: str = (
"margin:0in;font-size=14px;font-family:Calibri,sans-serif;color:#1F3864;"
"margin:0in;font-size:14px;font-family:Calibri,sans-serif;color:#1F3864;"
)

def view_letter(self) -> bool:
Expand Down
44 changes: 32 additions & 12 deletions app/model/email/html.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,19 +69,39 @@ def make_signature(sig_img: str, signature_settings: dict[str, str]) -> str:
office_street = signature_settings["office_street"]
office_city_st_zip = signature_settings["office_city_st_zip"]
signature = f"""
<p style='margin:0in;font-size:12px;font-family:Georgia Pro,serif;color:#1F3864;'>NOVAMAR INSURANCE GROUP</p>
<p style='margin:0in;font-size:12px;font-family:Georgia Pro,serif;color:#1F3864;'>
NOVAMAR INSURANCE GROUP
<br>
<img src='{logo_img}'>
<p style='margin:0in;font-size:12px;font-family:Georgia Pro,serif;color:#1F3864;'>Main:(800)-823-2798</p>
<p style='margin:0in;font-size:12px;font-family:Georgia Pro,serif;color:#1F3864;'>Office :{office_phone}</p>
<p style='margin:0in;font-size:12px;font-family:Georgia Pro,serif;color:#1F3864;'>Fax:(941)-328-3598</p><br>
<p style='margin:0in;color:#0563C1;text-decoration:underline;text-underline:single;font-size:12px;font-family:Georgia Pro,serif;'>{office_street}</p>
<p style='margin:0in;color:#0563C1;text-decoration:underline;text-underline:single;font-size:12px;font-family:Georgia Pro,serif;'>{office_city_st_zip}</p><br>
<p style='margin:0in;color:#1F3864;font-size:10.0pt;font-family:Georgia Pro,serif;color:blue;'><a href='http://www.novamarinsurance.com/' target='_blank'>www.novamarinsurance.com</a></p>
<p style='margin:0in;color:#1F3864;font-size:10.0pt;font-family:Georgia Pro,serif;color:blue;'><a href='http://www.novamarinsurance.com.mx/' target='_blank'>www.novamarinsurance.com.mx</a></p>
<p style='margin:0in;'><a href='https://www.facebook.com/NovamarInsurance' target='_blank'><img width=24 height=24 src='https://cdn1.iconfinder.com/data/icons/social-media-2285/512/Colored_Facebook3_svg-512.png'></a> <a href='https://www.instagram.com/novamar_insurance/' target='_blank'><img width=24 height=24 src='https://cdn2.iconfinder.com/data/icons/social-media-2285/512/1_Instagram_colored_svg_1-512.png' style='display:block'></a> <a href='https://twitter.com/NovamarIns' target='_blank'><img width=24 height=24 src='https://cdn2.iconfinder.com/data/icons/social-media-2285/512/1_Twitter3_colored_svg-512.png' style='display:block'></a> <a href='https://www.linkedin.com/company/novamar-insurance-group-inc' target='_blank'><img width=24 height=24 src='https://cdn2.iconfinder.com/data/icons/social-media-2285/512/1_Linkedin_unofficial_colored_svg-512.png' style='display:block'></a></p>
<p style='margin:0in;font-size:12px;font-family:Georgia Pro,serif;color:#1F3864;'>Established in 1987 with offices in: Seattle | Newport Beach | San Diego | Sarasota | Jacksonville | Puerto Vallarta | Cancun | San Miguel de Allende</p>
<p style='margin:0in;font-size:12px;font-family:Georgia Pro,serif;color:#1F3864;'>Please be advised that coverage is not bound, renewed, amended or in force unless confirmed in writing by a Novamar Insurance Group agent or by the represented company.</p>
<br>
Main:(800)-823-2798
<br>
Office :{office_phone}
</p>
Fax:(941)-328-3598
<br>
{office_street}
<br>
{office_city_st_zip}
<br>
<a href='http://www.novamarinsurance.com/' target='_blank'>www.novamarinsurance.com</a>
<br>
<a href='http://www.novamarinsurance.com.mx/' target='_blank'>www.novamarinsurance.com.mx</a>
</p>
<br>
<p style='margin:0in;'>
<a href='https://www.facebook.com/NovamarInsurance' target='_blank'><img width=24 height=24 src='https://cdn1.iconfinder.com/data/icons/social-media-2285/512/Colored_Facebook3_svg-512.png'></a>
<a href='https://www.instagram.com/novamar_insurance/' target='_blank'><img width=24 height=24 src='https://cdn2.iconfinder.com/data/icons/social-media-2285/512/1_Instagram_colored_svg_1-512.png'></a>
<a href='https://twitter.com/NovamarIns' target='_blank'><img width=24 height=24 src='https://cdn2.iconfinder.com/data/icons/social-media-2285/512/1_Twitter3_colored_svg-512.png'></a>
<a href='https://www.linkedin.com/company/novamar-insurance-group-inc' target='_blank'><img width=24 height=24 src='https://cdn2.iconfinder.com/data/icons/social-media-2285/512/1_Linkedin_unofficial_colored_svg-512.png'></a>
</p>
<br>
<p style='margin:0in;font-size:12px;font-family:Georgia Pro,serif;color:#1F3864;'>
Established in 1987 with offices in: Seattle | Newport Beach | San Diego | Sarasota | Jacksonville | Puerto Vallarta | Cancun | San Miguel de Allende
<br>
Please be advised that coverage is not bound, renewed, amended or in force unless confirmed in writing by a Novamar Insurance Group agent or by the represented company.
</p>
"""
if sig_img != "":
signature = f"<img src='{sig_img}'>" + signature
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ def get_eff_date(self) -> datetime:
if "with effect from" in block:
break
x = self.pages[0][i]
x = x.replace("00.01", "")
dates = datefinder.find_dates(x)
y = []
for date in dates:
Expand Down Expand Up @@ -151,6 +152,7 @@ def get_premiums(self) -> bool:
x = self.pages[0][i].partition("US$")[2].partition("cancelling")[0]
premium = x.strip().replace(",", "")
premium = float(premium)
premium += 35
elif (
self.user_doc_type == "cancel"
or self.user_doc_type == "rp"
Expand All @@ -163,7 +165,6 @@ def get_premiums(self) -> bool:
premium = float(premium)
else:
raise ValueError
premium += 35
self.premiums.append(premium)
return True

Expand Down

0 comments on commit 2e4ea93

Please sign in to comment.