{"action":"created","issue":{"url":"https://api.github.com/repos/UM-USElab/gradecraft-development/issues/1943","repository_url":"https://api.github.com/repos/UM-USElab/gradecraft-development","labels_url":"https://api.github.com/repos/UM-USElab/gradecraft-development/issues/1943/labels{/name}","comments_url":"https://api.github.com/repos/UM-USElab/gradecraft-development/issues/1943/comments","events_url":"https://api.github.com/repos/UM-USElab/gradecraft-development/issues/1943/events","html_url":"https://github.com/UM-USElab/gradecraft-development/pull/1943","id":151207669,"number":1943,"title":"Adds student badge index and show pages","user":{"login":"acousticrobot","id":1138350,"avatar_url":"https://avatars.githubusercontent.com/u/1138350?v=3","gravatar_id":"","url":"https://api.github.com/users/acousticrobot","html_url":"https://github.com/acousticrobot","followers_url":"https://api.github.com/users/acousticrobot/followers","following_url":"https://api.github.com/users/acousticrobot/following{/other_user}","gists_url":"https://api.github.com/users/acousticrobot/gists{/gist_id}","starred_url":"https://api.github.com/users/acousticrobot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/acousticrobot/subscriptions","organizations_url":"https://api.github.com/users/acousticrobot/orgs","repos_url":"https://api.github.com/users/acousticrobot/repos","events_url":"https://api.github.com/users/acousticrobot/events{/privacy}","received_events_url":"https://api.github.com/users/acousticrobot/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/UM-USElab/gradecraft-development/labels/needs%20review","name":"needs review","color":"009800"},{"url":"https://api.github.com/repos/UM-USElab/gradecraft-development/labels/Refactor","name":"Refactor","color":"722F37"}],"state":"open","locked":false,"assignee":{"login":"acousticrobot","id":1138350,"avatar_url":"https://avatars.githubusercontent.com/u/1138350?v=3","gravatar_id":"","url":"https://api.github.com/users/acousticrobot","html_url":"https://github.com/acousticrobot","followers_url":"https://api.github.com/users/acousticrobot/followers","following_url":"https://api.github.com/users/acousticrobot/following{/other_user}","gists_url":"https://api.github.com/users/acousticrobot/gists{/gist_id}","starred_url":"https://api.github.com/users/acousticrobot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/acousticrobot/subscriptions","organizations_url":"https://api.github.com/users/acousticrobot/orgs","repos_url":"https://api.github.com/users/acousticrobot/repos","events_url":"https://api.github.com/users/acousticrobot/events{/privacy}","received_events_url":"https://api.github.com/users/acousticrobot/received_events","type":"User","site_admin":false},"milestone":null,"comments":2,"created_at":"2016-04-26T18:33:38Z","updated_at":"2016-04-29T14:53:58Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/UM-USElab/gradecraft-development/pulls/1943","html_url":"https://github.com/UM-USElab/gradecraft-development/pull/1943","diff_url":"https://github.com/UM-USElab/gradecraft-development/pull/1943.diff","patch_url":"https://github.com/UM-USElab/gradecraft-development/pull/1943.patch"},"body":"### Additions\r\n\r\nBadgeController#index page now handles the badge index for faculty and students,\r\nas well as the faculty view of the students badge index.\r\n\r\nStudents now have access to the badge show page with faculty information \r\nremoved. The page includes an index of the student's earned\r\nbadges for the badge.\r\n\r\nThe show page has a presenter, which takes the logic out of the controller for\r\ndifferentiating a faculty view, student view, or faculty view of the student \r\nview.\r\n\r\nThe partial `_context_menu.haml` DRYs up the context menu for all badge pages.\r\n\r\n### Subtractions\r\n\r\nThe `my_badges` route has been removed, which pulls badge resources entirely \r\noff of the `StudentController`.\r\n\r\n### What this PR does not do:\r\n\r\nA new `student_visible_earned_badges_for_badge` query is placed on the User,\r\nfor now, where all other current badge queries currently live. These should all \r\nbe refactored together, and probably placed on either the Badge or EarnedBadge\r\nmodel instead.\r\n\r\nThe faculty views for badge index and show have been broken into components, to\r\naid in adding student view contexts for these pages, but most of the the \r\nelements in the components themselves have not been refactored.\r\n\r\nThe new student view of the show page has almost no styling, as we are about to \r\nhave a redesign for this page and I didn't want to spend too much time on it.\r\n"},"comment":{"url":"https://api.github.com/repos/UM-USElab/gradecraft-development/issues/comments/215743563","html_url":"https://github.com/UM-USElab/gradecraft-development/pull/1943#issuecomment-215743563","issue_url":"https://api.github.com/repos/UM-USElab/gradecraft-development/issues/1943","id":215743563,"user":{"login":"acousticrobot","id":1138350,"avatar_url":"https://avatars.githubusercontent.com/u/1138350?v=3","gravatar_id":"","url":"https://api.github.com/users/acousticrobot","html_url":"https://github.com/acousticrobot","followers_url":"https://api.github.com/users/acousticrobot/followers","following_url":"https://api.github.com/users/acousticrobot/following{/other_user}","gists_url":"https://api.github.com/users/acousticrobot/gists{/gist_id}","starred_url":"https://api.github.com/users/acousticrobot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/acousticrobot/subscriptions","organizations_url":"https://api.github.com/users/acousticrobot/orgs","repos_url":"https://api.github.com/users/acousticrobot/repos","events_url":"https://api.github.com/users/acousticrobot/events{/privacy}","received_events_url":"https://api.github.com/users/acousticrobot/received_events","type":"User","site_admin":false},"created_at":"2016-04-29T14:53:58Z","updated_at":"2016-04-29T14:53:58Z","body":"Recap of Slack conversation with @jwright\r\n\r\nThere are three contexts for the badges index page that we need to handle:\r\n\r\n  * faculty viewing an index of badges\r\n  * students viewing an index of badges\r\n  * faculty viewing a student's index view of badges\r\n\r\nOne reason we don't handle student badges through resourceful routing is that we do not expose any student resource paths directly to the students. (students go directly to `/my_badges`)\r\n\r\nWhat further complicates our routes is handling the faculty preview of a student's view by exposing the student resource route. (`student/66/badges` show a faculty what the student with id of 66 sees at `/my_badges`)\r\n\r\nSo currently:\r\n\r\n  * A student can't view the `/badges` route.\r\n  * Instead the student has a `/my_badges` route, which is really a badges index resource. This route name has been chosen purely as a way to distinguish it from the other resourceful `/badges` route.\r\n  * This allows us to expose a faculty view `student/:id/badges` which can then be differentiated from `/badges`\r\n\r\nThe problem with this approach is that is requires any student view that faculty can preview to be creatively renamed other than what it conventionally would be, cobbled onto the student controller, and exposed to the student as a root route.\r\n\r\n| resource                      | faculty route        | student route  | faculty preview of student route |\r\n| -------------                 | -------------------- | ------------   | --------------------- |\r\n| `assignemnts#index`           |  `/assignments`      | `/syllabus`     | `/student/:id`         |\r\n| `grade_scheme_elements#index` | `/grade_scheme_elements`| `/course_progress` | `/students/9/course_progress` |\r\n| `badges#index`                |  `/badges`           |  `/my_badges`   | `/student/:id/badges`  |\r\n| `badges#show`                 |  `/badges/:id`       |  _we need this_|  _we need this_       |\r\n| `teams#index`                 |  `/teams`            |  `/my_team`     |  `/student/:id/teams`  |\r\n| `teams#show`                  |  `/teams/:id`        |  ???           |   ??? |\r\n| `prediction models`           |  `/predictor`        |  `/predictor`   |  `/student/:id/predictor`  |\r\n|`assignemnts#show`, `grade#show`)|  `/assignments/:id`| `/assignments/:id` | `/assignments/:id/grade?student_id=:id`\r\n\r\nAdditionally, we have a second convention on a number of routes that uses string queries for the student resource (see last row above)\r\n\r\nThis Pull Request puts all three `badges#index` route contexts onto the `BadgeController#index`, exposed as `/badges` to faculty and students, and `/students/:id/badges` for the faculty preview\r\n\r\nThe problem is that it is not apparent from the code that for faculty this controller route is actually handling two different routes, one of which has a student in the context, which is acting like a resource.\r\n\r\nI am going to work on this a little more, but am tabling this PR until we can talk about it as a group, and come up with a strategy that will work for all routes that need to handle the same three contexts."}}