|
|
|
@ -1240,7 +1240,7 @@ exports.updateSensorQC = async (req, reply) => {
|
|
|
|
|
const { _id } = req.params;
|
|
|
|
|
let updateData = req.body;
|
|
|
|
|
|
|
|
|
|
const allowedFields = ["qccheck", "qcby", "comments","status"];
|
|
|
|
|
const allowedFields = ["qccheck", "qcby", "comments", "status"];
|
|
|
|
|
|
|
|
|
|
// Filter only allowed fields
|
|
|
|
|
const filteredUpdateData = Object.keys(updateData)
|
|
|
|
@ -1253,6 +1253,11 @@ exports.updateSensorQC = async (req, reply) => {
|
|
|
|
|
// Update qccheckdate with the current date in "DD-MMM-YYYY - HH:MM" format
|
|
|
|
|
filteredUpdateData.qccheckdate = moment().format("DD-MMM-YYYY - HH:mm");
|
|
|
|
|
|
|
|
|
|
// Update status based on qccheck value
|
|
|
|
|
if (filteredUpdateData.qccheck) {
|
|
|
|
|
filteredUpdateData.status = filteredUpdateData.qccheck.toLowerCase() === "ok" ? "available" : "rejected";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const updatedSensor = await Insensors.findByIdAndUpdate(
|
|
|
|
|
_id,
|
|
|
|
|
filteredUpdateData,
|
|
|
|
|