{"action":"opened","number":353,"pull_request":{"url":"https://api.github.com/repos/AgileVentures/MetPlus_PETS/pulls/353","id":81545139,"html_url":"https://github.com/AgileVentures/MetPlus_PETS/pull/353","diff_url":"https://github.com/AgileVentures/MetPlus_PETS/pull/353.diff","patch_url":"https://github.com/AgileVentures/MetPlus_PETS/pull/353.patch","issue_url":"https://api.github.com/repos/AgileVentures/MetPlus_PETS/issues/353","number":353,"state":"open","locked":false,"title":"Closes AgileVentures/MetPlus_tracker#400","user":{"login":"patmbolger","id":9968213,"avatar_url":"https://avatars.githubusercontent.com/u/9968213?v=3","gravatar_id":"","url":"https://api.github.com/users/patmbolger","html_url":"https://github.com/patmbolger","followers_url":"https://api.github.com/users/patmbolger/followers","following_url":"https://api.github.com/users/patmbolger/following{/other_user}","gists_url":"https://api.github.com/users/patmbolger/gists{/gist_id}","starred_url":"https://api.github.com/users/patmbolger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/patmbolger/subscriptions","organizations_url":"https://api.github.com/users/patmbolger/orgs","repos_url":"https://api.github.com/users/patmbolger/repos","events_url":"https://api.github.com/users/patmbolger/events{/privacy}","received_events_url":"https://api.github.com/users/patmbolger/received_events","type":"User","site_admin":false},"body":"# Story:\r\nCurrently we are showing timestamps for entity states based solely on the 'updated_at' timestamp for the entity. \r\n\r\nFor instance, this code segment (from views/jobs/_job_applications.html.haml) uses the 'updated_at' field to display the time when a job application was submitted:\r\n\r\n```\r\n  %table.table.table-hover\r\n    %thead\r\n      %tr\r\n        - application_fields(@application_type).each do |field|\r\n          - case field\r\n            - when :name\r\n              %th.strong Name\r\n            - when :js_status\r\n              %th.strong Job Seeker Status\r\n            - when :updated_at\r\n              %th.strong Applied\r\n            - when :action\r\n              %th.strong Action\r\n```\r\nIf the application status changes to 'accepted', or 'not_accepted', this view will show incorrect information.\r\n\r\nThis story is to design and implement a general way to track status changes for any entity with a simple status change structure (that is, when we only need to track 1) the state transitioned to (integer) and 2) the time when that transition occurred).  We get the second one for free from Rails (created_at).\r\n\r\n# Implementation\r\n\r\n- [ ] Design a model that will provide the structure and appropriate methods for managing state change, for example:\r\n```\r\nclass StatusChange < ActiveRecord::Base\r\n  belongs_to :entity, polymorphic: true\r\n\r\n  validates_presence_of status_change_to\r\n  validates_presence_of status_change_from, allow_nil: true\r\n  .....\r\n```\r\n- [ ] Migration to add to DB.  **NOTE** - you can create the model file and the DB migration with this one command:\r\n```\r\nrails g model StatusChange status_change_to:integer   status_change_from:integer   entity:references{polymorphic}\r\n```\r\n- [ ] Rspec tests\r\n\r\nNOTE: An entity for which this functionality is used must use an *enum* field to track status.  For instance, from the JobApplication model:\r\n```\r\nenum status: [:active, :accepted, :not_accepted]\r\n```\r\nThis allows some tolerance for change in how status values are displayed to the user.  For instance, if we decide to change the first status for JobApplication from :active to :Active, this will not affect the integrity of the information maintained by StateChange.\r\n\r\n- [ ] Add has_many status_changes association to JobApplication\r\n  - for testing purposes\r\n  - this model will need to be augmented to use StatusChange in order to address flaw(s) in view(s) (like the one described above)","created_at":"2016-08-16T21:08:39Z","updated_at":"2016-08-16T21:08:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"789d61923a3dbef8957bca62d1915d2a8ac01c7c","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/AgileVentures/MetPlus_PETS/pulls/353/commits","review_comments_url":"https://api.github.com/repos/AgileVentures/MetPlus_PETS/pulls/353/comments","review_comment_url":"https://api.github.com/repos/AgileVentures/MetPlus_PETS/pulls/comments{/number}","comments_url":"https://api.github.com/repos/AgileVentures/MetPlus_PETS/issues/353/comments","statuses_url":"https://api.github.com/repos/AgileVentures/MetPlus_PETS/statuses/670661e3bb96015ccb0c87a8def4050c13b7933a","head":{"label":"patmbolger:status-change#400","ref":"status-change#400","sha":"670661e3bb96015ccb0c87a8def4050c13b7933a","user":{"login":"patmbolger","id":9968213,"avatar_url":"https://avatars.githubusercontent.com/u/9968213?v=3","gravatar_id":"","url":"https://api.github.com/users/patmbolger","html_url":"https://github.com/patmbolger","followers_url":"https://api.github.com/users/patmbolger/followers","following_url":"https://api.github.com/users/patmbolger/following{/other_user}","gists_url":"https://api.github.com/users/patmbolger/gists{/gist_id}","starred_url":"https://api.github.com/users/patmbolger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/patmbolger/subscriptions","organizations_url":"https://api.github.com/users/patmbolger/orgs","repos_url":"https://api.github.com/users/patmbolger/repos","events_url":"https://api.github.com/users/patmbolger/events{/privacy}","received_events_url":"https://api.github.com/users/patmbolger/received_events","type":"User","site_admin":false},"repo":{"id":42128421,"name":"MetPlus_PETS","full_name":"patmbolger/MetPlus_PETS","owner":{"login":"patmbolger","id":9968213,"avatar_url":"https://avatars.githubusercontent.com/u/9968213?v=3","gravatar_id":"","url":"https://api.github.com/users/patmbolger","html_url":"https://github.com/patmbolger","followers_url":"https://api.github.com/users/patmbolger/followers","following_url":"https://api.github.com/users/patmbolger/following{/other_user}","gists_url":"https://api.github.com/users/patmbolger/gists{/gist_id}","starred_url":"https://api.github.com/users/patmbolger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/patmbolger/subscriptions","organizations_url":"https://api.github.com/users/patmbolger/orgs","repos_url":"https://api.github.com/users/patmbolger/repos","events_url":"https://api.github.com/users/patmbolger/events{/privacy}","received_events_url":"https://api.github.com/users/patmbolger/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/patmbolger/MetPlus_PETS","description":"Front End for the MetPlus project","fork":true,"url":"https://api.github.com/repos/patmbolger/MetPlus_PETS","forks_url":"https://api.github.com/repos/patmbolger/MetPlus_PETS/forks","keys_url":"https://api.github.com/repos/patmbolger/MetPlus_PETS/keys{/key_id}","collaborators_url":"https://api.github.com/repos/patmbolger/MetPlus_PETS/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/patmbolger/MetPlus_PETS/teams","hooks_url":"https://api.github.com/repos/patmbolger/MetPlus_PETS/hooks","issue_events_url":"https://api.github.com/repos/patmbolger/MetPlus_PETS/issues/events{/number}","events_url":"https://api.github.com/repos/patmbolger/MetPlus_PETS/events","assignees_url":"https://api.github.com/repos/patmbolger/MetPlus_PETS/assignees{/user}","branches_url":"https://api.github.com/repos/patmbolger/MetPlus_PETS/branches{/branch}","tags_url":"https://api.github.com/repos/patmbolger/MetPlus_PETS/tags","blobs_url":"https://api.github.com/repos/patmbolger/MetPlus_PETS/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/patmbolger/MetPlus_PETS/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/patmbolger/MetPlus_PETS/git/refs{/sha}","trees_url":"https://api.github.com/repos/patmbolger/MetPlus_PETS/git/trees{/sha}","statuses_url":"https://api.github.com/repos/patmbolger/MetPlus_PETS/statuses/{sha}","languages_url":"https://api.github.com/repos/patmbolger/MetPlus_PETS/languages","stargazers_url":"https://api.github.com/repos/patmbolger/MetPlus_PETS/stargazers","contributors_url":"https://api.github.com/repos/patmbolger/MetPlus_PETS/contributors","subscribers_url":"https://api.github.com/repos/patmbolger/MetPlus_PETS/subscribers","subscription_url":"https://api.github.com/repos/patmbolger/MetPlus_PETS/subscription","commits_url":"https://api.github.com/repos/patmbolger/MetPlus_PETS/commits{/sha}","git_commits_url":"https://api.github.com/repos/patmbolger/MetPlus_PETS/git/commits{/sha}","comments_url":"https://api.github.com/repos/patmbolger/MetPlus_PETS/comments{/number}","issue_comment_url":"https://api.github.com/repos/patmbolger/MetPlus_PETS/issues/comments{/number}","contents_url":"https://api.github.com/repos/patmbolger/MetPlus_PETS/contents/{+path}","compare_url":"https://api.github.com/repos/patmbolger/MetPlus_PETS/compare/{base}...{head}","merges_url":"https://api.github.com/repos/patmbolger/MetPlus_PETS/merges","archive_url":"https://api.github.com/repos/patmbolger/MetPlus_PETS/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/patmbolger/MetPlus_PETS/downloads","issues_url":"https://api.github.com/repos/patmbolger/MetPlus_PETS/issues{/number}","pulls_url":"https://api.github.com/repos/patmbolger/MetPlus_PETS/pulls{/number}","milestones_url":"https://api.github.com/repos/patmbolger/MetPlus_PETS/milestones{/number}","notifications_url":"https://api.github.com/repos/patmbolger/MetPlus_PETS/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/patmbolger/MetPlus_PETS/labels{/name}","releases_url":"https://api.github.com/repos/patmbolger/MetPlus_PETS/releases{/id}","deployments_url":"https://api.github.com/repos/patmbolger/MetPlus_PETS/deployments","created_at":"2015-09-08T17:37:16Z","updated_at":"2015-09-08T17:37:17Z","pushed_at":"2016-08-16T21:04:27Z","git_url":"git://github.com/patmbolger/MetPlus_PETS.git","ssh_url":"git@github.com:patmbolger/MetPlus_PETS.git","clone_url":"https://github.com/patmbolger/MetPlus_PETS.git","svn_url":"https://github.com/patmbolger/MetPlus_PETS","homepage":null,"size":1901,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"AgileVentures:development","ref":"development","sha":"e0c564b5f29fe70c855e1ffc58393fd074ab19b2","user":{"login":"AgileVentures","id":5116968,"avatar_url":"https://avatars.githubusercontent.com/u/5116968?v=3","gravatar_id":"","url":"https://api.github.com/users/AgileVentures","html_url":"https://github.com/AgileVentures","followers_url":"https://api.github.com/users/AgileVentures/followers","following_url":"https://api.github.com/users/AgileVentures/following{/other_user}","gists_url":"https://api.github.com/users/AgileVentures/gists{/gist_id}","starred_url":"https://api.github.com/users/AgileVentures/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AgileVentures/subscriptions","organizations_url":"https://api.github.com/users/AgileVentures/orgs","repos_url":"https://api.github.com/users/AgileVentures/repos","events_url":"https://api.github.com/users/AgileVentures/events{/privacy}","received_events_url":"https://api.github.com/users/AgileVentures/received_events","type":"Organization","site_admin":false},"repo":{"id":41921394,"name":"MetPlus_PETS","full_name":"AgileVentures/MetPlus_PETS","owner":{"login":"AgileVentures","id":5116968,"avatar_url":"https://avatars.githubusercontent.com/u/5116968?v=3","gravatar_id":"","url":"https://api.github.com/users/AgileVentures","html_url":"https://github.com/AgileVentures","followers_url":"https://api.github.com/users/AgileVentures/followers","following_url":"https://api.github.com/users/AgileVentures/following{/other_user}","gists_url":"https://api.github.com/users/AgileVentures/gists{/gist_id}","starred_url":"https://api.github.com/users/AgileVentures/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AgileVentures/subscriptions","organizations_url":"https://api.github.com/users/AgileVentures/orgs","repos_url":"https://api.github.com/users/AgileVentures/repos","events_url":"https://api.github.com/users/AgileVentures/events{/privacy}","received_events_url":"https://api.github.com/users/AgileVentures/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/AgileVentures/MetPlus_PETS","description":"Front End for the MetPlus project","fork":false,"url":"https://api.github.com/repos/AgileVentures/MetPlus_PETS","forks_url":"https://api.github.com/repos/AgileVentures/MetPlus_PETS/forks","keys_url":"https://api.github.com/repos/AgileVentures/MetPlus_PETS/keys{/key_id}","collaborators_url":"https://api.github.com/repos/AgileVentures/MetPlus_PETS/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/AgileVentures/MetPlus_PETS/teams","hooks_url":"https://api.github.com/repos/AgileVentures/MetPlus_PETS/hooks","issue_events_url":"https://api.github.com/repos/AgileVentures/MetPlus_PETS/issues/events{/number}","events_url":"https://api.github.com/repos/AgileVentures/MetPlus_PETS/events","assignees_url":"https://api.github.com/repos/AgileVentures/MetPlus_PETS/assignees{/user}","branches_url":"https://api.github.com/repos/AgileVentures/MetPlus_PETS/branches{/branch}","tags_url":"https://api.github.com/repos/AgileVentures/MetPlus_PETS/tags","blobs_url":"https://api.github.com/repos/AgileVentures/MetPlus_PETS/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/AgileVentures/MetPlus_PETS/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/AgileVentures/MetPlus_PETS/git/refs{/sha}","trees_url":"https://api.github.com/repos/AgileVentures/MetPlus_PETS/git/trees{/sha}","statuses_url":"https://api.github.com/repos/AgileVentures/MetPlus_PETS/statuses/{sha}","languages_url":"https://api.github.com/repos/AgileVentures/MetPlus_PETS/languages","stargazers_url":"https://api.github.com/repos/AgileVentures/MetPlus_PETS/stargazers","contributors_url":"https://api.github.com/repos/AgileVentures/MetPlus_PETS/contributors","subscribers_url":"https://api.github.com/repos/AgileVentures/MetPlus_PETS/subscribers","subscription_url":"https://api.github.com/repos/AgileVentures/MetPlus_PETS/subscription","commits_url":"https://api.github.com/repos/AgileVentures/MetPlus_PETS/commits{/sha}","git_commits_url":"https://api.github.com/repos/AgileVentures/MetPlus_PETS/git/commits{/sha}","comments_url":"https://api.github.com/repos/AgileVentures/MetPlus_PETS/comments{/number}","issue_comment_url":"https://api.github.com/repos/AgileVentures/MetPlus_PETS/issues/comments{/number}","contents_url":"https://api.github.com/repos/AgileVentures/MetPlus_PETS/contents/{+path}","compare_url":"https://api.github.com/repos/AgileVentures/MetPlus_PETS/compare/{base}...{head}","merges_url":"https://api.github.com/repos/AgileVentures/MetPlus_PETS/merges","archive_url":"https://api.github.com/repos/AgileVentures/MetPlus_PETS/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/AgileVentures/MetPlus_PETS/downloads","issues_url":"https://api.github.com/repos/AgileVentures/MetPlus_PETS/issues{/number}","pulls_url":"https://api.github.com/repos/AgileVentures/MetPlus_PETS/pulls{/number}","milestones_url":"https://api.github.com/repos/AgileVentures/MetPlus_PETS/milestones{/number}","notifications_url":"https://api.github.com/repos/AgileVentures/MetPlus_PETS/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/AgileVentures/MetPlus_PETS/labels{/name}","releases_url":"https://api.github.com/repos/AgileVentures/MetPlus_PETS/releases{/id}","deployments_url":"https://api.github.com/repos/AgileVentures/MetPlus_PETS/deployments","created_at":"2015-09-04T14:51:35Z","updated_at":"2016-06-02T16:00:36Z","pushed_at":"2016-08-16T21:08:39Z","git_url":"git://github.com/AgileVentures/MetPlus_PETS.git","ssh_url":"git@github.com:AgileVentures/MetPlus_PETS.git","clone_url":"https://github.com/AgileVentures/MetPlus_PETS.git","svn_url":"https://github.com/AgileVentures/MetPlus_PETS","homepage":null,"size":2258,"stargazers_count":3,"watchers_count":3,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":27,"mirror_url":null,"open_issues_count":7,"forks":27,"open_issues":7,"watchers":3,"default_branch":"development"}},"_links":{"self":{"href":"https://api.github.com/repos/AgileVentures/MetPlus_PETS/pulls/353"},"html":{"href":"https://github.com/AgileVentures/MetPlus_PETS/pull/353"},"issue":{"href":"https://api.github.com/repos/AgileVentures/MetPlus_PETS/issues/353"},"comments":{"href":"https://api.github.com/repos/AgileVentures/MetPlus_PETS/issues/353/comments"},"review_comments":{"href":"https://api.github.com/repos/AgileVentures/MetPlus_PETS/pulls/353/comments"},"review_comment":{"href":"https://api.github.com/repos/AgileVentures/MetPlus_PETS/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/AgileVentures/MetPlus_PETS/pulls/353/commits"},"statuses":{"href":"https://api.github.com/repos/AgileVentures/MetPlus_PETS/statuses/670661e3bb96015ccb0c87a8def4050c13b7933a"}},"merged":false,"mergeable":true,"mergeable_state":"clean","merged_by":null,"comments":0,"review_comments":0,"commits":1,"additions":102,"deletions":1,"changed_files":5}}
{"actor":{"display_login":"patmbolger"}}