fnschool 20251014.81347.804__tar.gz → 20251015.80844.859__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of fnschool might be problematic. Click here for more details.
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/PKG-INFO +1 -1
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/__init__.py +1 -1
- fnschool-20251015.80844.859/src/fnschoo1/canteen/migrations/0015_alter_category_options_alter_category_priority.py +28 -0
- fnschool-20251015.80844.859/src/fnschoo1/canteen/migrations/0016_consumption_unique_ingredient_date_of_using.py +20 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/canteen/models.py +6 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/canteen/templates/canteen/consumption/_create.html +1 -1
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/canteen/templates/canteen/consumption/create.html +53 -72
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/canteen/views.py +19 -8
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/canteen/workbook/generate.py +19 -5
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/manage.py +1 -1
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschool.egg-info/PKG-INFO +1 -1
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschool.egg-info/SOURCES.txt +2 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/LICENSE +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/README.md +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/pyproject.toml +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/setup.cfg +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/canteen/__init__.py +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/canteen/admin.py +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/canteen/apps.py +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/canteen/forms.py +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/canteen/migrations/0001_initial.py +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/canteen/migrations/0002_ingredient_is_disabled.py +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/canteen/migrations/0003_consumption_is_disabled_alter_ingredient_is_disabled.py +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/canteen/migrations/0004_alter_ingredient_name_category_and_more.py +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/canteen/migrations/0005_alter_category_created_at_alter_category_name_and_more.py +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/canteen/migrations/0006_category_is_disabled_alter_category_user_and_more.py +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/canteen/migrations/0007_alter_consumption_amount_used_and_more.py +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/canteen/migrations/0008_category_abbreviation_mealtype.py +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/canteen/migrations/0009_alter_category_abbreviation_and_more.py +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/canteen/migrations/0010_alter_consumption_options_alter_ingredient_options_and_more.py +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/canteen/migrations/0011_category_pin_to_consumptions_top.py +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/canteen/migrations/0012_alter_ingredient_storage_date.py +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/canteen/migrations/0013_alter_consumption_options_alter_ingredient_options_and_more.py +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/canteen/migrations/0014_category_priority.py +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/canteen/migrations/__init__.py +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/canteen/templates/canteen/category/create.html +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/canteen/templates/canteen/category/delete.html +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/canteen/templates/canteen/category/list.html +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/canteen/templates/canteen/category/update.html +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/canteen/templates/canteen/close.html +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/canteen/templates/canteen/ingredient/close.html +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/canteen/templates/canteen/ingredient/create.html +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/canteen/templates/canteen/ingredient/create_one.html +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/canteen/templates/canteen/ingredient/delete.html +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/canteen/templates/canteen/ingredient/list.html +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/canteen/templates/canteen/ingredient/update.html +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/canteen/templates/canteen/meal_type/create.html +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/canteen/templates/canteen/meal_type/delete.html +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/canteen/templates/canteen/meal_type/list.html +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/canteen/templates/canteen/meal_type/update.html +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/canteen/tests.py +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/canteen/urls.py +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/canteen/workbook/__init__.py +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/fnschool/__init__.py +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/fnschool/asgi.py +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/fnschool/settings.py +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/fnschool/templatetags/__init__.py +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/fnschool/templatetags/fnschool_tags.py +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/fnschool/urls.py +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/fnschool/views.py +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/fnschool/wsgi.py +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/locale/en/LC_MESSAGES/django.mo +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/locale/zh_Hans/LC_MESSAGES/django.mo +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/profiles/__init__.py +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/profiles/admin.py +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/profiles/apps.py +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/profiles/forms.py +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/profiles/migrations/0001_initial.py +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/profiles/migrations/0002_alter_profile_bio.py +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/profiles/migrations/0003_alter_profile_options_alter_profile_address_and_more.py +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/profiles/migrations/0004_profile_gender.py +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/profiles/migrations/0005_alter_profile_gender.py +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/profiles/migrations/__init__.py +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/profiles/models.py +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/profiles/signals.py +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/profiles/templates/profiles/create.html +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/profiles/templates/profiles/detail.html +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/profiles/templates/profiles/edit.html +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/profiles/templates/profiles/log_in.html +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/profiles/templates/profiles/log_out.html +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/profiles/tests.py +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/profiles/urls.py +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/profiles/views.py +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/static/css/bootstrap.min.css +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/static/css/fnschool.css +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/static/images/favicon.ico +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/static/js/bootstrap.bundle.min.js +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/static/js/bootstrap.min.js +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/static/js/fnschool.js +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/static/js/jquery.min.js +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/static/js/jquery.slim.min.js +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/static/js/popper.min.js +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/templates/base/_content.html +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/templates/base/_css.html +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/templates/base/_js.html +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/templates/base/content.html +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/templates/base/header_content_footer.html +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/templates/close.html +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/templates/home.html +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/templates/includes/_footer.html +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/templates/includes/_header.html +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/templates/includes/_navigation.html +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/templates/includes/_paginator.html +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/templates/registration/logged_out.html +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/templates/registration/login.html +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschool.egg-info/SOURCES.txt.py +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschool.egg-info/dependency_links.txt +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschool.egg-info/dependency_links.txt.py +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschool.egg-info/entry_points.txt +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschool.egg-info/entry_points.txt.py +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschool.egg-info/requires.txt +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschool.egg-info/requires.txt.py +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschool.egg-info/top_level.txt +0 -0
- {fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschool.egg-info/top_level.txt.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: fnschool
|
|
3
|
-
Version:
|
|
3
|
+
Version: 20251015.80844.859
|
|
4
4
|
Summary: Just some school related scripts, without any ambition.
|
|
5
5
|
Author-email: larryw3i <larryw3i@163.com>, Larry Wei <larryw3i@126.com>, Larry W3i <larryw3i@yeah.net>
|
|
6
6
|
Maintainer-email: larryw3i <larryw3i@163.com>, Larry Wei <larryw3i@126.com>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Generated by Django 4.2.25 on 2025-10-14 05:48
|
|
2
|
+
|
|
3
|
+
import django.core.validators
|
|
4
|
+
from django.db import migrations, models
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class Migration(migrations.Migration):
|
|
8
|
+
|
|
9
|
+
dependencies = [
|
|
10
|
+
("canteen", "0014_category_priority"),
|
|
11
|
+
]
|
|
12
|
+
|
|
13
|
+
operations = [
|
|
14
|
+
migrations.AlterModelOptions(
|
|
15
|
+
name="category",
|
|
16
|
+
options={"ordering": ["priority"]},
|
|
17
|
+
),
|
|
18
|
+
migrations.AlterField(
|
|
19
|
+
model_name="category",
|
|
20
|
+
name="priority",
|
|
21
|
+
field=models.IntegerField(
|
|
22
|
+
blank=True,
|
|
23
|
+
null=True,
|
|
24
|
+
validators=[django.core.validators.MinValueValidator(0)],
|
|
25
|
+
verbose_name="优先级",
|
|
26
|
+
),
|
|
27
|
+
),
|
|
28
|
+
]
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Generated by Django 4.2.25 on 2025-10-15 00:44
|
|
2
|
+
|
|
3
|
+
from django.db import migrations, models
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class Migration(migrations.Migration):
|
|
7
|
+
|
|
8
|
+
dependencies = [
|
|
9
|
+
("canteen", "0015_alter_category_options_alter_category_priority"),
|
|
10
|
+
]
|
|
11
|
+
|
|
12
|
+
operations = [
|
|
13
|
+
migrations.AddConstraint(
|
|
14
|
+
model_name="consumption",
|
|
15
|
+
constraint=models.UniqueConstraint(
|
|
16
|
+
fields=("ingredient", "date_of_using"),
|
|
17
|
+
name="unique_ingredient_date_of_using",
|
|
18
|
+
),
|
|
19
|
+
),
|
|
20
|
+
]
|
|
@@ -189,6 +189,12 @@ class Consumption(models.Model):
|
|
|
189
189
|
verbose_name = _("Consumption Record")
|
|
190
190
|
verbose_name_plural = _("Consumption Records")
|
|
191
191
|
ordering = ["-date_of_using"]
|
|
192
|
+
constraints = [
|
|
193
|
+
models.UniqueConstraint(
|
|
194
|
+
fields=["ingredient", "date_of_using"],
|
|
195
|
+
name="unique_ingredient_date_of_using",
|
|
196
|
+
)
|
|
197
|
+
]
|
|
192
198
|
|
|
193
199
|
def __str__(self):
|
|
194
200
|
return _("{0} of {1} was consumed on {2} .").format(
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<form onkeydown="if(event.keyCode==13){return false;}"
|
|
7
7
|
name="consumption_form"
|
|
8
8
|
data-is_disabled="{{ form.instance.is_disabled }}"
|
|
9
|
-
data-amount_used="{{ form.instance.amount_used }}"
|
|
9
|
+
data-amount_used="{{ form.instance.amount_used|default_if_none:0 }}"
|
|
10
10
|
data-ingredient_unit_price="{{ form.instance.ingredient.unit_price }}"
|
|
11
11
|
data-date_of_using="{{ form.instance.date_of_using|date:"Y-m-d" }}"
|
|
12
12
|
data-ingredient_meal_type="{{ form.instance.ingredient.meal_type }}"
|
|
@@ -47,7 +47,13 @@
|
|
|
47
47
|
<th class="">{% trans "Remaining Quantity" %}</th>
|
|
48
48
|
{% endif %}
|
|
49
49
|
{% for date_h in date_range %}
|
|
50
|
-
<th data-date_of_using="{{ date_h }}" class="consumption-date">
|
|
50
|
+
<th data-date_of_using="{{ date_h }}" class="consumption-date">
|
|
51
|
+
{{ date_h }}
|
|
52
|
+
<br />
|
|
53
|
+
|
|
|
54
|
+
<br />
|
|
55
|
+
|
|
|
56
|
+
</th>
|
|
51
57
|
{% empty %}
|
|
52
58
|
<th></th>
|
|
53
59
|
{% endfor %}
|
|
@@ -85,8 +91,6 @@
|
|
|
85
91
|
</table>
|
|
86
92
|
</div>
|
|
87
93
|
<div class="">
|
|
88
|
-
<button onclick="submit_consumptions();"
|
|
89
|
-
class="btn btn-submit-consumptions btn-primary float-start">{% trans "Submit" %}</button>
|
|
90
94
|
<button onclick="generate_spreadsheet();"
|
|
91
95
|
class="btn btn-submit-consumptions btn-success float-end">{% trans "Generate Spreadsheet" %}</button>
|
|
92
96
|
<select class="workbook-month-select form-select float-end mx-2"
|
|
@@ -180,23 +184,53 @@
|
|
|
180
184
|
});
|
|
181
185
|
});
|
|
182
186
|
|
|
187
|
+
function submit_consumption_form(element) {
|
|
188
|
+
var element = $(element)
|
|
189
|
+
var form = $(element.closest("form"));
|
|
190
|
+
var formData = new FormData(form[0]);
|
|
191
|
+
|
|
192
|
+
$.ajax({
|
|
193
|
+
url: form.attr('action'),
|
|
194
|
+
method: 'POST',
|
|
195
|
+
data: formData,
|
|
196
|
+
processData: false,
|
|
197
|
+
contentType: false,
|
|
198
|
+
success(res) {
|
|
199
|
+
if (res == "OK") {
|
|
200
|
+
element.css({
|
|
201
|
+
'border': "5px solid green",
|
|
202
|
+
"border-radius": "10px"
|
|
203
|
+
})
|
|
204
|
+
form.data("amount_used", element.val())
|
|
205
|
+
}
|
|
206
|
+
},
|
|
207
|
+
error(xhr) {
|
|
208
|
+
element.css({
|
|
209
|
+
'border': "5px solid red",
|
|
210
|
+
"border-radius": "10px"
|
|
211
|
+
})
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
}
|
|
216
|
+
|
|
183
217
|
function amount_used_input_blur(element) {
|
|
184
218
|
element = $(element)
|
|
185
219
|
var ingredient_quantity = element.closest('tr').data("ingredient_quantity")
|
|
186
220
|
ingredient_quantity = parseInt(ingredient_quantity) || 0
|
|
187
|
-
var
|
|
188
|
-
var
|
|
221
|
+
var $consumption_form = element.closest("form")
|
|
222
|
+
var amount_used = parseInt($consumption_form.data("amount_used")) || 0
|
|
223
|
+
var new_amount_used = parseInt($.trim(element.val())) || 0
|
|
189
224
|
new_amount_used = parseInt(new_amount_used) || 0
|
|
190
225
|
if (new_amount_used < 0) {
|
|
191
|
-
element.val('
|
|
226
|
+
element.val('')
|
|
192
227
|
new_amount_used = 0
|
|
193
228
|
}
|
|
194
|
-
if (new_amount_used === 0 && amount_used
|
|
229
|
+
if (new_amount_used === 0 && amount_used === 0) {
|
|
195
230
|
element.val('')
|
|
196
231
|
}
|
|
197
232
|
if (amount_used > 0 && new_amount_used === 0) {
|
|
198
233
|
element.val('0')
|
|
199
|
-
new_amount_used = 0
|
|
200
234
|
}
|
|
201
235
|
var $tds = element.parent().parent().siblings("td")
|
|
202
236
|
var $amount_used_inputs = $tds.find("form input[name='amount_used']")
|
|
@@ -207,7 +241,11 @@
|
|
|
207
241
|
});
|
|
208
242
|
if ((total_consumed + new_amount_used) > ingredient_quantity) {
|
|
209
243
|
var remaining_quantity = total_consumed < ingredient_quantity ? (ingredient_quantity - total_consumed) : 0
|
|
210
|
-
|
|
244
|
+
if (remaining_quantity === 0) {
|
|
245
|
+
element.val('')
|
|
246
|
+
} else {
|
|
247
|
+
element.val(remaining_quantity)
|
|
248
|
+
}
|
|
211
249
|
new_amount_used = remaining_quantity
|
|
212
250
|
}
|
|
213
251
|
total_consumed = total_consumed + new_amount_used
|
|
@@ -215,7 +253,11 @@
|
|
|
215
253
|
$(`td[name='remaining_${ingredient_id}']`).text(`${ingredient_quantity}-${total_consumed}=${ingredient_quantity-total_consumed}`)
|
|
216
254
|
element.closest("tr").find('.ingredient-progress').css('width', `${parseInt((ingredient_quantity-total_consumed)*100/ingredient_quantity)}%`)
|
|
217
255
|
var date_of_using = element.closest("form").data("date_of_using")
|
|
256
|
+
|
|
218
257
|
update_header(date_of_using)
|
|
258
|
+
if (new_amount_used != amount_used) {
|
|
259
|
+
submit_consumption_form(element, new_amount_used)
|
|
260
|
+
}
|
|
219
261
|
}
|
|
220
262
|
|
|
221
263
|
function update_header(date_of_using) {
|
|
@@ -321,69 +363,8 @@
|
|
|
321
363
|
});
|
|
322
364
|
|
|
323
365
|
function generate_spreadsheet() {
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
window.open(`/canteen/generate_spreadsheet/${month}`, '_blank');
|
|
327
|
-
});
|
|
328
|
-
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
function submit_consumptions(fn) {
|
|
332
|
-
if (dont_submit) {
|
|
333
|
-
return false
|
|
334
|
-
} else {
|
|
335
|
-
dont_submit = true
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
var consumption_forms = $('form[name="consumption_form"]')
|
|
339
|
-
var requests = [];
|
|
340
|
-
var progress = 0
|
|
341
|
-
consumption_forms_cp = []
|
|
342
|
-
consumption_forms.each(function(index, element) {
|
|
343
|
-
var form = $(element);
|
|
344
|
-
var amount_used_init = parseInt(form.data("amount_used")) || 0
|
|
345
|
-
var amount_used_new = parseInt(form.find("input[name='amount_used']").val()) || 0
|
|
346
|
-
if (form.data("is_disabled") == "True") {
|
|
347
|
-
return true;
|
|
348
|
-
}
|
|
349
|
-
if (form.find('input[name="amount_used"]').val().length < 1) {
|
|
350
|
-
return true;
|
|
351
|
-
}
|
|
352
|
-
if (amount_used_new == amount_used_init) {
|
|
353
|
-
return true;
|
|
354
|
-
}
|
|
355
|
-
consumption_forms_cp.push(form)
|
|
356
|
-
});
|
|
357
|
-
|
|
358
|
-
consumption_forms = consumption_forms_cp
|
|
359
|
-
var consumption_forms_length = consumption_forms.length
|
|
360
|
-
$(consumption_forms).each(function(index, element) {
|
|
361
|
-
form = $(element)
|
|
362
|
-
requests.push(
|
|
363
|
-
$.ajax({
|
|
364
|
-
url: form.attr('action'),
|
|
365
|
-
type: form.attr('method') || 'POST',
|
|
366
|
-
data: form.serialize(),
|
|
367
|
-
success: function(response) {
|
|
368
|
-
progress += 1
|
|
369
|
-
var footer_progressbar = $('.progress-footer')
|
|
370
|
-
if (footer_progressbar) {
|
|
371
|
-
var width = `${parseInt(progress*100/consumption_forms_length)}%`
|
|
372
|
-
$(footer_progressbar).css("width", width)
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
}).catch(function(error) {
|
|
376
|
-
return erroe;
|
|
377
|
-
}));
|
|
378
|
-
});
|
|
379
|
-
$.when.apply($, requests)
|
|
380
|
-
.done(function() {
|
|
381
|
-
if (fn != undefined) {
|
|
382
|
-
fn()
|
|
383
|
-
}
|
|
384
|
-
location.reload();
|
|
385
|
-
})
|
|
386
|
-
.fail(function() {});
|
|
366
|
+
var month = $(".workbook-month-select").val()
|
|
367
|
+
window.open(`/canteen/generate_spreadsheet/${month}`, 'generate_spreadsheet');
|
|
387
368
|
}
|
|
388
369
|
|
|
389
370
|
function set_consumptions_table_size() {
|
|
@@ -306,19 +306,19 @@ def create_consumptions(request, ingredient_id=None):
|
|
|
306
306
|
@require_POST
|
|
307
307
|
def new_consumption(request, consumption_id=None):
|
|
308
308
|
form = None
|
|
309
|
+
|
|
310
|
+
posted_date_of_using = date_parser.parse(request.POST.get("date_of_using"))
|
|
311
|
+
posted_amount_used = request.POST.get("amount_used")
|
|
312
|
+
|
|
309
313
|
if consumption_id:
|
|
310
314
|
consumption = Consumption.objects.filter(
|
|
311
315
|
Q(pk=consumption_id)
|
|
312
316
|
& Q(ingredient__user=request.user)
|
|
317
|
+
& Q(date_of_using=posted_date_of_using)
|
|
313
318
|
& Q(is_disabled=False)
|
|
314
319
|
).first()
|
|
315
320
|
if consumption:
|
|
316
|
-
|
|
317
|
-
posted_amount_used = request.POST.get("amount_used")
|
|
318
|
-
if (
|
|
319
|
-
posted_amount_used.replace(".", "").isnumeric()
|
|
320
|
-
and Decimal(posted_amount_used).is_zero()
|
|
321
|
-
):
|
|
321
|
+
if Decimal(posted_amount_used).is_zero():
|
|
322
322
|
consumption.delete()
|
|
323
323
|
return HttpResponse("OK", status=201)
|
|
324
324
|
|
|
@@ -327,13 +327,24 @@ def new_consumption(request, consumption_id=None):
|
|
|
327
327
|
return HttpResponse("Accepted", status=202)
|
|
328
328
|
|
|
329
329
|
else:
|
|
330
|
+
ingredient_id = request.POST.get("ingredient")
|
|
330
331
|
ingredient = Ingredient.objects.filter(
|
|
331
|
-
Q(user=request.user) & Q(pk=
|
|
332
|
+
Q(user=request.user) & Q(pk=ingredient_id)
|
|
332
333
|
).first()
|
|
333
334
|
if not ingredient:
|
|
334
335
|
return HttpResponse("Accepted", status=202)
|
|
335
336
|
|
|
336
|
-
consumption = Consumption(
|
|
337
|
+
consumption = Consumption.objects.filter(
|
|
338
|
+
Q(date_of_using=posted_date_of_using)
|
|
339
|
+
& Q(ingredient__id=ingredient_id)
|
|
340
|
+
).first()
|
|
341
|
+
|
|
342
|
+
if not consumption:
|
|
343
|
+
consumption = Consumption()
|
|
344
|
+
elif Decimal(posted_amount_used).is_zero():
|
|
345
|
+
consumption.delete()
|
|
346
|
+
return HttpResponse("OK", status=201)
|
|
347
|
+
|
|
337
348
|
consumption.ingredient = ingredient
|
|
338
349
|
form = ConsumptionForm(request.POST, instance=consumption)
|
|
339
350
|
|
|
@@ -880,7 +880,10 @@ class CanteenWorkBook:
|
|
|
880
880
|
|
|
881
881
|
split_dated_consumptions = sorted(
|
|
882
882
|
split_dated_consumptions,
|
|
883
|
-
key=lambda
|
|
883
|
+
key=lambda c: (
|
|
884
|
+
c.ingredient.category.priority,
|
|
885
|
+
c.ingredient.category.name,
|
|
886
|
+
),
|
|
884
887
|
)
|
|
885
888
|
|
|
886
889
|
consumption_date_index = sub_consumption_num
|
|
@@ -1234,7 +1237,8 @@ class CanteenWorkBook:
|
|
|
1234
1237
|
]
|
|
1235
1238
|
|
|
1236
1239
|
split_dated_ingredients = sorted(
|
|
1237
|
-
split_dated_ingredients,
|
|
1240
|
+
split_dated_ingredients,
|
|
1241
|
+
key=lambda i: (i.category.priority, i.category.name),
|
|
1238
1242
|
)
|
|
1239
1243
|
|
|
1240
1244
|
storage_date_index = sub_storage_num
|
|
@@ -1822,7 +1826,14 @@ class CanteenWorkBook:
|
|
|
1822
1826
|
_(
|
|
1823
1827
|
"{meal_type} ({category}, Checked/Storaged at {storage_date})"
|
|
1824
1828
|
).format(
|
|
1825
|
-
meal_type=
|
|
1829
|
+
meal_type=(
|
|
1830
|
+
(
|
|
1831
|
+
ingredient.meal_type.abbreviation
|
|
1832
|
+
or ingredient.meal_type.name
|
|
1833
|
+
)
|
|
1834
|
+
if ingredient.meal_type
|
|
1835
|
+
else ""
|
|
1836
|
+
),
|
|
1826
1837
|
category=ingredient.category,
|
|
1827
1838
|
storage_date=ingredient.storage_date,
|
|
1828
1839
|
),
|
|
@@ -2147,13 +2158,16 @@ def get_workbook_zip(request, month):
|
|
|
2147
2158
|
_(
|
|
2148
2159
|
"Canteen {meal_type} Daybook WorkBook ({month}) of {affiliation}"
|
|
2149
2160
|
).format(
|
|
2150
|
-
meal_type=
|
|
2161
|
+
meal_type=(
|
|
2162
|
+
(meal_type.abbreviation or meal_type.name)
|
|
2163
|
+
if meal_type
|
|
2164
|
+
else ""
|
|
2165
|
+
),
|
|
2151
2166
|
month=month.replace("-", ""),
|
|
2152
2167
|
affiliation=request.user.affiliation,
|
|
2153
2168
|
)
|
|
2154
2169
|
+ ".xlsx"
|
|
2155
2170
|
)
|
|
2156
|
-
# filename = escape_uri_path(filename)
|
|
2157
2171
|
|
|
2158
2172
|
wb = CanteenWorkBook(request, month, meal_type).fill_in()
|
|
2159
2173
|
excel_buffer = io.BytesIO()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: fnschool
|
|
3
|
-
Version:
|
|
3
|
+
Version: 20251015.80844.859
|
|
4
4
|
Summary: Just some school related scripts, without any ambition.
|
|
5
5
|
Author-email: larryw3i <larryw3i@163.com>, Larry Wei <larryw3i@126.com>, Larry W3i <larryw3i@yeah.net>
|
|
6
6
|
Maintainer-email: larryw3i <larryw3i@163.com>, Larry Wei <larryw3i@126.com>
|
{fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschool.egg-info/SOURCES.txt
RENAMED
|
@@ -25,6 +25,8 @@ src/fnschoo1/canteen/migrations/0011_category_pin_to_consumptions_top.py
|
|
|
25
25
|
src/fnschoo1/canteen/migrations/0012_alter_ingredient_storage_date.py
|
|
26
26
|
src/fnschoo1/canteen/migrations/0013_alter_consumption_options_alter_ingredient_options_and_more.py
|
|
27
27
|
src/fnschoo1/canteen/migrations/0014_category_priority.py
|
|
28
|
+
src/fnschoo1/canteen/migrations/0015_alter_category_options_alter_category_priority.py
|
|
29
|
+
src/fnschoo1/canteen/migrations/0016_consumption_unique_ingredient_date_of_using.py
|
|
28
30
|
src/fnschoo1/canteen/migrations/__init__.py
|
|
29
31
|
src/fnschoo1/canteen/templates/canteen/close.html
|
|
30
32
|
src/fnschoo1/canteen/templates/canteen/category/create.html
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/canteen/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/fnschool/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/fnschool/settings.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/profiles/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/profiles/signals.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/static/css/fnschool.css
RENAMED
|
File without changes
|
{fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/static/images/favicon.ico
RENAMED
|
File without changes
|
|
File without changes
|
{fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/static/js/bootstrap.min.js
RENAMED
|
File without changes
|
{fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/static/js/fnschool.js
RENAMED
|
File without changes
|
{fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/static/js/jquery.min.js
RENAMED
|
File without changes
|
|
File without changes
|
{fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/static/js/popper.min.js
RENAMED
|
File without changes
|
|
File without changes
|
{fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/templates/base/_css.html
RENAMED
|
File without changes
|
{fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/templates/base/_js.html
RENAMED
|
File without changes
|
{fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/templates/base/content.html
RENAMED
|
File without changes
|
|
File without changes
|
{fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/templates/close.html
RENAMED
|
File without changes
|
{fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschoo1/templates/home.html
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschool.egg-info/SOURCES.txt.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschool.egg-info/entry_points.txt
RENAMED
|
File without changes
|
|
File without changes
|
{fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschool.egg-info/requires.txt
RENAMED
|
File without changes
|
{fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschool.egg-info/requires.txt.py
RENAMED
|
File without changes
|
{fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschool.egg-info/top_level.txt
RENAMED
|
File without changes
|
{fnschool-20251014.81347.804 → fnschool-20251015.80844.859}/src/fnschool.egg-info/top_level.txt.py
RENAMED
|
File without changes
|