Skip to content

Commit

Permalink
feat(apply): multiple CVs
Browse files Browse the repository at this point in the history
  • Loading branch information
proffapt committed Dec 5, 2024
1 parent 3c6e1ef commit b6dd82f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
4 changes: 2 additions & 2 deletions mftp/company.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def fetch(session, headers, ssoToken):
company_additional_details = f"https://erp.iitkgp.ac.in/TrainingPlacementSSO/AdmFilePDF.htm?type=COM&year={year}&com_id={com_id}"
ppt = f"https://erp.iitkgp.ac.in/TrainingPlacementSSO/AdmFilePDF.htm?type=PPT&year={year}&com_id={com_id}"
jd = f"https://erp.iitkgp.ac.in/TrainingPlacementSSO/TPJNFView.jsp?jnf_id={jnf_id}&com_id={com_id}&yop={year}&user_type=SU&rollno={ROLL_NUMBER}"
apply_link = f"https://erp.iitkgp.ac.in/TrainingPlacementSSO/TPJNFViewAction.jsp?jnf_id={jnf_id}&com_id={com_id}&year={year}&rollno={ROLL_NUMBER}&mode=ApplyCV1"
apply_link_cv = f"https://erp.iitkgp.ac.in/TrainingPlacementSSO/TPJNFViewAction.jsp?jnf_id={jnf_id}&com_id={com_id}&year={year}&rollno={ROLL_NUMBER}&mode=ApplyCV"
additional_jd = f"https://erp.iitkgp.ac.in/TrainingPlacementSSO/JnfMoreDet.jsp?mode=jnfMoreDet&rollno={ROLL_NUMBER}&year={year}&com_id={com_id}&jnf_id={jnf_id}"
form_additional_details = f"https://erp.iitkgp.ac.in/TrainingPlacementSSO/AdmFilePDF.htm?type=JNF&year={year}&jnf_id={jnf_id}&com_id={com_id}"

Expand All @@ -73,7 +73,7 @@ def fetch(session, headers, ssoToken):
"PPT": ppt,
"Role": row.find("cell[4]").text.split("'")[1].strip(),
"Job_Description": jd,
"Apply_Link": apply_link,
"Apply_Link_CV": apply_link_cv,
"Additional_Job_Description": additional_jd,
"CTC": get_ctc_with_currency(session, headers, additional_jd),
"Form_Additional_Details": form_additional_details,
Expand Down
13 changes: 8 additions & 5 deletions mftp/mail.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from email.mime.text import MIMEText
from email.mime.base import MIMEBase
from email.mime.multipart import MIMEMultipart
from env import FROM_EMAIL, FROM_EMAIL_PASS, BCC_EMAIL_S, HOSTER_EMAIL, HOSTER_INTERESTED_ROLLS, ROLL_MAIL, ROLL_NAME
from env import FROM_EMAIL, FROM_EMAIL_PASS, BCC_EMAIL_S, HOSTER_EMAIL, HOSTER_INTERESTED_ROLLS, HOSTER_NAME, ROLL_MAIL, ROLL_NAME


def send_shortlists(mails, gmail_api, smtp):
Expand Down Expand Up @@ -193,11 +193,11 @@ def send_companies(mail, gmail_api, smtp):
logging.error(f" Failed to Send Mail : {mail['Subject']} ~ {str(e)}")


def format_companies(ssoToken, companies, subject):
def format_companies(ssoToken, companies):
print('[FORMATTING COMPANY UPDATES]', flush=True)

message = MIMEMultipart()
message["Subject"] = subject
message["Subject"] = f"{HOSTER_NAME} Apply Now! New companies opened"
message["From"] = f'MFTP < {FROM_EMAIL} >'
message["Bcc"] = ", ".join(HOSTER_EMAIL)

Expand All @@ -208,7 +208,10 @@ def generate_row(company):
<a href="{company['Company_Additional_Details']}&ssoToken={ssoToken}" target="_blank">{company['Name']}</a>
</td>
<td style="border: 1px solid #ddd; padding: 8px;">
<a href="{company['Apply_Link']}&ssoToken={ssoToken}" target="_blank">{company['Role']}</a>
{company['Role']}
(<a href="{company['Apply_Link_CV']}1&ssoToken={ssoToken}" target="_blank">CV1</a>,
<a href="{company['Apply_Link_CV']}2&ssoToken={ssoToken}" target="_blank">CV2</a>,
<a href="{company['Apply_Link_CV']}3&ssoToken={ssoToken}" target="_blank">CV3</a>)
</td>
<td style="border: 1px solid #ddd; padding: 8px;">
<a href="{company['Additional_Job_Description']}&ssoToken={ssoToken}" target="_blank">{company.get('CTC', 'N/A')}</a>
Expand All @@ -232,7 +235,7 @@ def generate_row(company):
<thead>
<tr style="background-color: #f2f2f2;">
<th style="border: 1px solid #ddd; padding: 8px; text-align: left;">Company</th>
<th style="border: 1px solid #ddd; padding: 8px; text-align: left;">Role</th>
<th style="border: 1px solid #ddd; padding: 8px; text-align: left;">Role (Apply)</th>
<th style="border: 1px solid #ddd; padding: 8px; text-align: left;">CTC</th>
<th style="border: 1px solid #ddd; padding: 8px; text-align: left;">End Date</th>
<th style="border: 1px solid #ddd; padding: 8px; text-align: left;">Interview Date</th>
Expand Down
3 changes: 1 addition & 2 deletions mftp/mftp.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,8 @@
filtered = company.filter(new + modified, "OPEN_N")
if filtered:
latest_ssoToken = session.cookies.get("ssoToken")
mail_subject = "APPLY NOW! New companies opened"
companies_mail = mail.format_companies(
latest_ssoToken, filtered, mail_subject
latest_ssoToken, filtered
)
mail.send_companies(companies_mail, args.gmail_api, args.smtp)
else:
Expand Down

0 comments on commit b6dd82f

Please sign in to comment.