summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRosyid Haryadi <rosyid_haryadi@protonmail.com>2024-07-27 12:39:47 +0700
committerRosyid Haryadi <rosyid_haryadi@protonmail.com>2024-07-27 12:39:47 +0700
commitc3820780c1a13a882c8bdc3255ec64338ec17051 (patch)
tree55a5d9a3b4bb41fdefd0ebe87e0a89c6dbcff938
parente9e934c38b4c5cf7697bd97682704e380ab5a327 (diff)
upd main
-rw-r--r--csvReader.py8
-rw-r--r--main.py17
2 files changed, 19 insertions, 6 deletions
diff --git a/csvReader.py b/csvReader.py
index 29fc347..5163ffd 100644
--- a/csvReader.py
+++ b/csvReader.py
@@ -18,7 +18,7 @@ def getCurrentMonth():
def readCSV(filename=os.getenv('DOWNLOAD_PATH') + os.getenv('FILENAME')):
- myPercentage = None
+ myScore = None
currentMonth = getCurrentMonth()
try:
with open(filename, mode='r', newline='') as csvfile:
@@ -26,13 +26,13 @@ def readCSV(filename=os.getenv('DOWNLOAD_PATH') + os.getenv('FILENAME')):
for row in reader:
# noinspection PyTypeChecker
if row['name'] == 'Rosyid Haryadi':
- myPercentage = row[currentMonth]
- logger.info(f'GOT RESULT FOR {currentMonth} = {myPercentage}')
+ myScore = row[currentMonth]
+ logger.info(f'GOT RESULT FOR {currentMonth} = {myScore}')
os.remove(filename)
except FileNotFoundError:
logger.error(f'File "{filename}" not found')
finally:
- return myPercentage
+ return myScore
if __name__ == '__main__':
diff --git a/main.py b/main.py
index 7f249ae..5ff4015 100644
--- a/main.py
+++ b/main.py
@@ -1,5 +1,18 @@
from downloader import downloadCsv
from csvReader import readCSV
+from bot import Bot
-downloadCsv()
-thisMonthPercentage = readCSV() \ No newline at end of file
+
+def main():
+ downloadCsv()
+ myScore = readCSV()
+ try:
+ myScore = 100 * float(myScore)
+ except ValueError:
+ myScore = 0
+ bot = Bot()
+ bot.send_message(f'Score leantime ente bulan ini {myScore}%')
+
+
+if __name__ == '__main__':
+ main()