Padawan#78
Merged
Merged
Conversation
Replaced all usages of chart.js and react-chartjs-2 with @mui/x-charts. Updated: - DistrictVotesChart (BarChart) - TotalVotesChart (BarChart) - VoterDistrictAgreementChart (BarChart) - VoterAgreementChart (BarChart) - AffinityChart (PieChart, ScatterChart) Updated vite.config.build.ts to remove chart.js chunks and include @mui/x-charts. Cleaned up sway_utils/charts.ts.
Removed the @github/webauthn-json dependency and replaced its usage with custom utility functions in app/frontend/sway_utils/webauthn.ts. These utilities handle the conversion between Base64URL strings (used by the server) and ArrayBuffers (required by the native WebAuthn API). Key changes: - Created app/frontend/sway_utils/webauthn.ts with `create` and `get` wrappers and Base64URL helpers. - Updated authentication and registration hooks to use the new utilities. - Removed @github/webauthn-json from package.json and vite.config.build.ts.
The user_legislators_by_locale method was causing an N+1 query by iterating over user_legislators and accessing nested associations inside the loop. This change refactors the query to use 'joins' and 'where' to filter in the database and 'includes' to eager-load the associations, resolving the performance issue. Co-authored-by: dcordz <17937472+dcordz@users.noreply.github.com>
This commit adds a set of Python scripts in the `legislation/` directory to: 1. Fetch and convert the Baltimore City Charter and Code from XML to Markdown (`fetch_law.py`). 2. Fetch recent Ordinances (2025-2026) from the Legistar API, download their PDF attachments, extract text, and generate a summary (`fetch_bills.py`). 3. Orchestrate the entire process (`main.py`). The output is stored in `legislation/baltimore_city_charter.md`, `legislation/baltimore_city_code.md`, and `legislation/diffs/`. The `diffs/` directory is gitignored. Co-authored-by: dcordz <17937472+dcordz@users.noreply.github.com>
…r-legislators-3571730287527064582 Fix N+1 query in user_legislators_by_locale
Co-authored-by: dcordz <17937472+dcordz@users.noreply.github.com>
Removed the @github/webauthn-json dependency and replaced its usage with custom utility functions in app/frontend/sway_utils/webauthn.ts. These utilities handle the conversion between Base64URL strings (used by the server) and ArrayBuffers (required by the native WebAuthn API). Key changes: - Created app/frontend/sway_utils/webauthn.ts with `create` and `get` wrappers and Base64URL helpers (now correctly handling unpadded strings). - Updated authentication and registration hooks to use the new utilities. - Removed @github/webauthn-json from package.json and vite.config.build.ts. Co-authored-by: dcordz <17937472+dcordz@users.noreply.github.com>
Updated VoterDistrictAgreementChart and VoterAgreementChart to use `swayFont` for titles instead of hardcoded "sans-serif". Verified build passes. Co-authored-by: dcordz <17937472+dcordz@users.noreply.github.com>
- Changed CONGRESS constant from 118 to 119 in lib/census.rb - Updated test data in spec/support/files/congress.json to use CD119 instead of CD118 - Skipped pre-commit and tests as per user request and due to lack of Ruby environment Co-authored-by: dcordz <17937472+dcordz@users.noreply.github.com>
This commit adds a set of Python scripts in the `legislation/` directory to: 1. Fetch and convert the Baltimore City Charter and Code from XML to Markdown (`fetch_law.py`). 2. Fetch recent Ordinances (2025-2026) from the Legistar API, download their PDF attachments, extract text, and generate a summary (`fetch_bills.py`). 3. Orchestrate the entire process (`main.py`). The output is stored in `legislation/baltimore_city_charter.md`, `legislation/baltimore_city_code.md`, and `legislation/diffs/`. The `diffs/` directory is gitignored. Co-authored-by: dcordz <17937472+dcordz@users.noreply.github.com>
…Calendar logic Co-authored-by: dcordz <17937472+dcordz@users.noreply.github.com>
…9-2897759042693090323 Update Congress configuration to 119th Congress
Co-authored-by: dcordz <17937472+dcordz@users.noreply.github.com>
Removed the @github/webauthn-json dependency and replaced its usage with custom utility functions in app/frontend/sway_utils/webauthn.ts. These utilities handle the conversion between Base64URL strings (used by the server) and ArrayBuffers (required by the native WebAuthn API). Key changes: - Created app/frontend/sway_utils/webauthn.ts with `create` and `get` wrappers using `PublicKeyCredential.parseCreationOptionsFromJSON` and `credential.toJSON()`. - Updated authentication and registration hooks to use the new utilities. - Removed @github/webauthn-json from package.json and vite.config.build.ts. - Added explicit type compatibility definitions for legacy code. Co-authored-by: dcordz <17937472+dcordz@users.noreply.github.com>
Replace Ruby-based block counting with database-level SQL counting.
- In `count_invites_where_inviter_is_user`, replaced `Invite.count { ... }` with `Invite.where(inviter_id: @user.id).count`.
- In `count_user_votes_by_locale`, replaced `UserVote.count { ... }` with `UserVote.joins(:bill).where(user_id: @user.id, bills: { sway_locale_id: @sway_locale.id }).count`.
These changes move filtering from Ruby memory to the database layer, significantly reducing memory usage and preventing N+1 queries when accessing the associated bill's locale ID.
Co-authored-by: dcordz <17937472+dcordz@users.noreply.github.com>
The `create` method already implements the functionality described by the TODO ("Create a position on a bill").
Existing tests in `spec/requests/organizations/positions_spec.rb` verify this behavior, confirming the TODO is obsolete.
Co-authored-by: dcordz <17937472+dcordz@users.noreply.github.com>
Added `.includes(:organization_bill_positions)` to `Organization.where(...)` queries in `BillsController#new` and `BillsController#edit` to prevent N+1 queries when serializing organization data. Verified logic with a standalone reproduction script (since deleted) simulating ActiveRecord behavior, which confirmed the reduction in queries from O(N) to O(1) (technically 2 queries). Co-authored-by: dcordz <17937472+dcordz@users.noreply.github.com>
- Added `.includes(:votes)` to `Bill.current_session` calls in `new` and `edit` actions of `BillsController`. - This prevents N+1 queries when `to_sway_json` is called on each bill, which accesses the `vote` association. - Verified with a reproduction script simulating the N+1 behavior and the fix. Co-authored-by: dcordz <17937472+dcordz@users.noreply.github.com>
- Lift isSelected calculation to parent - Wrap BillArgumentsOrganization in React.memo - Pass stable props to children Co-authored-by: dcordz <17937472+dcordz@users.noreply.github.com>
This commit adds a set of Python scripts in the `legislation/` directory to: 1. Fetch and convert the Baltimore City Charter and Code from XML to Markdown (`fetch_law.py`). 2. Fetch recent Ordinances (2025-2026) from the Legistar API, download their PDF attachments, extract text, and generate a summary (`fetch_bills.py`). 3. Orchestrate the entire process (`main.py`). The scripts are designed to be run manually. Generated artifacts (markdown copies of the Charter/Code and Bill diffs/summaries) are gitignored to avoid bloating the repository. Run `python3 legislation/main.py` to populate the data. Co-authored-by: dcordz <17937472+dcordz@users.noreply.github.com>
- Add nested includes to eager load associations accessed in to_sway_json - Use joins(:user_legislator) for correct user filtering Co-authored-by: dcordz <17937472+dcordz@users.noreply.github.com>
…scores-n-plus-one-12849247401939525554 ⚡ Optimize UserLegislatorScoresController index query
…9718051008337089617 Add legislation pipeline scripts
…itions-controller-5260384556739245592 Remove stale TODO in Organizations::PositionsController
…us-one-fix-16177993929539515317 ⚡ Optimize BillsController index with eager loading
…-5114983175129052515 ⚡ Resolve N+1 query in BillsController organizations fetch
…-n-plus-one-13373726571970258235 ⚡ Optimize BillsController N+1 query on votes
…guments-rendering-16479765246779760606 ⚡ Optimize BillArguments re-renders
This reverts commit c0c1048.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.