fnschool 20251012.81520.855__py3-none-any.whl → 20251013.80821.836__py3-none-any.whl

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.

fnschoo1/__init__.py CHANGED
@@ -6,7 +6,7 @@ import random
6
6
  import sys
7
7
  from pathlib import Path
8
8
 
9
- __version__ = "20251012.81520.855"
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:
@@ -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.81520.855
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>
@@ -1,4 +1,4 @@
1
- fnschoo1/__init__.py,sha256=xwXIxyOF7hS1i0IG9i2eEMLCovL3BDvqApE94-E5u4E,1496
1
+ fnschoo1/__init__.py,sha256=GeuZo0S1MIWL867jcYL4Zkuw_G1hZSc2SJs9eyxvd_g,1496
2
2
  fnschoo1/manage.py,sha256=pMv0yE2eTcNrgskSHDUdRrnY51iTm1DXg32I8mWDDqw,696
3
3
  fnschoo1/canteen/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  fnschoo1/canteen/admin.py,sha256=suMo4x8I3JBxAFBVIdE-5qnqZ6JAZV0FESABHOSc-vg,63
@@ -40,7 +40,7 @@ fnschoo1/canteen/templates/canteen/meal_type/delete.html,sha256=1UmCyXD-6lbYl-IE
40
40
  fnschoo1/canteen/templates/canteen/meal_type/list.html,sha256=c5kJUE1OgpRtSrMV4wFwL_gbRSaX_XMM4Zt1JTx34_g,1907
41
41
  fnschoo1/canteen/templates/canteen/meal_type/update.html,sha256=Rfv1TamSFIKHzvUNlgnmrPmfmzrehPpuo5Hv8VF0yek,818
42
42
  fnschoo1/canteen/workbook/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
43
- fnschoo1/canteen/workbook/generate.py,sha256=347Wg5WB90dLoQb5ZkMlCo4aV0L59FsWmKoE6BptGDg,82705
43
+ fnschoo1/canteen/workbook/generate.py,sha256=dSIhK0SKr7w_q7rFgdgjfvD68RRtdkiLW9wk3Z0vzWE,83686
44
44
  fnschoo1/fnschool/__init__.py,sha256=TmHhzykpKNMoMf6eD-EKvbvmnlzs1XGHtvD55ae1sXs,287
45
45
  fnschoo1/fnschool/asgi.py,sha256=kzkqosS10uBlyBX53EXcsATcvEZmac6nsPzyOHCuucE,393
46
46
  fnschoo1/fnschool/settings.py,sha256=l9Y1iQCivSfmsNfnHltfXLzxP6gG4VMIL4GEZgAp8YM,4357
@@ -93,9 +93,9 @@ fnschoo1/templates/includes/_navigation.html,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRk
93
93
  fnschoo1/templates/includes/_paginator.html,sha256=Z-Hxcdmun4SJ1YcHnWTDLfW8wrngROiBTwr4NZWaPP4,1246
94
94
  fnschoo1/templates/registration/logged_out.html,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
95
95
  fnschoo1/templates/registration/login.html,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
96
- fnschool-20251012.81520.855.dist-info/licenses/LICENSE,sha256=2n6rt7r999OuXp8iOqW9we7ORaxWncIbOwN1ILRGR2g,7651
97
- fnschool-20251012.81520.855.dist-info/METADATA,sha256=6ydEZqJHWItXNsyJlhkQ4DaYb4pQghd3-Cnl2_HOXUM,4752
98
- fnschool-20251012.81520.855.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
99
- fnschool-20251012.81520.855.dist-info/entry_points.txt,sha256=To2PDA9r0qhE0Wq1-M8hEE8uXxTrTe16BOcpKPT-q5g,47
100
- fnschool-20251012.81520.855.dist-info/top_level.txt,sha256=s6ZKnNm94Q0-247a50eI7jDK98uPF6P2kC9Ovd3LUlM,9
101
- fnschool-20251012.81520.855.dist-info/RECORD,,
96
+ fnschool-20251013.80821.836.dist-info/licenses/LICENSE,sha256=2n6rt7r999OuXp8iOqW9we7ORaxWncIbOwN1ILRGR2g,7651
97
+ fnschool-20251013.80821.836.dist-info/METADATA,sha256=Y1gulE_dYuQ74rqKBzcmPOJcrTpFiZyZwY14XsxoXLw,4752
98
+ fnschool-20251013.80821.836.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
99
+ fnschool-20251013.80821.836.dist-info/entry_points.txt,sha256=To2PDA9r0qhE0Wq1-M8hEE8uXxTrTe16BOcpKPT-q5g,47
100
+ fnschool-20251013.80821.836.dist-info/top_level.txt,sha256=s6ZKnNm94Q0-247a50eI7jDK98uPF6P2kC9Ovd3LUlM,9
101
+ fnschool-20251013.80821.836.dist-info/RECORD,,