{"action":"closed","number":221,"pull_request":{"url":"https://api.github.com/repos/alces-software/alces-flight-center/pulls/221","id":185465313,"html_url":"https://github.com/alces-software/alces-flight-center/pull/221","diff_url":"https://github.com/alces-software/alces-flight-center/pull/221.diff","patch_url":"https://github.com/alces-software/alces-flight-center/pull/221.patch","issue_url":"https://api.github.com/repos/alces-software/alces-flight-center/issues/221","number":221,"state":"closed","locked":false,"title":"Generate per-cluster sequential case IDs","user":{"login":"jamesremuscat","id":3471844,"avatar_url":"https://avatars2.githubusercontent.com/u/3471844?v=4","gravatar_id":"","url":"https://api.github.com/users/jamesremuscat","html_url":"https://github.com/jamesremuscat","followers_url":"https://api.github.com/users/jamesremuscat/followers","following_url":"https://api.github.com/users/jamesremuscat/following{/other_user}","gists_url":"https://api.github.com/users/jamesremuscat/gists{/gist_id}","starred_url":"https://api.github.com/users/jamesremuscat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jamesremuscat/subscriptions","organizations_url":"https://api.github.com/users/jamesremuscat/orgs","repos_url":"https://api.github.com/users/jamesremuscat/repos","events_url":"https://api.github.com/users/jamesremuscat/events{/privacy}","received_events_url":"https://api.github.com/users/jamesremuscat/received_events","type":"User","site_admin":false},"body":"This PR changes the way we publicly refer to `Case`s by introducing a per-cluster sequential \"display ID\", prefixed with a new \"shortcode\" allocated to each cluster.\r\n\r\nThe `#display_id` method on `Case` is therefore replaced by simply accessing the value of this stored field.\r\n\r\nNew-style display IDs are of the form `BAR123` - this being the 123rd case raised for the `BAR` cluster (which, in production, would be the shortcode allocated to Barkla).\r\n\r\nOld cases with RT ticket IDs use a display ID of the form `RT12345`, as previously.\r\n\r\nDisplay IDs are allocated immediately before the initial save of a `Case` (specifically, using the `before_create` callback). It is from `Cluster` that the numeric part of the display ID is obtained, and we use a database row-level lock on the cluster to ensure concurrently created cases comply correctly with the uniqueness constraint. \r\n\r\nSince the new display IDs include a cluster hint, we no longer include the cluster name explicitly in email subject lines.\r\n\r\nWe also support accessing cases via their display IDs in the URL. This works case-insensitively so that `/cases/bar1` and `/cases/BAR1` both go to the same place. Accessing cases by their database ID still works, so old links will continue to function, but we no longer display those links anywhere. Code should use `Case#find_from_id` rather than `Case.find` to take advantage of this omni-findyness.\r\n\r\nThere are two data migrations included in this PR:\r\n\r\n- One to allocate a shortcode to all clusters. This uses the first three characters in the cluster name, upper-cased; except for \"Demo Cluster\" which uses `DEMO`. There's some attempt at deduplication which almost certainly won't be needed, except possibly in development if you have old data lying around (I did).\r\n\r\n- One to assign display IDs to cases. For cases with an RT ticket ID, a display ID of the form `RTxxxx` is created. For cases without (and there won't be any in live) the cluster's `case_index` is used for numbering.\r\n\r\nI've also taken the liberty of making the ID column in the cases table a clickable link as per https://trello.com/c/yv5pDErI/261-cases-ticket-id-needs-to-be-on-the-left-and-make-it-a-link.\r\n\r\nTrello: https://trello.com/c/dzY3fb5C/252-new-case-ids-ready-for-use-after-replacing-rt","created_at":"2018-05-02T14:55:31Z","updated_at":"2018-05-03T15:05:56Z","closed_at":"2018-05-03T15:05:56Z","merged_at":"2018-05-03T15:05:56Z","merge_commit_sha":"3af5f8942d603bfe9d7c8fae25c22b7e490734e1","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/alces-software/alces-flight-center/pulls/221/commits","review_comments_url":"https://api.github.com/repos/alces-software/alces-flight-center/pulls/221/comments","review_comment_url":"https://api.github.com/repos/alces-software/alces-flight-center/pulls/comments{/number}","comments_url":"https://api.github.com/repos/alces-software/alces-flight-center/issues/221/comments","statuses_url":"https://api.github.com/repos/alces-software/alces-flight-center/statuses/9d8c53399b6c6bb48c5cfb87594d23e2ea85bf21","head":{"label":"alces-software:feature/cluster-based-case-ids","ref":"feature/cluster-based-case-ids","sha":"9d8c53399b6c6bb48c5cfb87594d23e2ea85bf21","user":{"login":"alces-software","id":945288,"avatar_url":"https://avatars0.githubusercontent.com/u/945288?v=4","gravatar_id":"","url":"https://api.github.com/users/alces-software","html_url":"https://github.com/alces-software","followers_url":"https://api.github.com/users/alces-software/followers","following_url":"https://api.github.com/users/alces-software/following{/other_user}","gists_url":"https://api.github.com/users/alces-software/gists{/gist_id}","starred_url":"https://api.github.com/users/alces-software/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alces-software/subscriptions","organizations_url":"https://api.github.com/users/alces-software/orgs","repos_url":"https://api.github.com/users/alces-software/repos","events_url":"https://api.github.com/users/alces-software/events{/privacy}","received_events_url":"https://api.github.com/users/alces-software/received_events","type":"Organization","site_admin":false},"repo":{"id":103410349,"name":"alces-flight-center","full_name":"alces-software/alces-flight-center","owner":{"login":"alces-software","id":945288,"avatar_url":"https://avatars0.githubusercontent.com/u/945288?v=4","gravatar_id":"","url":"https://api.github.com/users/alces-software","html_url":"https://github.com/alces-software","followers_url":"https://api.github.com/users/alces-software/followers","following_url":"https://api.github.com/users/alces-software/following{/other_user}","gists_url":"https://api.github.com/users/alces-software/gists{/gist_id}","starred_url":"https://api.github.com/users/alces-software/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alces-software/subscriptions","organizations_url":"https://api.github.com/users/alces-software/orgs","repos_url":"https://api.github.com/users/alces-software/repos","events_url":"https://api.github.com/users/alces-software/events{/privacy}","received_events_url":"https://api.github.com/users/alces-software/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/alces-software/alces-flight-center","description":"Alces Flight Center cluster support and management site","fork":false,"url":"https://api.github.com/repos/alces-software/alces-flight-center","forks_url":"https://api.github.com/repos/alces-software/alces-flight-center/forks","keys_url":"https://api.github.com/repos/alces-software/alces-flight-center/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alces-software/alces-flight-center/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alces-software/alces-flight-center/teams","hooks_url":"https://api.github.com/repos/alces-software/alces-flight-center/hooks","issue_events_url":"https://api.github.com/repos/alces-software/alces-flight-center/issues/events{/number}","events_url":"https://api.github.com/repos/alces-software/alces-flight-center/events","assignees_url":"https://api.github.com/repos/alces-software/alces-flight-center/assignees{/user}","branches_url":"https://api.github.com/repos/alces-software/alces-flight-center/branches{/branch}","tags_url":"https://api.github.com/repos/alces-software/alces-flight-center/tags","blobs_url":"https://api.github.com/repos/alces-software/alces-flight-center/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alces-software/alces-flight-center/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alces-software/alces-flight-center/git/refs{/sha}","trees_url":"https://api.github.com/repos/alces-software/alces-flight-center/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alces-software/alces-flight-center/statuses/{sha}","languages_url":"https://api.github.com/repos/alces-software/alces-flight-center/languages","stargazers_url":"https://api.github.com/repos/alces-software/alces-flight-center/stargazers","contributors_url":"https://api.github.com/repos/alces-software/alces-flight-center/contributors","subscribers_url":"https://api.github.com/repos/alces-software/alces-flight-center/subscribers","subscription_url":"https://api.github.com/repos/alces-software/alces-flight-center/subscription","commits_url":"https://api.github.com/repos/alces-software/alces-flight-center/commits{/sha}","git_commits_url":"https://api.github.com/repos/alces-software/alces-flight-center/git/commits{/sha}","comments_url":"https://api.github.com/repos/alces-software/alces-flight-center/comments{/number}","issue_comment_url":"https://api.github.com/repos/alces-software/alces-flight-center/issues/comments{/number}","contents_url":"https://api.github.com/repos/alces-software/alces-flight-center/contents/{+path}","compare_url":"https://api.github.com/repos/alces-software/alces-flight-center/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alces-software/alces-flight-center/merges","archive_url":"https://api.github.com/repos/alces-software/alces-flight-center/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alces-software/alces-flight-center/downloads","issues_url":"https://api.github.com/repos/alces-software/alces-flight-center/issues{/number}","pulls_url":"https://api.github.com/repos/alces-software/alces-flight-center/pulls{/number}","milestones_url":"https://api.github.com/repos/alces-software/alces-flight-center/milestones{/number}","notifications_url":"https://api.github.com/repos/alces-software/alces-flight-center/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alces-software/alces-flight-center/labels{/name}","releases_url":"https://api.github.com/repos/alces-software/alces-flight-center/releases{/id}","deployments_url":"https://api.github.com/repos/alces-software/alces-flight-center/deployments","created_at":"2017-09-13T14:30:59Z","updated_at":"2018-05-03T12:21:27Z","pushed_at":"2018-05-03T15:05:56Z","git_url":"git://github.com/alces-software/alces-flight-center.git","ssh_url":"git@github.com:alces-software/alces-flight-center.git","clone_url":"https://github.com/alces-software/alces-flight-center.git","svn_url":"https://github.com/alces-software/alces-flight-center","homepage":"https://center.alces-flight.com/","size":12878,"stargazers_count":2,"watchers_count":2,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":16,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":0,"open_issues":16,"watchers":2,"default_branch":"develop"}},"base":{"label":"alces-software:develop","ref":"develop","sha":"fee660f63febc87f4b72f37c059b6e18b655f356","user":{"login":"alces-software","id":945288,"avatar_url":"https://avatars0.githubusercontent.com/u/945288?v=4","gravatar_id":"","url":"https://api.github.com/users/alces-software","html_url":"https://github.com/alces-software","followers_url":"https://api.github.com/users/alces-software/followers","following_url":"https://api.github.com/users/alces-software/following{/other_user}","gists_url":"https://api.github.com/users/alces-software/gists{/gist_id}","starred_url":"https://api.github.com/users/alces-software/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alces-software/subscriptions","organizations_url":"https://api.github.com/users/alces-software/orgs","repos_url":"https://api.github.com/users/alces-software/repos","events_url":"https://api.github.com/users/alces-software/events{/privacy}","received_events_url":"https://api.github.com/users/alces-software/received_events","type":"Organization","site_admin":false},"repo":{"id":103410349,"name":"alces-flight-center","full_name":"alces-software/alces-flight-center","owner":{"login":"alces-software","id":945288,"avatar_url":"https://avatars0.githubusercontent.com/u/945288?v=4","gravatar_id":"","url":"https://api.github.com/users/alces-software","html_url":"https://github.com/alces-software","followers_url":"https://api.github.com/users/alces-software/followers","following_url":"https://api.github.com/users/alces-software/following{/other_user}","gists_url":"https://api.github.com/users/alces-software/gists{/gist_id}","starred_url":"https://api.github.com/users/alces-software/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alces-software/subscriptions","organizations_url":"https://api.github.com/users/alces-software/orgs","repos_url":"https://api.github.com/users/alces-software/repos","events_url":"https://api.github.com/users/alces-software/events{/privacy}","received_events_url":"https://api.github.com/users/alces-software/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/alces-software/alces-flight-center","description":"Alces Flight Center cluster support and management site","fork":false,"url":"https://api.github.com/repos/alces-software/alces-flight-center","forks_url":"https://api.github.com/repos/alces-software/alces-flight-center/forks","keys_url":"https://api.github.com/repos/alces-software/alces-flight-center/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alces-software/alces-flight-center/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alces-software/alces-flight-center/teams","hooks_url":"https://api.github.com/repos/alces-software/alces-flight-center/hooks","issue_events_url":"https://api.github.com/repos/alces-software/alces-flight-center/issues/events{/number}","events_url":"https://api.github.com/repos/alces-software/alces-flight-center/events","assignees_url":"https://api.github.com/repos/alces-software/alces-flight-center/assignees{/user}","branches_url":"https://api.github.com/repos/alces-software/alces-flight-center/branches{/branch}","tags_url":"https://api.github.com/repos/alces-software/alces-flight-center/tags","blobs_url":"https://api.github.com/repos/alces-software/alces-flight-center/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alces-software/alces-flight-center/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alces-software/alces-flight-center/git/refs{/sha}","trees_url":"https://api.github.com/repos/alces-software/alces-flight-center/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alces-software/alces-flight-center/statuses/{sha}","languages_url":"https://api.github.com/repos/alces-software/alces-flight-center/languages","stargazers_url":"https://api.github.com/repos/alces-software/alces-flight-center/stargazers","contributors_url":"https://api.github.com/repos/alces-software/alces-flight-center/contributors","subscribers_url":"https://api.github.com/repos/alces-software/alces-flight-center/subscribers","subscription_url":"https://api.github.com/repos/alces-software/alces-flight-center/subscription","commits_url":"https://api.github.com/repos/alces-software/alces-flight-center/commits{/sha}","git_commits_url":"https://api.github.com/repos/alces-software/alces-flight-center/git/commits{/sha}","comments_url":"https://api.github.com/repos/alces-software/alces-flight-center/comments{/number}","issue_comment_url":"https://api.github.com/repos/alces-software/alces-flight-center/issues/comments{/number}","contents_url":"https://api.github.com/repos/alces-software/alces-flight-center/contents/{+path}","compare_url":"https://api.github.com/repos/alces-software/alces-flight-center/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alces-software/alces-flight-center/merges","archive_url":"https://api.github.com/repos/alces-software/alces-flight-center/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alces-software/alces-flight-center/downloads","issues_url":"https://api.github.com/repos/alces-software/alces-flight-center/issues{/number}","pulls_url":"https://api.github.com/repos/alces-software/alces-flight-center/pulls{/number}","milestones_url":"https://api.github.com/repos/alces-software/alces-flight-center/milestones{/number}","notifications_url":"https://api.github.com/repos/alces-software/alces-flight-center/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alces-software/alces-flight-center/labels{/name}","releases_url":"https://api.github.com/repos/alces-software/alces-flight-center/releases{/id}","deployments_url":"https://api.github.com/repos/alces-software/alces-flight-center/deployments","created_at":"2017-09-13T14:30:59Z","updated_at":"2018-05-03T12:21:27Z","pushed_at":"2018-05-03T15:05:56Z","git_url":"git://github.com/alces-software/alces-flight-center.git","ssh_url":"git@github.com:alces-software/alces-flight-center.git","clone_url":"https://github.com/alces-software/alces-flight-center.git","svn_url":"https://github.com/alces-software/alces-flight-center","homepage":"https://center.alces-flight.com/","size":12878,"stargazers_count":2,"watchers_count":2,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":16,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":0,"open_issues":16,"watchers":2,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/alces-software/alces-flight-center/pulls/221"},"html":{"href":"https://github.com/alces-software/alces-flight-center/pull/221"},"issue":{"href":"https://api.github.com/repos/alces-software/alces-flight-center/issues/221"},"comments":{"href":"https://api.github.com/repos/alces-software/alces-flight-center/issues/221/comments"},"review_comments":{"href":"https://api.github.com/repos/alces-software/alces-flight-center/pulls/221/comments"},"review_comment":{"href":"https://api.github.com/repos/alces-software/alces-flight-center/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/alces-software/alces-flight-center/pulls/221/commits"},"statuses":{"href":"https://api.github.com/repos/alces-software/alces-flight-center/statuses/9d8c53399b6c6bb48c5cfb87594d23e2ea85bf21"}},"author_association":"CONTRIBUTOR","merged":true,"mergeable":null,"rebaseable":null,"mergeable_state":"unknown","merged_by":{"login":"bobwhitelock","id":7476523,"avatar_url":"https://avatars0.githubusercontent.com/u/7476523?v=4","gravatar_id":"","url":"https://api.github.com/users/bobwhitelock","html_url":"https://github.com/bobwhitelock","followers_url":"https://api.github.com/users/bobwhitelock/followers","following_url":"https://api.github.com/users/bobwhitelock/following{/other_user}","gists_url":"https://api.github.com/users/bobwhitelock/gists{/gist_id}","starred_url":"https://api.github.com/users/bobwhitelock/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bobwhitelock/subscriptions","organizations_url":"https://api.github.com/users/bobwhitelock/orgs","repos_url":"https://api.github.com/users/bobwhitelock/repos","events_url":"https://api.github.com/users/bobwhitelock/events{/privacy}","received_events_url":"https://api.github.com/users/bobwhitelock/received_events","type":"User","site_admin":false},"comments":4,"review_comments":3,"maintainer_can_modify":false,"commits":9,"additions":182,"deletions":27,"changed_files":16}}
{"actor":{"display_login":"bobwhitelock"}}