[ckan-changes] [okfn/ckan] d242bb: [#728] Add ckan.tracking_enabled to app_globals

GitHub noreply at github.com
Tue Apr 16 14:51:59 UTC 2013


  Branch: refs/heads/master
  Home:   https://github.com/okfn/ckan
  Commit: d242bb98a9af9b94c7ee760049aff91ddfde8c17
      https://github.com/okfn/ckan/commit/d242bb98a9af9b94c7ee760049aff91ddfde8c17
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2013-04-02 (Tue, 02 Apr 2013)

  Changed paths:
    M ckan/lib/app_globals.py

  Log Message:
  -----------
  [#728] Add ckan.tracking_enabled to app_globals

The ckan.tracking_enabled ini file setting was being ignored, so page
view tracking wasn't working. Adding ckan.tracking_enabled to
app_globals makes the setting work again.

Fixes #728


  Commit: 55129dbf959b060b27c68afce87486e5925e0b74
      https://github.com/okfn/ckan/commit/55129dbf959b060b27c68afce87486e5925e0b74
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2013-04-02 (Tue, 02 Apr 2013)

  Changed paths:
    M ckan/lib/cli.py

  Log Message:
  -----------
  [#729] Handle languages in URLs when updating page view tracking summary

Page view tracking was failing when a language was selected:

1. Put `ckan.tracking_enabled = true` in your ini file
2. Run CKAN, visit a page with a language e.g. `/en/dataset/annakarenina`
3. Run `paster tracking update`. If you look in your db, in the
   `tracking_summary` table there'll be a row with `package_id`
   `~~not~found~~`.
4. Run `paster tracking export tracking.csv`, the exported CSV file will
   say 0 views.

If you visit the page without the language in the URL e.g.
`/dataset/annakarenina` then run the export command again, the view does
get counted.

This commit fixes the SQL used by the `paster tracking update/export`
command to handle URLs with or without languages at the start.

Fixes #729


  Commit: 3eeeef257a9c9a7c574f9a9662289ebc7cd40d24
      https://github.com/okfn/ckan/commit/3eeeef257a9c9a7c574f9a9662289ebc7cd40d24
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2013-04-03 (Wed, 03 Apr 2013)

  Changed paths:
    M doc/index.rst
    A doc/tracking.rst

  Log Message:
  -----------
  [#541] Add docs for page view tracking feature

Add documentation for the page view tracking feature. There are still
some details to document, including how to show number of page views on
the pages themselves (eg. dataset views next to datasets) and how to
show "popular" labels next to popular datasets. It's also possible to
get a list of the N most popular datasets, for example for the front
page, perhaps this should be documented too.


  Commit: 8db766429d7f2afd593396b7138cb04e15e6d187
      https://github.com/okfn/ckan/commit/8db766429d7f2afd593396b7138cb04e15e6d187
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2013-04-03 (Wed, 03 Apr 2013)

  Changed paths:
    A doc/images/sort-datasets-by-popularity.png

  Log Message:
  -----------
  [#541] Add popularity-sorting screenshot

Should have been added in commit 3eeeef2 but I forgot.


  Commit: 52005cb098848ffe55117fb46c06be1a96e59c5d
      https://github.com/okfn/ckan/commit/52005cb098848ffe55117fb46c06be1a96e59c5d
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2013-04-03 (Wed, 03 Apr 2013)

  Changed paths:
    M ckan/templates/snippets/sort_by.html

  Log Message:
  -----------
  [#730] Only show 'Popular' sort option if tracking enabled

Sorting datasets by popularity only works if page view tracking is
enabled, so don't show the 'Popular' option in the 'Order by:' dropdown
if tracking isn't enabled.


  Commit: ca04063ce061fb80375e73d5aad865ebd6e0ae6d
      https://github.com/okfn/ckan/commit/ca04063ce061fb80375e73d5aad865ebd6e0ae6d
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2013-04-03 (Wed, 03 Apr 2013)

  Changed paths:
    M ckan/controllers/package.py
    M ckan/lib/search/query.py
    M ckan/logic/action/get.py
    M ckan/templates/snippets/sort_by.html

  Log Message:
  -----------
  [#714] Fix default sort ordering

Change the default sort order of package_search() to 'relevance asc,
metadata_modified desc'. We want to sort by relevance by default, but
when there's no search query relevance is meaningless, in that case fall
back on showing the most recently modified datasets first. Also changes
the sort ordering of the "Relevance" option in the "Order by:" dropdown
to 'relevance asc, metadata_modified desc' instead of just 'relevance
asc'.

The previous default ordering was 'score desc, name asc'. I'm not even
sure if that works, it seems to disagree with the sort strings that the
dropdown gives you, when you chose relevance from the dropdown you got
'relevance asc' not 'score desc' (and the datasets appeared in a
different order then the default), and when you chose name you get
'title_string' not name.

Previously we've fallen back on showing datasets alphabetically but
that's boring as it simply means that all the datasets beginning with 'a'
are always shown. Last modified seems more interesting and changes over
time. Popularity is not an option because that only works if the page
view tracking feature is enabled.

Move the logic that selects the default sort order for package_search()
out of lib and into package_search().

The package_search() action function now returns the sort order it used
in the 'sort' key of the returned dict, and the package controller sends
this to the templates to decide which sort ordering to show selected in
the "Order by:" dropdown. Previously the package controller and action
function each had their own logic and the dropdown was out of sync with
the actual sort order.

Fixes #714.


  Commit: 8d4c36649c307c27bd07945f043c89d95fafec92
      https://github.com/okfn/ckan/commit/8d4c36649c307c27bd07945f043c89d95fafec92
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2013-04-03 (Wed, 03 Apr 2013)

  Changed paths:
    A doc/images/popular-dataset.png
    A doc/images/popular-resource.png
    M doc/tracking.rst

  Log Message:
  -----------
  [#541] Add docs for highlighting popular datasets and resources

Also mention that tracking summary data is also available for resources
via the API, not just packages.


  Commit: 4822caa0565f10681864db4a364eafd91a50c58b
      https://github.com/okfn/ckan/commit/4822caa0565f10681864db4a364eafd91a50c58b
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2013-04-03 (Wed, 03 Apr 2013)

  Changed paths:
    M doc/tracking.rst

  Log Message:
  -----------
  [#541] Document how to show dataset and resource view counts in templates


  Commit: a38ce6b025442c5198a32196aa2098e7496705d5
      https://github.com/okfn/ckan/commit/a38ce6b025442c5198a32196aa2098e7496705d5
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2013-04-03 (Wed, 03 Apr 2013)

  Changed paths:
    M doc/tracking.rst

  Log Message:
  -----------
  [#541] Document showing most popular datasets on front page


  Commit: b0ce83c1ed6b42da83f2ccc2ebf0d4cac2ffbb33
      https://github.com/okfn/ckan/commit/b0ce83c1ed6b42da83f2ccc2ebf0d4cac2ffbb33
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2013-04-03 (Wed, 03 Apr 2013)

  Changed paths:
    M doc/tracking.rst

  Log Message:
  -----------
  [#541] Reference Google Analytics extension in Tracking docs


  Commit: 43516bff31528ff275c2c7e75daa95ed8ee282b5
      https://github.com/okfn/ckan/commit/43516bff31528ff275c2c7e75daa95ed8ee282b5
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2013-04-06 (Sat, 06 Apr 2013)

  Changed paths:
    M ckan/model/__init__.py
    M ckan/model/tracking.py

  Log Message:
  -----------
  [#730] Add tracking_raw_table to model

The tracking_raw table was being created by a migration script, but was
not actually defined anywhere in ckan's model. This means that in tests,
ckan.model.rebuild_db() would not clear the tracking_raw table, and the
old data would then leak it into tracking_summary as well. Adding
tracking_raw to the model makes rebuild_db() behave as expected again.


  Commit: c0484f86b55550d378d0f9906d016543bb2c2974
      https://github.com/okfn/ckan/commit/c0484f86b55550d378d0f9906d016543bb2c2974
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2013-04-07 (Sun, 07 Apr 2013)

  Changed paths:
    M ckan/logic/action/get.py

  Log Message:
  -----------
  [#730] Make sure 'sort' is always in package_search's data_dict

If data_dict contained no 'sort', the default value was not being added
if the data_dict did contain 'abort_search': True. The code nonetheless
tries to access data_dict['sort'] later on and crashes. (Isn't this what
schemas and validation are supposed to be for?) This was causing a test
to fail. Adding the default 'sort' value to data_dict even if
'abort_search': True is there fixes it.


  Commit: 2879cf964e7c214e2046a4644606a7417bc19e4b
      https://github.com/okfn/ckan/commit/2879cf964e7c214e2046a4644606a7417bc19e4b
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2013-04-07 (Sun, 07 Apr 2013)

  Changed paths:
    M ckan/tests/lib/test_solr_package_search.py

  Log Message:
  -----------
  [#714] Fix some solr package search tests

CKAN used to convert 'sort': 'rank' into 'sort': 'score desc, namae asc'
but since commit ca04063ce061fb80375e73d5aad865ebd6e0ae6d ([#714] Fix
default sort ordering) it no longer does this, which breaks these tests.
Update the tests to pass 'score desc, name asc' directly instead.


  Commit: bc496ffd758cf3053dc24e6e24e02f495553f71f
      https://github.com/okfn/ckan/commit/bc496ffd758cf3053dc24e6e24e02f495553f71f
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2013-04-08 (Mon, 08 Apr 2013)

  Changed paths:
    M ckan/logic/action/get.py
    M ckan/templates/snippets/sort_by.html

  Log Message:
  -----------
  [#714] Use score not relevance in default sort order

'relevance' is not actually in the solr schema so it doesn't do
anything, score is the one we want.


  Commit: 85b30cacf3d0f249544ace9fd73705f03933d1f9
      https://github.com/okfn/ckan/commit/85b30cacf3d0f249544ace9fd73705f03933d1f9
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2013-04-08 (Mon, 08 Apr 2013)

  Changed paths:
    M ckan/lib/create_test_data.py
    M ckan/tests/functional/test_pagination.py

  Log Message:
  -----------
  [#714] Fix pagination tests

Change create_arbitrary() to always create datasets in the same order,
instead of a different order each time. Update pagination tests to
expect datasets in the new default sort order.


  Commit: 495d1521ebacad5281d06c02ab21963bd6f4e13d
      https://github.com/okfn/ckan/commit/495d1521ebacad5281d06c02ab21963bd6f4e13d
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2013-04-08 (Mon, 08 Apr 2013)

  Changed paths:
    M ckan/tests/logic/test_action.py

  Log Message:
  -----------
  [#714] Fix an intermittently failing test

This test depends on the order of the two datasets. The default sort
order has changed now to most-recently-modified-first when there's no
search query, and since the test creates the two datasets in a random
order the search returns the datasets in a different order each time the
test is run, giving a 50/50 chance that the test will fail.

Change the test to not depend on the fixed order of the datasets.


  Commit: 5bd3efac1e0b19056b5305fd626eedafc40f510b
      https://github.com/okfn/ckan/commit/5bd3efac1e0b19056b5305fd626eedafc40f510b
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2013-04-09 (Tue, 09 Apr 2013)

  Changed paths:
    M doc/tracking.rst

  Log Message:
  -----------
  [#541] Tweak page view tracking docs

Just clarify the docs a bit, and also mention that "recent" means last
14 days and that paster export is for datasets only.


  Commit: 7c7f3320de025aad5a1abbe426925b0184b2c309
      https://github.com/okfn/ckan/commit/7c7f3320de025aad5a1abbe426925b0184b2c309
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2013-04-09 (Tue, 09 Apr 2013)

  Changed paths:
    M doc/tracking.rst

  Log Message:
  -----------
  [#541] Small tweak to page view tracking docs


  Commit: 08da6c7206e01a2dc7cfe3a87c0ec241ce9576e5
      https://github.com/okfn/ckan/commit/08da6c7206e01a2dc7cfe3a87c0ec241ce9576e5
  Author: tobes <toby.junk at gmail.com>
  Date:   2013-04-16 (Tue, 16 Apr 2013)

  Changed paths:
    M ckan/controllers/package.py
    M ckan/lib/app_globals.py
    M ckan/lib/cli.py
    M ckan/lib/create_test_data.py
    M ckan/lib/search/query.py
    M ckan/logic/action/get.py
    M ckan/model/__init__.py
    M ckan/model/tracking.py
    M ckan/templates/snippets/sort_by.html
    M ckan/tests/functional/test_pagination.py
    M ckan/tests/lib/test_solr_package_search.py
    M ckan/tests/logic/test_action.py
    A doc/images/popular-dataset.png
    A doc/images/popular-resource.png
    A doc/images/sort-datasets-by-popularity.png
    M doc/index.rst
    A doc/tracking.rst

  Log Message:
  -----------
  Merge branch 'tracking-fixes'

Conflicts:
	ckan/lib/app_globals.py

    new config options added in different branches no conflicts


Compare: https://github.com/okfn/ckan/compare/d2613b2977b1...08da6c7206e0


More information about the ckan-changes mailing list