I'm trying to show a table in my html that shows a CRUD log. My php script is selecting and storing the object before and after the UPDATE and saving the json object to the table. This is what my html table looks like:
Im trying to get it to show whats changed by comparing the 2 objects and finding the objects that don't match then showing in the table name:old value and name:new value in a readable view.. This is my function (that is returning no difference)
$scope.parsehistory = function(old, neww) {
try {
var o1 = JSON.parse(old),
o2 = JSON.parse(neww);
var old_value = _.omit(o1, function(v, k) {
return o2[k] === v;
});
const new_value = Object.keys(old_value).reduce((accumulator, key) => {
accumulator[key] = o2[key];
return accumulator;
}, {});
var length = Object.keys(old_value).length;
var keys = Object.keys(old_value);
console.log("length:", length);
for (i = 0; i < length; i++) {
var name = keys[i];
var oldvaluee = old_value[name];
var newvaluee = new_value[name];
var valuechanged = name;
console.log("newval", newvaluee);
console.log("oldval", oldvaluee);
console.log("valuechanged", valuechanged);
//studyCrudlog=function(uid,original_value,new_value,description,componant_name,study_id)
//AppStorage.studyCrudlog($scope.newuser.users_id,oldvaluee,newvaluee,(valuechanged + " value changed."),"Users",AppStorage.getStudy().id);
}
} catch (ex) {
console.log(ex);
}
}
Below is the result of the
console.log("newval", newvaluee); console.log("oldval", oldvaluee); console.log("valuechanged", valuechanged);
In this case, the difference would be numberid and sitename
Any assistance would be highly appreciated!

