{"action":"created","comment":{"url":"https://api.github.com/repos/yonadev/yona-server/pulls/comments/62546767","id":62546767,"diff_hunk":"@@ -104,22 +104,33 @@ public static WeekActivity createInstance(UserAnonymized userAnonymized, Goal go\n \tpublic static WeekActivity createInstanceInactivity(UserAnonymized userAnonymized, Goal goal, ZonedDateTime startOfWeek)\n \t{\n \t\tWeekActivity result = createInstance(userAnonymized, goal, startOfWeek);\n-\t\t// add the days\n-\t\t// notice this doesn't take care of user time zone changes during the week\n-\t\t// so for consistency it is important that the batch script adding inactivity does so\n-\t\tfor (int i = 0; i < 7; i++)\n+\t\tresult.addInactivityDays();\n+\t\treturn result;\n+\t}\n+\n+\tpublic void addInactivityDays() \n+\t{\n+\t\t// if the batch job has already run, skip\n+\t\tif(dayActivities.size() < 7)\n \t\t{\n-\t\t\tZonedDateTime startOfDay = startOfWeek.plusDays(i);\n-\t\t\tif (isInFuture(startOfDay, startOfWeek.getZone()))\n+\t\t\t// notice this doesn't take care of user time zone changes during the week\n+\t\t\t// so for consistency it is important that the batch script adding inactivity does so\n+\t\t\tfor (int i = 0; i < 7; i++)\n \t\t\t{\n-\t\t\t\tbreak;\n-\t\t\t}\n-\t\t\tif (goal.wasActiveAtInterval(startOfDay, ChronoUnit.DAYS))\n-\t\t\t{\n-\t\t\t\tresult.addDayActivity(DayActivity.createInstanceInactivity(userAnonymized, goal, startOfDay));\n+\t\t\t\tZonedDateTime startOfDay = getStartTime().plusDays(i);\n+\t\t\t\tif (isInFuture(startOfDay, getStartTime().getZone()))\n+\t\t\t\t{\n+\t\t\t\t\tbreak;\n+\t\t\t\t}\n+\t\t\t\tif (getGoal().wasActiveAtInterval(startOfDay, ChronoUnit.DAYS))\n+\t\t\t\t{\n+\t\t\t\t\tif(!dayActivities.stream().anyMatch(dayActivity -> dayActivity.getDate().getDayOfWeek().equals(startOfDay.getDayOfWeek())))","path":"core/src/main/java/nu/yona/server/analysis/entities/WeekActivity.java","position":35,"original_position":35,"commit_id":"8e8883d52f1261b37a85eed3b20d2a79e015b739","original_commit_id":"8e8883d52f1261b37a85eed3b20d2a79e015b739","user":{"login":"aristotelos","id":2814758,"avatar_url":"https://avatars.githubusercontent.com/u/2814758?v=3","gravatar_id":"","url":"https://api.github.com/users/aristotelos","html_url":"https://github.com/aristotelos","followers_url":"https://api.github.com/users/aristotelos/followers","following_url":"https://api.github.com/users/aristotelos/following{/other_user}","gists_url":"https://api.github.com/users/aristotelos/gists{/gist_id}","starred_url":"https://api.github.com/users/aristotelos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aristotelos/subscriptions","organizations_url":"https://api.github.com/users/aristotelos/orgs","repos_url":"https://api.github.com/users/aristotelos/repos","events_url":"https://api.github.com/users/aristotelos/events{/privacy}","received_events_url":"https://api.github.com/users/aristotelos/received_events","type":"User","site_admin":false},"body":"I don't think it will make it much simpler. If there was no activity on Sunday, Monday will be the first item in the list -- unless we add Sunday on the fly at that moment. If you think that last option should be chosen, I have nothing against it but it sounds as making it more complex.","created_at":"2016-05-09T18:18:50Z","updated_at":"2016-05-09T18:18:50Z","html_url":"https://github.com/yonadev/yona-server/pull/167#discussion_r62546767","pull_request_url":"https://api.github.com/repos/yonadev/yona-server/pulls/167","_links":{"self":{"href":"https://api.github.com/repos/yonadev/yona-server/pulls/comments/62546767"},"html":{"href":"https://github.com/yonadev/yona-server/pull/167#discussion_r62546767"},"pull_request":{"href":"https://api.github.com/repos/yonadev/yona-server/pulls/167"}}},"pull_request":{"url":"https://api.github.com/repos/yonadev/yona-server/pulls/167","id":68759006,"html_url":"https://github.com/yonadev/yona-server/pull/167","diff_url":"https://github.com/yonadev/yona-server/pull/167.diff","patch_url":"https://github.com/yonadev/yona-server/pull/167.patch","issue_url":"https://api.github.com/repos/yonadev/yona-server/issues/167","number":167,"state":"open","locked":false,"title":"YD-210 Extended activity tests, fixed two bugs","user":{"login":"aristotelos","id":2814758,"avatar_url":"https://avatars.githubusercontent.com/u/2814758?v=3","gravatar_id":"","url":"https://api.github.com/users/aristotelos","html_url":"https://github.com/aristotelos","followers_url":"https://api.github.com/users/aristotelos/followers","following_url":"https://api.github.com/users/aristotelos/following{/other_user}","gists_url":"https://api.github.com/users/aristotelos/gists{/gist_id}","starred_url":"https://api.github.com/users/aristotelos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aristotelos/subscriptions","organizations_url":"https://api.github.com/users/aristotelos/orgs","repos_url":"https://api.github.com/users/aristotelos/repos","events_url":"https://api.github.com/users/aristotelos/events{/privacy}","received_events_url":"https://api.github.com/users/aristotelos/received_events","type":"User","site_admin":false},"body":null,"created_at":"2016-05-03T19:13:17Z","updated_at":"2016-05-09T18:18:50Z","closed_at":null,"merged_at":null,"merge_commit_sha":"87f340627fb0c8f1c3bd04590da6d681b15cf4eb","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/yonadev/yona-server/pulls/167/commits","review_comments_url":"https://api.github.com/repos/yonadev/yona-server/pulls/167/comments","review_comment_url":"https://api.github.com/repos/yonadev/yona-server/pulls/comments{/number}","comments_url":"https://api.github.com/repos/yonadev/yona-server/issues/167/comments","statuses_url":"https://api.github.com/repos/yonadev/yona-server/statuses/8e8883d52f1261b37a85eed3b20d2a79e015b739","head":{"label":"yonadev:yd-210-extend-activity-tests","ref":"yd-210-extend-activity-tests","sha":"8e8883d52f1261b37a85eed3b20d2a79e015b739","user":{"login":"yonadev","id":14901571,"avatar_url":"https://avatars.githubusercontent.com/u/14901571?v=3","gravatar_id":"","url":"https://api.github.com/users/yonadev","html_url":"https://github.com/yonadev","followers_url":"https://api.github.com/users/yonadev/followers","following_url":"https://api.github.com/users/yonadev/following{/other_user}","gists_url":"https://api.github.com/users/yonadev/gists{/gist_id}","starred_url":"https://api.github.com/users/yonadev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yonadev/subscriptions","organizations_url":"https://api.github.com/users/yonadev/orgs","repos_url":"https://api.github.com/users/yonadev/repos","events_url":"https://api.github.com/users/yonadev/events{/privacy}","received_events_url":"https://api.github.com/users/yonadev/received_events","type":"Organization","site_admin":false},"repo":{"id":43589108,"name":"yona-server","full_name":"yonadev/yona-server","owner":{"login":"yonadev","id":14901571,"avatar_url":"https://avatars.githubusercontent.com/u/14901571?v=3","gravatar_id":"","url":"https://api.github.com/users/yonadev","html_url":"https://github.com/yonadev","followers_url":"https://api.github.com/users/yonadev/followers","following_url":"https://api.github.com/users/yonadev/following{/other_user}","gists_url":"https://api.github.com/users/yonadev/gists{/gist_id}","starred_url":"https://api.github.com/users/yonadev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yonadev/subscriptions","organizations_url":"https://api.github.com/users/yonadev/orgs","repos_url":"https://api.github.com/users/yonadev/repos","events_url":"https://api.github.com/users/yonadev/events{/privacy}","received_events_url":"https://api.github.com/users/yonadev/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/yonadev/yona-server","description":"Yona Server","fork":false,"url":"https://api.github.com/repos/yonadev/yona-server","forks_url":"https://api.github.com/repos/yonadev/yona-server/forks","keys_url":"https://api.github.com/repos/yonadev/yona-server/keys{/key_id}","collaborators_url":"https://api.github.com/repos/yonadev/yona-server/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/yonadev/yona-server/teams","hooks_url":"https://api.github.com/repos/yonadev/yona-server/hooks","issue_events_url":"https://api.github.com/repos/yonadev/yona-server/issues/events{/number}","events_url":"https://api.github.com/repos/yonadev/yona-server/events","assignees_url":"https://api.github.com/repos/yonadev/yona-server/assignees{/user}","branches_url":"https://api.github.com/repos/yonadev/yona-server/branches{/branch}","tags_url":"https://api.github.com/repos/yonadev/yona-server/tags","blobs_url":"https://api.github.com/repos/yonadev/yona-server/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/yonadev/yona-server/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/yonadev/yona-server/git/refs{/sha}","trees_url":"https://api.github.com/repos/yonadev/yona-server/git/trees{/sha}","statuses_url":"https://api.github.com/repos/yonadev/yona-server/statuses/{sha}","languages_url":"https://api.github.com/repos/yonadev/yona-server/languages","stargazers_url":"https://api.github.com/repos/yonadev/yona-server/stargazers","contributors_url":"https://api.github.com/repos/yonadev/yona-server/contributors","subscribers_url":"https://api.github.com/repos/yonadev/yona-server/subscribers","subscription_url":"https://api.github.com/repos/yonadev/yona-server/subscription","commits_url":"https://api.github.com/repos/yonadev/yona-server/commits{/sha}","git_commits_url":"https://api.github.com/repos/yonadev/yona-server/git/commits{/sha}","comments_url":"https://api.github.com/repos/yonadev/yona-server/comments{/number}","issue_comment_url":"https://api.github.com/repos/yonadev/yona-server/issues/comments{/number}","contents_url":"https://api.github.com/repos/yonadev/yona-server/contents/{+path}","compare_url":"https://api.github.com/repos/yonadev/yona-server/compare/{base}...{head}","merges_url":"https://api.github.com/repos/yonadev/yona-server/merges","archive_url":"https://api.github.com/repos/yonadev/yona-server/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/yonadev/yona-server/downloads","issues_url":"https://api.github.com/repos/yonadev/yona-server/issues{/number}","pulls_url":"https://api.github.com/repos/yonadev/yona-server/pulls{/number}","milestones_url":"https://api.github.com/repos/yonadev/yona-server/milestones{/number}","notifications_url":"https://api.github.com/repos/yonadev/yona-server/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/yonadev/yona-server/labels{/name}","releases_url":"https://api.github.com/repos/yonadev/yona-server/releases{/id}","deployments_url":"https://api.github.com/repos/yonadev/yona-server/deployments","created_at":"2015-10-03T05:33:54Z","updated_at":"2016-01-12T21:27:23Z","pushed_at":"2016-05-07T14:53:48Z","git_url":"git://github.com/yonadev/yona-server.git","ssh_url":"git@github.com:yonadev/yona-server.git","clone_url":"https://github.com/yonadev/yona-server.git","svn_url":"https://github.com/yonadev/yona-server","homepage":null,"size":2185,"stargazers_count":1,"watchers_count":1,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":5,"forks":2,"open_issues":5,"watchers":1,"default_branch":"master"}},"base":{"label":"yonadev:master","ref":"master","sha":"888d098f7e0c4122d913eb4685a9b1a462a01b6a","user":{"login":"yonadev","id":14901571,"avatar_url":"https://avatars.githubusercontent.com/u/14901571?v=3","gravatar_id":"","url":"https://api.github.com/users/yonadev","html_url":"https://github.com/yonadev","followers_url":"https://api.github.com/users/yonadev/followers","following_url":"https://api.github.com/users/yonadev/following{/other_user}","gists_url":"https://api.github.com/users/yonadev/gists{/gist_id}","starred_url":"https://api.github.com/users/yonadev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yonadev/subscriptions","organizations_url":"https://api.github.com/users/yonadev/orgs","repos_url":"https://api.github.com/users/yonadev/repos","events_url":"https://api.github.com/users/yonadev/events{/privacy}","received_events_url":"https://api.github.com/users/yonadev/received_events","type":"Organization","site_admin":false},"repo":{"id":43589108,"name":"yona-server","full_name":"yonadev/yona-server","owner":{"login":"yonadev","id":14901571,"avatar_url":"https://avatars.githubusercontent.com/u/14901571?v=3","gravatar_id":"","url":"https://api.github.com/users/yonadev","html_url":"https://github.com/yonadev","followers_url":"https://api.github.com/users/yonadev/followers","following_url":"https://api.github.com/users/yonadev/following{/other_user}","gists_url":"https://api.github.com/users/yonadev/gists{/gist_id}","starred_url":"https://api.github.com/users/yonadev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yonadev/subscriptions","organizations_url":"https://api.github.com/users/yonadev/orgs","repos_url":"https://api.github.com/users/yonadev/repos","events_url":"https://api.github.com/users/yonadev/events{/privacy}","received_events_url":"https://api.github.com/users/yonadev/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/yonadev/yona-server","description":"Yona Server","fork":false,"url":"https://api.github.com/repos/yonadev/yona-server","forks_url":"https://api.github.com/repos/yonadev/yona-server/forks","keys_url":"https://api.github.com/repos/yonadev/yona-server/keys{/key_id}","collaborators_url":"https://api.github.com/repos/yonadev/yona-server/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/yonadev/yona-server/teams","hooks_url":"https://api.github.com/repos/yonadev/yona-server/hooks","issue_events_url":"https://api.github.com/repos/yonadev/yona-server/issues/events{/number}","events_url":"https://api.github.com/repos/yonadev/yona-server/events","assignees_url":"https://api.github.com/repos/yonadev/yona-server/assignees{/user}","branches_url":"https://api.github.com/repos/yonadev/yona-server/branches{/branch}","tags_url":"https://api.github.com/repos/yonadev/yona-server/tags","blobs_url":"https://api.github.com/repos/yonadev/yona-server/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/yonadev/yona-server/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/yonadev/yona-server/git/refs{/sha}","trees_url":"https://api.github.com/repos/yonadev/yona-server/git/trees{/sha}","statuses_url":"https://api.github.com/repos/yonadev/yona-server/statuses/{sha}","languages_url":"https://api.github.com/repos/yonadev/yona-server/languages","stargazers_url":"https://api.github.com/repos/yonadev/yona-server/stargazers","contributors_url":"https://api.github.com/repos/yonadev/yona-server/contributors","subscribers_url":"https://api.github.com/repos/yonadev/yona-server/subscribers","subscription_url":"https://api.github.com/repos/yonadev/yona-server/subscription","commits_url":"https://api.github.com/repos/yonadev/yona-server/commits{/sha}","git_commits_url":"https://api.github.com/repos/yonadev/yona-server/git/commits{/sha}","comments_url":"https://api.github.com/repos/yonadev/yona-server/comments{/number}","issue_comment_url":"https://api.github.com/repos/yonadev/yona-server/issues/comments{/number}","contents_url":"https://api.github.com/repos/yonadev/yona-server/contents/{+path}","compare_url":"https://api.github.com/repos/yonadev/yona-server/compare/{base}...{head}","merges_url":"https://api.github.com/repos/yonadev/yona-server/merges","archive_url":"https://api.github.com/repos/yonadev/yona-server/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/yonadev/yona-server/downloads","issues_url":"https://api.github.com/repos/yonadev/yona-server/issues{/number}","pulls_url":"https://api.github.com/repos/yonadev/yona-server/pulls{/number}","milestones_url":"https://api.github.com/repos/yonadev/yona-server/milestones{/number}","notifications_url":"https://api.github.com/repos/yonadev/yona-server/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/yonadev/yona-server/labels{/name}","releases_url":"https://api.github.com/repos/yonadev/yona-server/releases{/id}","deployments_url":"https://api.github.com/repos/yonadev/yona-server/deployments","created_at":"2015-10-03T05:33:54Z","updated_at":"2016-01-12T21:27:23Z","pushed_at":"2016-05-07T14:53:48Z","git_url":"git://github.com/yonadev/yona-server.git","ssh_url":"git@github.com:yonadev/yona-server.git","clone_url":"https://github.com/yonadev/yona-server.git","svn_url":"https://github.com/yonadev/yona-server","homepage":null,"size":2185,"stargazers_count":1,"watchers_count":1,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":5,"forks":2,"open_issues":5,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/yonadev/yona-server/pulls/167"},"html":{"href":"https://github.com/yonadev/yona-server/pull/167"},"issue":{"href":"https://api.github.com/repos/yonadev/yona-server/issues/167"},"comments":{"href":"https://api.github.com/repos/yonadev/yona-server/issues/167/comments"},"review_comments":{"href":"https://api.github.com/repos/yonadev/yona-server/pulls/167/comments"},"review_comment":{"href":"https://api.github.com/repos/yonadev/yona-server/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/yonadev/yona-server/pulls/167/commits"},"statuses":{"href":"https://api.github.com/repos/yonadev/yona-server/statuses/8e8883d52f1261b37a85eed3b20d2a79e015b739"}}}}