Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added API endpoint for apportionment #921

Merged
merged 19 commits into from
Jan 31, 2025
Merged

Conversation

Lionqueen94
Copy link
Contributor

@Lionqueen94 Lionqueen94 commented Jan 28, 2025

Description

  • Added apportionment endpoint for election returning apportionment and election summary
  • Added apportionment integration tests
  • Added extra party to election fixtures 2 and 3 to allow more realistic scenarios
  • Added extra shared helper functions to add a data_entry parameter for easier testing
  • Added extra election_id parameter to shared create_result function to be able to use it for different elections
  • Updated Fraction to allow for correct deserialization
  • Updated response.status() testing to be the same in all tests (asserting with equality to StatusCode::)

Copy link

github-actions bot commented Jan 28, 2025

Sigrid maintainability feedback

✅ You wrote maintainable code and achieved your objective of 3.5 stars

Show details

Sigrid compared your code against the baseline of 2025-01-30.

👍 What went well?

You fixed or improved 0 refactoring candidates.

👎 What could be better?

Unfortunately, 3 refactoring candidates were introduced or got worse.

Risk System property Location
🔴 Unit Size
(Worsened)
backend/src/lib.rs
router(SqlitePool)
🔴 Unit Size
(Worsened)
backend/src/error.rs
IntoResponse.into_response()
🟠 Unit Interfacing
(Introduced)
backend/src/apportionment/api.rs
election_apportionment(any,any,any,any,any,any)

📚 Remaining technical debt

15 refactoring candidates didn't get better or worse, but are still present in the code you touched.

View this system in Sigrid** to explore your technical debt

⭐️ Sigrid ratings

System property System on 2025-01-30 Before changes New/changed code
Volume 5.2 N/A N/A
Duplication 4.3 5.2 5.3
Unit Size 2.4 1.9 1.9
Unit Complexity 3.4 4.4 4.4
Unit Interfacing 2.9 3.0 2.7
Module Coupling 4.0 5.5 5.5
Component Independence 2.8 N/A N/A
Component Entanglement 3.6 N/A N/A
Maintainability 3.6 4.2 4.2

💬 Did you find this feedback helpful?

We would like to know your thoughts to make Sigrid better.
Your username will remain confidential throughout the process.


View this system in Sigrid

Copy link

codecov bot commented Jan 30, 2025

Bundle Report

Changes will increase total bundle size by 509 bytes (0.03%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
abacus-frontend-esm 1.9MB 509 bytes (0.03%) ⬆️

Affected Assets, Files, and Routes:

view changes for bundle: abacus-frontend-esm

Assets Changed:

Asset Name Size Change Total Size Change (%)
assets/app-*.js 509 bytes 711.1kB 0.07%

Files in assets/app-*.js:

  • ./lib/i18n/locales/nl/error.json → Total Size: 2.66kB

praseodym
praseodym previously approved these changes Jan 30, 2025
Copy link
Contributor

@praseodym praseodym left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, just a few questions as comments.

praseodym
praseodym previously approved these changes Jan 30, 2025
Copy link
Contributor

@cikzh cikzh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work!

Is see that a lot of fully qualified names are moved to use imports, sometimes put behind a feature flag. Personally I think there is nothing wrong with using the fully qualified name in the code. Sometimes it help with ubiquitous terms like Client. Readability obviously shouldn't suffer though.

@cikzh cikzh added this pull request to the merge queue Jan 31, 2025
Merged via the queue into main with commit adc6203 Jan 31, 2025
21 checks passed
@cikzh cikzh deleted the 738-api-endpoint-for-apportionment branch January 31, 2025 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

API endpoint for apportionment
3 participants