Skip to content

Commit

Permalink
fix : change temperature cal
Browse files Browse the repository at this point in the history
  • Loading branch information
papicc45 committed Dec 6, 2023
1 parent c247514 commit d824678
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions controller/CategoryController.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,11 @@ exports.getHashtagInfo = async (req, res) => {
exports.getTop5 = async (req, res)=> {
const temp_min = parseFloat(req.query.temp_min);
const temp_max = parseFloat(req.query.temp_max);
const temp = Math.round((temp_min + temp_max) / 2);
const minus = temp - 1;
const plus = temp + 1;

try {
const result = await Category.aggregate([
{
$match: { temperature: { $gte: minus, $lte: plus } }
$match: { temperature: { $gte: temp_min, $lte: temp_max } }
},
{
$group: { _id: "$categoryName", count: { $sum: "$count" } }
Expand Down

0 comments on commit d824678

Please sign in to comment.