SE framework editor re-creating DB records when not needed
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Mahara |
Fix Released
|
Medium
|
Cecilia Vela Gurovic |
Bug Description
On the SmartEvidence framework editor when new information that is not saved to the DB is added, the javascript form will not have the DB record ids for this data.
The framework.json.php file is responsible for saving the framework to the DB. The way the algorithm works, it will check if the data from the js form contains the DB ids (uids in the form).
If there are records on the DB that are not present in the js form data, then these are DB records that need to be removed because they have been deleted in the js form.
If there are fields with no uids, then this is new data that needs to be saved.
So if we are adding new standards or elements and save the form, unless we find a way to add the DB ids of the newly created records to the js form, everytime the form is saved it will delete the records and add new ones with same data.
This stops happening for existing records when we reload the page, but will happen again for new data.
To test this:
- create a new framework with name 'New framework' and save
- go into the DB and run the query to get the id
select id, name from framework where name='New framework'
- on the DB run the query to check the standards and elements
select s.id sid, s.shortname,
e.id eid, e.shortname, e.parent from
framework_standard s left join
framework_
on e.standard=s.id
where s.framework=<id from query above> order by eid;
- go to the site and without reloading the page or making any changes, save the form again
- on the DB, run the query to get the standards and elements again
- compare the columns 'sid' and 'eid'
expected result: they should be the same for both results
actual result: the sid column values are different comparing both results, and the same thing happens with the eid column values
Changed in mahara: | |
status: | New → Confirmed |
importance: | Undecided → Low |
Changed in mahara: | |
importance: | Low → Medium |
status: | Confirmed → In Progress |
milestone: | none → 20.10.0 |
Changed in mahara: | |
assignee: | nobody → Cecilia Vela Gurovic (ceciliavg) |
Changed in mahara: | |
status: | In Progress → Fix Committed |
Changed in mahara: | |
status: | Fix Committed → Fix Released |
Patch for "master" branch: https:/ /reviews. mahara. org/11130