Skip to content

Commit fdaf006

Browse files
committed
Modified createRecord operation in SatisfactionSurvey API
1 parent 1492193 commit fdaf006

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/controllers/satisfactionSurvey/satisfactionSurvey.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ const surveyQueryObject = {
5252
],
5353
};
5454
const formatSurveyObject = async (surveyObject) => {
55+
//console.log(`*****\n\n\n\n\n${surveyObject.satisfactionSurveyRecipients}\n\n\n\n\n*****`);
5556
const recipients = await fetchRecipientData(
5657
surveyObject.satisfactionSurveyRecipients
5758
);
@@ -248,16 +249,16 @@ exports.createRecord = async (req, res) => {
248249

249250
if (satisfactionSurveyQuestions) {
250251
// Save questions
251-
let orderNumber = 1;
252+
//let orderNumber = 1;
252253
const questions = [];
253254
for (let question of satisfactionSurveyQuestions) {
254255
const questionData = {
255256
surveyId,
256-
orderNumber,
257-
question,
257+
orderNumber: question.orderNumber,
258+
question: question.question,
258259
};
259260
questions.push(questionData);
260-
orderNumber++;
261+
//orderNumber++;
261262
}
262263
if (questions.length > 0) {
263264
await db.satisfactionSurveyQuestion.bulkCreate(questions, {
@@ -269,8 +270,11 @@ exports.createRecord = async (req, res) => {
269270
if (satisfactionSurveyRecipients) {
270271
// Save recipient data
271272
const recipients = [];
272-
for (let empId of satisfactionSurveyRecipients) {
273-
recipients.push({ surveyId, empId });
273+
for (let emp of satisfactionSurveyRecipients) {
274+
recipients.push({
275+
surveyId,
276+
empId: emp.empId
277+
});
274278
}
275279
await db.satisfactionSurveyRecipient.bulkCreate(recipients, {
276280
validate: true,

0 commit comments

Comments
 (0)