{"action":"created","comment":{"url":"https://api.github.com/repos/HabitRPG/habitica/pulls/comments/223477921","pull_request_review_id":162614774,"id":223477921,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyMzQ3NzkyMQ==","diff_hunk":"@@ -116,9 +118,38 @@ layout-section(:title=\"$t('equipment')\")\n         return this.marketGearCategories.filter(c => c.id === this.selectedGroupGearByClass)[0];\n       },\n       sortedGearItems () {\n+        let result = this.filterGearItems();\n+        let selectedSortKey = sortGearTypeMap[this.selectedSortGearBy.id];\n+\n+        result = _sortBy(result, selectedSortKey);","path":"website/client/components/shops/market/equipmentSection.vue","position":23,"original_position":23,"commit_id":"efd18503fe77018e8cd5f7a8055b3e1e2d80645f","original_commit_id":"efd18503fe77018e8cd5f7a8055b3e1e2d80645f","user":{"login":"paglias","id":589911,"node_id":"MDQ6VXNlcjU4OTkxMQ==","avatar_url":"https://avatars2.githubusercontent.com/u/589911?v=4","gravatar_id":"","url":"https://api.github.com/users/paglias","html_url":"https://github.com/paglias","followers_url":"https://api.github.com/users/paglias/followers","following_url":"https://api.github.com/users/paglias/following{/other_user}","gists_url":"https://api.github.com/users/paglias/gists{/gist_id}","starred_url":"https://api.github.com/users/paglias/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paglias/subscriptions","organizations_url":"https://api.github.com/users/paglias/orgs","repos_url":"https://api.github.com/users/paglias/repos","events_url":"https://api.github.com/users/paglias/events{/privacy}","received_events_url":"https://api.github.com/users/paglias/received_events","type":"User","site_admin":false},"body":"hi @trvrfrd , sorry for the delay here. The code looks good, I'm just wondering if it's possible to condense these 3 sorting functions (2 sortBy and the reverse) into just one since with many items it would be a very expensive operation.\r\n\r\nFor example you could save the call to reverse() by using orderBy instead of sortBy and change to `desc` as the third parameter in case `selectedSortKey !== 'type' && selectedSortKey !== 'value' === true`\r\n\r\nSomething like this should work:\r\n\r\n```\r\nlet order = selectedSortKey !== 'type' && selectedSortKey !== 'value' ? 'desc' : 'asc';\r\nresult = _orderBy(result, [selectedSortKey, locked], ['', 'asc'];\r\n```","created_at":"2018-10-08T19:47:49Z","updated_at":"2018-10-08T19:48:32Z","html_url":"https://github.com/HabitRPG/habitica/pull/10734#discussion_r223477921","pull_request_url":"https://api.github.com/repos/HabitRPG/habitica/pulls/10734","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/HabitRPG/habitica/pulls/comments/223477921"},"html":{"href":"https://github.com/HabitRPG/habitica/pull/10734#discussion_r223477921"},"pull_request":{"href":"https://api.github.com/repos/HabitRPG/habitica/pulls/10734"}}},"pull_request":{"url":"https://api.github.com/repos/HabitRPG/habitica/pulls/10734","id":220069734,"node_id":"MDExOlB1bGxSZXF1ZXN0MjIwMDY5NzM0","html_url":"https://github.com/HabitRPG/habitica/pull/10734","diff_url":"https://github.com/HabitRPG/habitica/pull/10734.diff","patch_url":"https://github.com/HabitRPG/habitica/pull/10734.patch","issue_url":"https://api.github.com/repos/HabitRPG/habitica/issues/10734","number":10734,"state":"open","locked":false,"title":"Issue 10728: sort equipment by stat descending on Market page","user":{"login":"trvrfrd","id":1634668,"node_id":"MDQ6VXNlcjE2MzQ2Njg=","avatar_url":"https://avatars1.githubusercontent.com/u/1634668?v=4","gravatar_id":"","url":"https://api.github.com/users/trvrfrd","html_url":"https://github.com/trvrfrd","followers_url":"https://api.github.com/users/trvrfrd/followers","following_url":"https://api.github.com/users/trvrfrd/following{/other_user}","gists_url":"https://api.github.com/users/trvrfrd/gists{/gist_id}","starred_url":"https://api.github.com/users/trvrfrd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/trvrfrd/subscriptions","organizations_url":"https://api.github.com/users/trvrfrd/orgs","repos_url":"https://api.github.com/users/trvrfrd/repos","events_url":"https://api.github.com/users/trvrfrd/events{/privacy}","received_events_url":"https://api.github.com/users/trvrfrd/received_events","type":"User","site_admin":false},"body":"[//]: # (Note: See http://habitica.wikia.com/wiki/Using_Your_Local_Install_to_Modify_Habitica%27s_Website_and_API for more info)\r\n\r\n[//]: # (Put Issue # here, if applicable. This will automatically close the issue if your PR is merged in)\r\nFixes #10728 \r\n\r\n### Changes\r\n[//]: # (Describe the changes that were made in detail here. Include pictures if necessary)\r\nI changed the `sortGearItems()` computed property of the `equipmentSection.vue` component of the Market screen to reverse the order of the items when sorting by a stat. This will display the highest-stat items first, the same as on the Equipment section of the Inventory. (The alternative would be to sort in ascending order on both pages, which seems to make less sense)\r\n\r\nWhile I was making changes, I noticed that sorting by PER was not actually implemented. I couldn't find an open issue related to this, but I went ahead and included the fix.\r\n\r\nI also took the liberty of moving the filtering part of `sortGearItems()` into its own method, since `sortGearItems()` was getting fairly long and complicated, and the filtering logic seems to stand on its own. I'm not super familiar with Vue, though, so maybe it makes more sense as a computed property than a method?\r\n\r\nI'm open to feedback on all of these changes!\r\n\r\nAlso, I didn't see any obvious place to add tests for this, so I didn't, which is probably bad :eyes: \r\n\r\n[//]: # (Put User ID in here - found on the Habitica website at User Icon > Settings > API)\r\n\r\n----\r\nUUID: 7620c72a-bb5a-4798-b3c0-846dacb2b44d\r\n","created_at":"2018-10-03T14:57:48Z","updated_at":"2018-10-08T19:48:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"392b1789a3f9e488ae8a588d79177415bd3309e2","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":192741463,"node_id":"MDU6TGFiZWwxOTI3NDE0NjM=","url":"https://api.github.com/repos/HabitRPG/habitica/labels/status:%20pr:%20ready%20for%20review","name":"status: pr: ready for review","color":"fbca04","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/HabitRPG/habitica/pulls/10734/commits","review_comments_url":"https://api.github.com/repos/HabitRPG/habitica/pulls/10734/comments","review_comment_url":"https://api.github.com/repos/HabitRPG/habitica/pulls/comments{/number}","comments_url":"https://api.github.com/repos/HabitRPG/habitica/issues/10734/comments","statuses_url":"https://api.github.com/repos/HabitRPG/habitica/statuses/efd18503fe77018e8cd5f7a8055b3e1e2d80645f","head":{"label":"trvrfrd:issue-10728","ref":"issue-10728","sha":"efd18503fe77018e8cd5f7a8055b3e1e2d80645f","user":{"login":"trvrfrd","id":1634668,"node_id":"MDQ6VXNlcjE2MzQ2Njg=","avatar_url":"https://avatars1.githubusercontent.com/u/1634668?v=4","gravatar_id":"","url":"https://api.github.com/users/trvrfrd","html_url":"https://github.com/trvrfrd","followers_url":"https://api.github.com/users/trvrfrd/followers","following_url":"https://api.github.com/users/trvrfrd/following{/other_user}","gists_url":"https://api.github.com/users/trvrfrd/gists{/gist_id}","starred_url":"https://api.github.com/users/trvrfrd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/trvrfrd/subscriptions","organizations_url":"https://api.github.com/users/trvrfrd/orgs","repos_url":"https://api.github.com/users/trvrfrd/repos","events_url":"https://api.github.com/users/trvrfrd/events{/privacy}","received_events_url":"https://api.github.com/users/trvrfrd/received_events","type":"User","site_admin":false},"repo":{"id":151090649,"node_id":"MDEwOlJlcG9zaXRvcnkxNTEwOTA2NDk=","name":"habitica","full_name":"trvrfrd/habitica","private":false,"owner":{"login":"trvrfrd","id":1634668,"node_id":"MDQ6VXNlcjE2MzQ2Njg=","avatar_url":"https://avatars1.githubusercontent.com/u/1634668?v=4","gravatar_id":"","url":"https://api.github.com/users/trvrfrd","html_url":"https://github.com/trvrfrd","followers_url":"https://api.github.com/users/trvrfrd/followers","following_url":"https://api.github.com/users/trvrfrd/following{/other_user}","gists_url":"https://api.github.com/users/trvrfrd/gists{/gist_id}","starred_url":"https://api.github.com/users/trvrfrd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/trvrfrd/subscriptions","organizations_url":"https://api.github.com/users/trvrfrd/orgs","repos_url":"https://api.github.com/users/trvrfrd/repos","events_url":"https://api.github.com/users/trvrfrd/events{/privacy}","received_events_url":"https://api.github.com/users/trvrfrd/received_events","type":"User","site_admin":false},"html_url":"https://github.com/trvrfrd/habitica","description":"A habit tracker app which treats your goals like a Role Playing Game.","fork":true,"url":"https://api.github.com/repos/trvrfrd/habitica","forks_url":"https://api.github.com/repos/trvrfrd/habitica/forks","keys_url":"https://api.github.com/repos/trvrfrd/habitica/keys{/key_id}","collaborators_url":"https://api.github.com/repos/trvrfrd/habitica/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/trvrfrd/habitica/teams","hooks_url":"https://api.github.com/repos/trvrfrd/habitica/hooks","issue_events_url":"https://api.github.com/repos/trvrfrd/habitica/issues/events{/number}","events_url":"https://api.github.com/repos/trvrfrd/habitica/events","assignees_url":"https://api.github.com/repos/trvrfrd/habitica/assignees{/user}","branches_url":"https://api.github.com/repos/trvrfrd/habitica/branches{/branch}","tags_url":"https://api.github.com/repos/trvrfrd/habitica/tags","blobs_url":"https://api.github.com/repos/trvrfrd/habitica/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/trvrfrd/habitica/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/trvrfrd/habitica/git/refs{/sha}","trees_url":"https://api.github.com/repos/trvrfrd/habitica/git/trees{/sha}","statuses_url":"https://api.github.com/repos/trvrfrd/habitica/statuses/{sha}","languages_url":"https://api.github.com/repos/trvrfrd/habitica/languages","stargazers_url":"https://api.github.com/repos/trvrfrd/habitica/stargazers","contributors_url":"https://api.github.com/repos/trvrfrd/habitica/contributors","subscribers_url":"https://api.github.com/repos/trvrfrd/habitica/subscribers","subscription_url":"https://api.github.com/repos/trvrfrd/habitica/subscription","commits_url":"https://api.github.com/repos/trvrfrd/habitica/commits{/sha}","git_commits_url":"https://api.github.com/repos/trvrfrd/habitica/git/commits{/sha}","comments_url":"https://api.github.com/repos/trvrfrd/habitica/comments{/number}","issue_comment_url":"https://api.github.com/repos/trvrfrd/habitica/issues/comments{/number}","contents_url":"https://api.github.com/repos/trvrfrd/habitica/contents/{+path}","compare_url":"https://api.github.com/repos/trvrfrd/habitica/compare/{base}...{head}","merges_url":"https://api.github.com/repos/trvrfrd/habitica/merges","archive_url":"https://api.github.com/repos/trvrfrd/habitica/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/trvrfrd/habitica/downloads","issues_url":"https://api.github.com/repos/trvrfrd/habitica/issues{/number}","pulls_url":"https://api.github.com/repos/trvrfrd/habitica/pulls{/number}","milestones_url":"https://api.github.com/repos/trvrfrd/habitica/milestones{/number}","notifications_url":"https://api.github.com/repos/trvrfrd/habitica/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/trvrfrd/habitica/labels{/name}","releases_url":"https://api.github.com/repos/trvrfrd/habitica/releases{/id}","deployments_url":"https://api.github.com/repos/trvrfrd/habitica/deployments","created_at":"2018-10-01T13:10:05Z","updated_at":"2018-10-03T14:41:16Z","pushed_at":"2018-10-03T14:41:46Z","git_url":"git://github.com/trvrfrd/habitica.git","ssh_url":"git@github.com:trvrfrd/habitica.git","clone_url":"https://github.com/trvrfrd/habitica.git","svn_url":"https://github.com/trvrfrd/habitica","homepage":"https://habitica.com","size":961581,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"NOASSERTION","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"develop"}},"base":{"label":"HabitRPG:develop","ref":"develop","sha":"bd81d27145b99842e386f0c0ffe793f03abf9ace","user":{"login":"HabitRPG","id":3834775,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM4MzQ3NzU=","avatar_url":"https://avatars3.githubusercontent.com/u/3834775?v=4","gravatar_id":"","url":"https://api.github.com/users/HabitRPG","html_url":"https://github.com/HabitRPG","followers_url":"https://api.github.com/users/HabitRPG/followers","following_url":"https://api.github.com/users/HabitRPG/following{/other_user}","gists_url":"https://api.github.com/users/HabitRPG/gists{/gist_id}","starred_url":"https://api.github.com/users/HabitRPG/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HabitRPG/subscriptions","organizations_url":"https://api.github.com/users/HabitRPG/orgs","repos_url":"https://api.github.com/users/HabitRPG/repos","events_url":"https://api.github.com/users/HabitRPG/events{/privacy}","received_events_url":"https://api.github.com/users/HabitRPG/received_events","type":"Organization","site_admin":false},"repo":{"id":4578898,"node_id":"MDEwOlJlcG9zaXRvcnk0NTc4ODk4","name":"habitica","full_name":"HabitRPG/habitica","private":false,"owner":{"login":"HabitRPG","id":3834775,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM4MzQ3NzU=","avatar_url":"https://avatars3.githubusercontent.com/u/3834775?v=4","gravatar_id":"","url":"https://api.github.com/users/HabitRPG","html_url":"https://github.com/HabitRPG","followers_url":"https://api.github.com/users/HabitRPG/followers","following_url":"https://api.github.com/users/HabitRPG/following{/other_user}","gists_url":"https://api.github.com/users/HabitRPG/gists{/gist_id}","starred_url":"https://api.github.com/users/HabitRPG/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HabitRPG/subscriptions","organizations_url":"https://api.github.com/users/HabitRPG/orgs","repos_url":"https://api.github.com/users/HabitRPG/repos","events_url":"https://api.github.com/users/HabitRPG/events{/privacy}","received_events_url":"https://api.github.com/users/HabitRPG/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/HabitRPG/habitica","description":"A habit tracker app which treats your goals like a Role Playing Game.","fork":false,"url":"https://api.github.com/repos/HabitRPG/habitica","forks_url":"https://api.github.com/repos/HabitRPG/habitica/forks","keys_url":"https://api.github.com/repos/HabitRPG/habitica/keys{/key_id}","collaborators_url":"https://api.github.com/repos/HabitRPG/habitica/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/HabitRPG/habitica/teams","hooks_url":"https://api.github.com/repos/HabitRPG/habitica/hooks","issue_events_url":"https://api.github.com/repos/HabitRPG/habitica/issues/events{/number}","events_url":"https://api.github.com/repos/HabitRPG/habitica/events","assignees_url":"https://api.github.com/repos/HabitRPG/habitica/assignees{/user}","branches_url":"https://api.github.com/repos/HabitRPG/habitica/branches{/branch}","tags_url":"https://api.github.com/repos/HabitRPG/habitica/tags","blobs_url":"https://api.github.com/repos/HabitRPG/habitica/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/HabitRPG/habitica/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/HabitRPG/habitica/git/refs{/sha}","trees_url":"https://api.github.com/repos/HabitRPG/habitica/git/trees{/sha}","statuses_url":"https://api.github.com/repos/HabitRPG/habitica/statuses/{sha}","languages_url":"https://api.github.com/repos/HabitRPG/habitica/languages","stargazers_url":"https://api.github.com/repos/HabitRPG/habitica/stargazers","contributors_url":"https://api.github.com/repos/HabitRPG/habitica/contributors","subscribers_url":"https://api.github.com/repos/HabitRPG/habitica/subscribers","subscription_url":"https://api.github.com/repos/HabitRPG/habitica/subscription","commits_url":"https://api.github.com/repos/HabitRPG/habitica/commits{/sha}","git_commits_url":"https://api.github.com/repos/HabitRPG/habitica/git/commits{/sha}","comments_url":"https://api.github.com/repos/HabitRPG/habitica/comments{/number}","issue_comment_url":"https://api.github.com/repos/HabitRPG/habitica/issues/comments{/number}","contents_url":"https://api.github.com/repos/HabitRPG/habitica/contents/{+path}","compare_url":"https://api.github.com/repos/HabitRPG/habitica/compare/{base}...{head}","merges_url":"https://api.github.com/repos/HabitRPG/habitica/merges","archive_url":"https://api.github.com/repos/HabitRPG/habitica/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/HabitRPG/habitica/downloads","issues_url":"https://api.github.com/repos/HabitRPG/habitica/issues{/number}","pulls_url":"https://api.github.com/repos/HabitRPG/habitica/pulls{/number}","milestones_url":"https://api.github.com/repos/HabitRPG/habitica/milestones{/number}","notifications_url":"https://api.github.com/repos/HabitRPG/habitica/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/HabitRPG/habitica/labels{/name}","releases_url":"https://api.github.com/repos/HabitRPG/habitica/releases{/id}","deployments_url":"https://api.github.com/repos/HabitRPG/habitica/deployments","created_at":"2012-06-06T22:49:48Z","updated_at":"2018-10-08T19:48:17Z","pushed_at":"2018-10-08T19:38:17Z","git_url":"git://github.com/HabitRPG/habitica.git","ssh_url":"git@github.com:HabitRPG/habitica.git","clone_url":"https://github.com/HabitRPG/habitica.git","svn_url":"https://github.com/HabitRPG/habitica","homepage":"https://habitica.com","size":966656,"stargazers_count":6232,"watchers_count":6232,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2697,"mirror_url":null,"archived":false,"open_issues_count":270,"license":{"key":"other","name":"NOASSERTION","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":2697,"open_issues":270,"watchers":6232,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/HabitRPG/habitica/pulls/10734"},"html":{"href":"https://github.com/HabitRPG/habitica/pull/10734"},"issue":{"href":"https://api.github.com/repos/HabitRPG/habitica/issues/10734"},"comments":{"href":"https://api.github.com/repos/HabitRPG/habitica/issues/10734/comments"},"review_comments":{"href":"https://api.github.com/repos/HabitRPG/habitica/pulls/10734/comments"},"review_comment":{"href":"https://api.github.com/repos/HabitRPG/habitica/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/HabitRPG/habitica/pulls/10734/commits"},"statuses":{"href":"https://api.github.com/repos/HabitRPG/habitica/statuses/efd18503fe77018e8cd5f7a8055b3e1e2d80645f"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"paglias"}}