Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

502 the stats are not working #506

Merged
merged 1 commit into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions backend/src/controllers/statistics.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@ const { internalServerError } = require("../utils/errors.helper");
class StatisticsController {
async getStatistics(req, res) {
try {
const userId = req.user.id;
const statistics = await statisticsService.generateStatistics({
userId: userId.toString(),
});
const statistics = await statisticsService.generateStatistics();
res.status(200).json(statistics);
} catch (e) {
console.log(e)
Expand Down
3 changes: 1 addition & 2 deletions backend/src/service/statistics.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const { GuideType } = require("../utils/guidelog.helper");
const GuideLog = db.GuideLog;

class StatisticsService {
async generateStatistics({ userId }) {
async generateStatistics() {
DeboraSerra marked this conversation as resolved.
Show resolved Hide resolved
try {
const now = new Date();
const thisMonth = new Date(now.getFullYear(), now.getMonth(), 1);
Expand All @@ -14,7 +14,6 @@ class StatisticsService {
const logs = await GuideLog.findAll({
where: {
guideType: Number(guideType),
userId,
showingTime: {
[db.Sequelize.Op.gte]: twoMonthsAgo,
},
Expand Down
Loading