Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Maják
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TO
Maják
Commits
7132f43f
Verified
Commit
7132f43f
authored
1 year ago
by
jindra12
Browse files
Options
Downloads
Patches
Plain Diff
Correct tag count
#210
parent
4e8ba248
No related branches found
No related tags found
2 merge requests
!816
Release
,
!801
Prepare basic shared tags
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
shared/models.py
+11
-4
11 additions, 4 deletions
shared/models.py
with
11 additions
and
4 deletions
shared/models.py
+
11
−
4
View file @
7132f43f
...
...
@@ -4,8 +4,8 @@ from functools import reduce
from
django.apps
import
apps
from
django.db
import
models
from
django.db.models
import
F
,
Q
from
django.db.models.expressions
import
F
,
Value
from
django.db.models
import
Q
from
django.db.models.expressions
import
ExpressionWrapper
,
F
,
Value
from
django.db.models.functions
import
Coalesce
from
django.utils
import
timezone
from
modelcluster.fields
import
ParentalKey
,
ParentalManyToManyField
...
...
@@ -313,7 +313,10 @@ class ArticlesMixin(models.Model):
def
evaluate_page_query
(
self
,
results
):
return
list
(
reduce
(
lambda
unique
,
item
:
unique
|
{
f
"
{
item
[
'
union_page_ptr_id
'
]
}
"
:
item
},
lambda
unique
,
item
:
unique
if
item
[
"
union_page_ptr_id
"
]
in
unique
and
"
union_shared_from_id
"
in
item
else
unique
|
{
f
"
{
item
[
'
union_page_ptr_id
'
]
}
"
:
item
},
list
(
results
),
{},
).
values
()
...
...
@@ -564,11 +567,15 @@ class ArticlesMixin(models.Model):
articles
:
list
,
tags_model_query
=
None
,
):
own_page_type
=
self
.
determine_page_type
()
get_ids_by_page_type
=
lambda
page_type
:
list
(
map
(
lambda
article
:
article
.
page_ptr
.
id
,
filter
(
lambda
article
:
article
.
shared_type
==
page_type
,
lambda
article
:
article
.
shared_type
==
page_type
or
(
article
.
shared_type
is
None
and
own_page_type
.
value
==
page_type
),
articles
,
),
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment