{"action":"created","issue":{"url":"https://api.github.com/repos/translate/pootle/issues/3816","labels_url":"https://api.github.com/repos/translate/pootle/issues/3816/labels{/name}","comments_url":"https://api.github.com/repos/translate/pootle/issues/3816/comments","events_url":"https://api.github.com/repos/translate/pootle/issues/3816/events","html_url":"https://github.com/translate/pootle/pull/3816","id":87250176,"number":3816,"title":"Cache virtual folder stats using CachedTreeItem","user":{"login":"unho","id":939880,"avatar_url":"https://avatars.githubusercontent.com/u/939880?v=3","gravatar_id":"","url":"https://api.github.com/users/unho","html_url":"https://github.com/unho","followers_url":"https://api.github.com/users/unho/followers","following_url":"https://api.github.com/users/unho/following{/other_user}","gists_url":"https://api.github.com/users/unho/gists{/gist_id}","starred_url":"https://api.github.com/users/unho/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/unho/subscriptions","organizations_url":"https://api.github.com/users/unho/orgs","repos_url":"https://api.github.com/users/unho/repos","events_url":"https://api.github.com/users/unho/events{/privacy}","received_events_url":"https://api.github.com/users/unho/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-06-11T07:50:23Z","updated_at":"2015-06-17T17:49:02Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/translate/pootle/pulls/3816","html_url":"https://github.com/translate/pootle/pull/3816","diff_url":"https://github.com/translate/pootle/pull/3816.diff","patch_url":"https://github.com/translate/pootle/pull/3816.patch"},"body":"@translate/core  Ready to review.\r\n\r\nThe purpose of these changes is to use CachedTreeItem in order to keep stats in cache, resulting in a faster retrieval. In order to do so VFolderCachedTreeItem trees are created besides regular tree, see an example in https://imgrush.com/axFao5a_-dUN. Unfortunately creating those tree structures results in worsening the vfolder and regular directory name clash (#3534) which was reported as #3809. Stats can only be calculated using `refresh_stats_rq`.\r\n\r\nInstructions for setup:\r\n\r\n- Check out the branch locally\r\n- You might need to make the assets to ensure you use the latest JS.\r\n- Run `./manage.py shell_plus`\r\n- Run `VirtualFolder.objects.all().delete()` and exit the shell\r\n- If you have a `test_vfolders` project remove it from Pootle and from `POOTLE_TRANSLATION_DIRECTORY`\r\n- Get https://docs.google.com/file/d/0B-8KVyCPnkZRSHAzbUFRYmV3LWM and uncompress it on your `POOTLE_TRANSLATION_DIRECTORY`\r\n- Add a new `test_vfolders` project.\r\n- Run `./manage.py update_stores --project=test_vfolders`\r\n- Get http://dpaste.com/15NCKRS and save it as `vfolders_test_directory.json`\r\n- Run `./manage.py add_vfolders vfolders_test_directory.json`\r\n- Run `./manage.py refresh_stats_rq --project=test_vfolders`\r\n\r\n\r\nInstructions for testing:\r\n\r\n- Run `./manage.py runserver`\r\n- Log in as a regular user (not admin)\r\n- Go to `http://127.0.0.1:8000/af/test_vfolders/browser/chrome/`\r\n- Check that:\r\n  - the vfolders stats table is displayed\r\n  - the listed vfolders are all the vfolders that should be displayed. The following must not be displayed:\r\n    - not browsable vfolders,\r\n    - completely translated vfolders,\r\n    - priority below 1 vfolders,\r\n    - vfolders that don't match any file in that path.\r\n  - you can see completely translated vfolders that have failing checks.\r\n  - the counts match. Note that each vfolder counts must only include the files they match in the current location or below it.\r\n  -  the translate links are correct. Just are like regular translate links for this location, but with the vfolder name included just after its location, for example a vfolder with location `/af/test_vfolders/browser/` and name `test-overlapping-vfolder` will have a needs work translate link pointing to `http://127.0.0.1:8000/af/test_vfolders/translate/browser/test-overlapping-vfolder/chrome/#filter=incomplete`\r\n- Log in as an admin user\r\n- Check that in `http://127.0.0.1:8000/af/test_vfolders/browser/chrome/` now you can also see styled as disabled (grayed out):\r\n  - not browsable vfolders ,\r\n  - completely translated vfolders,\r\n  - vfolders with priority below 1.\r\n- Click on the `need translation` translate link for vfolder `test-overrides` on the vfolders stats table and ensure that:\r\n  - you see `browser/test-overrides/chrome` in the navbar dropdown,\r\n  - the URL in the browser location bar is `http://127.0.0.1:8000/af/test_vfolders/translate/browser/test-overrides/chrome/#filter=incomplete`,\r\n  - the units displayed only belong to files matched by the vfolder filter in `/af/test_vfolders/browser/chrome/`\r\n  - it is not possible to sort by priority.\r\n- Select the same path to be translated in the editor, but not restricted to a vfolder: `http://127.0.0.1:8000/af/test_vfolders/translate/browser/chrome/#filter=incomplete`. Check that:\r\n  - the unit count is bigger\r\n  - you can sort by priority.\r\n- Open the navbar dropdown and ensure that all the vfolders that match within current project are displayed:\r\n  - Should be included (even if they have low priority or are completely translated):\r\n    - test-overlapping-vfolder\r\n    - test-overrides\r\n    - test-low-priority\r\n    - test-vfolder1\r\n    - test-vfolder2\r\n    - test-vfolder3\r\n    - test-completely-translated-with-failing-checks\r\n  - Are not browsable and thus should not be included:\r\n    - test-not-browsable\r\n    - test-completely-translated\r\n  - Don't apply to any file, so they should not be included:\r\n    - test-directory\r\n    - test-newfile\r\n- Open `http://127.0.0.1:8000/af/test_vfolders/translate/chat/#filter=incomplete` and ensure that:\r\n  - no priority is being displayed for any of the units listed,\r\n  - it is not possible to select priority sorting.\r\n- Open `http://127.0.0.1:8000/af/test_vfolders/translate/dom/chrome/#filter=incomplete` and ensure that:\r\n  - the top priority is being displayed for all the units shown (the units in this location belong to the vfolders whose name starts with `test-vfolder`, which eases looking in the JSON). Remember to ensure that the top priority is shown for a unit that is included in several vfolders.\r\n  - you can sort by priority. Remember top priorities are above and lower at the bottom. "},"comment":{"url":"https://api.github.com/repos/translate/pootle/issues/comments/112889890","html_url":"https://github.com/translate/pootle/pull/3816#issuecomment-112889890","issue_url":"https://api.github.com/repos/translate/pootle/issues/3816","id":112889890,"user":{"login":"unho","id":939880,"avatar_url":"https://avatars.githubusercontent.com/u/939880?v=3","gravatar_id":"","url":"https://api.github.com/users/unho","html_url":"https://github.com/unho","followers_url":"https://api.github.com/users/unho/followers","following_url":"https://api.github.com/users/unho/following{/other_user}","gists_url":"https://api.github.com/users/unho/gists{/gist_id}","starred_url":"https://api.github.com/users/unho/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/unho/subscriptions","organizations_url":"https://api.github.com/users/unho/orgs","repos_url":"https://api.github.com/users/unho/repos","events_url":"https://api.github.com/users/unho/events{/privacy}","received_events_url":"https://api.github.com/users/unho/received_events","type":"User","site_admin":false},"created_at":"2015-06-17T17:49:02Z","updated_at":"2015-06-17T17:49:02Z","body":"Just added to this PR a commit that renames `is_browsable` to `is_public`. The JSON provided in the instructions to test this PR has been updated accordingly."}}