mirror of
https://github.com/ae-utbm/sith.git
synced 2025-11-09 21:43:07 +00:00
@@ -1,7 +1,7 @@
|
||||
repos:
|
||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||
# Ruff version.
|
||||
rev: v0.11.13
|
||||
rev: v0.14.4
|
||||
hooks:
|
||||
- id: ruff-check # just check the code, and print the errors
|
||||
- id: ruff-check # actually fix the fixable errors, but print nothing
|
||||
@@ -14,7 +14,7 @@ repos:
|
||||
- id: biome-check
|
||||
additional_dependencies: ["@biomejs/biome@1.9.4"]
|
||||
- repo: https://github.com/rtts/djhtml
|
||||
rev: 3.0.7
|
||||
rev: 3.0.10
|
||||
hooks:
|
||||
- id: djhtml
|
||||
name: format templates
|
||||
|
||||
@@ -1157,8 +1157,6 @@ class QuickUploadImage(models.Model):
|
||||
identifier = str(uuid4())
|
||||
name = Path(image.name).stem[: cls.IMAGE_NAME_SIZE - 1]
|
||||
file = File(convert_image(image), name=f"{identifier}.webp")
|
||||
width, height = Image.open(file).size
|
||||
|
||||
return cls.objects.create(
|
||||
uuid=identifier,
|
||||
name=name,
|
||||
|
||||
@@ -86,7 +86,7 @@ class CustomerQuerySet(models.QuerySet):
|
||||
.annotate(res=Sum(F("unit_price") * F("quantity"), default=0))
|
||||
.values("res")
|
||||
)
|
||||
return self.update(amount=Coalesce(money_in - money_out, Decimal("0")))
|
||||
return self.update(amount=Coalesce(money_in - money_out, Decimal(0)))
|
||||
|
||||
|
||||
class Customer(models.Model):
|
||||
|
||||
@@ -355,7 +355,7 @@ class TestCounterClick(TestFullClickBase):
|
||||
self.submit_basket(self.barmen, [BasketItem(self.beer.id, 1)])
|
||||
).status_code == 302
|
||||
|
||||
assert self.updated_amount(self.barmen) == Decimal("9")
|
||||
assert self.updated_amount(self.barmen) == Decimal(9)
|
||||
|
||||
def test_click_tray_price(self):
|
||||
force_refill_user(self.customer, 20)
|
||||
@@ -364,12 +364,12 @@ class TestCounterClick(TestFullClickBase):
|
||||
# Not applying tray price
|
||||
res = self.submit_basket(self.customer, [BasketItem(self.beer_tap.id, 2)])
|
||||
assert res.status_code == 302
|
||||
assert self.updated_amount(self.customer) == Decimal("17")
|
||||
assert self.updated_amount(self.customer) == Decimal(17)
|
||||
|
||||
# Applying tray price
|
||||
res = self.submit_basket(self.customer, [BasketItem(self.beer_tap.id, 7)])
|
||||
assert res.status_code == 302
|
||||
assert self.updated_amount(self.customer) == Decimal("8")
|
||||
assert self.updated_amount(self.customer) == Decimal(8)
|
||||
|
||||
def test_click_alcool_unauthorized(self):
|
||||
self.login_in_bar()
|
||||
@@ -381,13 +381,13 @@ class TestCounterClick(TestFullClickBase):
|
||||
res = self.submit_basket(user, [BasketItem(self.snack.id, 2)])
|
||||
assert res.status_code == 302
|
||||
|
||||
assert self.updated_amount(user) == Decimal("7")
|
||||
assert self.updated_amount(user) == Decimal(7)
|
||||
|
||||
# Buy product without age limit
|
||||
res = self.submit_basket(user, [BasketItem(self.beer.id, 2)])
|
||||
assert res.status_code == 200
|
||||
|
||||
assert self.updated_amount(user) == Decimal("7")
|
||||
assert self.updated_amount(user) == Decimal(7)
|
||||
|
||||
def test_click_unauthorized_customer(self):
|
||||
self.login_in_bar()
|
||||
@@ -401,7 +401,7 @@ class TestCounterClick(TestFullClickBase):
|
||||
assert resp.status_code == 302
|
||||
assert resp.url == resolve_url(self.counter)
|
||||
|
||||
assert self.updated_amount(user) == Decimal("10")
|
||||
assert self.updated_amount(user) == Decimal(10)
|
||||
|
||||
def test_click_user_without_customer(self):
|
||||
self.login_in_bar()
|
||||
@@ -418,7 +418,7 @@ class TestCounterClick(TestFullClickBase):
|
||||
)
|
||||
assert res.status_code == 302
|
||||
|
||||
assert self.updated_amount(self.customer_old_can_buy) == Decimal("7")
|
||||
assert self.updated_amount(self.customer_old_can_buy) == Decimal(7)
|
||||
|
||||
def test_click_wrong_counter(self):
|
||||
self.login_in_bar()
|
||||
@@ -443,7 +443,7 @@ class TestCounterClick(TestFullClickBase):
|
||||
)
|
||||
assertRedirects(res, self.counter.get_absolute_url())
|
||||
|
||||
assert self.updated_amount(self.customer) == Decimal("10")
|
||||
assert self.updated_amount(self.customer) == Decimal(10)
|
||||
|
||||
def test_click_not_connected(self):
|
||||
force_refill_user(self.customer, 10)
|
||||
@@ -455,7 +455,7 @@ class TestCounterClick(TestFullClickBase):
|
||||
)
|
||||
assert res.status_code == 403
|
||||
|
||||
assert self.updated_amount(self.customer) == Decimal("10")
|
||||
assert self.updated_amount(self.customer) == Decimal(10)
|
||||
|
||||
def test_click_product_not_in_counter(self):
|
||||
force_refill_user(self.customer, 10)
|
||||
@@ -463,7 +463,7 @@ class TestCounterClick(TestFullClickBase):
|
||||
|
||||
res = self.submit_basket(self.customer, [BasketItem(self.stamps.id, 2)])
|
||||
assert res.status_code == 200
|
||||
assert self.updated_amount(self.customer) == Decimal("10")
|
||||
assert self.updated_amount(self.customer) == Decimal(10)
|
||||
|
||||
def test_basket_empty(self):
|
||||
force_refill_user(self.customer, 10)
|
||||
@@ -477,7 +477,7 @@ class TestCounterClick(TestFullClickBase):
|
||||
self.submit_basket(self.customer, basket),
|
||||
self.counter.get_absolute_url(),
|
||||
)
|
||||
assert self.updated_amount(self.customer) == Decimal("10")
|
||||
assert self.updated_amount(self.customer) == Decimal(10)
|
||||
|
||||
def test_click_product_invalid(self):
|
||||
force_refill_user(self.customer, 10)
|
||||
@@ -490,7 +490,7 @@ class TestCounterClick(TestFullClickBase):
|
||||
BasketItem(self.beer.id, None),
|
||||
]:
|
||||
assert self.submit_basket(self.customer, [item]).status_code == 200
|
||||
assert self.updated_amount(self.customer) == Decimal("10")
|
||||
assert self.updated_amount(self.customer) == Decimal(10)
|
||||
|
||||
def test_click_not_enough_money(self):
|
||||
force_refill_user(self.customer, 10)
|
||||
@@ -501,7 +501,7 @@ class TestCounterClick(TestFullClickBase):
|
||||
)
|
||||
assert res.status_code == 200
|
||||
|
||||
assert self.updated_amount(self.customer) == Decimal("10")
|
||||
assert self.updated_amount(self.customer) == Decimal(10)
|
||||
|
||||
def test_annotate_has_barman_queryset(self):
|
||||
"""Test if the custom queryset method `annotate_has_barman` works as intended."""
|
||||
|
||||
@@ -242,7 +242,7 @@ class Invoice(models.Model):
|
||||
def validate(self):
|
||||
if self.validated:
|
||||
raise DataError(_("Invoice already validated"))
|
||||
customer, created = Customer.get_or_create(user=self.user)
|
||||
customer, _created = Customer.get_or_create(user=self.user)
|
||||
eboutic = Counter.objects.filter(type="EBOUTIC").first()
|
||||
for i in self.items.all():
|
||||
if i.type_id == settings.SITH_COUNTER_PRODUCTTYPE_REFILLING:
|
||||
|
||||
@@ -108,7 +108,7 @@ class TestPaymentSith(TestPaymentBase):
|
||||
)
|
||||
assert Basket.objects.filter(id=self.basket.id).first() is None
|
||||
self.customer.customer.refresh_from_db()
|
||||
assert self.customer.customer.amount == Decimal("1")
|
||||
assert self.customer.customer.amount == Decimal(1)
|
||||
|
||||
sellings = Selling.objects.filter(customer=self.customer.customer).order_by(
|
||||
"quantity"
|
||||
|
||||
1054
package-lock.json
generated
1054
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
58
package.json
58
package.json
@@ -24,48 +24,48 @@
|
||||
"#com:*": "./com/static/bundled/*"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.25.2",
|
||||
"@babel/preset-env": "^7.25.4",
|
||||
"@biomejs/biome": "1.9.4",
|
||||
"@babel/core": "^7.28.5",
|
||||
"@babel/preset-env": "^7.28.5",
|
||||
"@biomejs/biome": "^1.9.4",
|
||||
"@hey-api/openapi-ts": "^0.73.0",
|
||||
"@rollup/plugin-inject": "^5.0.5",
|
||||
"@types/alpinejs": "^3.13.10",
|
||||
"@types/cytoscape-cxtmenu": "^3.4.4",
|
||||
"@types/cytoscape-klay": "^3.1.4",
|
||||
"@types/alpinejs": "^3.13.11",
|
||||
"@types/cytoscape-cxtmenu": "^3.4.5",
|
||||
"@types/cytoscape-klay": "^3.1.5",
|
||||
"@types/js-cookie": "^3.0.6",
|
||||
"typescript": "^5.8.3",
|
||||
"vite": "^6.3.6",
|
||||
"typescript": "^5.9.3",
|
||||
"vite": "^6.4.1",
|
||||
"vite-bundle-visualizer": "^1.2.1",
|
||||
"vite-plugin-static-copy": "^3.1.2"
|
||||
"vite-plugin-static-copy": "^3.1.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"@alpinejs/sort": "^3.14.7",
|
||||
"@alpinejs/sort": "^3.15.1",
|
||||
"@arendjr/text-clipper": "npm:@jsr/arendjr__text-clipper@^3.0.0",
|
||||
"@floating-ui/dom": "^1.6.13",
|
||||
"@fortawesome/fontawesome-free": "^6.6.0",
|
||||
"@fullcalendar/core": "^6.1.15",
|
||||
"@fullcalendar/daygrid": "^6.1.15",
|
||||
"@fullcalendar/icalendar": "^6.1.15",
|
||||
"@fullcalendar/list": "^6.1.15",
|
||||
"@sentry/browser": "^9.29.0",
|
||||
"@zip.js/zip.js": "^2.7.52",
|
||||
"3d-force-graph": "^1.73.4",
|
||||
"alpinejs": "^3.14.7",
|
||||
"chart.js": "^4.4.4",
|
||||
"@floating-ui/dom": "^1.7.4",
|
||||
"@fortawesome/fontawesome-free": "^6.7.2",
|
||||
"@fullcalendar/core": "^6.1.19",
|
||||
"@fullcalendar/daygrid": "^6.1.19",
|
||||
"@fullcalendar/icalendar": "^6.1.19",
|
||||
"@fullcalendar/list": "^6.1.19",
|
||||
"@sentry/browser": "^9.46.0",
|
||||
"@zip.js/zip.js": "^2.8.9",
|
||||
"3d-force-graph": "^1.79.0",
|
||||
"alpinejs": "^3.15.1",
|
||||
"chart.js": "^4.5.1",
|
||||
"country-flag-emoji-polyfill": "^0.1.8",
|
||||
"cytoscape": "^3.30.2",
|
||||
"cytoscape": "^3.33.1",
|
||||
"cytoscape-cxtmenu": "^3.5.0",
|
||||
"cytoscape-klay": "^3.1.4",
|
||||
"d3-force-3d": "^3.0.5",
|
||||
"easymde": "^2.19.0",
|
||||
"glob": "^11.0.0",
|
||||
"d3-force-3d": "^3.0.6",
|
||||
"easymde": "^2.20.0",
|
||||
"glob": "^11.0.3",
|
||||
"html2canvas": "^1.4.1",
|
||||
"htmx.org": "^2.0.3",
|
||||
"htmx.org": "^2.0.8",
|
||||
"js-cookie": "^3.0.5",
|
||||
"lit-html": "^3.3.0",
|
||||
"lit-html": "^3.3.1",
|
||||
"native-file-system-adapter": "^3.0.1",
|
||||
"three": "^0.177.0",
|
||||
"three-spritetext": "^1.9.0",
|
||||
"tom-select": "^2.3.1"
|
||||
"three-spritetext": "^1.10.0",
|
||||
"tom-select": "^2.4.3"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,36 +19,36 @@ authors = [
|
||||
license = { text = "GPL-3.0-only" }
|
||||
requires-python = "<4.0,>=3.12"
|
||||
dependencies = [
|
||||
"django>=5.2.1,<6.0.0",
|
||||
"django-ninja<2.0.0,>=1.4.0",
|
||||
"django-ninja-extra<1.0.0,>=0.22.9",
|
||||
"Pillow<12.0.0,>=11.1.0",
|
||||
"mistune<4.0.0,>=3.1.3",
|
||||
"django>=5.2.8,<6.0.0",
|
||||
"django-ninja>=1.4.5,<2.0.0",
|
||||
"django-ninja-extra>=0.30.2,<1.0.0",
|
||||
"Pillow>=12.0.0,<13.0.0",
|
||||
"mistune>=3.1.4,<4.0.0",
|
||||
"django-jinja<3.0.0,>=2.11.0",
|
||||
"cryptography>=45.0.3,<46.0.0",
|
||||
"django-phonenumber-field<9.0.0,>=8.1.0",
|
||||
"phonenumbers>=9.0.2,<10.0.0",
|
||||
"reportlab<5.0.0,>=4.3.1",
|
||||
"cryptography>=46.0.3,<47.0.0",
|
||||
"django-phonenumber-field>=8.3.0,<9.0.0",
|
||||
"phonenumbers>=9.0.18,<10.0.0",
|
||||
"reportlab>=4.4.4,<5.0.0",
|
||||
"django-haystack<4.0.0,>=3.3.0",
|
||||
"xapian-haystack<4.0.0,>=3.1.0",
|
||||
"libsass<1.0.0,>=0.23.0",
|
||||
"django-ordered-model<4.0.0,>=3.7.4",
|
||||
"django-simple-captcha<1.0.0,>=0.6.2",
|
||||
"python-dateutil<3.0.0.0,>=2.9.0.post0",
|
||||
"sentry-sdk<3.0.0,>=2.25.1",
|
||||
"sentry-sdk>=2.43.0,<3.0.0",
|
||||
"jinja2<4.0.0,>=3.1.6",
|
||||
"django-countries<8.0.0,>=7.6.1",
|
||||
"dict2xml<2.0.0,>=1.7.6",
|
||||
"django-countries>=8.0.0,<9.0.0",
|
||||
"dict2xml>=1.7.7,<2.0.0",
|
||||
"Sphinx<6,>=5",
|
||||
"tomli<3.0.0,>=2.2.1",
|
||||
"tomli>=2.3.0,<3.0.0",
|
||||
"django-honeypot>=1.3.0,<2",
|
||||
"pydantic-extra-types<3.0.0,>=2.10.3",
|
||||
"ical>=11,<12",
|
||||
"pydantic-extra-types>=2.10.6,<3.0.0",
|
||||
"ical>=11.1.0,<12",
|
||||
"redis[hiredis]<7,>=5.3.0",
|
||||
"environs[django]<15.0.0,>=14.1.1",
|
||||
"requests>=2.32.3",
|
||||
"environs[django]>=14.5.0,<15.0.0",
|
||||
"requests>=2.32.5,<3.0.0",
|
||||
"honcho>=2.0.0",
|
||||
"psutil>=7.0.0",
|
||||
"psutil>=7.1.3,<8.0.0",
|
||||
"celery[redis]>=5.5.2",
|
||||
"django-celery-results>=2.5.1",
|
||||
"django-celery-beat>=2.7.0",
|
||||
@@ -60,32 +60,32 @@ documentation = "https://sith-ae.readthedocs.io/"
|
||||
|
||||
[dependency-groups]
|
||||
prod = [
|
||||
"psycopg[c]>=3.2.9,<4.0.0",
|
||||
"psycopg[c]>=3.2.12,<4.0.0",
|
||||
]
|
||||
dev = [
|
||||
"django-debug-toolbar>=6,<7",
|
||||
"ipython<10.0.0,>=9.0.2",
|
||||
"pre-commit<5.0.0,>=4.1.0",
|
||||
"ruff>=0.11.13,<1.0.0",
|
||||
"djhtml<4.0.0,>=3.0.7",
|
||||
"faker<38.0.0,>=37.0.0",
|
||||
"rjsmin<2.0.0,>=1.2.4",
|
||||
"django-debug-toolbar>=6.1.0,<7",
|
||||
"ipython>=9.7.0,<10.0.0",
|
||||
"pre-commit>=4.3.0,<5.0.0",
|
||||
"ruff>=0.14.4,<1.0.0",
|
||||
"djhtml>=3.0.10,<4.0.0",
|
||||
"faker>=37.12.0,<38.0.0",
|
||||
"rjsmin>=1.2.5,<2.0.0",
|
||||
]
|
||||
tests = [
|
||||
"freezegun<2.0.0,>=1.5.1",
|
||||
"pytest<9.0.0,>=8.3.5",
|
||||
"pytest-cov<7.0.0,>=6.0.0",
|
||||
"freezegun>=1.5.5,<2.0.0",
|
||||
"pytest>=8.4.2,<9.0.0",
|
||||
"pytest-cov>=7.0.0,<8.0.0",
|
||||
"pytest-django<5.0.0,>=4.10.0",
|
||||
"model-bakery<2.0.0,>=1.20.4",
|
||||
"beautifulsoup4>=4.13.3,<5",
|
||||
"lxml>=6,<7",
|
||||
"beautifulsoup4>=4.14.2,<5",
|
||||
"lxml>=6.0.2,<7",
|
||||
]
|
||||
docs = [
|
||||
"mkdocs<2.0.0,>=1.6.1",
|
||||
"mkdocs-material<10.0.0,>=9.6.7",
|
||||
"mkdocstrings<1.0.0,>=0.28.3",
|
||||
"mkdocstrings-python<2.0.0,>=1.16.3",
|
||||
"mkdocs-include-markdown-plugin<8.0.0,>=7.1.5",
|
||||
"mkdocs-material>=9.6.23,<10.0.0",
|
||||
"mkdocstrings>=0.30.1,<1.0.0",
|
||||
"mkdocstrings-python>=1.18.2,<2.0.0",
|
||||
"mkdocs-include-markdown-plugin>=7.2.0,<8.0.0",
|
||||
]
|
||||
|
||||
[tool.uv]
|
||||
|
||||
@@ -81,7 +81,7 @@ class Subscription(models.Model):
|
||||
|
||||
from counter.models import Customer
|
||||
|
||||
customer, _ = Customer.get_or_create(self.member)
|
||||
Customer.get_or_create(self.member)
|
||||
# Someone who subscribed once will be considered forever
|
||||
# as an old subscriber.
|
||||
self.member.groups.add(settings.SITH_GROUP_OLD_SUBSCRIBERS_ID)
|
||||
|
||||
Reference in New Issue
Block a user