From 0e4139123db85fa2f69cf7bf51c4652dc4c6be9a Mon Sep 17 00:00:00 2001 From: LJBL22 Date: Fri, 29 Dec 2023 22:52:15 +0800 Subject: [PATCH] update & submit-1: style, tt, README --- README.md | 8 +- app.py | 14 +- price.db | Bin 20480 -> 20480 bytes static/style.css | 30 +++- templates/calculator.html | 318 +++++++++++++++++++------------------- templates/index.html | 65 ++++++-- templates/layout.html | 52 ++++--- templates/records.html | 10 +- 8 files changed, 287 insertions(+), 210 deletions(-) diff --git a/README.md b/README.md index 3d444ef..54fa9b5 100644 --- a/README.md +++ b/README.md @@ -20,13 +20,15 @@ - To assist users in calculating the appropriate amount for a red packet, taking into account various factors. - Review the checking records. -### Background: +### Idea Background: #### Taiwanese Wedding Red Packet Etiquette -For guests attending weddings, the customary red envelope gift typically starts at 600 NTD. When estimating a total gift amount of less than 10,000 NTD, it is advisable to steer clear of the numbers 4 and 8. This caution stems from cultural nuances, where the number 4 is associated with the word for "death," and the number 8, while considered “wealth” in many contexts, sounds similar to the word for "separation." Thus, it may not be deemed suitable for inclusion in wedding gift amounts. Additionally, one should avoid having an odd digit or the digit 0 in the hundreds place. +A red packet or a red envelope is a monetary gift given during holidays or for special occasions such as a wedding. ---[Wikipedia](https://en.wikipedia.org/wiki/Red_envelope) -Interestingly, the amount of 9,900 NTD is considered especially auspicious. This is due to its homophonic sound "長長久久" in Chinese, symbolising a heartfelt wish for enduring marital happiness. +In Taiwan, for guests attending weddings, the customary red envelope gift typically starts at NTD 600. When estimating a total gift amount of less than 10,000 NTD, it is advisable to steer clear of the numbers 4 and 8. This caution stems from cultural nuances, where the number 4 is associated with the word for "death," and the number 8, while considered “wealth” in many contexts, sounds similar to the word for "separation." Thus, it may not be deemed suitable for inclusion in wedding gift amounts. Additionally, one should avoid having an odd digit, which related to funerals, or the digit 0 in the hundreds place, following established conventions. + +Interestingly, the amount of NTD 9,900 is considered especially auspicious. This is due to its homophonic sound "jiu-jiu" in Mandarin, symbolising a heartfelt wish for enduring marital happiness. In the event that the gift amount exceeds 10,000 NTD, it is recommended to minimise the presence of two or more odd digits and to avoid the numbers 4 and 8 whenever possible. diff --git a/app.py b/app.py index c294378..8345618 100644 --- a/app.py +++ b/app.py @@ -1,5 +1,5 @@ from cs50 import SQL -from flask import Flask, render_template, request +from flask import Flask, render_template, redirect, request # Configure application app = Flask(__name__) @@ -25,7 +25,6 @@ def index(): return render_template("index.html") - @app.route("/calculator", methods=["GET", "POST"]) def calculator(): venues = db.execute("SELECT * FROM venues") @@ -34,7 +33,6 @@ def calculator(): if request.method == "POST": relationship_option = request.form.get("relationship") - print(relationship_option) if not (relationship_option): return render_template("error.html", error_msg = "Please choose a RELATION option") showup_option = request.form.get("showup") @@ -95,9 +93,9 @@ def replace_digit(number): return number ###### DEV ONLY -original_number = 9000 -modified_number = replace_digit(original_number) -print(f"{original_number} becomes {modified_number}") +# original_number = 9000 +# modified_number = replace_digit(original_number) +# print(f"{original_number} becomes {modified_number}") @app.route("/records", methods=["GET", "POST"]) def records(): @@ -109,7 +107,7 @@ def records(): def ntd(value): """Format value as NTD.""" - return f"NTD${value:,}" + return f"NTD {value:,}" # Custom filter -app.jinja_env.filters["ntd"] = ntd +app.jinja_env.filters["ntd"] = ntd \ No newline at end of file diff --git a/price.db b/price.db index 18949ee1d99cf015126dadd231d9d8ebef1387ba..aa51aecc0dd4c4624601f0bea3b0df22631da681 100644 GIT binary patch delta 289 zcmZozz}T>Wae}nqLIwr~Rv?A}`H4Elj0-m=EaT@|$-w`H{{sIe{*{{r1!nS3-XPEE zA;ZkVV98XJT3nJ?T9lYqqOXvVpPQ;skXTew$v8oZiG{(GsXR3$B{MHwAt^Dhur#$q zAtNy-hh>8hBMXBnlc_FHXOTk2=3nw$3LH%QSq%K!__KiK$MM&DF>xBZ3#)Q+a4;De z7#Zst8tEEYDj1qrnHpFbTBa3crsky->nGWae}m9Jp%&+D-gqg#6%rq#`=v3%lNrAFz~?|w{ z!W@43j-t#g4BAXZsl_FUrA3K(CHfipxv9(wQcNrircB|fDJhwG=?YGXd4;8^B?=yi zIXNsFgcw;ERGCb5fm(_bJU0K5=Tcx}xMowc@L17LK4kjZ5BV%1d jBV8j)1p`YfQwu9YgT%tp#LT>s#JuFx;=FvI3z#ARwV^P3 diff --git a/static/style.css b/static/style.css index 43f270c..8b0e3bf 100644 --- a/static/style.css +++ b/static/style.css @@ -1,3 +1,31 @@ +@import url('https://fonts.googleapis.com/css2?family=Quicksand&family=Roboto+Slab:wght@400;700&display=swap'); + +* { + font-family: 'Quicksand', sans-serif; +} + +.article-title { + position: relative; +} + +.article-title img { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + object-fit: cover; + opacity: 0.5; +} + +.article-title { + color: red; + font-size: 3rem; + font-family: 'Roboto Slab', serif; + position: relative; + z-index: 1; +} + .white { - color: white; + color: white; } diff --git a/templates/calculator.html b/templates/calculator.html index a07792b..f4361e5 100644 --- a/templates/calculator.html +++ b/templates/calculator.html @@ -1,159 +1,161 @@ -{% extends "layout.html" %} - -{% block title %} -calculator -{% endblock %} - -{% block main %} -
-
-
-
-
-

What's your relationship with the newlyweds?

-
-
- -
-
-
-
-

Will you be present?

-
-
- -
-
- -
-
- -
-
- -
-
-
-
-

Where does the wedding ceremony take place?

-
-
- -
-
-
-
-

How many additional guest will you bring?

-
-
- -
-
- -
-
- -
-
- -
-
-
-
-

Optional add:

-
-
- -
-
- -
-
-

{{total | ntd}}

-

* Plase aware that above NT$10,000, even numbers in such as 16,000 is much more welcome than 15,000.

-
-
-
- - - - - - - - - - - - - - - {% for record in records %} - - - - - - - - - - - {% endfor %} - -
#relationshowvenueadultchildoptionaltotal
{{ record.Timestamp }}{{ record.relation }}{{ record.showup }}{{ record.venue }}{{ record.add_adult }}{{ record.add_child }}{{ record.add_money }}{{ record.total_amount | ntd }}
-
-
-
+{% extends "layout.html" %} {% block title %} calculator {% endblock %} {% block +main %} +
+
+
+
+
+

What's your relationship with the newlyweds?

+
+
+ +
+
+
+
+

Will you be present?

+
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+
+

Where does the wedding ceremony take place?

+
+
+ +
+
+
+
+

How many additional guest will you bring?

+
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+
+

Optional add:

+
+
+ +

*Feel free to add more to the amount

+
+
+
+ +
+
+
+

{{total | ntd}}

+

+ * In the event that the gift amount exceeds 10,000 NTD, it is + recommended to minimise the presence of two or more odd digits and to + avoid the numbers 4 and 8 whenever possible. +

+
+
+
+ + + + + + + + + + + + + + + {% for record in records %} + + + + + + + + + + + {% endfor %} + +
#relationshowvenueadultchildoptionaltotal
{{ record.Timestamp }}{{ record.relation }}{{ record.showup }}{{ record.venue }}{{ record.add_adult }}{{ record.add_child }}{{ record.add_money | ntd }}{{ record.total_amount | ntd }}
+
+
- {% endblock %} +
+{% endblock %} diff --git a/templates/index.html b/templates/index.html index 0505c6d..66a033c 100644 --- a/templates/index.html +++ b/templates/index.html @@ -1,12 +1,55 @@ -{% extends "layout.html" %} -{% block title %} -Custom -{% endblock %} - -{% block main %} -

Taiwanese Wedding Red Packet Etiquette:

-

For guests attending weddings, the customary red envelope gift typically starts at 600 NTD. When estimating a total gift amount of less than 10,000 NTD, it is advisable to steer clear of the numbers 4 and 8. This caution stems from cultural nuances, where the number 4 is associated with the word for "death," and the number 8, while considered “wealth” in many contexts, sounds similar to the word for "separation." Thus, it may not be deemed suitable for inclusion in wedding gift amounts. Additionally, one should avoid having an odd digit or the digit 0 in the hundreds place.

-

Interestingly, the amount of 9,900 NTD is considered especially auspicious. This is due to its homophonic sound "長長久久" in Chinese, symbolising a heartfelt wish for enduring marital happiness.

-

In the event that the gift amount exceeds 10,000 NTD, it is recommended to minimise the presence of two or more odd digits and to avoid the numbers 4 and 8 whenever possible.

-

However, regardless of the size of the gift you present, the most crucial aspect lies in the sincerity of your well-wishes for the newlyweds. May your contribution be a token of blessings that accompany them on their journey into marital bliss.

+{% extends "layout.html" %} {% block title %} Custom {% endblock %} {% block +main %} +
+
+
+
+ red envelope +

Taiwanese Wedding Red Packet Etiquette

+
+
+

+ A red packet or a red envelope is a monetary gift given during + holidays or for special occasions such as a wedding. --- + Wikipedia +

+

+ In Taiwan, for guests attending weddings, the customary red envelope + gift typically starts at NTD 600. When estimating a total gift amount + of less than 10,000 NTD, it is advisable to steer clear of the numbers + 4 and 8. This caution stems from cultural nuances, where the number 4 + is associated with the word for "death," and the number 8, while + considered “wealth” in many contexts, sounds similar to the word for + "separation." Thus, it may not be deemed suitable for inclusion in + wedding gift amounts. Additionally, one should avoid having an odd + digit, which related to funerals, or the digit 0 in the hundreds + place, following established conventions. +

+

+ Interestingly, the amount of NTD 9,900 is considered especially + auspicious. This is due to its homophonic sound "jiu-jiu" in Mandarin, + symbolising a heartfelt wish for enduring marital happiness. +

+

+ In the event that the gift amount exceeds 10,000 NTD, it is + recommended to minimise the presence of two or more odd digits and to + avoid the numbers 4 and 8 whenever possible. +

+

+ However, regardless of the size of the gift you present, the most + crucial aspect lies in the sincerity of your well-wishes for the + newlyweds. May your contribution be a token of blessings that + accompany them on their journey into marital bliss. +

+
+
+
+
{% endblock %} diff --git a/templates/layout.html b/templates/layout.html index f5c1476..6c48d71 100644 --- a/templates/layout.html +++ b/templates/layout.html @@ -20,30 +20,40 @@ WRP 🧧 {% block title %}{% endblock %} - -
{% block main %}{% endblock %}
@@ -53,9 +63,7 @@ href="https://pll.harvard.edu/course/cs50-introduction-computer-science" >CS50 - final project by LJBL22. + final project by LJBL22. diff --git a/templates/records.html b/templates/records.html index 19c49c0..9ff08a2 100644 --- a/templates/records.html +++ b/templates/records.html @@ -1,9 +1,5 @@ -{% extends "layout.html" %} -{% block title %} -records -{% endblock %} - -{% block main %} +{% extends "layout.html" %} {% block title %} records {% endblock %} {% block +main %}
@@ -27,7 +23,7 @@ - + {% endfor %}
{{ record.venue }} {{ record.add_adult }} {{ record.add_child }}{{ record.add_money }}{{ record.add_money | ntd }} {{ record.total_amount | ntd }}