diff --git a/src/bot/whatsapp/screenshot.png b/src/bot/whatsapp/screenshot.png deleted file mode 100644 index 0627f9f..0000000 Binary files a/src/bot/whatsapp/screenshot.png and /dev/null differ diff --git a/src/bot/whatsapp/whatsapp_bot.py b/src/bot/whatsapp/whatsapp_bot.py index 022de03..835e64b 100644 --- a/src/bot/whatsapp/whatsapp_bot.py +++ b/src/bot/whatsapp/whatsapp_bot.py @@ -2,8 +2,6 @@ from selenium.webdriver.firefox.options import Options # Selenium from selenium import webdriver # Selenium from dotenv import load_dotenv from twilio.rest import Client -import time -import subprocess import os load_dotenv() @@ -14,6 +12,14 @@ PHONE_NUMBER_PERSONAL = os.getenv('PHONE_NUMBER_PERSONAL') client = Client(SID, AUTH_TOKEN) +options = Options() # Set options +options.add_argument("--headless") # Headless mode (so you don't see the browser) +options.add_argument('--disable-gpu') # Disable GPU +options.add_argument('window-size=1024x768') +driver = webdriver.Firefox(options=options) +driver.get('http://127.0.0.1:4999/orario') +driver.get_screenshot_as_file("screenshot.png") +driver.quit() message = client.messages \ .create( body="Test", diff --git a/src/events/school_time/update_time_school.py b/src/events/school_time/update_time_school.py index 1749be4..aa8b212 100644 --- a/src/events/school_time/update_time_school.py +++ b/src/events/school_time/update_time_school.py @@ -387,7 +387,7 @@ def update_time_school(): if gagaga == 9: gagaga = 0 else: #If school subject is not 0, add school subject in MongoDB - #remove_things_in_front = school_subject.split(' ', 1)[1] + remove_things_in_front = school_subject.split(' ', 1)[1] find_document_school_time_table = list(collection.find({}, {"Date": long_date})) find_document_archive_school_time_table = list(collection_archive.find({}, {"Date": long_date})) array_document_school_time_table = find_document_school_time_table[0]["_id"] @@ -396,14 +396,14 @@ def update_time_school(): collection.update_one( { "_id": ObjectId(array_document_school_time_table)}, { "$set": { - "School Subject." + array_test[0] + "." + str(gagaga) + ".Subject": school_subject, + "School Subject." + array_test[0] + "." + str(gagaga) + ".Subject": remove_things_in_front, } } ) collection_archive.update_one( { "_id": ObjectId(array_document_archive_school_time_table)}, { "$set": { - "School Subject." + array_test[0] + "." + str(gagaga) + ".Subject": school_subject, + "School Subject." + array_test[0] + "." + str(gagaga) + ".Subject": remove_things_in_front, } } ) @@ -421,6 +421,7 @@ def update_time_school(): array_test.append(convert_date_to_day) number_day += 1 if school_subject == 0: #If school subject is 0, add "" in MongoDB + print(school_subject) find_document_school_time_table = list(collection.find({}, {"Date": long_date})) find_document_archive_school_time_table = list(collection_archive.find({}, {"Date": long_date})) array_document_school_time_table = find_document_school_time_table[0]["_id"] @@ -449,7 +450,7 @@ def update_time_school(): if gagaga == 8: gagaga = 0 else: #If school subject is not 0, add school subject in MongoDB - #remove_things_in_front = school_subject.split(' ', 1)[1] + remove_things_in_front = school_subject.split(' ', 1)[1] find_document_school_time_table = list(collection.find({}, {"Date": long_date})) find_document_archive_school_time_table = list(collection_archive.find({}, {"Date": long_date})) array_document_school_time_table = find_document_school_time_table[0]["_id"] @@ -458,14 +459,14 @@ def update_time_school(): collection.update_one( { "_id": ObjectId(array_document_school_time_table)}, { "$set": { - "School Subject." + array_test[0] + "." + str(gagaga)+ ".Subject": school_subject, + "School Subject." + array_test[0] + "." + str(gagaga)+ ".Subject": remove_things_in_front, } } ) collection_archive.update_one( { "_id": ObjectId(array_document_archive_school_time_table)}, { "$set": { - "School Subject." + array_test[0] + "." + str(gagaga)+ ".Subject": school_subject, + "School Subject." + array_test[0] + "." + str(gagaga)+ ".Subject": remove_things_in_front, } } ) @@ -634,8 +635,6 @@ def update_time_school(): pass else: search_class = ws.cell(row=3, column=c).value - print(search_class) - print(gagaga_room) collection.update_one( { "_id": ObjectId(array_document_school_time_table)}, { "$set": { @@ -645,4 +644,5 @@ def update_time_school(): ) else: pass + update_time_school() \ No newline at end of file diff --git a/static/css/index.css b/static/css/index.css index e62fae7..192abb0 100644 --- a/static/css/index.css +++ b/static/css/index.css @@ -1,54 +1,26 @@ - -.ExcelTable2007 { - border: 1px solid #B0CBEF; - border-width: 1px 0px 0px 1px; - font-size: 11pt; - font-family: Calibri; - font-weight: 100; - border-spacing: 0px; - border-collapse: collapse; - font-family: 'Roboto Slab', serif; +/* Housekeeping */ +html{ + font:0.75em/1.5 sans-serif; + color:#333; + background-color:#fff; + padding:1em; } -.ExcelTable2007 TH { - background-image: url(excel-2007-header-bg.gif); - background-repeat: repeat-x; - font-weight: normal; - font-size: 14px; - border: 1px solid #9EB6CE; - border-width: 0px 1px 1px 0px; - height: 17px; - font-family: 'Roboto Slab', serif; +/* Tables */ +table{ + width:100%; + margin-bottom:1em; + border-collapse: collapse; } - -.ExcelTable2007 TD { - - border: 0px; - background-color: white; - padding: 10px 10px 10px 10px; - border: 1px solid #D0D7E5; - border-width: 0px 1px 1px 0px; - font-family: 'Roboto Slab', serif; +th{ + font-weight:bold; + background-color:#ddd; } - -.ExcelTable2007 TD B { - border: 0px; - background-color: white; - font-weight: bold; - font-family: 'Roboto Slab', serif; - zoom: 50%; +th, +td{ + padding:0.5em; + border:1px solid #ccc; } - -.ExcelTable2007 TD.heading { - background-color: #E4ECF7; - text-align: center; - border: 1px solid #9EB6CE; - border-width: 0px 1px 1px 0px; - font-family: 'Roboto Slab', serif; -} - -.ExcelTable2007 TH.heading { - background-image: url(excel-2007-header-left.gif); - background-repeat: none; - font-family: 'Roboto Slab', serif; +td.space{ + padding-right: 20px; } diff --git a/templates/orario/orario.html b/templates/orario/orario.html index bd35e02..1269227 100644 --- a/templates/orario/orario.html +++ b/templates/orario/orario.html @@ -8,7 +8,7 @@ - +
@@ -52,6 +52,11 @@ {% endfor %} + + + + + {% for i in data %} @@ -85,6 +90,11 @@ {% endfor %} + + + + + {% for i in data %} @@ -118,6 +128,11 @@ {% endfor %} + + + + + {% for i in data %} @@ -151,6 +166,11 @@ {% endfor %} + + + + + {% for i in data %} @@ -184,6 +204,11 @@ {% endfor %} + + + + + {% for i in data %} @@ -217,6 +242,11 @@ {% endfor %} + + + + + {% for i in data %} @@ -247,6 +277,11 @@ {% endfor %} + + + + + {% for i in data %} @@ -277,16 +312,11 @@ {% endfor %} + + + + +
{{ i['School Subject']['Saturday'][0]['Room'] }}
08:55{{ i['School Subject']['Saturday'][1]['Room'] }}
09:55{{ i['School Subject']['Saturday'][2]['Room'] }}
11:10{{ i['School Subject']['Saturday'][3]['Room'] }}
12:10{{ i['School Subject']['Saturday'][4]['Room'] }}
13:10{{ i['School Subject']['Saturday'][5]['Room'] }}
{{ i['School Subject']['Monday'][6]['Subject'] }}{{ i['School Subject']['Saturday'][6]['Room'] }}
{{ i['School Subject']['Monday'][7]['Subject'] }}{{ i['School Subject']['Saturday'][7]['Room'] }}
- - {% for i in data %} - {% for c in number %} - {% for b in day %} - -

{{b + " " + c}}

- {% endfor %} - {% endfor %} - {% endfor %} - \ No newline at end of file