2020-07-25 04:36:43 +00:00
|
|
|
import ApplicationSerializer from './application';
|
2020-07-28 04:29:22 +00:00
|
|
|
import { arrToObj } from '../utils';
|
2020-07-25 04:36:43 +00:00
|
|
|
|
|
|
|
export default ApplicationSerializer.extend({
|
|
|
|
embed: true,
|
|
|
|
include: ['taskGroupScales'],
|
2020-07-28 04:29:22 +00:00
|
|
|
|
|
|
|
serialize() {
|
|
|
|
var json = ApplicationSerializer.prototype.serialize.apply(this, arguments);
|
|
|
|
if (json instanceof Array) {
|
|
|
|
json.forEach(serializeJobScale);
|
|
|
|
} else {
|
|
|
|
serializeJobScale(json);
|
|
|
|
}
|
|
|
|
return json;
|
|
|
|
},
|
2020-07-25 04:36:43 +00:00
|
|
|
});
|
2020-07-28 04:29:22 +00:00
|
|
|
|
|
|
|
function serializeJobScale(jobScale) {
|
|
|
|
jobScale.TaskGroups = jobScale.TaskGroupScales.reduce(arrToObj('Name'), {});
|
|
|
|
}
|