Commit 07d6b22c authored by soheib's avatar soheib
Browse files

fix calculate score repeated records

parent 41eeb938
......@@ -16,7 +16,7 @@ import { StoryMentionSchema } from './instagram/models/storyMention.schema'
@Module({
imports: [
MongooseModule.forRoot(
'mongodb://instagram:wcD3B5sGw0yQ@185.231.180.248:27017/instagram-lottry?authSource=admin&authMechanism=SCRAM-SHA-256&connectTimeoutMS=10000&readPreference=primary&serverSelectionTimeoutMS=5000&appname=MongoDB%20Compass&directConnection=true&ssl=false',
'mongodb://localhost:27017/instagram-lottry',
),
MongooseModule.forFeature([
{ name: 'User', schema: UserSchema },
......
......@@ -46,8 +46,8 @@ export class LotteryService {
let index = 0
for await (const user_id of foundUser_idsList) {
let userScore = await this.scoreService.calculateUserScore(user_id.toString(), profileUsername, postArray)
if(userScore>0){
console.log(userScore,user_id.toString());
if (userScore > 0) {
console.log(userScore, user_id.toString());
}
let foundUserLastCount = await this.lotteryResultModel.countDocuments({
user_id: new Types.ObjectId(user_id)
......@@ -57,7 +57,7 @@ export class LotteryService {
await this.lotteryResultModel.create({
_id: new Types.ObjectId(),
index: await this.codeGenerator(),
user_id: user_id,
user_id: new Types.ObjectId(user_id),
status: 'valid',
})
}
......
......@@ -113,6 +113,7 @@ export class ScoreService {
let likesScore = await this.getUserLikesScore(username, profileUsername, postArray)
let commentScore = await this.getUserCommentsScore(username, profileUsername, postArray)
let addToStoryScore = await this.getTagsScore(username)
console.log("=======", likesScore, commentScore, addToStoryScore)
return likesScore + commentScore + addToStoryScore
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment