FIX: re-add logic incorrectly removed submissions logic during merge
Dieser Commit ist enthalten in:
Ursprung
072a3ea142
Commit
60abb6981e
1 geänderte Dateien mit 35 neuen und 5 gelöschten Zeilen
|
@ -9,15 +9,45 @@ export default DiscourseRoute.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
setupController(controller, model) {
|
setupController(controller, model) {
|
||||||
const fields = model.fields.map((f) => {
|
let fields = [
|
||||||
const fieldsObject = EmberObject.create(f);
|
EmberObject.create({ id: "username", label: "User", enabled: true }),
|
||||||
fieldsObject.enabled = true;
|
];
|
||||||
return fieldsObject;
|
let submissions = [];
|
||||||
|
|
||||||
|
model.submissions.forEach((s) => {
|
||||||
|
let submission = {
|
||||||
|
username: s.user,
|
||||||
|
};
|
||||||
|
|
||||||
|
Object.keys(s.fields).forEach((fieldId) => {
|
||||||
|
if (!fields.some((field) => field.id === fieldId)) {
|
||||||
|
fields.push(
|
||||||
|
EmberObject.create({
|
||||||
|
id: fieldId,
|
||||||
|
label: s.fields[fieldId].label,
|
||||||
|
enabled: true,
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
submission[fieldId] = s.fields[fieldId];
|
||||||
|
});
|
||||||
|
|
||||||
|
submission["submitted_at"] = s.submitted_at;
|
||||||
|
submissions.push(EmberObject.create(submission));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
let submittedAt = {
|
||||||
|
id: "submitted_at",
|
||||||
|
label: "Submitted At",
|
||||||
|
enabled: true,
|
||||||
|
};
|
||||||
|
|
||||||
|
fields.push(EmberObject.create(submittedAt));
|
||||||
|
|
||||||
controller.setProperties({
|
controller.setProperties({
|
||||||
wizard: model.wizard,
|
wizard: model.wizard,
|
||||||
fields: A(fields),
|
fields: A(fields),
|
||||||
submissions: A(model.submissions),
|
submissions: A(submissions),
|
||||||
total: model.total,
|
total: model.total,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
Laden …
In neuem Issue referenzieren