mirror of
https://github.com/assenzostefano/class-website.git
synced 2025-02-19 20:40: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 selenium import webdriver # Selenium
|
||||||
from dotenv import load_dotenv
|
from dotenv import load_dotenv
|
||||||
from twilio.rest import Client
|
from twilio.rest import Client
|
||||||
import time
|
|
||||||
import subprocess
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
load_dotenv()
|
load_dotenv()
|
||||||
@ -14,6 +12,14 @@ PHONE_NUMBER_PERSONAL = os.getenv('PHONE_NUMBER_PERSONAL')
|
|||||||
|
|
||||||
client = Client(SID, AUTH_TOKEN)
|
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 \
|
message = client.messages \
|
||||||
.create(
|
.create(
|
||||||
body="Test",
|
body="Test",
|
||||||
|
@ -387,7 +387,7 @@ def update_time_school():
|
|||||||
if gagaga == 9:
|
if gagaga == 9:
|
||||||
gagaga = 0
|
gagaga = 0
|
||||||
else: #If school subject is not 0, add school subject in MongoDB
|
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_school_time_table = list(collection.find({}, {"Date": long_date}))
|
||||||
find_document_archive_school_time_table = list(collection_archive.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"]
|
array_document_school_time_table = find_document_school_time_table[0]["_id"]
|
||||||
@ -396,14 +396,14 @@ def update_time_school():
|
|||||||
collection.update_one(
|
collection.update_one(
|
||||||
{ "_id": ObjectId(array_document_school_time_table)},
|
{ "_id": ObjectId(array_document_school_time_table)},
|
||||||
{ "$set": {
|
{ "$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(
|
collection_archive.update_one(
|
||||||
{ "_id": ObjectId(array_document_archive_school_time_table)},
|
{ "_id": ObjectId(array_document_archive_school_time_table)},
|
||||||
{ "$set": {
|
{ "$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)
|
array_test.append(convert_date_to_day)
|
||||||
number_day += 1
|
number_day += 1
|
||||||
if school_subject == 0: #If school subject is 0, add "" in MongoDB
|
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_school_time_table = list(collection.find({}, {"Date": long_date}))
|
||||||
find_document_archive_school_time_table = list(collection_archive.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"]
|
array_document_school_time_table = find_document_school_time_table[0]["_id"]
|
||||||
@ -449,7 +450,7 @@ def update_time_school():
|
|||||||
if gagaga == 8:
|
if gagaga == 8:
|
||||||
gagaga = 0
|
gagaga = 0
|
||||||
else: #If school subject is not 0, add school subject in MongoDB
|
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_school_time_table = list(collection.find({}, {"Date": long_date}))
|
||||||
find_document_archive_school_time_table = list(collection_archive.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"]
|
array_document_school_time_table = find_document_school_time_table[0]["_id"]
|
||||||
@ -458,14 +459,14 @@ def update_time_school():
|
|||||||
collection.update_one(
|
collection.update_one(
|
||||||
{ "_id": ObjectId(array_document_school_time_table)},
|
{ "_id": ObjectId(array_document_school_time_table)},
|
||||||
{ "$set": {
|
{ "$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(
|
collection_archive.update_one(
|
||||||
{ "_id": ObjectId(array_document_archive_school_time_table)},
|
{ "_id": ObjectId(array_document_archive_school_time_table)},
|
||||||
{ "$set": {
|
{ "$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
|
pass
|
||||||
else:
|
else:
|
||||||
search_class = ws.cell(row=3, column=c).value
|
search_class = ws.cell(row=3, column=c).value
|
||||||
print(search_class)
|
|
||||||
print(gagaga_room)
|
|
||||||
collection.update_one(
|
collection.update_one(
|
||||||
{ "_id": ObjectId(array_document_school_time_table)},
|
{ "_id": ObjectId(array_document_school_time_table)},
|
||||||
{ "$set": {
|
{ "$set": {
|
||||||
@ -645,4 +644,5 @@ def update_time_school():
|
|||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
update_time_school()
|
update_time_school()
|
@ -1,54 +1,26 @@
|
|||||||
|
/* Housekeeping */
|
||||||
.ExcelTable2007 {
|
html{
|
||||||
border: 1px solid #B0CBEF;
|
font:0.75em/1.5 sans-serif;
|
||||||
border-width: 1px 0px 0px 1px;
|
color:#333;
|
||||||
font-size: 11pt;
|
background-color:#fff;
|
||||||
font-family: Calibri;
|
padding:1em;
|
||||||
font-weight: 100;
|
|
||||||
border-spacing: 0px;
|
|
||||||
border-collapse: collapse;
|
|
||||||
font-family: 'Roboto Slab', serif;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.ExcelTable2007 TH {
|
/* Tables */
|
||||||
background-image: url(excel-2007-header-bg.gif);
|
table{
|
||||||
background-repeat: repeat-x;
|
width:100%;
|
||||||
font-weight: normal;
|
margin-bottom:1em;
|
||||||
font-size: 14px;
|
border-collapse: collapse;
|
||||||
border: 1px solid #9EB6CE;
|
|
||||||
border-width: 0px 1px 1px 0px;
|
|
||||||
height: 17px;
|
|
||||||
font-family: 'Roboto Slab', serif;
|
|
||||||
}
|
}
|
||||||
|
th{
|
||||||
.ExcelTable2007 TD {
|
font-weight:bold;
|
||||||
|
background-color:#ddd;
|
||||||
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,
|
||||||
.ExcelTable2007 TD B {
|
td{
|
||||||
border: 0px;
|
padding:0.5em;
|
||||||
background-color: white;
|
border:1px solid #ccc;
|
||||||
font-weight: bold;
|
|
||||||
font-family: 'Roboto Slab', serif;
|
|
||||||
zoom: 50%;
|
|
||||||
}
|
}
|
||||||
|
td.space{
|
||||||
.ExcelTable2007 TD.heading {
|
padding-right: 20px;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<table class="ExcelTable2007">
|
<table>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<th></th>
|
<th></th>
|
||||||
@ -52,6 +52,11 @@
|
|||||||
<td>{{ i['School Subject']['Saturday'][0]['Room'] }}</td>
|
<td>{{ i['School Subject']['Saturday'][0]['Room'] }}</td>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="space"></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td style="text-align: center; vertical-align: middle;">08:55</td>
|
<td style="text-align: center; vertical-align: middle;">08:55</td>
|
||||||
{% for i in data %}
|
{% for i in data %}
|
||||||
@ -85,6 +90,11 @@
|
|||||||
<td>{{ i['School Subject']['Saturday'][1]['Room'] }}</td>
|
<td>{{ i['School Subject']['Saturday'][1]['Room'] }}</td>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="space"></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td style="text-align: center; vertical-align: middle;">09:55</td>
|
<td style="text-align: center; vertical-align: middle;">09:55</td>
|
||||||
{% for i in data %}
|
{% for i in data %}
|
||||||
@ -118,6 +128,11 @@
|
|||||||
<td>{{ i['School Subject']['Saturday'][2]['Room'] }}</td>
|
<td>{{ i['School Subject']['Saturday'][2]['Room'] }}</td>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="space"></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td style="text-align: center; vertical-align: middle;">11:10</td>
|
<td style="text-align: center; vertical-align: middle;">11:10</td>
|
||||||
{% for i in data %}
|
{% for i in data %}
|
||||||
@ -151,6 +166,11 @@
|
|||||||
<td>{{ i['School Subject']['Saturday'][3]['Room'] }}</td>
|
<td>{{ i['School Subject']['Saturday'][3]['Room'] }}</td>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="space"></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td style="text-align: center; vertical-align: middle;">12:10</td>
|
<td style="text-align: center; vertical-align: middle;">12:10</td>
|
||||||
{% for i in data %}
|
{% for i in data %}
|
||||||
@ -184,6 +204,11 @@
|
|||||||
<td>{{ i['School Subject']['Saturday'][4]['Room'] }}</td>
|
<td>{{ i['School Subject']['Saturday'][4]['Room'] }}</td>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="space"></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td style="text-align: center; vertical-align: middle;">13:10</td>
|
<td style="text-align: center; vertical-align: middle;">13:10</td>
|
||||||
{% for i in data %}
|
{% for i in data %}
|
||||||
@ -217,6 +242,11 @@
|
|||||||
<td>{{ i['School Subject']['Saturday'][5]['Room'] }}</td>
|
<td>{{ i['School Subject']['Saturday'][5]['Room'] }}</td>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="space"></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
{% for i in data %}
|
{% for i in data %}
|
||||||
<td>{{ i['School Subject']['Monday'][6]['Subject'] }}</td>
|
<td>{{ i['School Subject']['Monday'][6]['Subject'] }}</td>
|
||||||
@ -247,6 +277,11 @@
|
|||||||
<td>{{ i['School Subject']['Saturday'][6]['Room'] }}</td>
|
<td>{{ i['School Subject']['Saturday'][6]['Room'] }}</td>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="space"></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
{% for i in data %}
|
{% for i in data %}
|
||||||
<td>{{ i['School Subject']['Monday'][7]['Subject'] }}</td>
|
<td>{{ i['School Subject']['Monday'][7]['Subject'] }}</td>
|
||||||
@ -277,16 +312,11 @@
|
|||||||
<td>{{ i['School Subject']['Saturday'][7]['Room'] }}</td>
|
<td>{{ i['School Subject']['Saturday'][7]['Room'] }}</td>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="space"></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<tr>
|
|
||||||
{% for i in data %}
|
|
||||||
{% for c in number %}
|
|
||||||
{% for b in day %}
|
|
||||||
|
|
||||||
<p>{{b + " " + c}}</p>
|
|
||||||
{% endfor %}
|
|
||||||
{% endfor %}
|
|
||||||
{% endfor %}
|
|
||||||
</tr>
|
|
||||||
</body>
|
</body>
|
Loading…
x
Reference in New Issue
Block a user