{"id":19820371,"url":"https://github.com/drcbeatz/discounts","last_synced_at":"2026-04-21T09:32:01.483Z","repository":{"id":214559903,"uuid":"736815614","full_name":"DrCBeatz/discounts","owner":"DrCBeatz","description":"Python module for identifying dealer discount codes, calculating dealer cost, customer price \u0026 profit margin.","archived":false,"fork":false,"pushed_at":"2025-02-08T20:54:44.000Z","size":14,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-29T15:31:58.197Z","etag":null,"topics":["ci","github-actions","parametrized-tests","pipenv","pytest","python","unit-testing"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DrCBeatz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-12-29T00:47:40.000Z","updated_at":"2025-02-08T20:54:47.000Z","dependencies_parsed_at":"2023-12-29T01:31:02.816Z","dependency_job_id":"4e13c91c-0385-49c7-9fde-734f26ba9628","html_url":"https://github.com/DrCBeatz/discounts","commit_stats":null,"previous_names":["drcbeatz/discounts"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/DrCBeatz/discounts","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DrCBeatz%2Fdiscounts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DrCBeatz%2Fdiscounts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DrCBeatz%2Fdiscounts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DrCBeatz%2Fdiscounts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DrCBeatz","download_url":"https://codeload.github.com/DrCBeatz/discounts/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DrCBeatz%2Fdiscounts/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32085435,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-21T06:27:27.065Z","status":"ssl_error","status_checked_at":"2026-04-21T06:27:21.250Z","response_time":128,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ci","github-actions","parametrized-tests","pipenv","pytest","python","unit-testing"],"created_at":"2024-11-12T10:23:05.862Z","updated_at":"2026-04-21T09:32:01.465Z","avatar_url":"https://github.com/DrCBeatz.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Product Discount Calculator\n\nThis repository provides a Python-based tool for calculating product costs for music suppliers using discount codes. \nMusic suppliers often provide discounts via specific codes rather than listing final prices, and this tool calculates \nthe actual dealer costs based on those codes.\n\n## Features\n\n- **Apply Discounts**: Apply various discount codes to a retail price to determine the dealer cost.\n- **Profit Margin Calculation**: Calculate the profit margin between retail price and cost.\n- **Discount Code Determination**: Determine which discount code was used to achieve a given dealer cost.\n- **Flexible Rounding**: Round numbers to the nearest specified multiple, with options for custom rounding precision.\n\n## Files\n\n- **discounts.py**: Main module that includes all functions for calculating dealer costs, applying discounts, and determining profit margins.\n- **test files**: Separate files for testing each function, including:\n  - `test_apply_discount.py`: Tests for applying discounts using predefined price brackets.\n  - `test_calculate_cost.py`: Tests for calculating dealer costs using discount codes.\n  - `test_calculate_discount.py`: Tests for determining discount codes based on dealer cost.\n  - `test_ceil.py`: Tests for the rounding function.\n  - `test_profit_margin.py`: Tests for calculating profit margins.\n\n- **.github/workflows/run-tests.yml**: GitHub Actions workflow file for running tests on every push to the main branch.\n\n## Installation\n\n### Requirements\n\n- Python 3.9+\n- Pipenv (for managing dependencies)\n\n### Steps\n\n1. Clone the repository:\n   ```bash\n   git clone https://github.com/your-username/discount-calculator.git\n   cd discount-calculator\n   ```\n\n2. Install dependencies:\n   ```bash\n   pipenv install --dev\n   ```\n\n3. Run the tests:\n   ```bash\n   pipenv run pytest\n   ```\n\n## Usage\n\nImport the functions from `discounts.py` to integrate discount calculation and margin analysis into your own applications:\n\n```python\nfrom discounts import calculate_cost, apply_discount, calculate_discount, profit_margin\n\n# Calculate dealer cost with a discount code\ndealer_cost = calculate_cost(retail=100, discount=\"B\")\n\n# Apply a custom discount rate directly\ndiscounted_price = apply_discount(price=100, discount=0.5)\n\n# Determine the profit margin\nmargin = profit_margin(revenue=200, cost=100)\n```\n\n## Testing\n\nThis project includes extensive tests for each function using `pytest`. The GitHub Actions workflow automatically runs \nthe tests on each push to the main branch, ensuring code reliability.\n\nTo manually run the tests, use:\n\n```bash\npipenv run pytest\n```\n\n## License\n\nThis project is open source and available under the MIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdrcbeatz%2Fdiscounts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdrcbeatz%2Fdiscounts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdrcbeatz%2Fdiscounts/lists"}