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

Re-importing a NOFO should create 'archived' past version of NOFO #170

Open
pcraig3 opened this issue Jan 16, 2025 · 0 comments
Open

Re-importing a NOFO should create 'archived' past version of NOFO #170

pcraig3 opened this issue Jan 16, 2025 · 0 comments
Labels
Dev This is a dev priority ticket, not strictly user-facing

Comments

@pcraig3
Copy link
Collaborator

pcraig3 commented Jan 16, 2025

Summary

When someone re-imports a NOFO document, all of the previous sections and subsections are deleted and replaced with completely new sections and subsections.

This has the potential to cause problems — and one time it did, leading us to restore from a database backup to get the old version of the NOFO again.

We don't allow (non-admin) users to completely delete a NOFO, which is why we introduced the concept of "archiving" a NOFO. By the same token, we shouldn't allow people to wipe out all of a NOFO's content, which is akin to what deleting a NOFO actually means.

Functional requirements

We want this all to be invisible from a user's perspective, which means that we should not archive the current NOFO they are using and give them a new URL. People link to NOFOs by id number, so we should keep their existing URLs working. Instead, let's clone their NOFO, archive it, and then overwrite sections & subsections as we do now.

As context: When re-import is successful, we create an internal dictionary of sections and then call overwrite_nofo. This wipes out all existing sections (and subsections).

Instead, let's do something like this:

  • Before we overwrite_nofo, duplicate our original NOFO
  • The duplicated NOFO should immediately be set to "archived"
  • Then we call overwrite_nofo

Also, we should introduce a new NOFO model field called ancestor or something (int field, default null), which would contain the ID of the archived NOFO. The idea here is that a NOFO should know how to find its previous version. If there are multiple previous versions, we can just pull them sequentially.

This puts us in a way better spot so that we can prevent users from messing things up unintentionally or intentionally.

@pcraig3 pcraig3 added the Dev This is a dev priority ticket, not strictly user-facing label Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Dev This is a dev priority ticket, not strictly user-facing
Projects
None yet
Development

No branches or pull requests

1 participant