{"action":"created","comment":{"url":"https://api.github.com/repos/fossasia/open-event-webapp/pulls/comments/66162427","id":66162427,"diff_hunk":"@@ -0,0 +1,253 @@\n+'use strict'\n+\n+var exports = module.exports = {};\n+\n+const fs = require('fs');\n+const moment = require('moment');\n+const handlebars = require('handlebars');\n+var AdmZip = require('adm-zip');\n+\n+const tpl = handlebars.compile(fs.readFileSync(__dirname + '/schedule.tpl').toString('utf-8'));\n+const sessionsData = require('../../../mockjson/sessions.json');\n+const speakersData = require('../../../mockjson/speakers.json');\n+const servicesData = require('../../../mockjson/event.json');\n+const sponsorsData = require('../../../mockjson/sponsors.json');\n+\n+if(!String.linkify) {\n+  String.prototype.linkify = function() {\n+    var urlPattern = /\\b(?:https?|ftp):\\/\\/[a-z0-9-+&@#\\/%?=~_|!:,.;]*[a-z0-9-+&@#\\/%=~_|]/gim;\n+    var pseudoUrlPattern = /(^|[^\\/])(www\\.[\\S]+(\\b|$))/gim;\n+    var emailAddressPattern = /[\\w.]+@[a-zA-Z_-]+?(?:\\.[a-zA-Z]{2,6})+/gim;\n+    return this\n+            .replace(urlPattern, '<a href=\"$&\">$&</a>')\n+            .replace(pseudoUrlPattern, '$1<a href=\"http://$2\">$2</a>')\n+            .replace(emailAddressPattern, '<a href=\"mailto:$&\">$&</a>');\n+  };\n+}\n+\n+handlebars.registerHelper('linkify', function(options) {\n+  var content = options.fn(this);\n+  return new handlebars.SafeString(content.linkify());\n+});\n+\n+function slugify(str) {\n+  if (str === undefined) {\n+    return \"\";\n+  }\n+  return str.replace(/[^\\w]/g, '-').replace(/-+/g, '-').toLowerCase();\n+}\n+\n+function speakerNameWithOrg(speaker) {\n+  return speaker.organisation ?\n+    `${speaker.name} (${speaker.organisation})` :\n+    speaker.name\n+}\n+\n+function foldByDate(tracks) {\n+  let dateMap = new Map();\n+\n+  tracks.forEach((track) => {\n+    if (!dateMap.has(track.date)) {\n+      dateMap.set(track.date, {\n+        caption: track.date,\n+        tracks: []\n+      })\n+    }\n+    dateMap.get(track.date).tracks.push(track);\n+  })\n+\n+  let dates = Array.from(dateMap.values())\n+  dates.forEach((date) => date.tracks.sort(byProperty('sortKey')))\n+\n+  return dates;\n+}\n+\n+function byProperty(key) {\n+  return (a, b) => {\n+    if (a[key] > b[key]) {\n+      return 1;\n+    }\n+    if (a[key] < b[key]) {\n+      return -1;\n+    } else {\n+      return 0;\n+    }\n+  }\n+}\n+\n+function zeroFill(num) {\n+  if (num === undefined) {\n+    return \"\"\n+  }\n+  if (num >= 10) {\n+    return num.toString();\n+  } else {\n+    return '0' + num.toString();\n+  }\n+}\n+\n+function foldByTrack(sessions, speakers) {\n+  let trackData = new Map()\n+  let speakersMap = new Map(speakers.map((s) => [s.id, s]));\n+\n+  sessions.forEach((session) => {\n+    if (!session.start_time) {\n+      return\n+    }\n+\n+    // generate slug/key for session\n+    let date = moment(session.start_time).format('YYYY-MM-DD');\n+    let slug = date + '-' + slugify(session.track.name);\n+    let track = null;\n+\n+    // set up track if it does not exist\n+    if (!trackData.has(slug)) {\n+      track = {\n+        title: session.track.name,\n+        date: moment(session.start_time).locale('de').format('ddd D. MMM') + ' / ' + moment(session.start_time).format('ddd, Do MMM'),\n+        slug: slug,\n+        sortKey: date + '-' + zeroFill(session.track.order),\n+        sessions: []\n+      }\n+      trackData.set(slug, track);\n+    } else {\n+      track = trackData.get(slug);\n+    }\n+\n+    track.sessions.push({\n+      start: moment(session.start_time).utcOffset(2).format('HH:mm'),\n+      title: session.title,\n+      type: session.type,\n+      location: session.location,\n+      speakers: session.speakers.map(speakerNameWithOrg).join(', '),\n+      speakers_list: session.speakers.map((speaker) => speakersMap.get(speaker.id)),\n+      description: session.description,\n+      session_id: session.session_id,\n+      sign_up: session.sign_up,\n+      video: session.video,\n+      slides: session.slides,\n+      audio: session.audio\n+    })\n+  });\n+\n+  let tracks = Array.from(trackData.values())\n+  tracks.sort(byProperty('sortKey'))\n+\n+  return tracks;\n+}\n+\n+function getCopyrightData(services) {\n+  let copyright = services.copyright\n+  return copyright;\n+}\n+\n+function foldByLevel(sponsors) {\n+  let levelData = {}\n+\n+  sponsors.forEach((sponsor) => {\n+    if (levelData[sponsor.level] === undefined) {\n+      levelData[sponsor.level] = []\n+    }\n+\n+    let sponsorItem = {\n+      divclass: '',\n+      imgsize: '',\n+      name: sponsor.name,\n+      image: sponsor.image,\n+      link: sponsor.link,\n+      level: sponsor.level,\n+      description: sponsor.description,\n+      type: sponsor.type\n+    }\n+\n+    switch (sponsorItem.level) {\n+      case '1':\n+        sponsorItem.divclass = \"largeoffset col-md-4\"","path":"src/generator/backend/generator.js","position":165,"original_position":165,"commit_id":"84af17e49271a41d672768f4e2cc81ba843f9f0e","original_commit_id":"84af17e49271a41d672768f4e2cc81ba843f9f0e","user":{"login":"juslee","id":1696598,"avatar_url":"https://avatars.githubusercontent.com/u/1696598?v=3","gravatar_id":"","url":"https://api.github.com/users/juslee","html_url":"https://github.com/juslee","followers_url":"https://api.github.com/users/juslee/followers","following_url":"https://api.github.com/users/juslee/following{/other_user}","gists_url":"https://api.github.com/users/juslee/gists{/gist_id}","starred_url":"https://api.github.com/users/juslee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/juslee/subscriptions","organizations_url":"https://api.github.com/users/juslee/orgs","repos_url":"https://api.github.com/users/juslee/repos","events_url":"https://api.github.com/users/juslee/events{/privacy}","received_events_url":"https://api.github.com/users/juslee/received_events","type":"User","site_admin":false},"body":"![Codacy](https://www.codacy.com/assets/images/favicon.png) Issue found: [Mixed double and single quotes.](https://www.codacy.com/app/triplez/open-event-webapp/file/2708617232/issues/source?bid=3233857&fileBranchId=3342834#l165)","created_at":"2016-06-07T22:12:08Z","updated_at":"2016-06-07T22:12:08Z","html_url":"https://github.com/fossasia/open-event-webapp/pull/240#discussion_r66162427","pull_request_url":"https://api.github.com/repos/fossasia/open-event-webapp/pulls/240","_links":{"self":{"href":"https://api.github.com/repos/fossasia/open-event-webapp/pulls/comments/66162427"},"html":{"href":"https://github.com/fossasia/open-event-webapp/pull/240#discussion_r66162427"},"pull_request":{"href":"https://api.github.com/repos/fossasia/open-event-webapp/pulls/240"}}},"pull_request":{"url":"https://api.github.com/repos/fossasia/open-event-webapp/pulls/240","id":72906312,"html_url":"https://github.com/fossasia/open-event-webapp/pull/240","diff_url":"https://github.com/fossasia/open-event-webapp/pull/240.diff","patch_url":"https://github.com/fossasia/open-event-webapp/pull/240.patch","issue_url":"https://api.github.com/repos/fossasia/open-event-webapp/issues/240","number":240,"state":"open","locked":false,"title":"[DO NOT MERGE] create express app that runs the generator","user":{"login":"championswimmer","id":1327050,"avatar_url":"https://avatars.githubusercontent.com/u/1327050?v=3","gravatar_id":"","url":"https://api.github.com/users/championswimmer","html_url":"https://github.com/championswimmer","followers_url":"https://api.github.com/users/championswimmer/followers","following_url":"https://api.github.com/users/championswimmer/following{/other_user}","gists_url":"https://api.github.com/users/championswimmer/gists{/gist_id}","starred_url":"https://api.github.com/users/championswimmer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/championswimmer/subscriptions","organizations_url":"https://api.github.com/users/championswimmer/orgs","repos_url":"https://api.github.com/users/championswimmer/repos","events_url":"https://api.github.com/users/championswimmer/events{/privacy}","received_events_url":"https://api.github.com/users/championswimmer/received_events","type":"User","site_admin":false},"body":"Signed-off-by: Arnav Gupta <championswimmer@gmail.com>","created_at":"2016-06-07T16:23:59Z","updated_at":"2016-06-07T22:12:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c6cff7ef1e365a7f2297385e02efd076d8f9a1df","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/fossasia/open-event-webapp/pulls/240/commits","review_comments_url":"https://api.github.com/repos/fossasia/open-event-webapp/pulls/240/comments","review_comment_url":"https://api.github.com/repos/fossasia/open-event-webapp/pulls/comments{/number}","comments_url":"https://api.github.com/repos/fossasia/open-event-webapp/issues/240/comments","statuses_url":"https://api.github.com/repos/fossasia/open-event-webapp/statuses/84af17e49271a41d672768f4e2cc81ba843f9f0e","head":{"label":"championswimmer:master_basic_generator_app","ref":"master_basic_generator_app","sha":"84af17e49271a41d672768f4e2cc81ba843f9f0e","user":{"login":"championswimmer","id":1327050,"avatar_url":"https://avatars.githubusercontent.com/u/1327050?v=3","gravatar_id":"","url":"https://api.github.com/users/championswimmer","html_url":"https://github.com/championswimmer","followers_url":"https://api.github.com/users/championswimmer/followers","following_url":"https://api.github.com/users/championswimmer/following{/other_user}","gists_url":"https://api.github.com/users/championswimmer/gists{/gist_id}","starred_url":"https://api.github.com/users/championswimmer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/championswimmer/subscriptions","organizations_url":"https://api.github.com/users/championswimmer/orgs","repos_url":"https://api.github.com/users/championswimmer/repos","events_url":"https://api.github.com/users/championswimmer/events{/privacy}","received_events_url":"https://api.github.com/users/championswimmer/received_events","type":"User","site_admin":false},"repo":{"id":53207624,"name":"open-event-webapp","full_name":"championswimmer/open-event-webapp","owner":{"login":"championswimmer","id":1327050,"avatar_url":"https://avatars.githubusercontent.com/u/1327050?v=3","gravatar_id":"","url":"https://api.github.com/users/championswimmer","html_url":"https://github.com/championswimmer","followers_url":"https://api.github.com/users/championswimmer/followers","following_url":"https://api.github.com/users/championswimmer/following{/other_user}","gists_url":"https://api.github.com/users/championswimmer/gists{/gist_id}","starred_url":"https://api.github.com/users/championswimmer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/championswimmer/subscriptions","organizations_url":"https://api.github.com/users/championswimmer/orgs","repos_url":"https://api.github.com/users/championswimmer/repos","events_url":"https://api.github.com/users/championswimmer/events{/privacy}","received_events_url":"https://api.github.com/users/championswimmer/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/championswimmer/open-event-webapp","description":"Open Event Webapp","fork":true,"url":"https://api.github.com/repos/championswimmer/open-event-webapp","forks_url":"https://api.github.com/repos/championswimmer/open-event-webapp/forks","keys_url":"https://api.github.com/repos/championswimmer/open-event-webapp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/championswimmer/open-event-webapp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/championswimmer/open-event-webapp/teams","hooks_url":"https://api.github.com/repos/championswimmer/open-event-webapp/hooks","issue_events_url":"https://api.github.com/repos/championswimmer/open-event-webapp/issues/events{/number}","events_url":"https://api.github.com/repos/championswimmer/open-event-webapp/events","assignees_url":"https://api.github.com/repos/championswimmer/open-event-webapp/assignees{/user}","branches_url":"https://api.github.com/repos/championswimmer/open-event-webapp/branches{/branch}","tags_url":"https://api.github.com/repos/championswimmer/open-event-webapp/tags","blobs_url":"https://api.github.com/repos/championswimmer/open-event-webapp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/championswimmer/open-event-webapp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/championswimmer/open-event-webapp/git/refs{/sha}","trees_url":"https://api.github.com/repos/championswimmer/open-event-webapp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/championswimmer/open-event-webapp/statuses/{sha}","languages_url":"https://api.github.com/repos/championswimmer/open-event-webapp/languages","stargazers_url":"https://api.github.com/repos/championswimmer/open-event-webapp/stargazers","contributors_url":"https://api.github.com/repos/championswimmer/open-event-webapp/contributors","subscribers_url":"https://api.github.com/repos/championswimmer/open-event-webapp/subscribers","subscription_url":"https://api.github.com/repos/championswimmer/open-event-webapp/subscription","commits_url":"https://api.github.com/repos/championswimmer/open-event-webapp/commits{/sha}","git_commits_url":"https://api.github.com/repos/championswimmer/open-event-webapp/git/commits{/sha}","comments_url":"https://api.github.com/repos/championswimmer/open-event-webapp/comments{/number}","issue_comment_url":"https://api.github.com/repos/championswimmer/open-event-webapp/issues/comments{/number}","contents_url":"https://api.github.com/repos/championswimmer/open-event-webapp/contents/{+path}","compare_url":"https://api.github.com/repos/championswimmer/open-event-webapp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/championswimmer/open-event-webapp/merges","archive_url":"https://api.github.com/repos/championswimmer/open-event-webapp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/championswimmer/open-event-webapp/downloads","issues_url":"https://api.github.com/repos/championswimmer/open-event-webapp/issues{/number}","pulls_url":"https://api.github.com/repos/championswimmer/open-event-webapp/pulls{/number}","milestones_url":"https://api.github.com/repos/championswimmer/open-event-webapp/milestones{/number}","notifications_url":"https://api.github.com/repos/championswimmer/open-event-webapp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/championswimmer/open-event-webapp/labels{/name}","releases_url":"https://api.github.com/repos/championswimmer/open-event-webapp/releases{/id}","deployments_url":"https://api.github.com/repos/championswimmer/open-event-webapp/deployments","created_at":"2016-03-05T15:18:15Z","updated_at":"2016-06-06T20:05:45Z","pushed_at":"2016-06-07T22:10:33Z","git_url":"git://github.com/championswimmer/open-event-webapp.git","ssh_url":"git@github.com:championswimmer/open-event-webapp.git","clone_url":"https://github.com/championswimmer/open-event-webapp.git","svn_url":"https://github.com/championswimmer/open-event-webapp","homepage":null,"size":1462,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"fossasia:master","ref":"master","sha":"b8f3870bb136a59b33ae61fa8b831c765e07bc18","user":{"login":"fossasia","id":6295529,"avatar_url":"https://avatars.githubusercontent.com/u/6295529?v=3","gravatar_id":"","url":"https://api.github.com/users/fossasia","html_url":"https://github.com/fossasia","followers_url":"https://api.github.com/users/fossasia/followers","following_url":"https://api.github.com/users/fossasia/following{/other_user}","gists_url":"https://api.github.com/users/fossasia/gists{/gist_id}","starred_url":"https://api.github.com/users/fossasia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fossasia/subscriptions","organizations_url":"https://api.github.com/users/fossasia/orgs","repos_url":"https://api.github.com/users/fossasia/repos","events_url":"https://api.github.com/users/fossasia/events{/privacy}","received_events_url":"https://api.github.com/users/fossasia/received_events","type":"Organization","site_admin":false},"repo":{"id":35269905,"name":"open-event-webapp","full_name":"fossasia/open-event-webapp","owner":{"login":"fossasia","id":6295529,"avatar_url":"https://avatars.githubusercontent.com/u/6295529?v=3","gravatar_id":"","url":"https://api.github.com/users/fossasia","html_url":"https://github.com/fossasia","followers_url":"https://api.github.com/users/fossasia/followers","following_url":"https://api.github.com/users/fossasia/following{/other_user}","gists_url":"https://api.github.com/users/fossasia/gists{/gist_id}","starred_url":"https://api.github.com/users/fossasia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fossasia/subscriptions","organizations_url":"https://api.github.com/users/fossasia/orgs","repos_url":"https://api.github.com/users/fossasia/repos","events_url":"https://api.github.com/users/fossasia/events{/privacy}","received_events_url":"https://api.github.com/users/fossasia/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/fossasia/open-event-webapp","description":"Open Event Webapp","fork":false,"url":"https://api.github.com/repos/fossasia/open-event-webapp","forks_url":"https://api.github.com/repos/fossasia/open-event-webapp/forks","keys_url":"https://api.github.com/repos/fossasia/open-event-webapp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fossasia/open-event-webapp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fossasia/open-event-webapp/teams","hooks_url":"https://api.github.com/repos/fossasia/open-event-webapp/hooks","issue_events_url":"https://api.github.com/repos/fossasia/open-event-webapp/issues/events{/number}","events_url":"https://api.github.com/repos/fossasia/open-event-webapp/events","assignees_url":"https://api.github.com/repos/fossasia/open-event-webapp/assignees{/user}","branches_url":"https://api.github.com/repos/fossasia/open-event-webapp/branches{/branch}","tags_url":"https://api.github.com/repos/fossasia/open-event-webapp/tags","blobs_url":"https://api.github.com/repos/fossasia/open-event-webapp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fossasia/open-event-webapp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fossasia/open-event-webapp/git/refs{/sha}","trees_url":"https://api.github.com/repos/fossasia/open-event-webapp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fossasia/open-event-webapp/statuses/{sha}","languages_url":"https://api.github.com/repos/fossasia/open-event-webapp/languages","stargazers_url":"https://api.github.com/repos/fossasia/open-event-webapp/stargazers","contributors_url":"https://api.github.com/repos/fossasia/open-event-webapp/contributors","subscribers_url":"https://api.github.com/repos/fossasia/open-event-webapp/subscribers","subscription_url":"https://api.github.com/repos/fossasia/open-event-webapp/subscription","commits_url":"https://api.github.com/repos/fossasia/open-event-webapp/commits{/sha}","git_commits_url":"https://api.github.com/repos/fossasia/open-event-webapp/git/commits{/sha}","comments_url":"https://api.github.com/repos/fossasia/open-event-webapp/comments{/number}","issue_comment_url":"https://api.github.com/repos/fossasia/open-event-webapp/issues/comments{/number}","contents_url":"https://api.github.com/repos/fossasia/open-event-webapp/contents/{+path}","compare_url":"https://api.github.com/repos/fossasia/open-event-webapp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fossasia/open-event-webapp/merges","archive_url":"https://api.github.com/repos/fossasia/open-event-webapp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fossasia/open-event-webapp/downloads","issues_url":"https://api.github.com/repos/fossasia/open-event-webapp/issues{/number}","pulls_url":"https://api.github.com/repos/fossasia/open-event-webapp/pulls{/number}","milestones_url":"https://api.github.com/repos/fossasia/open-event-webapp/milestones{/number}","notifications_url":"https://api.github.com/repos/fossasia/open-event-webapp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fossasia/open-event-webapp/labels{/name}","releases_url":"https://api.github.com/repos/fossasia/open-event-webapp/releases{/id}","deployments_url":"https://api.github.com/repos/fossasia/open-event-webapp/deployments","created_at":"2015-05-08T09:11:00Z","updated_at":"2016-06-07T12:13:53Z","pushed_at":"2016-06-07T22:10:34Z","git_url":"git://github.com/fossasia/open-event-webapp.git","ssh_url":"git@github.com:fossasia/open-event-webapp.git","clone_url":"https://github.com/fossasia/open-event-webapp.git","svn_url":"https://github.com/fossasia/open-event-webapp","homepage":null,"size":11013,"stargazers_count":18,"watchers_count":18,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":59,"mirror_url":null,"open_issues_count":13,"forks":59,"open_issues":13,"watchers":18,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/fossasia/open-event-webapp/pulls/240"},"html":{"href":"https://github.com/fossasia/open-event-webapp/pull/240"},"issue":{"href":"https://api.github.com/repos/fossasia/open-event-webapp/issues/240"},"comments":{"href":"https://api.github.com/repos/fossasia/open-event-webapp/issues/240/comments"},"review_comments":{"href":"https://api.github.com/repos/fossasia/open-event-webapp/pulls/240/comments"},"review_comment":{"href":"https://api.github.com/repos/fossasia/open-event-webapp/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/fossasia/open-event-webapp/pulls/240/commits"},"statuses":{"href":"https://api.github.com/repos/fossasia/open-event-webapp/statuses/84af17e49271a41d672768f4e2cc81ba843f9f0e"}}}}
{"actor":{"display_login":"juslee"}}