SPB Git

spb/wp30_uqo

Public
8.3 KB · 15 lines json
1{2  "document_id": "exec_00230_2000",3  "family": "exec",4  "split": "test",5  "text": "ENGINEERING TICKET\n\nBug report BR-9897: 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 24 June 2031: (1) exclude returned rows; (2) exclude rows whose region is 'Ouest'; (3) exclude rows with fewer than 5 units; (4) line revenue = units * unit_price * (1 - discount_pct/100); (5) apply a tax of 14.975 % 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\": \"Centre\", \"product\": \"zeta\", \"units\": 39, \"unit_price\": 34.41, \"discount_pct\": 25, \"returned\": false, \"shipped_days\": 4}, {\"region\": \"Ouest\", \"product\": \"beta\", \"units\": 12, \"unit_price\": 36.88, \"discount_pct\": 10, \"returned\": false, \"shipped_days\": 13}, {\"region\": \"Sud\", \"product\": \"gamma\", \"units\": 33, \"unit_price\": 42.84, \"discount_pct\": 15, \"returned\": true, \"shipped_days\": 1}, {\"region\": \"Nord\", \"product\": \"gamma\", \"units\": 20, \"unit_price\": 25.91, \"discount_pct\": 15, \"returned\": false, \"shipped_days\": 12}, {\"region\": \"Est\", \"product\": \"beta\", \"units\": 12, \"unit_price\": 20.67, \"discount_pct\": 0, \"returned\": false, \"shipped_days\": 13}, {\"region\": \"Centre\", \"product\": \"gamma\", \"units\": 40, \"unit_price\": 69.12, \"discount_pct\": 0, \"returned\": false, \"shipped_days\": 10}]\n\nThe data dictionary defines shipped_days as the number of calendar days from order to shipment.\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.\nThe data dictionary defines shipped_days as the number of calendar days from order to shipment.\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.\nCode style follows the repository's formatter settings; do not reformat unrelated lines.\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.\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.\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.\nCode style follows the repository's formatter settings; do not reformat unrelated lines.\nDeployment to production requires a reviewer approval and a green pipeline.\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.\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.\nHistoric tickets BR-1183 and BR-2047 are unrelated and remain closed.\nDeployment to production requires a reviewer approval and a green pipeline.\nHistoric tickets BR-1183 and BR-2047 are unrelated and remain closed.\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.\nCode style follows the repository's formatter settings; do not reformat unrelated lines.\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.\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.\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.\nHistoric tickets BR-1183 and BR-2047 are unrelated and remain closed.\nDeployment to production requires a reviewer approval and a green pipeline.\nHistoric tickets BR-1183 and BR-2047 are unrelated and remain closed.\nUnit tests live in the tests/ directory and are executed in CI on every push.\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'] < 5:\n            continue\n        total += r['units'] * r['unit_price'] * (1 - r['discount_pct'] / 100.0)\n    return round(total, 0)\n\nHistoric tickets BR-1183 and BR-2047 are unrelated and remain closed.\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.\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.\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.\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 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.\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.\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.\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.\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.\nCode style follows the repository's formatter settings; do not reformat unrelated lines.\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.\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.\nCode style follows the repository's formatter settings; do not reformat unrelated lines.\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.\nAll monetary values are in the client's reporting currency; no FX conversion is applied here.\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.\nThe data dictionary defines shipped_days as the number of calendar days from order to shipment.\nDeployment to production requires a reviewer approval and a green pipeline.\nCode style follows the repository's formatter settings; do not reformat unrelated lines.\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.",6  "char_len": 7830,7  "document_hash": "cbb9dba4a75d2570390205536d928042eae0341c49e7dcc11a2cea988c175ba9",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 · e6d9a3b2e6aad04d133df41f962eaa0b3171272e
Menu

Theme