SPB Git

spb/wp30_uqo

Public
8.4 KB · 15 lines json
1{2  "document_id": "exec_00008_2000",3  "family": "exec",4  "split": "train",5  "text": "ENGINEERING TICKET\n\nBug report BR-9591: the function net_revenue(rows) must compute the total net revenue of the rows list (each row is a dict with keys ['region', 'product', 'units', 'unit_price', 'discount_pct', 'returned', 'shipped_days']). Rules agreed with the client on 15 September 2031: (1) exclude returned rows; (2) exclude rows whose region is 'Ouest'; (3) exclude rows with fewer than 3 units; (4) line revenue = units * unit_price * (1 - discount_pct/100); (5) apply a tax of 5.0 % on the sum; (6) return the result rounded to 0 decimals (Python round). The current implementation forgets rule (2) and applies no tax.\n\nSample rows (first 6 of the extract):\n[{\"region\": \"Ouest\", \"product\": \"delta\", \"units\": 20, \"unit_price\": 27.18, \"discount_pct\": 15, \"returned\": true, \"shipped_days\": 12}, {\"region\": \"Centre\", \"product\": \"beta\", \"units\": 19, \"unit_price\": 55.08, \"discount_pct\": 10, \"returned\": true, \"shipped_days\": 2}, {\"region\": \"Ouest\", \"product\": \"gamma\", \"units\": 11, \"unit_price\": 28.44, \"discount_pct\": 15, \"returned\": false, \"shipped_days\": 6}, {\"region\": \"Nord\", \"product\": \"beta\", \"units\": 3, \"unit_price\": 59.67, \"discount_pct\": 0, \"returned\": false, \"shipped_days\": 9}, {\"region\": \"Nord\", \"product\": \"alpha\", \"units\": 21, \"unit_price\": 79.85, \"discount_pct\": 25, \"returned\": false, \"shipped_days\": 14}, {\"region\": \"Est\", \"product\": \"epsilon\", \"units\": 36, \"unit_price\": 26.43, \"discount_pct\": 5, \"returned\": false, \"shipped_days\": 6}]\n\nUnit tests live in the tests/ directory and are executed in CI on every push.\nUnit tests live in the tests/ directory and are executed in CI on every push.\nCode style follows the repository's formatter settings; do not reformat unrelated lines.\nUnit tests live in the tests/ directory and are executed in CI on every push.\nThe data dictionary defines shipped_days as the number of calendar days from order to shipment.\nHistoric tickets BR-1183 and BR-2047 are unrelated and remain closed.\nAll monetary values are in the client's reporting currency; no FX conversion is applied here.\nThe ticketing system assigns severity on a four-level scale; this ticket is severity 2.\nAll monetary values are in the client's reporting currency; no FX conversion is applied here.\nThe ticketing system assigns severity on a four-level scale; this ticket is severity 2.\nCode style follows the repository's formatter settings; do not reformat unrelated lines.\nCode style follows the repository's formatter settings; do not reformat unrelated lines.\nDeployment to production requires a reviewer approval and a green pipeline.\nUnit tests live in the tests/ directory and are executed in CI on every push.\nAll monetary values are in the client's reporting currency; no FX conversion is applied here.\nUnit tests live in the tests/ directory and are executed in CI on every push.\nThe ticketing system assigns severity on a four-level scale; this ticket is severity 2.\nDeployment to production requires a reviewer approval and a green pipeline.\nAll monetary values are in the client's reporting currency; no FX conversion is applied here.\nUnit tests live in the tests/ directory and are executed in CI on every push.\nDeployment to production requires a reviewer approval and a green pipeline.\nDeployment to production requires a reviewer approval and a green pipeline.\nCode style follows the repository's formatter settings; do not reformat unrelated lines.\nHistoric tickets BR-1183 and BR-2047 are unrelated and remain closed.\nAll monetary values are in the client's reporting currency; no FX conversion is applied here.\nUnit tests live in the tests/ directory and are executed in CI on every push.\nThe ticketing system assigns severity on a four-level scale; this ticket is severity 2.\nThe data dictionary defines shipped_days as the number of calendar days from order to shipment.\nAll monetary values are in the client's reporting currency; no FX conversion is applied here.\nThe data engineering team refreshes the sales extract nightly at 02:00 local time.\nThe data dictionary defines shipped_days as the number of calendar days from order to shipment.\nThe data dictionary defines shipped_days as the number of calendar days from order to shipment.\nThe data engineering team refreshes the sales extract nightly at 02:00 local time.\nAll monetary values are in the client's reporting currency; no FX conversion is applied here.\nAll monetary values are in the client's reporting currency; no FX conversion is applied here.\nHistoric tickets BR-1183 and BR-2047 are unrelated and remain closed.\n\nThe existing (buggy) implementation is:\n\ndef net_revenue(rows):\n    total = 0.0\n    for r in rows:\n        if r['returned']:\n            continue\n        if r['units'] < 3:\n            continue\n        total += r['units'] * r['unit_price'] * (1 - r['discount_pct'] / 100.0)\n    return round(total, 0)\n\nThe ticketing system assigns severity on a four-level scale; this ticket is severity 2.\nThe data engineering team refreshes the sales extract nightly at 02:00 local time.\nThe ticketing system assigns severity on a four-level scale; this ticket is severity 2.\nUnit tests live in the tests/ directory and are executed in CI on every push.\nUnit tests live in the tests/ directory and are executed in CI on every push.\nThe ticketing system assigns severity on a four-level scale; this ticket is severity 2.\nThe ticketing system assigns severity on a four-level scale; this ticket is severity 2.\nHistoric tickets BR-1183 and BR-2047 are unrelated and remain closed.\nHistoric tickets BR-1183 and BR-2047 are unrelated and remain closed.\nCode style follows the repository's formatter settings; do not reformat unrelated lines.\nHistoric tickets BR-1183 and BR-2047 are unrelated and remain closed.\nDeployment to production requires a reviewer approval and a green pipeline.\nThe ticketing system assigns severity on a four-level scale; this ticket is severity 2.\nCode style follows the repository's formatter settings; do not reformat unrelated lines.\nThe ticketing system assigns severity on a four-level scale; this ticket is severity 2.\nUnit tests live in the tests/ directory and are executed in CI on every push.\nDeployment to production requires a reviewer approval and a green pipeline.\nDeployment to production requires a reviewer approval and a green pipeline.\nThe data dictionary defines shipped_days as the number of calendar days from order to shipment.\nThe data engineering team refreshes the sales extract nightly at 02:00 local time.\nUnit tests live in the tests/ directory and are executed in CI on every push.\nThe data engineering team refreshes the sales extract nightly at 02:00 local time.\nThe data dictionary defines shipped_days as the number of calendar days from order to shipment.\nThe data dictionary defines shipped_days as the number of calendar days from order to shipment.\nThe data engineering team refreshes the sales extract nightly at 02:00 local time.\nAll monetary values are in the client's reporting currency; no FX conversion is applied here.\nThe ticketing system assigns severity on a four-level scale; this ticket is severity 2.\nCode style follows the repository's formatter settings; do not reformat unrelated lines.\nCode style follows the repository's formatter settings; do not reformat unrelated lines.\nCode style follows the repository's formatter settings; do not reformat unrelated lines.\nThe data dictionary defines shipped_days as the number of calendar days from order to shipment.\nCode style follows the repository's formatter settings; do not reformat unrelated lines.\nThe ticketing system assigns severity on a four-level scale; this ticket is severity 2.\nThe data engineering team refreshes the sales extract nightly at 02:00 local time.\nUnit tests live in the tests/ directory and are executed in CI on every push.\nUnit tests live in the tests/ directory and are executed in CI on every push.",6  "char_len": 7873,7  "document_hash": "4ad9a1fbe7db8f523841d367742505a5c92581010a15fdabb2bb6b6d77afbaa4",8  "questions": [9    {10      "question_id": "q00_exec",11      "qtype": "exec",12      "question": "Rewrite the Python function net_revenue(rows) so that it implements ALL the agreed rules in the ticket. Output only Python code defining net_revenue; no explanations, no markdown fences."13    }14  ]15}
Files · main
Menu

Theme