Skip to content

Commit

Permalink
Merge pull request #2520 from vrk-kpa/remove_tracking
Browse files Browse the repository at this point in the history
AV-2384: Remove tracking due to performance reasons
  • Loading branch information
Zharktas authored Jan 9, 2025
2 parents 8d41a39 + 7527a98 commit ce0fe9e
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 13 deletions.
3 changes: 2 additions & 1 deletion ckan/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,8 @@ RUN cd ${SRC_DIR}/ckan && \
patch --strip=1 --input=patches/implement_is_required_for_image_upload.patch && \
patch --strip=1 --input=patches/add_drafts_to_search.patch && \
patch --strip=1 --input=patches/add_prefix_to_werkzeug.patch && \
patch --strip=1 --input=patches/fix_use_default_schema_parameter.patch
patch --strip=1 --input=patches/fix_use_default_schema_parameter.patch && \
patch --strip=1 --input=patches/remove_tracking.patch

RUN \
# Make scripts executable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
(_('Relevance'), 'score desc, metadata_created desc'),
(_('Newest first'), 'metadata_created desc'),
(_('Oldest first'), 'metadata_created asc'),
(_('Popular'), 'views_recent desc') if g.tracking_enabled else (false, false)
(_('Popular'), 'views_recent desc') if g.tracking_enabled else (false, false),
(_('Name Ascending'), 'title_string asc'),
(_('Name Descending'), 'title_string desc'),
(_('Last Modified'), 'metadata_modified desc')]
Expand Down
3 changes: 2 additions & 1 deletion ckan/cron/crontab
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
0 1 * * * cd /srv/app && ./cron/scripts/matomo-fetch.sh
0 3 */3 * * cd /srv/app && ./cron/scripts/archiver-update.sh
*/5 * * * * cd /srv/app && ./cron/scripts/harvester-run.sh
0 22 * * * cd /srv/app && ./cron/scripts/ckan-refresh.sh
# tracking updates disabled, due to performance reasons
# 0 22 * * * cd /srv/app && ./cron/scripts/ckan-refresh.sh
0 2 * * * cd /srv/app && ./cron/scripts/qa-update.sh
0 5 * * * cd /srv/app && ./cron/scripts/report-generate.sh
0 11 * * * cd /srv/app && ./cron/scripts/harvest-stuck-reports.sh
Expand Down
22 changes: 22 additions & 0 deletions ckan/src/ckan/patches/remove_tracking.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
diff --git a/ckan/views/dataset.py b/ckan/views/dataset.py
index 5f32faa22..27864f59a 100644
--- a/ckan/views/dataset.py
+++ b/ckan/views/dataset.py
@@ -385,7 +385,7 @@ def resources(package_type, id):
u'for_view': True,
u'auth_user_obj': g.userobj
}
- data_dict = {u'id': id, u'include_tracking': True}
+ data_dict = {u'id': id, u'include_tracking': False}

try:
check_access(u'package_update', context, data_dict)
@@ -427,7 +427,7 @@ def read(package_type, id):
u'for_view': True,
u'auth_user_obj': g.userobj
}
- data_dict = {u'id': id, u'include_tracking': True}
+ data_dict = {u'id': id, u'include_tracking': False}
activity_id = request.params.get(u'activity_id')

# check if package exists
2 changes: 1 addition & 1 deletion ckan/templates/production.ini.j2
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ ckanext.spatial.common_map.attribution = &copy; <a href="http://www.openstreetma

solr_url = http://{{ environ('SOLR_HOST') }}:{{ environ('SOLR_PORT') }}/{{ environ('SOLR_PATH') }}

ckan.tracking_enabled = true
ckan.tracking_enabled = false

ckan.max_resource_size = {{ environ('CKAN_MAX_RESOURCE_SIZE') }}

Expand Down
1 change: 0 additions & 1 deletion cypress/e2e/advancedsearch_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,6 @@ describe('Advanced search tests', () => {
cy.get('#field-order-by > option').eq(3).should('have.value', 'metadata_modified desc');
cy.get('#field-order-by > option').eq(4).should('have.value', 'metadata_created asc');
cy.get('#field-order-by > option').eq(5).should('have.value', 'metadata_created desc');
cy.get('#field-order-by > option').eq(6).should('have.value', 'views_recent desc');
});

it('Default sorting option is sorting by relevance', function(){
Expand Down
11 changes: 3 additions & 8 deletions cypress/e2e/dataset_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,18 +71,14 @@ describe('Dataset tests',

cy.get('#field-order-by').select('metadata_created desc');
cy.url({timeout: 20000}).should('contain', `dataset?q=&sort=metadata_created+desc`)

cy.get('#field-order-by').select('views_recent desc');
cy.url({timeout: 20000}).should('contain', `dataset?q=&sort=views_recent+desc`)
});

it('Chosen sorting option persists after search', function(){
cy.get('#field-order-by').select('views_recent desc');
cy.url({timeout: 20000}).should('contain', `dataset?q=&sort=views_recent+desc`)
cy.get('#field-order-by').select('metadata_created desc');
cy.url({timeout: 20000}).should('contain', `dataset?q=&sort=metadata_created+desc`)
cy.get('.search').type('random search');
cy.get('.fal').click();
cy.url({timeout: 20000}).should('contain', `dataset?q=random+search&sort=views_recent+desc`)
cy.get('#field-order-by').select('views_recent desc');
cy.url({timeout: 20000}).should('contain', `dataset?q=random+search&sort=metadata_created+desc`)
});

it('Datasets have sorting options', function(){
Expand All @@ -92,7 +88,6 @@ describe('Dataset tests',
cy.get('#field-order-by > option').eq(3).should('have.value', 'metadata_modified desc');
cy.get('#field-order-by > option').eq(4).should('have.value', 'metadata_created asc');
cy.get('#field-order-by > option').eq(5).should('have.value', 'metadata_created desc');
cy.get('#field-order-by > option').eq(6).should('have.value', 'views_recent desc');
});

// NOTE! This test currently is dependent on the ordering of the datasets, so if any datasets are created before in
Expand Down

0 comments on commit ce0fe9e

Please sign in to comment.