{"action":"created","comment":{"url":"https://api.github.com/repos/nightscout/cgm-remote-monitor/pulls/comments/174226153","pull_request_review_id":103543542,"id":174226153,"diff_hunk":"@@ -69,6 +71,48 @@ function configure (app, wares, ctx) {\n       return es.map(sync);\n     }\n \n+    // check for last modified from in-memory data\n+\n+    function ifModifiedSinceCTX (req, res, next) {\n+\n+      var lastEntry = _.last(ctx.ddata.sgvs);\n+      var lastEntryDate = null;\n+      \n+      if (!_.isNil(lastEntry)) {\n+        lastEntryDate = new Date(_.last(ctx.ddata.sgvs).mills);\n+        res.setHeader('Last-Modified', lastEntryDate.toUTCString());\n+      }\n+      \n+      var ifModifiedSince = req.get('If-Modified-Since');\n+      if (!ifModifiedSince) { return next(); }\n+      \n+      if (lastEntryDate.getTime() <= new Date(ifModifiedSince).getTime()) {\n+        res.status(304).send({status:304, message: 'Not modified', type:'internal'});\n+        return;\n+      }\n+      \n+      return next();\n+    }\n+\n+    // check for last modified from query results\n+    \n+    function ifModifiedSince (req, res, next) {","path":"lib/api/entries/index.js","position":44,"original_position":44,"commit_id":"e5c8933adec738c13ca9be176a5a5ca15bb78839","original_commit_id":"e5c8933adec738c13ca9be176a5a5ca15bb78839","user":{"login":"codacy-bot","id":19940114,"avatar_url":"https://avatars1.githubusercontent.com/u/19940114?v=4","gravatar_id":"","url":"https://api.github.com/users/codacy-bot","html_url":"https://github.com/codacy-bot","followers_url":"https://api.github.com/users/codacy-bot/followers","following_url":"https://api.github.com/users/codacy-bot/following{/other_user}","gists_url":"https://api.github.com/users/codacy-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/codacy-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codacy-bot/subscriptions","organizations_url":"https://api.github.com/users/codacy-bot/orgs","repos_url":"https://api.github.com/users/codacy-bot/repos","events_url":"https://api.github.com/users/codacy-bot/events{/privacy}","received_events_url":"https://api.github.com/users/codacy-bot/received_events","type":"User","site_admin":false},"body":"![Codacy](https://app.codacy.com/assets/images/favicon.png) Issue found: ['ifModifiedSince' is defined but never used. (no-unused-vars)](https://app.codacy.com/app/Nightscout/cgm-remote-monitor/pullRequest?prid=1428111)","created_at":"2018-03-13T17:50:20Z","updated_at":"2018-03-13T17:50:20Z","html_url":"https://github.com/nightscout/cgm-remote-monitor/pull/3443#discussion_r174226153","pull_request_url":"https://api.github.com/repos/nightscout/cgm-remote-monitor/pulls/3443","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/nightscout/cgm-remote-monitor/pulls/comments/174226153"},"html":{"href":"https://github.com/nightscout/cgm-remote-monitor/pull/3443#discussion_r174226153"},"pull_request":{"href":"https://api.github.com/repos/nightscout/cgm-remote-monitor/pulls/3443"}}},"pull_request":{"url":"https://api.github.com/repos/nightscout/cgm-remote-monitor/pulls/3443","id":174734441,"html_url":"https://github.com/nightscout/cgm-remote-monitor/pull/3443","diff_url":"https://github.com/nightscout/cgm-remote-monitor/pull/3443.diff","patch_url":"https://github.com/nightscout/cgm-remote-monitor/pull/3443.patch","issue_url":"https://api.github.com/repos/nightscout/cgm-remote-monitor/issues/3443","number":3443,"state":"open","locked":false,"title":"Dev","user":{"login":"benhamou","id":13717816,"avatar_url":"https://avatars3.githubusercontent.com/u/13717816?v=4","gravatar_id":"","url":"https://api.github.com/users/benhamou","html_url":"https://github.com/benhamou","followers_url":"https://api.github.com/users/benhamou/followers","following_url":"https://api.github.com/users/benhamou/following{/other_user}","gists_url":"https://api.github.com/users/benhamou/gists{/gist_id}","starred_url":"https://api.github.com/users/benhamou/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benhamou/subscriptions","organizations_url":"https://api.github.com/users/benhamou/orgs","repos_url":"https://api.github.com/users/benhamou/repos","events_url":"https://api.github.com/users/benhamou/events{/privacy}","received_events_url":"https://api.github.com/users/benhamou/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-03-13T17:29:16Z","updated_at":"2018-03-13T17:50:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5961dd54f460edf986a6d1bb62892f12e4e1ae15","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/nightscout/cgm-remote-monitor/pulls/3443/commits","review_comments_url":"https://api.github.com/repos/nightscout/cgm-remote-monitor/pulls/3443/comments","review_comment_url":"https://api.github.com/repos/nightscout/cgm-remote-monitor/pulls/comments{/number}","comments_url":"https://api.github.com/repos/nightscout/cgm-remote-monitor/issues/3443/comments","statuses_url":"https://api.github.com/repos/nightscout/cgm-remote-monitor/statuses/e5c8933adec738c13ca9be176a5a5ca15bb78839","head":{"label":"benhamou:dev","ref":"dev","sha":"e5c8933adec738c13ca9be176a5a5ca15bb78839","user":{"login":"benhamou","id":13717816,"avatar_url":"https://avatars3.githubusercontent.com/u/13717816?v=4","gravatar_id":"","url":"https://api.github.com/users/benhamou","html_url":"https://github.com/benhamou","followers_url":"https://api.github.com/users/benhamou/followers","following_url":"https://api.github.com/users/benhamou/following{/other_user}","gists_url":"https://api.github.com/users/benhamou/gists{/gist_id}","starred_url":"https://api.github.com/users/benhamou/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benhamou/subscriptions","organizations_url":"https://api.github.com/users/benhamou/orgs","repos_url":"https://api.github.com/users/benhamou/repos","events_url":"https://api.github.com/users/benhamou/events{/privacy}","received_events_url":"https://api.github.com/users/benhamou/received_events","type":"User","site_admin":false},"repo":{"id":54059609,"name":"cgm-remote-monitor","full_name":"benhamou/cgm-remote-monitor","owner":{"login":"benhamou","id":13717816,"avatar_url":"https://avatars3.githubusercontent.com/u/13717816?v=4","gravatar_id":"","url":"https://api.github.com/users/benhamou","html_url":"https://github.com/benhamou","followers_url":"https://api.github.com/users/benhamou/followers","following_url":"https://api.github.com/users/benhamou/following{/other_user}","gists_url":"https://api.github.com/users/benhamou/gists{/gist_id}","starred_url":"https://api.github.com/users/benhamou/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benhamou/subscriptions","organizations_url":"https://api.github.com/users/benhamou/orgs","repos_url":"https://api.github.com/users/benhamou/repos","events_url":"https://api.github.com/users/benhamou/events{/privacy}","received_events_url":"https://api.github.com/users/benhamou/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/benhamou/cgm-remote-monitor","description":"nightscout web monitor","fork":true,"url":"https://api.github.com/repos/benhamou/cgm-remote-monitor","forks_url":"https://api.github.com/repos/benhamou/cgm-remote-monitor/forks","keys_url":"https://api.github.com/repos/benhamou/cgm-remote-monitor/keys{/key_id}","collaborators_url":"https://api.github.com/repos/benhamou/cgm-remote-monitor/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/benhamou/cgm-remote-monitor/teams","hooks_url":"https://api.github.com/repos/benhamou/cgm-remote-monitor/hooks","issue_events_url":"https://api.github.com/repos/benhamou/cgm-remote-monitor/issues/events{/number}","events_url":"https://api.github.com/repos/benhamou/cgm-remote-monitor/events","assignees_url":"https://api.github.com/repos/benhamou/cgm-remote-monitor/assignees{/user}","branches_url":"https://api.github.com/repos/benhamou/cgm-remote-monitor/branches{/branch}","tags_url":"https://api.github.com/repos/benhamou/cgm-remote-monitor/tags","blobs_url":"https://api.github.com/repos/benhamou/cgm-remote-monitor/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/benhamou/cgm-remote-monitor/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/benhamou/cgm-remote-monitor/git/refs{/sha}","trees_url":"https://api.github.com/repos/benhamou/cgm-remote-monitor/git/trees{/sha}","statuses_url":"https://api.github.com/repos/benhamou/cgm-remote-monitor/statuses/{sha}","languages_url":"https://api.github.com/repos/benhamou/cgm-remote-monitor/languages","stargazers_url":"https://api.github.com/repos/benhamou/cgm-remote-monitor/stargazers","contributors_url":"https://api.github.com/repos/benhamou/cgm-remote-monitor/contributors","subscribers_url":"https://api.github.com/repos/benhamou/cgm-remote-monitor/subscribers","subscription_url":"https://api.github.com/repos/benhamou/cgm-remote-monitor/subscription","commits_url":"https://api.github.com/repos/benhamou/cgm-remote-monitor/commits{/sha}","git_commits_url":"https://api.github.com/repos/benhamou/cgm-remote-monitor/git/commits{/sha}","comments_url":"https://api.github.com/repos/benhamou/cgm-remote-monitor/comments{/number}","issue_comment_url":"https://api.github.com/repos/benhamou/cgm-remote-monitor/issues/comments{/number}","contents_url":"https://api.github.com/repos/benhamou/cgm-remote-monitor/contents/{+path}","compare_url":"https://api.github.com/repos/benhamou/cgm-remote-monitor/compare/{base}...{head}","merges_url":"https://api.github.com/repos/benhamou/cgm-remote-monitor/merges","archive_url":"https://api.github.com/repos/benhamou/cgm-remote-monitor/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/benhamou/cgm-remote-monitor/downloads","issues_url":"https://api.github.com/repos/benhamou/cgm-remote-monitor/issues{/number}","pulls_url":"https://api.github.com/repos/benhamou/cgm-remote-monitor/pulls{/number}","milestones_url":"https://api.github.com/repos/benhamou/cgm-remote-monitor/milestones{/number}","notifications_url":"https://api.github.com/repos/benhamou/cgm-remote-monitor/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/benhamou/cgm-remote-monitor/labels{/name}","releases_url":"https://api.github.com/repos/benhamou/cgm-remote-monitor/releases{/id}","deployments_url":"https://api.github.com/repos/benhamou/cgm-remote-monitor/deployments","created_at":"2016-03-16T19:13:25Z","updated_at":"2016-03-16T19:13:30Z","pushed_at":"2018-03-13T09:06:29Z","git_url":"git://github.com/benhamou/cgm-remote-monitor.git","ssh_url":"git@github.com:benhamou/cgm-remote-monitor.git","clone_url":"https://github.com/benhamou/cgm-remote-monitor.git","svn_url":"https://github.com/benhamou/cgm-remote-monitor","homepage":"","size":9842,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":null,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"nightscout:master","ref":"master","sha":"57a4ea39647aa85ee918a2df28639e295066126b","user":{"login":"nightscout","id":7661012,"avatar_url":"https://avatars2.githubusercontent.com/u/7661012?v=4","gravatar_id":"","url":"https://api.github.com/users/nightscout","html_url":"https://github.com/nightscout","followers_url":"https://api.github.com/users/nightscout/followers","following_url":"https://api.github.com/users/nightscout/following{/other_user}","gists_url":"https://api.github.com/users/nightscout/gists{/gist_id}","starred_url":"https://api.github.com/users/nightscout/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nightscout/subscriptions","organizations_url":"https://api.github.com/users/nightscout/orgs","repos_url":"https://api.github.com/users/nightscout/repos","events_url":"https://api.github.com/users/nightscout/events{/privacy}","received_events_url":"https://api.github.com/users/nightscout/received_events","type":"Organization","site_admin":false},"repo":{"id":20042152,"name":"cgm-remote-monitor","full_name":"nightscout/cgm-remote-monitor","owner":{"login":"nightscout","id":7661012,"avatar_url":"https://avatars2.githubusercontent.com/u/7661012?v=4","gravatar_id":"","url":"https://api.github.com/users/nightscout","html_url":"https://github.com/nightscout","followers_url":"https://api.github.com/users/nightscout/followers","following_url":"https://api.github.com/users/nightscout/following{/other_user}","gists_url":"https://api.github.com/users/nightscout/gists{/gist_id}","starred_url":"https://api.github.com/users/nightscout/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nightscout/subscriptions","organizations_url":"https://api.github.com/users/nightscout/orgs","repos_url":"https://api.github.com/users/nightscout/repos","events_url":"https://api.github.com/users/nightscout/events{/privacy}","received_events_url":"https://api.github.com/users/nightscout/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/nightscout/cgm-remote-monitor","description":"nightscout web monitor","fork":false,"url":"https://api.github.com/repos/nightscout/cgm-remote-monitor","forks_url":"https://api.github.com/repos/nightscout/cgm-remote-monitor/forks","keys_url":"https://api.github.com/repos/nightscout/cgm-remote-monitor/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nightscout/cgm-remote-monitor/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nightscout/cgm-remote-monitor/teams","hooks_url":"https://api.github.com/repos/nightscout/cgm-remote-monitor/hooks","issue_events_url":"https://api.github.com/repos/nightscout/cgm-remote-monitor/issues/events{/number}","events_url":"https://api.github.com/repos/nightscout/cgm-remote-monitor/events","assignees_url":"https://api.github.com/repos/nightscout/cgm-remote-monitor/assignees{/user}","branches_url":"https://api.github.com/repos/nightscout/cgm-remote-monitor/branches{/branch}","tags_url":"https://api.github.com/repos/nightscout/cgm-remote-monitor/tags","blobs_url":"https://api.github.com/repos/nightscout/cgm-remote-monitor/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nightscout/cgm-remote-monitor/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nightscout/cgm-remote-monitor/git/refs{/sha}","trees_url":"https://api.github.com/repos/nightscout/cgm-remote-monitor/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nightscout/cgm-remote-monitor/statuses/{sha}","languages_url":"https://api.github.com/repos/nightscout/cgm-remote-monitor/languages","stargazers_url":"https://api.github.com/repos/nightscout/cgm-remote-monitor/stargazers","contributors_url":"https://api.github.com/repos/nightscout/cgm-remote-monitor/contributors","subscribers_url":"https://api.github.com/repos/nightscout/cgm-remote-monitor/subscribers","subscription_url":"https://api.github.com/repos/nightscout/cgm-remote-monitor/subscription","commits_url":"https://api.github.com/repos/nightscout/cgm-remote-monitor/commits{/sha}","git_commits_url":"https://api.github.com/repos/nightscout/cgm-remote-monitor/git/commits{/sha}","comments_url":"https://api.github.com/repos/nightscout/cgm-remote-monitor/comments{/number}","issue_comment_url":"https://api.github.com/repos/nightscout/cgm-remote-monitor/issues/comments{/number}","contents_url":"https://api.github.com/repos/nightscout/cgm-remote-monitor/contents/{+path}","compare_url":"https://api.github.com/repos/nightscout/cgm-remote-monitor/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nightscout/cgm-remote-monitor/merges","archive_url":"https://api.github.com/repos/nightscout/cgm-remote-monitor/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nightscout/cgm-remote-monitor/downloads","issues_url":"https://api.github.com/repos/nightscout/cgm-remote-monitor/issues{/number}","pulls_url":"https://api.github.com/repos/nightscout/cgm-remote-monitor/pulls{/number}","milestones_url":"https://api.github.com/repos/nightscout/cgm-remote-monitor/milestones{/number}","notifications_url":"https://api.github.com/repos/nightscout/cgm-remote-monitor/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nightscout/cgm-remote-monitor/labels{/name}","releases_url":"https://api.github.com/repos/nightscout/cgm-remote-monitor/releases{/id}","deployments_url":"https://api.github.com/repos/nightscout/cgm-remote-monitor/deployments","created_at":"2014-05-22T00:32:28Z","updated_at":"2018-03-13T12:02:17Z","pushed_at":"2018-03-13T17:29:17Z","git_url":"git://github.com/nightscout/cgm-remote-monitor.git","ssh_url":"git@github.com:nightscout/cgm-remote-monitor.git","clone_url":"https://github.com/nightscout/cgm-remote-monitor.git","svn_url":"https://github.com/nightscout/cgm-remote-monitor","homepage":"","size":18051,"stargazers_count":433,"watchers_count":433,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":14680,"mirror_url":null,"archived":false,"open_issues_count":152,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":14680,"open_issues":152,"watchers":433,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/nightscout/cgm-remote-monitor/pulls/3443"},"html":{"href":"https://github.com/nightscout/cgm-remote-monitor/pull/3443"},"issue":{"href":"https://api.github.com/repos/nightscout/cgm-remote-monitor/issues/3443"},"comments":{"href":"https://api.github.com/repos/nightscout/cgm-remote-monitor/issues/3443/comments"},"review_comments":{"href":"https://api.github.com/repos/nightscout/cgm-remote-monitor/pulls/3443/comments"},"review_comment":{"href":"https://api.github.com/repos/nightscout/cgm-remote-monitor/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/nightscout/cgm-remote-monitor/pulls/3443/commits"},"statuses":{"href":"https://api.github.com/repos/nightscout/cgm-remote-monitor/statuses/e5c8933adec738c13ca9be176a5a5ca15bb78839"}},"author_association":"NONE"}}
{"actor":{"display_login":"codacy-bot"}}