Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
ckanext-odsh
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
Open-Data
ckanext-odsh
Commits
39c175fd
Commit
39c175fd
authored
4 years ago
by
Jesper Zedlitz
Browse files
Options
Downloads
Patches
Plain Diff
Anzeige von Colleciton sicherer machen
Nach Datum sortieren Namen der Collection (statt der Id) verwenden
parent
06774c5c
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!17
Stage System soll in Zukunft Master Branch erhalten
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ckanext/odsh/collection/helpers.py
+13
-6
13 additions, 6 deletions
ckanext/odsh/collection/helpers.py
with
13 additions
and
6 deletions
ckanext/odsh/collection/helpers.py
+
13
−
6
View file @
39c175fd
...
...
@@ -33,14 +33,21 @@ def get_collection_id(dataset_dict):
def
get_package_dict
(
name
):
return
model
.
Package
.
get
(
name
).
as_dict
()
package
=
model
.
Package
.
get
(
name
)
if
package
:
return
package
.
as_dict
()
else
:
return
None
def
get_dataset_names
(
collection_dict
):
collection_dict
=
get_package_dict
(
collection_dict
.
get
(
'
id
'
))
# needed to get full package_dict
relationships_collection
=
collection_dict
.
get
(
'
relationships
'
)
names_collection_members
=
[
relationship
.
get
(
'
object
'
)
for
relationship
in
relationships_collection
]
return
names_collection_members
if
collection_dict
:
relationships_collection
=
collection_dict
.
get
(
'
relationships
'
)
names_collection_members
=
[
relationship
.
get
(
'
object
'
)
for
relationship
in
relationships_collection
]
return
names_collection_members
else
:
return
[]
def
get_datasets_from_solr
(
dataset_names
):
...
...
@@ -49,7 +56,7 @@ def get_datasets_from_solr(dataset_names):
name_expression
=
'
OR
'
.
join
(
dataset_names
)
fq
=
'
name:({})
'
.
format
(
name_expression
)
sort
=
'
name asc,
extras_issued asc
'
sort
=
'
extras_issued asc
'
# maximum possible number of results is 1000,
# see https://docs.ckan.org/en/ckan-2.7.3/api/index.html#ckan.logic.action.get.package_search
...
...
@@ -75,7 +82,7 @@ def gather_collection_info(collection_dict, datasets_in_collection, dataset_dict
name_collection
=
collection_dict
.
get
(
'
name
'
)
persistent_link_last_member
=
url_last_member
(
name_collection
)
url_collection
=
url_from_id
(
collection_dict
.
get
(
'
id
'
))
url_collection
=
url_from_id
(
collection_dict
.
get
(
'
name
'
))
if
dataset_dict
:
name_current_dataset
=
dataset_dict
.
get
(
'
name
'
)
...
...
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