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
81d55edf
Commit
81d55edf
authored
Dec 17, 2018
by
段英荣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modify
parent
2f14a250
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
+7
-7
group.py
search/views/group.py
+7
-7
No files found.
search/views/group.py
View file @
81d55edf
...
...
@@ -59,14 +59,14 @@ def group_sort(user_id=-1,sort_type=GroupSortTypes.HOT_RECOMMEND,offset=0,size=1
attention_group_id_list
=
[
item
[
"group_id"
]
for
item
in
attention_group_list
]
sorted_group_ids_list
=
GroupUtils
.
get_group_ids_by_aggs
(
attention_group_id_list
)
group_recommend_ids_list
=
sorted_group_ids_list
[
offset
:(
offset
+
size
)]
if
len
(
group_recommend_ids_list
)
<
size
and
len
(
group_recommend_ids_list
)
<
len
(
attention_group_list
):
sorted_attention_group_list
=
sorted
(
attention_group_list
,
key
=
lambda
item
:
item
[
"update_time_val"
],
reverse
=
True
)
for
item
in
sorted_attention_group_list
:
if
item
[
"group_id"
]
not
in
sorted_group
_ids_list
:
group_recommend_ids_list
.
append
(
item
[
"group_id"
])
group_recommend_ids_list
=
sorted_group_ids_list
#
if len(group_recommend_ids_list) < size and len(group_recommend_ids_list)<len(attention_group_list):
sorted_attention_group_list
=
sorted
(
attention_group_list
,
key
=
lambda
item
:
item
[
"update_time_val"
],
reverse
=
True
)
for
item
in
sorted_attention_group_list
:
if
item
[
"group_id"
]
not
in
group_recommend
_ids_list
:
group_recommend_ids_list
.
append
(
item
[
"group_id"
])
return
{
"group_recommend_ids"
:
group_recommend_ids_list
}
return
{
"group_recommend_ids"
:
group_recommend_ids_list
[
offset
:(
offset
+
size
)]
}
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
...
...
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