Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
N
NACSOS Core
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
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
MCC APSIS
NACSOS
NACSOS Core
Commits
2e26ae70
Commit
2e26ae70
authored
1 year ago
by
Tim Repke
Browse files
Options
Downloads
Patches
Plain Diff
fix histogram
parent
ac8a9d60
Branches
main
No related tags found
1 merge request
!72
fix histogram
Pipeline
#2472
passed
1 year ago
Stage: build
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
server/api/routes/stats.py
+3
-3
3 additions, 3 deletions
server/api/routes/stats.py
with
3 additions
and
3 deletions
server/api/routes/stats.py
+
3
−
3
View file @
2e26ae70
...
...
@@ -140,7 +140,7 @@ async def get_publication_year_histogram(
if
project
.
type
==
ItemType
.
academic
:
alias
=
'
itm
'
from_stmt
=
f
'
{
AcademicItem
.
__tablename__
}
itm
'
column
=
f
'
make_timestamp(
{
AcademicItem
.
publication_year
.
name
}
,2,2,2,2,2)
'
column
=
f
'
make_timestamp(
itm.
{
AcademicItem
.
publication_year
.
name
}
,2,2,2,2,2)
'
elif
project
.
type
==
ItemType
.
twitter
:
alias
=
'
itm
'
from_stmt
=
f
'
{
TwitterItem
.
__tablename__
}
itm
'
...
...
@@ -149,13 +149,13 @@ async def get_publication_year_histogram(
alias
=
'
jn
'
from_stmt
=
(
f
'
{
LexisNexisItemSource
.
__tablename__
}
itm
'
f
'
LEFT JOIN
{
LexisNexisItem
.
__tablename__
}
jn ON itm.item_id = jn.item_id
'
)
column
=
LexisNexisItemSource
.
published_at
.
name
column
=
f
'
itm.
{
LexisNexisItemSource
.
published_at
.
name
}
'
else
:
raise
NotImplementedError
(
'
Only available for academic, lexisnexis, and twitter projects!
'
)
stmt
=
text
(
f
'''
WITH buckets as (SELECT generate_series(:from_date ::timestamp, :to_date ::timestamp,
'
1 year
'
) as bucket),
items as (SELECT
itm.
{
column
}
as time_ref, itm.item_id
items as (SELECT
{
column
}
as time_ref, itm.item_id
FROM
{
from_stmt
}
WHERE
{
alias
}
.project_id = :project_id)
SELECT b.bucket as bucket, count(DISTINCT item_id) as num_items
...
...
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