You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Problem: The run method in the scrapper.controller.js file throws a bill not exist error because the scrapping url should accept month parameter with leading zero.
Example:
// month param less than 10
https://dpdc.org.bd/service/ebill?btyp=current&year=2021&month=01&cno=24546800&email=
// month more than 10
https://dpdc.org.bd/service/ebill?btyp=current&year=2021&month=12&cno=24546800&email=
Solution:
const run = async function (req, res) {
const year = req.query.year;
const month = req.query.month.length===1 ? '0'+req.query.month:req.query.month; //add this line
const customer_no = req.query.cno.split(",");
//console.log({ year, month, customer_no });
try {
//error handling code
if (checkParam(year) && checkParam(month) && checkParam(customer_no)) {
const data = await getData(year, month, customer_no, res);
res.status(200).json(data);
} else {
res.status(400).json({
msg: "Parameters are undefined or null value",
parameter: { year, month, customer_no },
});
}
} catch (error) {
res.status(500).json({ msg: error });
}
};
The text was updated successfully, but these errors were encountered:
Problem: The run method in the scrapper.controller.js file throws a bill not exist error because the scrapping url should accept month parameter with leading zero.
Example:
Solution:
The text was updated successfully, but these errors were encountered: