Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
P
physical
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
alpha
physical
Commits
260be532
Commit
260be532
authored
Dec 04, 2018
by
段英荣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modify
parent
2c1e418b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
4 deletions
+6
-4
topic.py
search/views/topic.py
+6
-4
No files found.
search/views/topic.py
View file @
260be532
...
...
@@ -40,7 +40,7 @@ def home_recommend(session_id="",user_id=-1,offset=0,size=10):
have_read_topic_id_tuple
=
set
(
json
.
loads
(
redis_val_dict
[
b
"have_read_topic_id"
]))
for
item
in
topic_id_list
:
if
item
[
"group_id"
]
in
have_read_group_id_tuple
:
unread_topic_id_list
.
append
(
item
[
"id"
]
)
unread_topic_id_list
.
append
(
item
)
else
:
if
item
[
"id"
]
not
in
have_read_topic_id_tuple
:
recommend_topic_ids
.
append
(
item
[
"id"
])
...
...
@@ -52,7 +52,8 @@ def home_recommend(session_id="",user_id=-1,offset=0,size=10):
break
if
len
(
recommend_topic_ids
)
<
size
and
len
(
unread_topic_id_list
)
>
0
:
recommend_len
=
len
(
recommend_topic_ids
)
recommend_topic_ids
=
recommend_topic_ids
+
unread_topic_id_list
[:(
size
-
recommend_len
)]
offi_unread_topic_id
=
[
item
[
"id"
]
for
item
in
unread_topic_id_list
[:(
size
-
recommend_len
)]]
recommend_topic_ids
=
recommend_topic_ids
+
offi_unread_topic_id
unread_topic_id_list
=
unread_topic_id_list
[(
size
-
recommend_len
):]
if
len
(
unread_topic_id_list
)
>
0
:
...
...
@@ -101,7 +102,7 @@ def home_query(session_id="",user_id=-1,query="",offset=0,size=10):
have_read_topic_id_tuple
=
set
(
json
.
loads
(
redis_val_dict
[
b
"have_read_topic_id"
]))
for
item
in
topic_id_list
:
if
item
[
"group_id"
]
in
have_read_group_id_tuple
:
unread_topic_id_list
.
append
(
item
[
"id"
]
)
unread_topic_id_list
.
append
(
item
)
else
:
if
item
[
"id"
]
not
in
have_read_topic_id_tuple
:
recommend_topic_ids
.
append
(
item
[
"id"
])
...
...
@@ -113,7 +114,8 @@ def home_query(session_id="",user_id=-1,query="",offset=0,size=10):
break
if
len
(
recommend_topic_ids
)
<
size
and
len
(
unread_topic_id_list
)
>
0
:
recommend_len
=
len
(
recommend_topic_ids
)
recommend_topic_ids
=
recommend_topic_ids
+
unread_topic_id_list
[:(
size
-
recommend_len
)]
offi_unread_topic_id
=
[
item
[
"id"
]
for
item
in
unread_topic_id_list
[:(
size
-
recommend_len
)]]
recommend_topic_ids
=
recommend_topic_ids
+
offi_unread_topic_id
unread_topic_id_list
=
unread_topic_id_list
[(
size
-
recommend_len
):]
if
len
(
unread_topic_id_list
)
>
0
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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