{"action":"created","issue":{"url":"https://api.github.com/repos/learningequality/kolibri/issues/3515","repository_url":"https://api.github.com/repos/learningequality/kolibri","labels_url":"https://api.github.com/repos/learningequality/kolibri/issues/3515/labels{/name}","comments_url":"https://api.github.com/repos/learningequality/kolibri/issues/3515/comments","events_url":"https://api.github.com/repos/learningequality/kolibri/issues/3515/events","html_url":"https://github.com/learningequality/kolibri/issues/3515","id":312952406,"number":3515,"title":"The remove option in Lesson does not works all the time.","user":{"login":"amit3107","id":38091824,"avatar_url":"https://avatars0.githubusercontent.com/u/38091824?v=4","gravatar_id":"","url":"https://api.github.com/users/amit3107","html_url":"https://github.com/amit3107","followers_url":"https://api.github.com/users/amit3107/followers","following_url":"https://api.github.com/users/amit3107/following{/other_user}","gists_url":"https://api.github.com/users/amit3107/gists{/gist_id}","starred_url":"https://api.github.com/users/amit3107/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amit3107/subscriptions","organizations_url":"https://api.github.com/users/amit3107/orgs","repos_url":"https://api.github.com/users/amit3107/repos","events_url":"https://api.github.com/users/amit3107/events{/privacy}","received_events_url":"https://api.github.com/users/amit3107/received_events","type":"User","site_admin":false},"labels":[{"id":667034823,"url":"https://api.github.com/repos/learningequality/kolibri/labels/P1%20-%20important","name":"P1 - important","color":"ff8400","default":false},{"id":447172036,"url":"https://api.github.com/repos/learningequality/kolibri/labels/TASK:%20bug%20fix","name":"TASK: bug fix","color":"72486f","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/learningequality/kolibri/milestones/21","html_url":"https://github.com/learningequality/kolibri/milestone/21","labels_url":"https://api.github.com/repos/learningequality/kolibri/milestones/21/labels","id":3214137,"number":21,"title":"0.9.1","description":"","creator":{"login":"benjaoming","id":374612,"avatar_url":"https://avatars0.githubusercontent.com/u/374612?v=4","gravatar_id":"","url":"https://api.github.com/users/benjaoming","html_url":"https://github.com/benjaoming","followers_url":"https://api.github.com/users/benjaoming/followers","following_url":"https://api.github.com/users/benjaoming/following{/other_user}","gists_url":"https://api.github.com/users/benjaoming/gists{/gist_id}","starred_url":"https://api.github.com/users/benjaoming/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benjaoming/subscriptions","organizations_url":"https://api.github.com/users/benjaoming/orgs","repos_url":"https://api.github.com/users/benjaoming/repos","events_url":"https://api.github.com/users/benjaoming/events{/privacy}","received_events_url":"https://api.github.com/users/benjaoming/received_events","type":"User","site_admin":false},"open_issues":13,"closed_issues":21,"state":"open","created_at":"2018-03-24T12:37:38Z","updated_at":"2018-04-11T18:22:48Z","due_on":null,"closed_at":null},"comments":1,"created_at":"2018-04-10T14:36:41Z","updated_at":"2018-04-11T19:24:42Z","closed_at":null,"author_association":"NONE","body":"### Observed behavior\r\n\r\nIn the lesson feature, remove option is temporarily showing that the resource is removed but when we go back and then enter the lesson, the resources are still there.\r\n\r\n### Expected behaviour\r\n\r\nIn the lesson feature, remove option must remove a resource from the lesson.\r\n\r\n### User-facing consequences\r\n\r\nWill not be able to remove a resource.\r\n\r\n\r\n### Steps to reproduce\r\n\r\n1. Login as admin and create a lesson in the class with 2-4 resources.\r\n2. Try to remove the resource, go back and check whether the resources were removed or not.\r\n\r\nKolibri version : kolibri 0.9.0\r\nOperating system : ubuntu 14.04\r\nBrowser : Chrome\r\n\r\n### screenshots\r\n\r\n![l1](https://user-images.githubusercontent.com/38091824/38563493-a4080546-3cfa-11e8-8af1-083343c7a363.png)\r\n![l2](https://user-images.githubusercontent.com/38091824/38563494-a47ae200-3cfa-11e8-82e1-6027828bc262.png)\r\n![l3](https://user-images.githubusercontent.com/38091824/38563495-a4c11d4c-3cfa-11e8-90fb-e31c6a4ccd91.png)\r\n![l4](https://user-images.githubusercontent.com/38091824/38563497-a532a0c0-3cfa-11e8-8dba-8a5966f54715.png)\r\n\r\n\r\n\r\n\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/learningequality/kolibri/issues/comments/380567534","html_url":"https://github.com/learningequality/kolibri/issues/3515#issuecomment-380567534","issue_url":"https://api.github.com/repos/learningequality/kolibri/issues/3515","id":380567534,"user":{"login":"DXCanas","id":9877852,"avatar_url":"https://avatars2.githubusercontent.com/u/9877852?v=4","gravatar_id":"","url":"https://api.github.com/users/DXCanas","html_url":"https://github.com/DXCanas","followers_url":"https://api.github.com/users/DXCanas/followers","following_url":"https://api.github.com/users/DXCanas/following{/other_user}","gists_url":"https://api.github.com/users/DXCanas/gists{/gist_id}","starred_url":"https://api.github.com/users/DXCanas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DXCanas/subscriptions","organizations_url":"https://api.github.com/users/DXCanas/orgs","repos_url":"https://api.github.com/users/DXCanas/repos","events_url":"https://api.github.com/users/DXCanas/events{/privacy}","received_events_url":"https://api.github.com/users/DXCanas/received_events","type":"User","site_admin":false},"created_at":"2018-04-11T19:24:42Z","updated_at":"2018-04-11T19:24:42Z","author_association":"MEMBER","body":"So, this happens because the API `patch` isn't made until that snackbar goes away. The idea is you can batch remove a ton of different resources and have all of that equate to a single API call (The removals stack into a single operation that you can undo). Or, if you end up hitting undo, it would be only 1 call rather than 2 (or however many items it is you removed).\r\n\r\nThe problem, I think, is that we're navigating to a page that doesn't have a `workingResources` state property before snackbar disappears. If you navigate to \"add resources\", this works fine, but only because `workingResources` is carried over.\r\n\r\nI tried fixing this by passing a duplicate of the array (pass-by-value rather than pass-by-reference) to the autosave function. But I'm pretty sure that, because the snackbar's `hideCallback` isn't called until it's actually hidden (which may be on another page), it doesn't work as planned. \r\n\r\nPotential quick fixes _could_ be binding the callback (though that might not work, since the element will have been destroyed by this point anyway?) or passing the data needed as parameters (with defaults?) to the callback.\r\n\r\nLong term, it'd be nice if we could leverage [`vue-router`'s In-Component guards](https://router.vuejs.org/en/advanced/navigation-guards.html#in-component-guards). I made an attempt that ultimately ended up taking too long. Main obstacle is our modified version of `vue-router` to use actions rather than state. One approach (suggested by @rtibbles) I was trying but gave up on is binding a dummy component (with state) to the route for the sole purpose of using the guard. It wasn't working for me, but by that point I thought I was in too deep a rabbit hole."}}
{"actor":{"display_login":"DXCanas"}}