diff --git a/README.md b/README.md index a52fc1e9..9081b5b7 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,7 @@ which by default will run in docker. * Follow instructions for [working on openstates.org](https://docs.openstates.org/contributing/openstates-org/) from the docs. * Quirks I ran into: + * 2025: hit error `ERR_OSSL_EVP_UNSUPPORTED` when running `npm run build` so fixed by running `export NODE_OPTIONS=--openssl-legacy-provider` * `npm run start` did not actually make JS/CSS available when I hit the app at `localhost:8000`. Instead I ran `npm run build` and then rebuilt the docker containers with `docker compose build`, finally started them again. diff --git a/ansible/inventory/host_vars/openstates.org.yml b/ansible/inventory/host_vars/openstates.org.yml index 35a45162..d11869ce 100644 --- a/ansible/inventory/host_vars/openstates.org.yml +++ b/ansible/inventory/host_vars/openstates.org.yml @@ -14,8 +14,8 @@ django_environment: NEW_RELIC_APP_NAME: "openstates.org" # postgres -pg_password: "{{ lookup('aws_ssm', '/bobsled/backups/PGPASSWORD') }}" -pg_host: "{{ lookup('aws_ssm', '/bobsled/backups/PGHOST') }}" -pg_user: "{{ lookup('aws_ssm', '/bobsled/backups/PGUSER') }}" +pg_password: "{{ lookup('aws_ssm', '/passwords/osorg_db_password') }}" +pg_host: "openstates.cn70ucbuuwc7.us-east-1.rds.amazonaws.com" +pg_user: os_django pg_port: 5432 pg_database: openstatesorg diff --git a/ansible/openstates/tasks/main.yml b/ansible/openstates/tasks/main.yml index 86aa7ffe..e4bbd6d6 100644 --- a/ansible/openstates/tasks/main.yml +++ b/ansible/openstates/tasks/main.yml @@ -169,7 +169,7 @@ become_user: "openstates" - name: install packages via poetry - command: python3.9 -m poetry install # --deploy + command: python3.9 -m poetry install --no-root # --deploy changed_when: false args: chdir: /home/openstates/src/openstates.org diff --git a/public/views/legislators.py b/public/views/legislators.py index 098f9370..61d8c559 100644 --- a/public/views/legislators.py +++ b/public/views/legislators.py @@ -96,73 +96,11 @@ def legislators(request, state): def person(request, person_id): - SPONSORED_BILLS_TO_SHOW = 4 - RECENT_VOTES_TO_SHOW = 3 - try: ocd_person_id = decode_uuid(person_id) except ValueError: ocd_person_id = ( person_id # will be invalid and raise 404, but useful in logging later ) - person = get_object_or_404( - Person.objects.prefetch_related("memberships__organization"), - pk=ocd_person_id, - ) - - # to display district in front of district name, or not? - district_maybe = "" - - # canonicalize the URL - canonical_url = pretty_url(person) - if request.path != canonical_url: - return redirect(canonical_url, permanent=True) - - if not person.current_jurisdiction_id: - state = None - retired = True - elif not person.current_role: - # this breaks if they held office in two states, but we don't really worry about that - state = jid_to_abbr(person.current_jurisdiction_id) - retired = True - else: - state = jid_to_abbr(person.current_jurisdiction_id) - retired = False - # does it start with a number? - if str(person.current_role["district"])[0] in "0123456789": - district_maybe = "District" - person.all_links = list(person.links.all()) - person.all_offices = list(person.offices.all()) - - person.sponsored_bills = list( - Bill.objects.all() - .select_related( - "legislative_session", - "legislative_session__jurisdiction", - ) - .filter(sponsorships__person=person) - .order_by("-created_at", "id")[:SPONSORED_BILLS_TO_SHOW] - ) - - votes = ( - person.votes.all() - .select_related("vote_event", "vote_event__bill") - .order_by("-vote_event__start__date")[:RECENT_VOTES_TO_SHOW] - ) - person.vote_events = [] - for vote in votes: - vote_event = vote.vote_event - vote_event.legislator_vote = vote - person.vote_events.append(vote_event) - - return render( - request, - "public/views/legislator.html", - { - "state": state, - "person": person, - "state_nav": "legislators", - "retired": retired, - "district_maybe": district_maybe, - }, - ) + redirect_person_id = ocd_person_id.replace("ocd-person/", "") + return redirect(f"https://pluralpolicy.com/app/person/{redirect_person_id}/", permanent=True)