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

Return final and intermediate apportionment steps #864

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

Lionqueen94
Copy link
Contributor

@Lionqueen94 Lionqueen94 commented Jan 19, 2025

Closes #737

Description

  • Adds data structure to report final and intermediate apportionment steps, to be used by the frontend and the eml & pdf generators (@Lionqueen94 & @praseodym)
  • Add oneOf support to OpenAPI generator (@praseodym)
  • Removed the unused DataEntryStatus type from the OpenAPI spec and fixes the build without the dev-database feature by always including the ElectionRequest struct. (@praseodym)

Copy link

github-actions bot commented Jan 19, 2025

Sigrid maintainability feedback

⚠️ Your code did not improve maintainability towards your objective of 3.5 stars

Show details

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

👍 What went well?

You fixed or improved 0 refactoring candidates.

👎 What could be better?

Unfortunately, 11 refactoring candidates were introduced or got worse.

Risk System property Location
🔴 Duplication
(Introduced)
backend/src/election/structs.rs (lines 10-19)
backend/src/election/structs.rs (lines 29-38)
🔴 Duplication
(Introduced)
backend/src/apportionment/mod.rs (lines 224-229)
backend/src/apportionment/mod.rs (lines 299-304)
🔴 Unit Size
(Worsened)
backend/src/apportionment/mod.rs
allocate_remaining_seats(PoliticalGroupVotes,BTreeMap,Fraction,u64,u64)
🟠 Unit Size
(Introduced)
backend/src/apportionment/mod.rs
perform_highest_average_allocation(u64,PoliticalGroupVotes,BTreeMap,BTreeMap,u64,Option)
🟠 Unit Size
(Worsened)
backend/src/apportionment/mod.rs
seat_allocation(u64,ElectionSummary)
🟠 Unit Size
(Worsened)
frontend/scripts/openapi/generator.ts
generator.ts.addDefinition(string,ReferenceObject
🟠 Unit Complexity
(Worsened)
frontend/scripts/openapi/generator.ts
generator.ts.addDefinition(string,ReferenceObject
🟠 Unit Interfacing
(Introduced)
backend/src/apportionment/mod.rs
perform_highest_average_allocation(u64,PoliticalGroupVotes,BTreeMap,BTreeMap,u64,Option)
⚫️ + 3 more

📚 Remaining technical debt

9 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-23 Before changes New/changed code
Volume 5.2 N/A N/A
Duplication 3.5 4.3 4.4
Unit Size 2.2 1.5 1.5
Unit Complexity 3.2 3.3 3.0
Unit Interfacing 3.0 1.9 1.4
Module Coupling 3.9 5.5 5.5
Component Independence 2.9 N/A N/A
Component Entanglement 3.6 N/A N/A
Maintainability 3.4 3.5 3.3

💬 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

@praseodym
Copy link
Contributor

  • enum RestSeatAllocationDetails is not being added to openapi.ts by the gen_openapi_types.ts script causing error in openapi.ts

Fixed with 70fade5

@Lionqueen94 Lionqueen94 marked this pull request as ready for review January 21, 2025 14:17
@Lionqueen94 Lionqueen94 requested a review from a team as a code owner January 21, 2025 14:17
backend/src/apportionment/mod.rs Outdated Show resolved Hide resolved
backend/src/apportionment/mod.rs Outdated Show resolved Hide resolved
backend/src/apportionment/mod.rs Outdated Show resolved Hide resolved
backend/src/apportionment/mod.rs Show resolved Hide resolved
cikzh
cikzh previously approved these changes Jan 23, 2025
@Lionqueen94 Lionqueen94 changed the base branch from 772-apportionment-calculation-for-19-seats to main January 23, 2025 09:24
@Lionqueen94 Lionqueen94 dismissed cikzh’s stale review January 23, 2025 09:24

The base branch was changed.

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.

Return final and intermediate apportionment steps
3 participants