{"action":"created","issue":{"url":"https://api.github.com/repos/SpriteLink/NIPAP/issues/824","labels_url":"https://api.github.com/repos/SpriteLink/NIPAP/issues/824/labels{/name}","comments_url":"https://api.github.com/repos/SpriteLink/NIPAP/issues/824/comments","events_url":"https://api.github.com/repos/SpriteLink/NIPAP/issues/824/events","html_url":"https://github.com/SpriteLink/NIPAP/pull/824","id":95137055,"number":824,"title":"sql: fix parent_prefix selection","user":{"login":"plajjan","id":841628,"avatar_url":"https://avatars.githubusercontent.com/u/841628?v=3","gravatar_id":"","url":"https://api.github.com/users/plajjan","html_url":"https://github.com/plajjan","followers_url":"https://api.github.com/users/plajjan/followers","following_url":"https://api.github.com/users/plajjan/following{/other_user}","gists_url":"https://api.github.com/users/plajjan/gists{/gist_id}","starred_url":"https://api.github.com/users/plajjan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/plajjan/subscriptions","organizations_url":"https://api.github.com/users/plajjan/orgs","repos_url":"https://api.github.com/users/plajjan/repos","events_url":"https://api.github.com/users/plajjan/events{/privacy}","received_events_url":"https://api.github.com/users/plajjan/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/SpriteLink/NIPAP/labels/backend","name":"backend","color":"c7def8"},{"url":"https://api.github.com/repos/SpriteLink/NIPAP/labels/bug","name":"bug","color":"e10c02"}],"state":"open","locked":false,"assignee":{"login":"garberg","id":849751,"avatar_url":"https://avatars.githubusercontent.com/u/849751?v=3","gravatar_id":"","url":"https://api.github.com/users/garberg","html_url":"https://github.com/garberg","followers_url":"https://api.github.com/users/garberg/followers","following_url":"https://api.github.com/users/garberg/following{/other_user}","gists_url":"https://api.github.com/users/garberg/gists{/gist_id}","starred_url":"https://api.github.com/users/garberg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/garberg/subscriptions","organizations_url":"https://api.github.com/users/garberg/orgs","repos_url":"https://api.github.com/users/garberg/repos","events_url":"https://api.github.com/users/garberg/events{/privacy}","received_events_url":"https://api.github.com/users/garberg/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/SpriteLink/NIPAP/milestones/35","html_url":"https://github.com/SpriteLink/NIPAP/milestones/Version%200.28%20-%20Hades","labels_url":"https://api.github.com/repos/SpriteLink/NIPAP/milestones/35/labels","id":748131,"number":35,"title":"Version 0.28 - Hades","description":"","creator":{"login":"plajjan","id":841628,"avatar_url":"https://avatars.githubusercontent.com/u/841628?v=3","gravatar_id":"","url":"https://api.github.com/users/plajjan","html_url":"https://github.com/plajjan","followers_url":"https://api.github.com/users/plajjan/followers","following_url":"https://api.github.com/users/plajjan/following{/other_user}","gists_url":"https://api.github.com/users/plajjan/gists{/gist_id}","starred_url":"https://api.github.com/users/plajjan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/plajjan/subscriptions","organizations_url":"https://api.github.com/users/plajjan/orgs","repos_url":"https://api.github.com/users/plajjan/repos","events_url":"https://api.github.com/users/plajjan/events{/privacy}","received_events_url":"https://api.github.com/users/plajjan/received_events","type":"User","site_admin":false},"open_issues":3,"closed_issues":96,"state":"open","created_at":"2014-08-08T22:18:37Z","updated_at":"2015-07-16T10:39:23Z","due_on":null,"closed_at":null},"comments":1,"created_at":"2015-07-15T08:41:57Z","updated_at":"2015-07-16T10:59:40Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/SpriteLink/NIPAP/pulls/824","html_url":"https://github.com/SpriteLink/NIPAP/pull/824","diff_url":"https://github.com/SpriteLink/NIPAP/pull/824.diff","patch_url":"https://github.com/SpriteLink/NIPAP/pull/824.patch"},"body":"If a prefix is shrunk we have to filter it out in the before trigger to\r\navoid selecting its old self as its parent_prefix. This is perfectly\r\nnatural as the database before trigger sees the data before the update\r\nhas been applied.\r\n\r\nThis fixes the scenario when trying to shrink an assignment prefix.\r\nBefore it would select itself as parent and when running the consistency\r\nchecks on that it would refuse the update as an assignment cannot have\r\nan assignment (its old self) as a parent.\r\n\r\nThe prefix statistics were written under this false assumption, so with\r\nthe correct parent_prefix it would generate incorrect statistics which\r\nI've solved by adding an explicit path for when shrinking prefixes, i.e.\r\nNEW is smaller than OLD but indent level is the same.\r\n\r\nThis fixes #817."},"comment":{"url":"https://api.github.com/repos/SpriteLink/NIPAP/issues/comments/121926290","html_url":"https://github.com/SpriteLink/NIPAP/pull/824#issuecomment-121926290","issue_url":"https://api.github.com/repos/SpriteLink/NIPAP/issues/824","id":121926290,"user":{"login":"garberg","id":849751,"avatar_url":"https://avatars.githubusercontent.com/u/849751?v=3","gravatar_id":"","url":"https://api.github.com/users/garberg","html_url":"https://github.com/garberg","followers_url":"https://api.github.com/users/garberg/followers","following_url":"https://api.github.com/users/garberg/following{/other_user}","gists_url":"https://api.github.com/users/garberg/gists{/gist_id}","starred_url":"https://api.github.com/users/garberg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/garberg/subscriptions","organizations_url":"https://api.github.com/users/garberg/orgs","repos_url":"https://api.github.com/users/garberg/repos","events_url":"https://api.github.com/users/garberg/events{/privacy}","received_events_url":"https://api.github.com/users/garberg/received_events","type":"User","site_admin":false},"created_at":"2015-07-16T10:59:40Z","updated_at":"2015-07-16T10:59:40Z","body":"Looks good to me, merging!"}}