SE framework editor re-creating DB records when not needed

Bug #1890214 reported by Cecilia Vela Gurovic
6
This bug affects 1 person
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_standard_element e
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)
Revision history for this message
Mahara Bot (dev-mahara) wrote : A patch has been submitted for review

Patch for "master" branch: https://reviews.mahara.org/11130

Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

Reviewed: https://reviews.mahara.org/11130
Committed: https://git.mahara.org/mahara/mahara/commit/8184fa8bf0e957c6120d7c485bd86e32f6104992
Submitter: Robert Lyon (<email address hidden>)
Branch: master

commit 8184fa8bf0e957c6120d7c485bd86e32f6104992
Author: Cecilia Vela Gurovic <email address hidden>
Date: Wed Aug 12 15:52:52 2020 +1200

Bug 1890214: reload framework editor after submit

behatnotneeded

Change-Id: Iff0fc3635520c2c8bbdb3e04b31f68d1b64c3423

Robert Lyon (robertl-9)
Changed in mahara:
status: In Progress → Fix Committed
Robert Lyon (robertl-9)
Changed in mahara:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.