Skip to content

Commit

Permalink
Merge pull request #69 from shikshalokam/kafka_logs
Browse files Browse the repository at this point in the history
kafka logs added
  • Loading branch information
aks30 authored Feb 4, 2022
2 parents 318d3a6 + afeae08 commit dd6cc85
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions module/observationSubmissions/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,15 @@ module.exports = class ObservationSubmissionsHelper {
)
);
}
console.log("--------------------------OBS WITH RUBRIC ISSUE DEGUG START pushObservationSubmissionForReporting()-------------------");


console.log("STATUS : ",observationSubmissionsDocument.status);
console.log("OBS SUBMISSION ID : ",observationSubmissionId);

console.log("BEFORE CALLING pushObservationSubmissionToKafka method ");
const kafkaMessage = await kafkaClient.pushObservationSubmissionToKafka(observationSubmissionsDocument);

console.log("AFTER CALLING pushObservationSubmissionToKafka method ",JSON.stringify(kafkaMessage));

if(kafkaMessage.status != "success") {
let errorObject = {
formData: {
Expand All @@ -137,10 +141,12 @@ module.exports = class ObservationSubmissionsHelper {
};
console.log(errorObject);
}

console.log("--------------------------OBS WITH RUBRIC ISSUE DEGUG END pushObservationSubmissionForReporting()-------------------");
return resolve(kafkaMessage);

} catch (error) {

console.log("pushObservationSubmissionForReporting() catch block",JSON.stringify(error));
return reject({
success: false,
message: error.message,
Expand Down Expand Up @@ -319,8 +325,13 @@ module.exports = class ObservationSubmissionsHelper {
}

let resultingArray = await scoringHelper.rateEntities([submissionDocument], "singleRateApi");


console.log("--------------------------OBS WITH RUBRIC ISSUE DEGUG START rateSubmissionById()-------------------");
console.log("Resulting Array : ",resultingArray.result.runUpdateQuery);

if(resultingArray.result.runUpdateQuery) {
console.log("Submission Id : ",rsubmissionId);

await database.models.observationSubmissions.updateOne(
{
_id: ObjectId(submissionId)
Expand All @@ -330,15 +341,21 @@ module.exports = class ObservationSubmissionsHelper {
completedDate: new Date()
}
);
console.log("-------------------------Before calling pushObservationSubmissionForReporting------------");
await this.pushObservationSubmissionForReporting(submissionId);
console.log("-------------------------After calling pushObservationSubmissionForReporting------------");
console.log("--------------------------OBS WITH RUBRIC ISSUE DEGUG END rateSubmissionById()-------------------");
emailClient.pushMailToEmailService(emailRecipients,messageConstants.apiResponses.OBSERVATION_AUTO_RATING_SUCCESS+" - "+submissionId,JSON.stringify(resultingArray));
return resolve(messageConstants.apiResponses.OBSERVATION_RATING);
} else {
emailClient.pushMailToEmailService(emailRecipients,messageConstants.apiResponses.OBSERVATION_AUTO_RATING_FAILED+" - "+submissionId,JSON.stringify(resultingArray));
return resolve(messageConstants.apiResponses.OBSERVATION_RATING);
}



} catch (error) {
console.log("rateSubmissionById() catch block",JSON.stringify(error));

emailClient.pushMailToEmailService(emailRecipients,messageConstants.apiResponses.OBSERVATION_AUTO_RATING_FAILED+" - "+submissionId,error.message);
return reject(error);
Expand Down

0 comments on commit dd6cc85

Please sign in to comment.