File tree Expand file tree Collapse file tree 1 file changed +19
-3
lines changed
Expand file tree Collapse file tree 1 file changed +19
-3
lines changed Original file line number Diff line number Diff line change 1+ import re
12import os
23import asyncio
34import requests
5+ from datetime import datetime
46from bs4 import BeautifulSoup
57from shared .database_service import get_collection , save_to_database , check_database
68from shared .telegram_service import send_text_message
@@ -122,16 +124,30 @@ def get_highlight(rate_str):
122124 # User Details:
123125 tableMeta = projectSoup .find ("table" , class_ = "table-meta" )
124126 tableTrs = tableMeta .find_all ("tr" )
125- signDate = tableTrs [0 ].find_all ("td" )[1 ].get_text (strip = True )
126- employmentRate = tableTrs [1 ].find_all ("td" )[1 ].get_text (strip = True )
127127
128+ # Employment rate condition
129+ employmentRate = tableTrs [1 ].find_all ("td" )[1 ].get_text (strip = True )
128130 if not employmentRate == "لم يحسب بعد" :
129131
130132 employmentRateValue = float (employmentRate .strip ("%" ))
131133
132134 if employmentRateValue < 50 :
133135 print (
134- f"Employment rate value less than 50% - skipping this project"
136+ f"\n ❗ Employment rate value less than 50% - skipping this project\n "
137+ )
138+ continue
139+
140+ # Sign date condition
141+ signDate = tableTrs [0 ].find_all ("td" )[1 ].get_text (strip = True )
142+ match = re .search (r"\d{4}" , signDate )
143+ if match :
144+ year_str = match .group ()
145+ year = int (year_str )
146+ current_year = datetime .now ().year
147+
148+ if year < current_year :
149+ print (
150+ "\n ❗ Employment equal not calculated yet but sign date is old - skipping this project\n "
135151 )
136152 continue
137153
You can’t perform that action at this time.
0 commit comments