Wednesday 10 May 2017

How to carry over one session data to another session in node

am working on a feature to get the total number of votes per done day, as am using session the user vote details have been stored in session once the user sign out the session data will get erased so is there any way to get the total number votes per day by all session users ?

my code is her:

    var scores = {
        up: 1,
        down: -1
    };
    var today = new Date(),
        link = null;

    today = [today.getFullYear(), today.getMonth(), today.getDate()].join('/');
function(done_users_vote_count) {
            if (!(req.session.user.used_vote_score && req.session.user.used_vote_score[today])) {
                req.session.user.used_vote_score = {};
                req.session.user.used_vote_score[today] = 0;
            }
            console.log("req.session.user.used_vote_score[today]",req.session.user.used_vote_score[today])
            if (req.session.user.used_vote_score[today] >= 100) {
                return res.status(400).send({
                    message: 'no more votes.'
                });
            }
            return save_user_vote_scores(done_users_vote_count);
        },



via Schüler

No comments:

Post a Comment