fnschool 20251012.81427.834__tar.gz → 20251013.80821.836__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.

Files changed (106) hide show
  1. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/PKG-INFO +1 -1
  2. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/__init__.py +2 -2
  3. fnschool-20251013.80821.836/src/fnschoo1/canteen/migrations/0013_alter_consumption_options_alter_ingredient_options_and_more.py +197 -0
  4. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/canteen/views.py +2 -2
  5. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/canteen/workbook/generate.py +72 -53
  6. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschool.egg-info/PKG-INFO +1 -1
  7. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschool.egg-info/SOURCES.txt +1 -0
  8. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/LICENSE +0 -0
  9. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/README.md +0 -0
  10. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/pyproject.toml +0 -0
  11. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/setup.cfg +0 -0
  12. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/canteen/__init__.py +0 -0
  13. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/canteen/admin.py +0 -0
  14. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/canteen/apps.py +0 -0
  15. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/canteen/forms.py +0 -0
  16. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/canteen/migrations/0001_initial.py +0 -0
  17. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/canteen/migrations/0002_ingredient_is_disabled.py +0 -0
  18. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/canteen/migrations/0003_consumption_is_disabled_alter_ingredient_is_disabled.py +0 -0
  19. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/canteen/migrations/0004_alter_ingredient_name_category_and_more.py +0 -0
  20. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/canteen/migrations/0005_alter_category_created_at_alter_category_name_and_more.py +0 -0
  21. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/canteen/migrations/0006_category_is_disabled_alter_category_user_and_more.py +0 -0
  22. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/canteen/migrations/0007_alter_consumption_amount_used_and_more.py +0 -0
  23. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/canteen/migrations/0008_category_abbreviation_mealtype.py +0 -0
  24. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/canteen/migrations/0009_alter_category_abbreviation_and_more.py +0 -0
  25. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/canteen/migrations/0010_alter_consumption_options_alter_ingredient_options_and_more.py +0 -0
  26. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/canteen/migrations/0011_category_pin_to_consumptions_top.py +0 -0
  27. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/canteen/migrations/0012_alter_ingredient_storage_date.py +0 -0
  28. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/canteen/migrations/__init__.py +0 -0
  29. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/canteen/models.py +0 -0
  30. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/canteen/templates/canteen/category/create.html +0 -0
  31. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/canteen/templates/canteen/category/delete.html +0 -0
  32. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/canteen/templates/canteen/category/list.html +0 -0
  33. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/canteen/templates/canteen/category/update.html +0 -0
  34. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/canteen/templates/canteen/close.html +0 -0
  35. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/canteen/templates/canteen/consumption/_create.html +0 -0
  36. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/canteen/templates/canteen/consumption/create.html +0 -0
  37. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/canteen/templates/canteen/ingredient/close.html +0 -0
  38. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/canteen/templates/canteen/ingredient/create.html +0 -0
  39. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/canteen/templates/canteen/ingredient/create_one.html +0 -0
  40. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/canteen/templates/canteen/ingredient/delete.html +0 -0
  41. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/canteen/templates/canteen/ingredient/list.html +0 -0
  42. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/canteen/templates/canteen/ingredient/update.html +0 -0
  43. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/canteen/templates/canteen/meal_type/create.html +0 -0
  44. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/canteen/templates/canteen/meal_type/delete.html +0 -0
  45. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/canteen/templates/canteen/meal_type/list.html +0 -0
  46. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/canteen/templates/canteen/meal_type/update.html +0 -0
  47. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/canteen/tests.py +0 -0
  48. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/canteen/urls.py +0 -0
  49. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/canteen/workbook/__init__.py +0 -0
  50. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/fnschool/__init__.py +0 -0
  51. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/fnschool/asgi.py +0 -0
  52. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/fnschool/settings.py +0 -0
  53. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/fnschool/templatetags/__init__.py +0 -0
  54. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/fnschool/templatetags/fnschool_tags.py +0 -0
  55. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/fnschool/urls.py +0 -0
  56. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/fnschool/views.py +0 -0
  57. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/fnschool/wsgi.py +0 -0
  58. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/locale/en/LC_MESSAGES/django.mo +0 -0
  59. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/locale/zh_Hans/LC_MESSAGES/django.mo +0 -0
  60. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/manage.py +0 -0
  61. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/profiles/__init__.py +0 -0
  62. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/profiles/admin.py +0 -0
  63. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/profiles/apps.py +0 -0
  64. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/profiles/forms.py +0 -0
  65. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/profiles/migrations/0001_initial.py +0 -0
  66. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/profiles/migrations/0002_alter_profile_bio.py +0 -0
  67. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/profiles/migrations/0003_alter_profile_options_alter_profile_address_and_more.py +0 -0
  68. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/profiles/migrations/0004_profile_gender.py +0 -0
  69. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/profiles/migrations/0005_alter_profile_gender.py +0 -0
  70. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/profiles/migrations/__init__.py +0 -0
  71. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/profiles/models.py +0 -0
  72. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/profiles/signals.py +0 -0
  73. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/profiles/templates/profiles/create.html +0 -0
  74. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/profiles/templates/profiles/detail.html +0 -0
  75. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/profiles/templates/profiles/edit.html +0 -0
  76. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/profiles/templates/profiles/log_in.html +0 -0
  77. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/profiles/templates/profiles/log_out.html +0 -0
  78. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/profiles/tests.py +0 -0
  79. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/profiles/urls.py +0 -0
  80. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/profiles/views.py +0 -0
  81. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/static/css/bootstrap.min.css +0 -0
  82. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/static/css/fnschool.css +0 -0
  83. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/static/images/favicon.ico +0 -0
  84. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/static/js/bootstrap.bundle.min.js +0 -0
  85. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/static/js/bootstrap.min.js +0 -0
  86. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/static/js/fnschool.js +0 -0
  87. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/static/js/jquery.min.js +0 -0
  88. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/static/js/jquery.slim.min.js +0 -0
  89. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/static/js/popper.min.js +0 -0
  90. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/templates/base/_content.html +0 -0
  91. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/templates/base/_css.html +0 -0
  92. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/templates/base/_js.html +0 -0
  93. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/templates/base/content.html +0 -0
  94. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/templates/base/header_content_footer.html +0 -0
  95. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/templates/close.html +0 -0
  96. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/templates/home.html +0 -0
  97. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/templates/includes/_footer.html +0 -0
  98. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/templates/includes/_header.html +0 -0
  99. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/templates/includes/_navigation.html +0 -0
  100. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/templates/includes/_paginator.html +0 -0
  101. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/templates/registration/logged_out.html +0 -0
  102. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschoo1/templates/registration/login.html +0 -0
  103. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschool.egg-info/dependency_links.txt +0 -0
  104. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschool.egg-info/entry_points.txt +0 -0
  105. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschool.egg-info/requires.txt +0 -0
  106. {fnschool-20251012.81427.834 → fnschool-20251013.80821.836}/src/fnschool.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fnschool
3
- Version: 20251012.81427.834
3
+ Version: 20251013.80821.836
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>
@@ -6,7 +6,7 @@ import random
6
6
  import sys
7
7
  from pathlib import Path
8
8
 
9
- __version__ = "20251012.81427.834"
9
+ __version__ = "20251013.80821.836"
10
10
 
11
11
  FNSCHOOL_PATH = Path(__file__).parent
12
12
  if FNSCHOOL_PATH.as_posix() not in sys.path:
@@ -37,7 +37,7 @@ def main():
37
37
  "forget to activate a virtual environment?"
38
38
  ) from exc
39
39
 
40
- if not "runserver" in sys.argv:
40
+ if len(sys.argv) < 2:
41
41
  local_port = str(random.randint(8080, 65530))
42
42
  local_url = "http://127.0.0.1:" + local_port
43
43
  sys.argv.append("runserver")
@@ -0,0 +1,197 @@
1
+ # Generated by Django 4.2.25 on 2025-10-12 07:14
2
+
3
+ import django.core.validators
4
+ import django.db.models.deletion
5
+ import django.utils.timezone
6
+ from django.conf import settings
7
+ from django.db import migrations, models
8
+
9
+
10
+ class Migration(migrations.Migration):
11
+
12
+ dependencies = [
13
+ migrations.swappable_dependency(settings.AUTH_USER_MODEL),
14
+ ("canteen", "0012_alter_ingredient_storage_date"),
15
+ ]
16
+
17
+ operations = [
18
+ migrations.AlterModelOptions(
19
+ name="consumption",
20
+ options={
21
+ "ordering": ["-date_of_using"],
22
+ "verbose_name": "消耗记录",
23
+ "verbose_name_plural": "消耗记录列表",
24
+ },
25
+ ),
26
+ migrations.AlterModelOptions(
27
+ name="ingredient",
28
+ options={
29
+ "verbose_name": "Ingredient",
30
+ "verbose_name_plural": "食材列表",
31
+ },
32
+ ),
33
+ migrations.AlterField(
34
+ model_name="category",
35
+ name="abbreviation",
36
+ field=models.CharField(
37
+ blank=True, max_length=100, null=True, verbose_name="简称"
38
+ ),
39
+ ),
40
+ migrations.AlterField(
41
+ model_name="category",
42
+ name="created_at",
43
+ field=models.DateField(verbose_name="创建日期"),
44
+ ),
45
+ migrations.AlterField(
46
+ model_name="category",
47
+ name="is_disabled",
48
+ field=models.BooleanField(default=False, verbose_name="已禁用"),
49
+ ),
50
+ migrations.AlterField(
51
+ model_name="category",
52
+ name="name",
53
+ field=models.CharField(max_length=100, verbose_name="食材大类名"),
54
+ ),
55
+ migrations.AlterField(
56
+ model_name="category",
57
+ name="pin_to_consumptions_top",
58
+ field=models.BooleanField(default=False, verbose_name="置顶出库"),
59
+ ),
60
+ migrations.AlterField(
61
+ model_name="category",
62
+ name="user",
63
+ field=models.ForeignKey(
64
+ on_delete=django.db.models.deletion.CASCADE,
65
+ related_name="Categories",
66
+ to=settings.AUTH_USER_MODEL,
67
+ verbose_name="大类",
68
+ ),
69
+ ),
70
+ migrations.AlterField(
71
+ model_name="consumption",
72
+ name="date_of_using",
73
+ field=models.DateField(verbose_name="日期"),
74
+ ),
75
+ migrations.AlterField(
76
+ model_name="consumption",
77
+ name="ingredient",
78
+ field=models.ForeignKey(
79
+ on_delete=django.db.models.deletion.CASCADE,
80
+ related_name="consumptions",
81
+ to="canteen.ingredient",
82
+ verbose_name="食材",
83
+ ),
84
+ ),
85
+ migrations.AlterField(
86
+ model_name="consumption",
87
+ name="is_disabled",
88
+ field=models.BooleanField(default=False, verbose_name="已禁用"),
89
+ ),
90
+ migrations.AlterField(
91
+ model_name="ingredient",
92
+ name="category",
93
+ field=models.ForeignKey(
94
+ on_delete=django.db.models.deletion.PROTECT,
95
+ related_name="ingredients",
96
+ to="canteen.category",
97
+ verbose_name="大类",
98
+ ),
99
+ ),
100
+ migrations.AlterField(
101
+ model_name="ingredient",
102
+ name="is_disabled",
103
+ field=models.BooleanField(default=False, verbose_name="禁用"),
104
+ ),
105
+ migrations.AlterField(
106
+ model_name="ingredient",
107
+ name="is_ignorable",
108
+ field=models.BooleanField(default=False, verbose_name="不入库"),
109
+ ),
110
+ migrations.AlterField(
111
+ model_name="ingredient",
112
+ name="meal_type",
113
+ field=models.ForeignKey(
114
+ on_delete=django.db.models.deletion.PROTECT,
115
+ related_name="ingredients",
116
+ to="canteen.mealtype",
117
+ verbose_name="餐类",
118
+ ),
119
+ ),
120
+ migrations.AlterField(
121
+ model_name="ingredient",
122
+ name="name",
123
+ field=models.CharField(max_length=100, verbose_name="食材名"),
124
+ ),
125
+ migrations.AlterField(
126
+ model_name="ingredient",
127
+ name="quantity",
128
+ field=models.IntegerField(
129
+ validators=[django.core.validators.MinValueValidator(0)],
130
+ verbose_name="数量",
131
+ ),
132
+ ),
133
+ migrations.AlterField(
134
+ model_name="ingredient",
135
+ name="quantity_unit_name",
136
+ field=models.CharField(
137
+ blank=True, max_length=20, null=True, verbose_name="数量单位"
138
+ ),
139
+ ),
140
+ migrations.AlterField(
141
+ model_name="ingredient",
142
+ name="storage_date",
143
+ field=models.DateField(
144
+ default=django.utils.timezone.now, verbose_name="入库日期"
145
+ ),
146
+ preserve_default=False,
147
+ ),
148
+ migrations.AlterField(
149
+ model_name="ingredient",
150
+ name="total_price",
151
+ field=models.DecimalField(
152
+ decimal_places=2, max_digits=10, verbose_name="总价"
153
+ ),
154
+ ),
155
+ migrations.AlterField(
156
+ model_name="ingredient",
157
+ name="user",
158
+ field=models.ForeignKey(
159
+ on_delete=django.db.models.deletion.CASCADE,
160
+ related_name="ingredients",
161
+ to=settings.AUTH_USER_MODEL,
162
+ verbose_name="用户",
163
+ ),
164
+ ),
165
+ migrations.AlterField(
166
+ model_name="mealtype",
167
+ name="abbreviation",
168
+ field=models.CharField(
169
+ blank=True, max_length=100, null=True, verbose_name="简称"
170
+ ),
171
+ ),
172
+ migrations.AlterField(
173
+ model_name="mealtype",
174
+ name="created_at",
175
+ field=models.DateField(verbose_name="创建日期"),
176
+ ),
177
+ migrations.AlterField(
178
+ model_name="mealtype",
179
+ name="is_disabled",
180
+ field=models.BooleanField(default=False, verbose_name="已禁用"),
181
+ ),
182
+ migrations.AlterField(
183
+ model_name="mealtype",
184
+ name="name",
185
+ field=models.CharField(max_length=100, verbose_name="餐类名称"),
186
+ ),
187
+ migrations.AlterField(
188
+ model_name="mealtype",
189
+ name="user",
190
+ field=models.ForeignKey(
191
+ on_delete=django.db.models.deletion.CASCADE,
192
+ related_name="meal_types",
193
+ to=settings.AUTH_USER_MODEL,
194
+ verbose_name="餐类",
195
+ ),
196
+ ),
197
+ ]
@@ -421,7 +421,7 @@ def list_ingredients(request):
421
421
  if c.get("category__name") in search_query
422
422
  ]
423
423
  for category in categories:
424
- queries &= Q(category__icontains=category)
424
+ queries &= Q(category__name__icontains=category)
425
425
  search_query = search_query.replace(category, "")
426
426
 
427
427
  meal_types = Ingredient.objects.values("meal_type__name").distinct()
@@ -431,7 +431,7 @@ def list_ingredients(request):
431
431
  if m.get("meal_type__name") in search_query
432
432
  ]
433
433
  for meal_type in meal_types:
434
- queries &= Q(meal_type__icontains=meal_type)
434
+ queries &= Q(meal_type__name__icontains=meal_type)
435
435
  search_query = search_query.replace(meal_type, "")
436
436
 
437
437
  names = re.split(r"\s+", search_query)
@@ -1597,54 +1597,66 @@ class CanteenWorkBook:
1597
1597
  & Q(is_disabled=False)
1598
1598
  & Q(is_ignorable=False)
1599
1599
  ).all()
1600
- month_days = [
1601
- self.date_start + timedelta(days=i)
1602
- for i in range((self.date_end - self.date_start).days)
1603
- ]
1604
- month_days.append(self.date_end)
1605
-
1606
- min_storage_date = min(
1607
- [
1608
- i.storage_date
1609
- for i in ingredients
1610
- if i.storage_date >= self.date_start
1600
+
1601
+ consumptions = []
1602
+ for ingredient in ingredients:
1603
+ consumptions += [
1604
+ c
1605
+ for c in ingredient.consumptions.filter(
1606
+ Q(is_disabled=False)
1607
+ ).all()
1611
1608
  ]
1609
+
1610
+ inventory_days = []
1611
+ dates_of_using = sorted(
1612
+ list(set([c.date_of_using for c in consumptions]))
1613
+ )
1614
+ for i, date_of_using in enumerate(dates_of_using):
1615
+ if i + 1 < len(dates_of_using):
1616
+ if (date_of_using + timedelta(days=1)) < dates_of_using[i + 1]:
1617
+ inventory_days.append(date_of_using)
1618
+ else:
1619
+ inventory_days.append(date_of_using)
1620
+ inventory_days.insert(
1621
+ 0, (self.date_start.replace(day=1) - timedelta(days=1))
1612
1622
  )
1613
- print("min_storage_date", min_storage_date)
1614
- sundays = [
1615
- d for d in month_days if d.weekday() == 6 and d >= min_storage_date
1616
- ]
1617
1623
 
1618
1624
  formed_ingredients = []
1619
- for sunday in sundays:
1620
- sunday_ingredients = []
1625
+ for inventory_day in inventory_days:
1626
+ inventory_day_ingredients = []
1621
1627
  for ingredient in ingredients:
1628
+ if (
1629
+ ingredient.storage_date > inventory_day
1630
+ and inventory_day != inventory_days[-1]
1631
+ ):
1632
+ continue
1622
1633
  remaining_quantity = ingredient.quantity - sum(
1623
1634
  [
1624
1635
  c.amount_used
1625
1636
  for c in ingredient.consumptions.filter(
1626
1637
  Q(is_disabled=False)
1638
+ & Q(date_of_using__lte=inventory_day)
1627
1639
  ).all()
1628
- if c.date_of_using <= sunday
1629
1640
  ]
1630
1641
  )
1631
1642
  if remaining_quantity > Decimal("0.0"):
1632
- sunday_ingredients.append(ingredient)
1633
- print(ingredient.name, remaining_quantity)
1634
- form_count = len(sunday_ingredients) / ingredient_rows_count
1643
+ inventory_day_ingredients.append(ingredient)
1644
+ form_count = len(inventory_day_ingredients) / ingredient_rows_count
1635
1645
  surplus_ingredients_len = (
1636
- len(sunday_ingredients) % ingredient_rows_count
1646
+ len(inventory_day_ingredients) % ingredient_rows_count
1637
1647
  )
1638
1648
  fake_ingredients_len = (
1639
1649
  ingredient_rows_count - surplus_ingredients_len
1640
1650
  )
1641
1651
 
1642
- sunday_ingredients = sorted(
1643
- sunday_ingredients, key=lambda i: i.category.name
1652
+ inventory_day_ingredients = sorted(
1653
+ inventory_day_ingredients, key=lambda i: i.category.name
1644
1654
  )
1645
1655
 
1646
- s_ingredient0 = sunday_ingredients[0]
1647
- sunday_ingredients += [
1656
+ if len(inventory_day_ingredients) < 1:
1657
+ continue
1658
+ s_ingredient0 = inventory_day_ingredients[0]
1659
+ inventory_day_ingredients += [
1648
1660
  Ingredient(
1649
1661
  user=user,
1650
1662
  storage_date=self.date_start,
@@ -1660,17 +1672,21 @@ class CanteenWorkBook:
1660
1672
  for i in range(fake_ingredients_len)
1661
1673
  ]
1662
1674
  for index in range(
1663
- 0, len(sunday_ingredients), ingredient_rows_count
1675
+ 0, len(inventory_day_ingredients), ingredient_rows_count
1664
1676
  ):
1665
- split_ingredients = sunday_ingredients[
1677
+ split_ingredients = inventory_day_ingredients[
1666
1678
  index : index + ingredient_rows_count
1667
1679
  ]
1668
1680
 
1669
- formed_ingredients.append([sunday, index, split_ingredients])
1681
+ formed_ingredients.append(
1682
+ [inventory_day, index, split_ingredients]
1683
+ )
1670
1684
 
1671
- for index, (sunday, sunday_index, ingredients) in enumerate(
1672
- formed_ingredients
1673
- ):
1685
+ for index, (
1686
+ inventory_day,
1687
+ inventory_day_index,
1688
+ ingredients,
1689
+ ) in enumerate(formed_ingredients):
1674
1690
 
1675
1691
  title_row_num = (ingredient_rows_count + 8) * index + 1
1676
1692
  title_cell = sheet.cell(title_row_num, 1)
@@ -1693,9 +1709,9 @@ class CanteenWorkBook:
1693
1709
  )
1694
1710
  ).format(
1695
1711
  affiliation=user.affiliation,
1696
- year=sunday.year,
1697
- month=sunday.month,
1698
- day=sunday.day,
1712
+ year=inventory_day.year,
1713
+ month=inventory_day.month,
1714
+ day=inventory_day.day,
1699
1715
  )
1700
1716
 
1701
1717
  sub_title_affiliation_date_cell.font = self.font_12
@@ -1766,6 +1782,7 @@ class CanteenWorkBook:
1766
1782
  )
1767
1783
 
1768
1784
  summary_total_price = Decimal("0.0")
1785
+ formed_ingredients_index = index
1769
1786
  for index, ingredient in enumerate(ingredients):
1770
1787
  ingredient_row_num = header1_row_num + index + 1
1771
1788
  ingredient_quantity = (
@@ -1774,9 +1791,9 @@ class CanteenWorkBook:
1774
1791
  [
1775
1792
  c.amount_used
1776
1793
  for c in ingredient.consumptions.filter(
1777
- is_disabled=False
1794
+ Q(date_of_using__lte=inventory_day)
1795
+ & Q(is_disabled=False)
1778
1796
  ).all()
1779
- if c.date_of_using <= sunday
1780
1797
  ]
1781
1798
  )
1782
1799
  if ingredient.id
@@ -1808,25 +1825,29 @@ class CanteenWorkBook:
1808
1825
 
1809
1826
  summary_row_num = header1_row_num + ingredient_rows_count + 1
1810
1827
 
1811
- prev_sunday = (
1812
- formed_ingredients[index - 1][0]
1813
- if 0 <= index - 1 < len(formed_ingredients)
1828
+ prev_inventory_day = (
1829
+ formed_ingredients[formed_ingredients_index - 1][0]
1830
+ if 0 <= formed_ingredients_index - 1 < len(formed_ingredients)
1814
1831
  else None
1815
1832
  )
1816
- next_sunday = (
1817
- storaged_ingredients[index + 1][0]
1818
- if 0 < index + 1 < (len(formed_ingredients) - 1)
1833
+ next_inventory_day = (
1834
+ formed_ingredients[formed_ingredients_index + 1][0]
1835
+ if 0 < formed_ingredients_index + 1 < len(formed_ingredients)
1819
1836
  else None
1820
1837
  )
1821
- summary_1_value = ""
1838
+ summary_col1_value = ""
1822
1839
 
1823
- if not next_sunday or not next_sunday == sunday:
1824
- summary_1_value = _("Summary Total Price (Surplus Sheet)")
1840
+ if next_inventory_day and next_inventory_day == inventory_day:
1841
+ summary_col1_value = _(
1842
+ "Sub0-summary Total Price (Surplus Sheet)"
1843
+ )
1844
+ else:
1845
+ summary_col1_value = _("Summary Total Price (Surplus Sheet)")
1825
1846
  summary_total_price = Decimal("0.0")
1826
1847
  ingredients_list = [
1827
1848
  __ingredients
1828
- for __sunday, __sunday_index, __ingredients in formed_ingredients
1829
- if __sunday == sunday
1849
+ for __inventory_day, __inventory_day_index, __ingredients in formed_ingredients
1850
+ if __inventory_day == inventory_day
1830
1851
  ]
1831
1852
  for ingredients in ingredients_list:
1832
1853
  for ingredient in ingredients:
@@ -1835,7 +1856,8 @@ class CanteenWorkBook:
1835
1856
  [
1836
1857
  c.amount_used
1837
1858
  for c in ingredient.consumptions.filter(
1838
- is_disabled=False
1859
+ Q(is_disabled=False)
1860
+ & Q(date_of_using__lte=inventory_day)
1839
1861
  ).all()
1840
1862
  ]
1841
1863
  )
@@ -1846,10 +1868,7 @@ class CanteenWorkBook:
1846
1868
  ingredient_quantity * ingredient.unit_price
1847
1869
  )
1848
1870
 
1849
- else:
1850
- summary_1_value = _("Sub0-summary Total Price (Surplus Sheet)")
1851
-
1852
- sheet.cell(summary_row_num, 1, summary_1_value)
1871
+ sheet.cell(summary_row_num, 1, summary_col1_value)
1853
1872
 
1854
1873
  sheet.cell(summary_row_num, 4, summary_total_price)
1855
1874
  sheet.cell(summary_row_num, 6, summary_total_price)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fnschool
3
- Version: 20251012.81427.834
3
+ Version: 20251013.80821.836
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>
@@ -23,6 +23,7 @@ src/fnschoo1/canteen/migrations/0009_alter_category_abbreviation_and_more.py
23
23
  src/fnschoo1/canteen/migrations/0010_alter_consumption_options_alter_ingredient_options_and_more.py
24
24
  src/fnschoo1/canteen/migrations/0011_category_pin_to_consumptions_top.py
25
25
  src/fnschoo1/canteen/migrations/0012_alter_ingredient_storage_date.py
26
+ src/fnschoo1/canteen/migrations/0013_alter_consumption_options_alter_ingredient_options_and_more.py
26
27
  src/fnschoo1/canteen/migrations/__init__.py
27
28
  src/fnschoo1/canteen/templates/canteen/close.html
28
29
  src/fnschoo1/canteen/templates/canteen/category/create.html