ore-ero
ore-ero copied to clipboard
Conflict between new Administration (owner) and new administration (partner)
The way it is currently set up, new partner administration under the same gov. level will overwrite the changes to a new administration as the owner of the code project, or user of a software/standard
Just for clarity: Partner administration refers to a new administration created via the partners field Owner administration refers to an administration created through the new administration "pop up" which gives the file its name (for code and partnership).
Potential solution:
Adapt the getNewPartnerPromise function
- Move it to the adminForm (since its function will be to add administrations)
- Rename it getNewAdminPromise
- Changes its parameters to allow for the partner object AND the new owner administration
- Add the new owner administration in the loop so its data is also added to the administration file
- Update the submit function(s) in the [type]Form.js files to reflect that change.
- PartnershipForm.js should be relatively easy since I changed the submit function flow to be more linear
- The other might be a tad more complicated since there's two functions, one for submitting the form with a new administration and the other without. It might be a good idea to change it so the flow follows the same idea as the partnership submit function, it might be easier that way.
Another potential solution:
Add a functionality to filewriter.merge
- Instead of fetching content from the file specified in the parameters of the merge function, allow passing content directly as a parameter.
- That way we could update the content of a file without loosing previous changes made to it.
- Then, when we add a new owner administration, put the file value (the object is already returned by the .merge function) in a variable, and when the new partner administration needs to be created, instead of using merge directly and overwriting the previous change, use the changed content stored in the variable instead and merge on that.
Attempted to replicate this bug with the code form since software/standard don't have a partners field. The code file was created with no problem. However, only the new partner administration was added to the _data/administrations/municipal.yml file, with the new administration itself nowhere to be found. Doesn't seem to be the same bug as described here. Test done with PR #1141