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

Copy metadata for matching subsections when re-importing #136

Closed
pcraig3 opened this issue Dec 26, 2024 · 2 comments
Closed

Copy metadata for matching subsections when re-importing #136

pcraig3 opened this issue Dec 26, 2024 · 2 comments
Assignees

Comments

@pcraig3
Copy link
Collaborator

pcraig3 commented Dec 26, 2024

When re-importing a NOFO, we are currently creating entirely new sections and subsections and then assigning them over the old ones.

This means we lose all the updates to the old subsections, if any.

Some of the metadata fields which would be easy for us to preserve on re-imports are:

  • subsection classnames
  • whether or not something is a callout box

The classnames are a string, and the callout box information is a boolean.

Matching the subsections to each other is not an exact science here though, so we will have to use a best-guess for this.

There are 2 ways to approach this, both of which should be the same thing:

  1. exact match for subsection.section.name and subsection.name, or
  2. match html_id after removing the counter number

The subsection.html_id is created (see here) by combining a counter (for uniqueness), the section name, and the subsection name. The counter can't be relied on to be the same, but if the other two line up, we are 99% sure they are the same subsection.

If there is a match, transfer the html_class (if exists) and callout_box (either value) to the new subsection before replacing them.

This is an easy first step we can take to make reimporting a little bit easier.

@jtmst jtmst self-assigned this Jan 2, 2025
@pcraig3
Copy link
Collaborator Author

pcraig3 commented Jan 7, 2025

Update to this ticket as of Jan 7th 2025. 📆

Demoed to our HRSA users this morning and they generally loved the idea but make a request that we also add a confirmation checkbox, and then in chatting to Adam it sounds like we should reverse course on callout boxes.

Add a checkbox on the reimport page

We heard from HRSA that keeping page breaks is usually a good idea, but that sometimes they want them to go away. Their suggestion was to add a checkbox that defaults to checked and says something like “Keep page breaks from current NOFO”

  • If the checkbox is checked, preserve page breaks.
  • If the checkbox is not checked, overwrite everything (current behaviour)

You can find checkbox info here: https://designsystem.digital.gov/components/checkbox/

Also, some of our Django forms are Django form classes, but the reimport forms are raw HTML, so we don't need to faff around with that.

Do not carry over callout boxes

Adam and I talked afterwards about the callout boxes. Unlike page breaks, callout boxes can’t be easily edited in the NOFO UI, so there is a low chance that people managed to change callout box information after importing (although callout boxes can be created when you add a new section).

So we discussed not overwriting the callout box field, just page breaks.

I’ve asked in the NOFO Builder channel for a recco, but I think we are probably going to not carry these over.

@pcraig3
Copy link
Collaborator Author

pcraig3 commented Jan 24, 2025

Closed! Since #143 was merged.

@pcraig3 pcraig3 closed this as completed Jan 24, 2025
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

No branches or pull requests

2 participants