Author SHA1 Message Date
Sbhayana e17157a93a Release notes: document bulk discount (closes #28)
continuous-integration/jenkins Jenkins: all gates passed
2026-12-03 00:41:04 +00:00
Sbhayana f976f56765 Merge pull request 'Allow v3 release in Ansible deploy validation (refs #25)' (#27) from fix/allow-v3-deploy into main
continuous-integration/jenkins Jenkins: all gates passed
Reviewed-on: #27
2026-12-01 20:15:43 +00:00
Sbhayana 9cc9ede5d8 Allow v3 release in Ansible deploy validation (refs #25) 2026-12-01 20:15:20 +00:00
Sbhayana d3cdee8f1f Merge pull request 'Bulk discount for 10+ units (Closes #25)' (#26) from fix/bulk-discount-25 into main
continuous-integration/jenkins Jenkins: a gate failed or approval was not given
Reviewed-on: #26
2026-12-01 20:08:30 +00:00
Sbhayana b0a3fb04da Apply 10% bulk discount for 10+ units; release v3 / 1.3 (closes #25)
continuous-integration/jenkins Jenkins: all gates passed
2026-12-01 19:34:47 +00:00
Sbhayana a160b84da6 Merge pull request 'Pipeline: semantic version major.minor.build, Pyreverse diagrams + LaTeX release notes, versioned ZIP artifact' (#24) from feature/demo-pipeline into main
Reviewed-on: #24
2026-12-01 15:44:27 +00:00
5 changed files with 18 additions and 5 deletions
+1 -1
View File
@@ -1 +1 @@
1.2
1.3
+1 -1
View File
@@ -11,7 +11,7 @@
that:
- target_env in ['staging', 'production']
- "'@sha256:' in release_image"
- expected_version in ['v1', 'v2']
- expected_version in ['v1', 'v2', 'v3']
- expected_total | int > 0
- public_url.startswith('https://')
- proxy_network | length > 0
+7 -2
View File
@@ -2,8 +2,10 @@ import os
from flask import Flask, jsonify, request
app = Flask(__name__)
VERSION = "v2"
VERSION = "v3"
UNIT_PRICE = 12
BULK_MIN_QUANTITY = 10
BULK_DISCOUNT = 0.10
COMMIT = os.environ.get("APP_COMMIT", "development")
BUILD = os.environ.get("APP_SEMVER", "development")
@@ -11,7 +13,10 @@ BUILD = os.environ.get("APP_SEMVER", "development")
def total_price(quantity):
if quantity < 1 or quantity > 1000:
raise ValueError("quantity must be between 1 and 1000")
return UNIT_PRICE * quantity
total = UNIT_PRICE * quantity
if quantity >= BULK_MIN_QUANTITY:
total = round(total * (1 - BULK_DISCOUNT), 2)
return total
@app.get("/")
+7 -1
View File
@@ -12,12 +12,18 @@ class PricingTests(unittest.TestCase):
self.assertEqual(response.status_code, 200)
self.assertEqual(response.json["total"], 36)
def test_bulk_discount(self):
self.assertEqual(total_price(9), 108)
self.assertEqual(total_price(10), 108.0)
r = self.client.get("/price?quantity=12")
self.assertEqual(r.json["total"], 129.6)
def test_invalid_quantity(self):
for value in ["0", "-1", "1001", "abc", "1.5"]:
self.assertEqual(self.client.get("/price?quantity=" + value).status_code, 400)
def test_release_identity(self):
self.assertEqual(self.client.get("/").json["version"], "v2")
self.assertEqual(self.client.get("/").json["version"], "v3")
self.assertEqual(self.client.get("/health").json["status"], "ok")
+2
View File
@@ -29,4 +29,6 @@ Class diagram of \texttt{app} and \texttt{test\_app}
\includegraphics[width=0.3\linewidth,keepaspectratio]{packages_pricing.png}\\[1ex]
Module (package) dependency diagram
\end{center}
Bulk discount: 10\% off orders of 10 or more units.
\end{document}