1
0
Fork 0

IMPROVE: Make edit columns adjust submissions as well

Dieser Commit ist enthalten in:
Keegan George 2021-08-31 13:29:30 -07:00
Ursprung 0bc151fc7b
Commit 280d2ffe54

Datei anzeigen

@ -31,16 +31,20 @@ export default Controller.extend({
@discourseComputed('submissions', 'fields.@each.enabled') @discourseComputed('submissions', 'fields.@each.enabled')
displaySubmissions(submissions, fields) { displaySubmissions(submissions, fields) {
return submissions.map(submission => { let result = [];
let field = fields.find(f => Object.keys(submission).includes(f.id));
if (!field.enabled) { submissions.forEach(submission => {
// insert field / submission deletion code here: let sub = {};
console.log(field, "is not enabled for ", submission);
} else if (field.enabled) { Object.keys(submission).forEach(fieldId => {
console.log(field, "is enabled for ", submission); if (fields.some(f => f.id === fieldId && f.enabled)) {
sub[fieldId] = submission[fieldId];
} }
return submission;
}); });
result.push(sub);
});
return result;
}, },
actions: { actions: {