Skip to content

Commit dff3486

Browse files
committed
Update email templates and add scheduling functionality for daily tasks
1 parent 27c770d commit dff3486

File tree

5 files changed

+66
-24
lines changed

5 files changed

+66
-24
lines changed

document_analysis/result_v1.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ The first version of the Document Analysis Application successfully implements c
9595
### Index Page
9696

9797
![Home Page](./result_images/v1_img.png)
98-
_Modern landing page with feature overview_
98+
_Index page view_
9999

100100
### Dashboard View
101101

start_your_day/backend/email.html

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<head>
55
<meta charset="UTF-8">
66
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7-
<title>Daily Digest - 10 December 2024</title>
7+
<title>Daily Digest - 14 December 2024</title>
88
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;700&display=swap" rel="stylesheet">
99
<style>
1010
body {
@@ -54,32 +54,32 @@
5454
<div class="container">
5555
<h1>🌞 Daily Digest</h1>
5656
<p style="text-align: center; color: #7f8c8d;">
57-
10 December 2024
57+
14 December 2024
5858
</p>
5959

6060

6161
<div class="section quote">
6262
<h2>📜 Quote of the Day</h2>
6363
<blockquote>
64-
<i> Every champion was once a contender that refused to give up.</i>
65-
<footer>Sylvester Stallone, Rocky, </footer>
64+
<i> I look around at us and you know what I see? Losers. But life’s giving us a chance.</i>
65+
<footer>Chris Pratt, Guardians of the Galaxy, </footer>
6666
</blockquote>
6767
</div>
6868

6969

7070
<div class="section weather">
7171
<h2>🌦️ Weather Forecast</h2>
72-
<p><strong>Location:</strong> Le Plessis-Bouchard, FR</p>
72+
<p><strong>Location:</strong> Franconville, FR</p>
7373
<ul>
74-
<li>2024-12-10 01:00:00: Overcast Clouds, 5.53°C</li><li>2024-12-10 04:00:00: Overcast Clouds, 5.32°C</li><li>2024-12-10 07:00:00: Overcast Clouds, 5.06°C</li><li>2024-12-10 10:00:00: Light Rain, 5.43°C</li><li>2024-12-10 13:00:00: Overcast Clouds, 5.41°C</li><li>2024-12-10 16:00:00: Overcast Clouds, 5.81°C</li><li>2024-12-10 19:00:00: Overcast Clouds, 5.4°C</li><li>2024-12-10 22:00:00: Overcast Clouds, 5.07°C</li><li>2024-12-11 01:00:00: Overcast Clouds, 4.8°C</li>
74+
<li>2024-12-14 22:00:00: Light Rain, 4.69°C</li><li>2024-12-15 01:00:00: Overcast Clouds, 4.02°C</li><li>2024-12-15 04:00:00: Scattered Clouds, 3.15°C</li><li>2024-12-15 07:00:00: Broken Clouds, 3.03°C</li><li>2024-12-15 10:00:00: Broken Clouds, 4.11°C</li><li>2024-12-15 13:00:00: Broken Clouds, 5.74°C</li><li>2024-12-15 16:00:00: Overcast Clouds, 6.53°C</li><li>2024-12-15 19:00:00: Overcast Clouds, 6.74°C</li><li>2024-12-15 22:00:00: Overcast Clouds, 7.33°C</li>
7575
</ul>
7676
</div>
7777

7878

7979
<div class="section wikipedia">
8080
<h2>🧠 Did You Know?</h2>
81-
<p>Ostenia is a genus of flies in the family Dolichopodidae. It contains only one species, Ostenia robusta, which is endemic to New Zealand. The species was first described by Frederick Hutton in 1901, and the genus was named after Carl Robert Osten-Sacken.</p>
82-
<p><em>Source: <a href="https://en.wikipedia.org/wiki/Ostenia">https://en.wikipedia.org/wiki/Ostenia</a></em></p>
81+
<p>Singapore competed at the 1962 British Empire and Commonwealth Games in Perth, Western Australia, from 22 November to 1 December 1962. This was the first and only time Singapore competed as a self-governing British colony.</p>
82+
<p><em>Source: <a href="https://en.wikipedia.org/wiki/Singapore_at_the_1962_British_Empire_and_Commonwealth_Games">https://en.wikipedia.org/wiki/Singapore_at_the_1962_British_Empire_and_Commonwealth_Games</a></em></p>
8383
</div>
8484

8585
<div class="footer">

start_your_day/backend/email.txt

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
1-
🌞 Daily Digest - 10 December 2024 🌞
1+
🌞 Daily Digest - 14 December 2024 🌞
22
==================================================
33

44
📜 Quote of the Day 📜
55
-------------------------
6-
Every champion was once a contender that refused to give up.❞
7-
- Sylvester Stallone, Rocky,
6+
I look around at us and you know what I see? Losers. But life’s giving us a chance.❞
7+
- Chris Pratt, Guardians of the Galaxy,
88

9-
🌦️ Weather Forecast: Le Plessis-Bouchard, FR 🌦️
9+
🌦️ Weather Forecast: Franconville, FR 🌦️
1010
--------------------------------------------------
11-
• 2024-12-10 01:00:00: Overcast Clouds | 5.53°C
12-
• 2024-12-10 04:00:00: Overcast Clouds | 5.32°C
13-
• 2024-12-10 07:00:00: Overcast Clouds | 5.06°C
14-
• 2024-12-10 10:00:00: Light Rain | 5.43°C
15-
• 2024-12-10 13:00:00: Overcast Clouds | 5.41°C
16-
• 2024-12-10 16:00:00: Overcast Clouds | 5.81°C
17-
• 2024-12-10 19:00:00: Overcast Clouds | 5.4°C
18-
• 2024-12-10 22:00:00: Overcast Clouds | 5.07°C
19-
• 2024-12-11 01:00:00: Overcast Clouds | 4.8°C
11+
• 2024-12-14 22:00:00: Light Rain | 4.69°C
12+
• 2024-12-15 01:00:00: Overcast Clouds | 4.02°C
13+
• 2024-12-15 04:00:00: Scattered Clouds | 3.15°C
14+
• 2024-12-15 07:00:00: Broken Clouds | 3.03°C
15+
• 2024-12-15 10:00:00: Broken Clouds | 4.11°C
16+
• 2024-12-15 13:00:00: Broken Clouds | 5.74°C
17+
• 2024-12-15 16:00:00: Overcast Clouds | 6.53°C
18+
• 2024-12-15 19:00:00: Overcast Clouds | 6.74°C
19+
• 2024-12-15 22:00:00: Overcast Clouds | 7.33°C
2020

2121
🧠 Did You Know? 🧠
2222
-------------------------
23-
Ostenia is a genus of flies in the family Dolichopodidae. It contains only one species, Ostenia robusta, which is endemic to New Zealand. The species was first described by Frederick Hutton in 1901, and the genus was named after Carl Robert Osten-Sacken.
24-
(Source: https://en.wikipedia.org/wiki/Ostenia)
23+
Singapore competed at the 1962 British Empire and Commonwealth Games in Perth, Western Australia, from 22 November to 1 December 1962. This was the first and only time Singapore competed as a self-governing British colony.
24+
(Source: https://en.wikipedia.org/wiki/Singapore_at_the_1962_British_Empire_and_Commonwealth_Games)
2525

2626
✨ Have a Fantastic Day! ✨
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import threading
2+
import time
3+
import schedule
4+
5+
class Scheduler:
6+
def __init__(self):
7+
super().__init__()
8+
self.__stop_running = threading.Event()
9+
10+
# schedule the task to run every day at 8:00 AM
11+
def schedule_task(self, hour, minute, task):
12+
schedule.clear() # clear any existing schedules
13+
schedule.every().day.at(f"{hour:02d}:{minute:02d}").do(task)
14+
15+
# start the scheduler as background thread...
16+
def start(self):
17+
self.__stop_running.clear()
18+
while not self.__stop_running.is_set():
19+
schedule.run_pending()
20+
time.sleep(1)
21+
22+
# stop the scheduler
23+
def stop(self):
24+
self.__stop_running.set()
25+
26+
27+
#test
28+
if __name__ == '__main__':
29+
# creating a custom task for the scheduler to run
30+
def task():
31+
print("Task is running...\n")
32+
print("Task completed successfully!\n")
33+
34+
scheduler = Scheduler() # create a scheduler instance
35+
scheduler.start()
36+
hour = time.localtime().tm_hour # get the current hour
37+
minute = time.localtime().tm_min + 1 # get the current minute and add 1 to run the task in the next minute
38+
print(f"Scheduling the task to run every day at {hour:02d}:{minute:02d}...\n")
39+
scheduler.schedule_task(hour, minute, task) # schedule the task to run every day at the current hour and the next minute
40+
time.sleep(5) # wait for 20 seconds before stopping the scheduler, ensure the task runs at least once
41+
scheduler.stop()
42+

0 commit comments

Comments
 (0)