summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.env.template2
-rw-r--r--csvReader.py8
2 files changed, 6 insertions, 4 deletions
diff --git a/.env.template b/.env.template
index 06cab91..6064de5 100644
--- a/.env.template
+++ b/.env.template
@@ -3,7 +3,7 @@ DOWNLOAD_PATH=
FILENAME="Akhdani Task Management Report_Dashboard_Tabel.csv"
LOGFILE='watcher.log'
REPORT_AREA_SELECTOR_TYPE="css selector"
-REPORT_AREA=
+REPORT_AREA="div.table"
EXPORT_BUTTON_SELECTOR_TYPE="xpath"
EXPORT_BUTTON='//*[@id="mat-menu-panel-0"]/div/span[3]/button'
DOWNLOAD_BUTTON_SELECTOR_TYPE="xpath"
diff --git a/csvReader.py b/csvReader.py
index 7644bf5..29fc347 100644
--- a/csvReader.py
+++ b/csvReader.py
@@ -10,10 +10,11 @@ logger = setupLogger()
def getCurrentMonth():
# Terlalu males setup locale
MONTH = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'agu', 'sep', 'okt', 'nov', 'des']
- if datetime.now().day < 24:
- return MONTH[datetime.now().month - 1]
+ now = datetime.now()
+ if now.day < 24:
+ return MONTH[now.month - 1]
else:
- return MONTH[datetime.now().month] # ikutnya bulan depannya
+ return MONTH[now.month] # ikutnya bulan depannya
def readCSV(filename=os.getenv('DOWNLOAD_PATH') + os.getenv('FILENAME')):
@@ -27,6 +28,7 @@ def readCSV(filename=os.getenv('DOWNLOAD_PATH') + os.getenv('FILENAME')):
if row['name'] == 'Rosyid Haryadi':
myPercentage = row[currentMonth]
logger.info(f'GOT RESULT FOR {currentMonth} = {myPercentage}')
+ os.remove(filename)
except FileNotFoundError:
logger.error(f'File "{filename}" not found')
finally: