Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
shahriar
instagram-service
Commits
07d6b22c
Commit
07d6b22c
authored
Aug 21, 2021
by
soheib
Browse files
fix calculate score repeated records
parent
41eeb938
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/app.module.ts
View file @
07d6b22c
...
...
@@ -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
},
...
...
src/lottery/lottery.service.ts
View file @
07d6b22c
...
...
@@ -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
'
,
})
}
...
...
src/lottery/score.service.ts
View file @
07d6b22c
...
...
@@ -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
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment