CE-938: fixed bug on deletion final associated child record was not working properly

This commit is contained in:
Tim Chamberlain
2024-06-03 15:26:40 -05:00
parent 4508dea767
commit faafacc722

View File

@ -823,16 +823,19 @@ public class QJavalinImplementation
JSONObject associationsJSON = new JSONObject(value); JSONObject associationsJSON = new JSONObject(value);
for(String key : associationsJSON.keySet()) for(String key : associationsJSON.keySet())
{ {
JSONArray associatedRecords = associationsJSON.getJSONArray(key); JSONArray associatedRecordsJSON = associationsJSON.getJSONArray(key);
for(int i = 0; i < associatedRecords.length(); i++) List<QRecord> associatedRecords = new ArrayList<>();
record.withAssociatedRecords(key, associatedRecords);
for(int i = 0; i < associatedRecordsJSON.length(); i++)
{ {
QRecord associatedRecord = new QRecord(); QRecord associatedRecord = new QRecord();
JSONObject recordJSON = associatedRecords.getJSONObject(i); JSONObject recordJSON = associatedRecordsJSON.getJSONObject(i);
for(String k : recordJSON.keySet()) for(String k : recordJSON.keySet())
{ {
associatedRecord.withValue(k, ValueUtils.getValueAsString(recordJSON.get(k))); associatedRecord.withValue(k, ValueUtils.getValueAsString(recordJSON.get(k)));
} }
record.withAssociatedRecord(key, associatedRecord); associatedRecords.add(associatedRecord);
} }
} }
continue; continue;