{"action":"created","issue":{"url":"https://api.github.com/repos/ezsystems/repository-forms/issues/55","labels_url":"https://api.github.com/repos/ezsystems/repository-forms/issues/55/labels{/name}","comments_url":"https://api.github.com/repos/ezsystems/repository-forms/issues/55/comments","events_url":"https://api.github.com/repos/ezsystems/repository-forms/issues/55/events","html_url":"https://github.com/ezsystems/repository-forms/pull/55","id":113620133,"number":55,"title":"Fix EZP-24569: Automatically compute FieldDefinition position","user":{"login":"glye","id":289744,"avatar_url":"https://avatars.githubusercontent.com/u/289744?v=3","gravatar_id":"","url":"https://api.github.com/users/glye","html_url":"https://github.com/glye","followers_url":"https://api.github.com/users/glye/followers","following_url":"https://api.github.com/users/glye/following{/other_user}","gists_url":"https://api.github.com/users/glye/gists{/gist_id}","starred_url":"https://api.github.com/users/glye/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/glye/subscriptions","organizations_url":"https://api.github.com/users/glye/orgs","repos_url":"https://api.github.com/users/glye/repos","events_url":"https://api.github.com/users/glye/events{/privacy}","received_events_url":"https://api.github.com/users/glye/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2015-10-27T16:07:19Z","updated_at":"2015-11-09T13:32:10Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/ezsystems/repository-forms/pulls/55","html_url":"https://github.com/ezsystems/repository-forms/pull/55","diff_url":"https://github.com/ezsystems/repository-forms/pull/55.diff","patch_url":"https://github.com/ezsystems/repository-forms/pull/55.patch"},"body":"> Implements https://jira.ez.no/browse/EZP-24569\r\n> Status: Ready for review\r\n> BDD for this: https://github.com/ezsystems/PlatformUIBundle/pull/423\r\n\r\nChanges:\r\n- Fielddefs are sorted when the content type is updated\r\n- New fielddefs are created with position = max existing position + 1, so they show up last\r\n- When the position is the same, sort by ~~create order~~ identifier (alphabetically ascending)\r\n\r\nTasks\r\n- [x] \"max existing position + 1\" doesn't work when a position has been edited at the same time (same submit) as a new fielddef is added - the edited position is not taken into account\r\n- [x] Tests"},"comment":{"url":"https://api.github.com/repos/ezsystems/repository-forms/issues/comments/155063043","html_url":"https://github.com/ezsystems/repository-forms/pull/55#issuecomment-155063043","issue_url":"https://api.github.com/repos/ezsystems/repository-forms/issues/55","id":155063043,"user":{"login":"glye","id":289744,"avatar_url":"https://avatars.githubusercontent.com/u/289744?v=3","gravatar_id":"","url":"https://api.github.com/users/glye","html_url":"https://github.com/glye","followers_url":"https://api.github.com/users/glye/followers","following_url":"https://api.github.com/users/glye/following{/other_user}","gists_url":"https://api.github.com/users/glye/gists{/gist_id}","starred_url":"https://api.github.com/users/glye/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/glye/subscriptions","organizations_url":"https://api.github.com/users/glye/orgs","repos_url":"https://api.github.com/users/glye/repos","events_url":"https://api.github.com/users/glye/events{/privacy}","received_events_url":"https://api.github.com/users/glye/received_events","type":"User","site_admin":false},"created_at":"2015-11-09T13:32:09Z","updated_at":"2015-11-09T13:32:09Z","body":"@lolautruche I think this should have your blessing too, before I merge. It's your issue, and this solution differs from what you wanted:\r\n- \"Position needs to be computed from the order FieldDefinitions are created in, unless the position has been forced with a defined value.\" - See above, we changed this to sort by identifier, since there is no timestamp, and the autoincremented ID is legacy specific. But new fielddefs now have priority set to max() + 1, so they appear last.\r\n- \"Ideally positions need to be calculated on the client side.\" - This solution is server side only."}}