{"action":"created","issue":{"url":"https://api.github.com/repos/CMPUT301W15T07/TravelTracker/issues/84","labels_url":"https://api.github.com/repos/CMPUT301W15T07/TravelTracker/issues/84/labels{/name}","comments_url":"https://api.github.com/repos/CMPUT301W15T07/TravelTracker/issues/84/comments","events_url":"https://api.github.com/repos/CMPUT301W15T07/TravelTracker/issues/84/events","html_url":"https://github.com/CMPUT301W15T07/TravelTracker/issues/84","id":61917888,"number":84,"title":"All non-Login activities should observe the DataSource, repopulating on `update()`.","user":{"login":"kdbanman","id":1323521,"avatar_url":"https://avatars.githubusercontent.com/u/1323521?v=3","gravatar_id":"","url":"https://api.github.com/users/kdbanman","html_url":"https://github.com/kdbanman","followers_url":"https://api.github.com/users/kdbanman/followers","following_url":"https://api.github.com/users/kdbanman/following{/other_user}","gists_url":"https://api.github.com/users/kdbanman/gists{/gist_id}","starred_url":"https://api.github.com/users/kdbanman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kdbanman/subscriptions","organizations_url":"https://api.github.com/users/kdbanman/orgs","repos_url":"https://api.github.com/users/kdbanman/repos","events_url":"https://api.github.com/users/kdbanman/events{/privacy}","received_events_url":"https://api.github.com/users/kdbanman/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/CMPUT301W15T07/TravelTracker/labels/backend","name":"backend","color":"bfe5bf"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-03-15T23:16:28Z","updated_at":"2015-03-16T06:41:20Z","closed_at":null,"body":"Currently, only ClaimsListActivity and ExpenseItemsListActivity are currently Observers of the data source.  All activities except the login activity be observers of the data source, because all their Views need to be repopulated every time the DataSource notices a model update.\r\n\r\nFor example, in ClaimInfoActivity:\r\n\r\n```java\r\n// this will be called *every* time *any* model object changes\r\n@Override\r\npublic void update(DataSource datasource) {\r\n  // no need to use the passed datasource - activity already has a reference.\r\n  \r\n  // on some activities, this block will be executed **OFTEN** (i.e. every keypress),\r\n  // so this probably shouldn't be an asynchronous doom block.\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/CMPUT301W15T07/TravelTracker/issues/comments/81449245","html_url":"https://github.com/CMPUT301W15T07/TravelTracker/issues/84#issuecomment-81449245","issue_url":"https://api.github.com/repos/CMPUT301W15T07/TravelTracker/issues/84","id":81449245,"user":{"login":"kdbanman","id":1323521,"avatar_url":"https://avatars.githubusercontent.com/u/1323521?v=3","gravatar_id":"","url":"https://api.github.com/users/kdbanman","html_url":"https://github.com/kdbanman","followers_url":"https://api.github.com/users/kdbanman/followers","following_url":"https://api.github.com/users/kdbanman/following{/other_user}","gists_url":"https://api.github.com/users/kdbanman/gists{/gist_id}","starred_url":"https://api.github.com/users/kdbanman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kdbanman/subscriptions","organizations_url":"https://api.github.com/users/kdbanman/orgs","repos_url":"https://api.github.com/users/kdbanman/repos","events_url":"https://api.github.com/users/kdbanman/events{/privacy}","received_events_url":"https://api.github.com/users/kdbanman/received_events","type":"User","site_admin":false},"created_at":"2015-03-16T06:41:20Z","updated_at":"2015-03-16T06:41:20Z","body":"Strange unit testing problem related to Observers.  By making the ClaimInfoActivity observe the datasource for changes, 2 tests break:\r\n\r\n- `testSetExpenseClaimEndDate()`\r\n- `testSetExpenseClaimStartDate()`\r\n\r\nHowever, the in-app behaviour is fine - the dates change as expected.  The changes made are as follows.\r\n\r\n```java\r\npublic class ClaimInfoActivity extends TravelTrackerActivity implements Observer<DataSource> {\r\n\r\n  public void onCreate() {\r\n    // ...\r\n    datasource.addObserver(this);\r\n  }\r\n\r\n  @Override\r\n  public void update() {\r\n    datasource.getClaim(claimID, new ClaimCallback());\r\n  }\r\n\r\n}\r\n```"}}