{"action":"created","issue":{"url":"https://api.github.com/repos/mitodl/edx-sga/issues/96","labels_url":"https://api.github.com/repos/mitodl/edx-sga/issues/96/labels{/name}","comments_url":"https://api.github.com/repos/mitodl/edx-sga/issues/96/comments","events_url":"https://api.github.com/repos/mitodl/edx-sga/issues/96/events","html_url":"https://github.com/mitodl/edx-sga/pull/96","id":78547453,"number":96,"title":"Implement support for multiply SGA elements at one vertical","user":{"login":"aliaksandrb","id":526022,"avatar_url":"https://avatars.githubusercontent.com/u/526022?v=3","gravatar_id":"","url":"https://api.github.com/users/aliaksandrb","html_url":"https://github.com/aliaksandrb","followers_url":"https://api.github.com/users/aliaksandrb/followers","following_url":"https://api.github.com/users/aliaksandrb/following{/other_user}","gists_url":"https://api.github.com/users/aliaksandrb/gists{/gist_id}","starred_url":"https://api.github.com/users/aliaksandrb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aliaksandrb/subscriptions","organizations_url":"https://api.github.com/users/aliaksandrb/orgs","repos_url":"https://api.github.com/users/aliaksandrb/repos","events_url":"https://api.github.com/users/aliaksandrb/events{/privacy}","received_events_url":"https://api.github.com/users/aliaksandrb/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/mitodl/edx-sga/labels/Needs%20Review","name":"Needs Review","color":"0052cc"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-05-20T14:27:34Z","updated_at":"2015-06-08T11:24:35Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/mitodl/edx-sga/pulls/96","html_url":"https://github.com/mitodl/edx-sga/pull/96","diff_url":"https://github.com/mitodl/edx-sga/pull/96.diff","patch_url":"https://github.com/mitodl/edx-sga/pull/96.patch"},"body":"Hi!\r\n\r\nI was able to fix the #81 (Support multiple SGA types in one vertical) issue at our current project with a \"hack\" presented in the current PR.\r\n\r\nThe idea to consists in rewriting the `change` event on `fileupload` object (provided by the [jQuery-File-Upload](https://github.com/blueimp/jQuery-File-Upload) plugin, used it `edx-sga` internally) to prevent recursion of call stack.\r\n\r\nCurrent implementation of the `_onChange` handler depends on the version of `jQuery-File-Upload`, the latest for example https://github.com/blueimp/jQuery-File-Upload/blob/master/js/jquery.fileupload.js#L1209-L1228 but all of them shared such behavior:\r\n```javascript\r\n...\r\nif (that._trigger(\r\n        'change',\r\n        $.Event('change', {delegatedEvent: e}),\r\n        data\r\n    ) !== false) {\r\n        that._onAdd(e, data);\r\n}\r\n...\r\n```\r\nor for the older versions\r\n```javascript\r\n...\r\nif (that._trigger('change', e, data) !== false) {\r\n    that._onAdd(e, data);\r\n}\r\n...   \r\n```\r\nAnd rewritten version just avoid this condition, calling  ``` that._onAdd(e, data);``` without `change` event triggering.\r\n\r\nIt fixed both problems \"Upload file on lms/sga\" and \"Upload annotated file on Grade submissions dialog on lms/sga\" for me.\r\n\r\nI am not sure if this solution is good enough to be merged but at least it could be used temporary for everybody faced original issue until the better one would be provided :blush:\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/mitodl/edx-sga/issues/comments/109956547","html_url":"https://github.com/mitodl/edx-sga/pull/96#issuecomment-109956547","issue_url":"https://api.github.com/repos/mitodl/edx-sga/issues/96","id":109956547,"user":{"login":"amir-qayyum-khan","id":10431250,"avatar_url":"https://avatars.githubusercontent.com/u/10431250?v=3","gravatar_id":"","url":"https://api.github.com/users/amir-qayyum-khan","html_url":"https://github.com/amir-qayyum-khan","followers_url":"https://api.github.com/users/amir-qayyum-khan/followers","following_url":"https://api.github.com/users/amir-qayyum-khan/following{/other_user}","gists_url":"https://api.github.com/users/amir-qayyum-khan/gists{/gist_id}","starred_url":"https://api.github.com/users/amir-qayyum-khan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amir-qayyum-khan/subscriptions","organizations_url":"https://api.github.com/users/amir-qayyum-khan/orgs","repos_url":"https://api.github.com/users/amir-qayyum-khan/repos","events_url":"https://api.github.com/users/amir-qayyum-khan/events{/privacy}","received_events_url":"https://api.github.com/users/amir-qayyum-khan/received_events","type":"User","site_admin":false},"created_at":"2015-06-08T11:24:35Z","updated_at":"2015-06-08T11:24:35Z","body":"(y)"}}