1{2 "document_id": "exec_00221_2000",3 "family": "exec",4 "split": "test",5 "text": "ENGINEERING TICKET\n\nBug report BR-8588: 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 1 September 2031: (1) exclude returned rows; (2) exclude rows whose region is 'Centre'; (3) exclude rows with fewer than 3 units; (4) rows shipped in more than 7 days receive an additional 5 percentage points of discount on top of discount_pct, capped at 50 %; (5) line revenue = units * unit_price * (1 - total_discount/100); (6) apply a tax of 14.975 % on the sum; (7) return the result rounded to 2 decimals (Python round). The current implementation forgets rule (4) and rule (2).\n\nSample rows (first 6 of the extract):\n[{\"region\": \"Nord\", \"product\": \"gamma\", \"units\": 12, \"unit_price\": 67.75, \"discount_pct\": 25, \"returned\": true, \"shipped_days\": 7}, {\"region\": \"Sud\", \"product\": \"zeta\", \"units\": 24, \"unit_price\": 38.86, \"discount_pct\": 0, \"returned\": true, \"shipped_days\": 8}, {\"region\": \"Est\", \"product\": \"zeta\", \"units\": 29, \"unit_price\": 52.88, \"discount_pct\": 5, \"returned\": false, \"shipped_days\": 10}, {\"region\": \"Centre\", \"product\": \"zeta\", \"units\": 12, \"unit_price\": 29.86, \"discount_pct\": 0, \"returned\": false, \"shipped_days\": 6}, {\"region\": \"Sud\", \"product\": \"epsilon\", \"units\": 36, \"unit_price\": 7.64, \"discount_pct\": 0, \"returned\": false, \"shipped_days\": 8}, {\"region\": \"Nord\", \"product\": \"gamma\", \"units\": 39, \"unit_price\": 27.73, \"discount_pct\": 25, \"returned\": false, \"shipped_days\": 9}]\n\nDeployment to production requires a reviewer approval and a green pipeline.\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.\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.\nThe data engineering team refreshes the sales extract nightly at 02:00 local time.\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.\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.\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.\nHistoric tickets BR-1183 and BR-2047 are unrelated and remain closed.\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.\nDeployment to production requires a reviewer approval and a green pipeline.\nHistoric tickets BR-1183 and BR-2047 are unrelated and remain closed.\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.\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.\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.\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.\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.\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 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.\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 d = r['discount_pct']\n total += r['units'] * r['unit_price'] * (1 - d / 100.0)\n total = total * (1 + 14.975 / 100.0)\n return round(total, 2)\n\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.\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.\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.\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.\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.\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.\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 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.\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.\nCode style follows the repository's formatter settings; do not reformat unrelated lines.\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.\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.\nCode style follows the repository's formatter settings; do not reformat unrelated lines.\nDeployment to production requires a reviewer approval and a green pipeline.\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.\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.",6 "char_len": 7820,7 "document_hash": "a986eec8e76aa658fd694272657b8e201d940be0671e7769a934ffe76ca4748a",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}