Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -204,20 +204,31 @@ progress_data = {
|
|
| 204 |
"streak": 0,
|
| 205 |
"badges": []
|
| 206 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 207 |
|
| 208 |
def update_daily_stats(is_correct: bool):
|
| 209 |
-
"""Update today's progress based on correctness."""
|
| 210 |
today = str(datetime.date.today())
|
| 211 |
|
| 212 |
# Reset if new day
|
| 213 |
if progress_data["today"] != today:
|
| 214 |
-
|
| 215 |
-
|
| 216 |
-
|
| 217 |
-
|
| 218 |
-
|
| 219 |
-
|
| 220 |
-
|
|
|
|
| 221 |
|
| 222 |
|
| 223 |
if is_correct:
|
|
@@ -233,8 +244,10 @@ def update_daily_stats(is_correct: bool):
|
|
| 233 |
# PART INCLUDED
|
| 234 |
def evaluate_sentence(user_sentence: str) -> bool:
|
| 235 |
"""
|
| 236 |
-
|
| 237 |
-
|
|
|
|
|
|
|
| 238 |
"""
|
| 239 |
# Example: assume grammar_checker returns True if correct, False if incorrect
|
| 240 |
is_correct = grammar_checker(user_sentence)
|
|
|
|
| 204 |
"streak": 0,
|
| 205 |
"badges": []
|
| 206 |
}
|
| 207 |
+
# added part
|
| 208 |
+
def reset_daily_progress():
|
| 209 |
+
"""Reset progress when a new day starts."""
|
| 210 |
+
progress_data.update({
|
| 211 |
+
"today": str(datetime.date.today()),
|
| 212 |
+
"correct_count": 0,
|
| 213 |
+
"incorrect_count": 0,
|
| 214 |
+
"streak": 0,
|
| 215 |
+
"badges": []
|
| 216 |
+
})
|
| 217 |
|
| 218 |
def update_daily_stats(is_correct: bool):
|
| 219 |
+
"""Update today's progress based on grammer correctness."""
|
| 220 |
today = str(datetime.date.today())
|
| 221 |
|
| 222 |
# Reset if new day
|
| 223 |
if progress_data["today"] != today:
|
| 224 |
+
reset_daily_progress()
|
| 225 |
+
# progress_data.update({
|
| 226 |
+
# "today": today,
|
| 227 |
+
# "correct_count": 0,
|
| 228 |
+
# "incorrect_count": 0,
|
| 229 |
+
# "streak": 0,
|
| 230 |
+
# "badges": []
|
| 231 |
+
# })
|
| 232 |
|
| 233 |
|
| 234 |
if is_correct:
|
|
|
|
| 244 |
# PART INCLUDED
|
| 245 |
def evaluate_sentence(user_sentence: str) -> bool:
|
| 246 |
"""
|
| 247 |
+
Check grammar correctness ONLY.
|
| 248 |
+
Style suggestions (informal/difficult words) do not count as incorrect.
|
| 249 |
+
"""
|
| 250 |
+
# TODO: Replace this with your grammar-checking logic
|
| 251 |
"""
|
| 252 |
# Example: assume grammar_checker returns True if correct, False if incorrect
|
| 253 |
is_correct = grammar_checker(user_sentence)
|