Closed chouinar closed 4 months ago
Looking into this, I found that the existing version logic is more complex than I would have expected. Here is roughly what the current algorithm is:
A few things we'll need to account for:
There are two additional complexities ontop of what I wrote above (debateable whether these are intentional or bugs?)
If an opportunity has forecast and synopsis records, whichever one is deemed the current one will display, but the other "current" will just not appear at all, but the history records for both types will. So if the current synopsis is 3, and the current forecast is 2, we'll see Synopsis 3, 2, 1, BUT for forecast we'll only see Forecast 1. This seems.. unnecessary? Most of the time the forecast does actually get updated after the fact to automatically set an archive date. Not terribly exciting info, but no reason to hide it.
I can't confirm this with 100% certainty as I didn't download the required data before our stoppage - but it seems like there is one other case where a forecast/synopsis won't appear in the history. The way it fetches these is weird, it actually gets a list of Opportunity History + Synopsis Hist + Forecast Hist records grouped by the revision number. The revision number is updated on an opportunity for.. I actually don't know the exact reasons, but based on what I'm seeing, the revision number of an opportunity increases for every record added to the synopsis/forecast history tables (although there is likely more that does that).
So, with those history tuple-like objects, what would happen if the opportunity history record was marked as deleted (or just actually deleted)? Presumably, that record wouldn't get returned at all since the query looks to be specifically for the opportunity history, not the synopsis/forecast history. Which means, if the opportunity records ever get deleted, the current system doesn't return those versions of the history records. Is this intentional? Why are opportunities organized like that with revision number?
So, thinking through how we might do this right now
Issue migrated to hhs/simpler-grants-gov#2079
Summary
This would be a sub-endpoint under the opportunity endpoint, something like
GET /opportunity/<opportunityId>/versions
and maybe a specific version one asGET /opportunity/<opportunityId>/version/<versionId?>
.We should figure out how the response would be structured, likely just a list of values similar to our GET endpoint. Note that versions are.. odd in that only ~80% of the data is versioned. The top-level opportunity info isn't versioned in the current experience (although does have versions), so we'll need to sort that out.
Acceptance criteria
No response