mirror of
https://github.com/assenzostefano/class-website.git
synced 2025-02-16 14:20:37 +01:00
New table for school time - Little test for Whatsapp Bot
This commit is contained in:
parent
931cf9975e
commit
0788b337b7
Binary file not shown.
Before Width: | Height: | Size: 125 KiB |
@ -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",
|
||||
|
@ -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()
|
@ -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;
|
||||
}
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<table class="ExcelTable2007">
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th></th>
|
||||
@ -52,6 +52,11 @@
|
||||
<td>{{ i['School Subject']['Saturday'][0]['Room'] }}</td>
|
||||
{% endfor %}
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="space"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td style="text-align: center; vertical-align: middle;">08:55</td>
|
||||
{% for i in data %}
|
||||
@ -85,6 +90,11 @@
|
||||
<td>{{ i['School Subject']['Saturday'][1]['Room'] }}</td>
|
||||
{% endfor %}
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="space"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td style="text-align: center; vertical-align: middle;">09:55</td>
|
||||
{% for i in data %}
|
||||
@ -118,6 +128,11 @@
|
||||
<td>{{ i['School Subject']['Saturday'][2]['Room'] }}</td>
|
||||
{% endfor %}
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="space"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td style="text-align: center; vertical-align: middle;">11:10</td>
|
||||
{% for i in data %}
|
||||
@ -151,6 +166,11 @@
|
||||
<td>{{ i['School Subject']['Saturday'][3]['Room'] }}</td>
|
||||
{% endfor %}
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="space"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td style="text-align: center; vertical-align: middle;">12:10</td>
|
||||
{% for i in data %}
|
||||
@ -184,6 +204,11 @@
|
||||
<td>{{ i['School Subject']['Saturday'][4]['Room'] }}</td>
|
||||
{% endfor %}
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="space"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td style="text-align: center; vertical-align: middle;">13:10</td>
|
||||
{% for i in data %}
|
||||
@ -217,6 +242,11 @@
|
||||
<td>{{ i['School Subject']['Saturday'][5]['Room'] }}</td>
|
||||
{% endfor %}
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="space"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
{% for i in data %}
|
||||
<td>{{ i['School Subject']['Monday'][6]['Subject'] }}</td>
|
||||
@ -247,6 +277,11 @@
|
||||
<td>{{ i['School Subject']['Saturday'][6]['Room'] }}</td>
|
||||
{% endfor %}
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="space"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
{% for i in data %}
|
||||
<td>{{ i['School Subject']['Monday'][7]['Subject'] }}</td>
|
||||
@ -277,16 +312,11 @@
|
||||
<td>{{ i['School Subject']['Saturday'][7]['Room'] }}</td>
|
||||
{% endfor %}
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="space"></td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
<tr>
|
||||
{% for i in data %}
|
||||
{% for c in number %}
|
||||
{% for b in day %}
|
||||
|
||||
<p>{{b + " " + c}}</p>
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
</tr>
|
||||
</body>
|
Loading…
x
Reference in New Issue
Block a user