{"action":"created","comment":{"url":"https://api.github.com/repos/code-squad/javascript-grade/pulls/comments/218451463","pull_request_review_id":156391217,"id":218451463,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxODQ1MTQ2Mw==","diff_hunk":"@@ -1,60 +1,103 @@\n-const readline = require('readline');\n-\n-var data = [];\n-\n-const rl = readline.createInterface({\n-    input: process.stdin,\n-    output: process.stdout\n-});\n-\n-function convertGrade(currGrade) {\n-    var grade = 'FDCBA';\n-    var score = grade.indexOf(currGrade[0]);\n-    if(grade[1] === '+' && score !== 0){\n-        score += 0.5;\n-    }\n-    return score;\n-}\n-\n-function calculateGradepoint(data) {\n-    var creditSum = 0 , creditGradeSum = 0;\n-    var majorCreditSum = 0 , majorCreditGradeSum = 0;\n-    var gpa = 0,majorGpa = 0;\n-    var convertGpa = 0;\n-\n-    data.forEach(function (curr) {\n-        creditSum += curr.credit;\n-        creditGradeSum += convertGrade(curr.grade)*curr.credit;\n-        if(curr.bMajor){\n-            if(curr.bMajor)\n-            majorCreditSum += convertGrade(curr.grade);\n-            majorCreditGradeSum += convertGrade(curr.grade)*curr.credit;\n-        }\n+// 김아무개의 학점데이터\n+const gradesData = [\n+    {\n+        name: '데이터베이스',\n+        grade: 'A',\n+        credit: 3,\n+        major: false,\n+    },\n+    {\n+        name: '교양영어',\n+        grade: 'B+',\n+        credit: 2,\n+        major: true,\n+    },\n+    {\n+        name: '철학',\n+        grade: 'B+',\n+        credit: 1,\n+        major: false,\n+    },\n+];\n+// 4.5기준 학점등급 객체\n+const fourPointFiveRating = {\n+    'A+': 4.5,\n+    'A': 4.0,\n+    'B+': 3.5,\n+    'B': 3.0,\n+    'C+': 2.5,\n+    'C': 2.0,\n+    'D+': 1.5,\n+    'D': 1.0,\n+    'F': 0\n+};\n+// 4.0기준 학점등급 객체\n+const fourPointZeroRating = {\n+    'A+': 4.0,\n+    'A': 4.0,\n+    'A-': 3.7,\n+    'B+': 3.3,\n+    'B': 3.0,\n+    'B-': 2.7,\n+    'C+': 2.3,\n+    'C': 2.0,\n+    'C-': 1.7,\n+    'D+': 1.3,\n+    'D': 1.0,\n+    'D-': 0.7,\n+    'F': 0\n+};\n+// 학점데이터의 총 이수학점을 구하는 함수\n+let getTotalOfCredits = function (gradesData) {\n+    let totalOfCredits = 0;\n+    gradesData.forEach(function (v) {\n+        totalOfCredits += v.credit;\n     });\n-\n-    gpa = (creditGradeSum/creditSum).toFixed(2);\n-    majorGpa = (majorCreditGradeSum/majorCreditSum).toFixed(2);\n-    convertGpa = ((creditGradeSum/creditSum) * 4 / 4.5).toFixed(2);\n-\n-    console.log('총평점 : ' + gpa);\n-    console.log('전공평점 : ' + majorGpa);\n-    console.log('이수학점 : ' + creditSum);\n-    console.log('전공이수학점 : ' + majorCreditSum);\n-    console.log('4.0으로 변환시 : ' + convertGpa);\n-\n+    return totalOfCredits.toFixed(2);\n }\n-\n-function addLecture() {\n-    rl.question('과목을 JSON형태로 입력하세요<종료는 end입력>',function(answer){\n-        if(answer === 'end'){\n-            setTimeout(function () {\n-                calculateGradepoint(data);\n-            },2000);\n-            return rl.close();\n+// 성적을 계산하는 함수 (성적 * 이수학점)을 모두더한다\n+let getTotlalOfGrades = function (gradesData, rating) {\n+    let totlalOfGrades = 0;\n+    gradesData.forEach(function (v) {\n+        totlalOfGrades += (rating[v.grade] * v.credit)\n+    })\n+    return totlalOfGrades.toFixed(2);\n+}\n+// 4.0 기준 학점계산함수\n+let calculateFourPointZeroCredit = function (gradesData, rating) {\n+    let fourPointZeroGrades = getTotlalOfGrades(gradesData, rating) / getTotalOfCredits(gradesData)\n+    return fourPointZeroGrades\n+}\n+// 4.5기준 학점계산함수\n+let calculateFourPointFiveCredit = function (gradesData, rating) {\n+    let fourPointFiveGrades = getTotlalOfGrades(gradesData, rating) / getTotalOfCredits(gradesData)\n+    return fourPointFiveGrades\n+}\n+// 전공과목 gradesData배열 생성함수\n+let createMajorGradeObj = function (gradesData) {\n+    let majorGradesData = gradesData.filter(function (v) {\n+        return v.major === true\n+    })\n+    return majorGradesData;\n+}\n+// 전공과목 이수학점 계산 함수\n+let getTotalofMajorCredit = function (gradesData) {\n+    let TotalofMajorCredit = 0;\n+    gradesData.forEach(function (v) {\n+        if (v.major === true) {","path":"index.js","position":138,"original_position":138,"commit_id":"444c7e3ccb22708ac777aeac2eb0e5d78417e501","original_commit_id":"444c7e3ccb22708ac777aeac2eb0e5d78417e501","user":{"login":"sk2504","id":22962121,"node_id":"MDQ6VXNlcjIyOTYyMTIx","avatar_url":"https://avatars0.githubusercontent.com/u/22962121?v=4","gravatar_id":"","url":"https://api.github.com/users/sk2504","html_url":"https://github.com/sk2504","followers_url":"https://api.github.com/users/sk2504/followers","following_url":"https://api.github.com/users/sk2504/following{/other_user}","gists_url":"https://api.github.com/users/sk2504/gists{/gist_id}","starred_url":"https://api.github.com/users/sk2504/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sk2504/subscriptions","organizations_url":"https://api.github.com/users/sk2504/orgs","repos_url":"https://api.github.com/users/sk2504/repos","events_url":"https://api.github.com/users/sk2504/events{/privacy}","received_events_url":"https://api.github.com/users/sk2504/received_events","type":"User","site_admin":false},"body":"헉..네 ","created_at":"2018-09-18T14:17:25Z","updated_at":"2018-09-18T14:17:25Z","html_url":"https://github.com/code-squad/javascript-grade/pull/34#discussion_r218451463","pull_request_url":"https://api.github.com/repos/code-squad/javascript-grade/pulls/34","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/code-squad/javascript-grade/pulls/comments/218451463"},"html":{"href":"https://github.com/code-squad/javascript-grade/pull/34#discussion_r218451463"},"pull_request":{"href":"https://api.github.com/repos/code-squad/javascript-grade/pulls/34"}},"in_reply_to_id":218449033},"pull_request":{"url":"https://api.github.com/repos/code-squad/javascript-grade/pulls/34","id":216314593,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE2MzE0NTkz","html_url":"https://github.com/code-squad/javascript-grade/pull/34","diff_url":"https://github.com/code-squad/javascript-grade/pull/34.diff","patch_url":"https://github.com/code-squad/javascript-grade/pull/34.patch","issue_url":"https://api.github.com/repos/code-squad/javascript-grade/issues/34","number":34,"state":"open","locked":false,"title":"step1 학점계산기 구현","user":{"login":"sk2504","id":22962121,"node_id":"MDQ6VXNlcjIyOTYyMTIx","avatar_url":"https://avatars0.githubusercontent.com/u/22962121?v=4","gravatar_id":"","url":"https://api.github.com/users/sk2504","html_url":"https://github.com/sk2504","followers_url":"https://api.github.com/users/sk2504/followers","following_url":"https://api.github.com/users/sk2504/following{/other_user}","gists_url":"https://api.github.com/users/sk2504/gists{/gist_id}","starred_url":"https://api.github.com/users/sk2504/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sk2504/subscriptions","organizations_url":"https://api.github.com/users/sk2504/orgs","repos_url":"https://api.github.com/users/sk2504/repos","events_url":"https://api.github.com/users/sk2504/events{/privacy}","received_events_url":"https://api.github.com/users/sk2504/received_events","type":"User","site_admin":false},"body":"학점계산기를 구현했습니다, 4.5만점기준,4.0만점기준결과 출력및\r\n이수학점, 전공이수학점 표시기능도 추가하였습니다 \r\n피드백 부탁드립니다 ","created_at":"2018-09-18T13:48:18Z","updated_at":"2018-09-18T14:17:25Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0150aa5bb9e31941c4c05e07a0fcc076a8b2c691","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/code-squad/javascript-grade/pulls/34/commits","review_comments_url":"https://api.github.com/repos/code-squad/javascript-grade/pulls/34/comments","review_comment_url":"https://api.github.com/repos/code-squad/javascript-grade/pulls/comments{/number}","comments_url":"https://api.github.com/repos/code-squad/javascript-grade/issues/34/comments","statuses_url":"https://api.github.com/repos/code-squad/javascript-grade/statuses/444c7e3ccb22708ac777aeac2eb0e5d78417e501","head":{"label":"sk2504:step1","ref":"step1","sha":"444c7e3ccb22708ac777aeac2eb0e5d78417e501","user":{"login":"sk2504","id":22962121,"node_id":"MDQ6VXNlcjIyOTYyMTIx","avatar_url":"https://avatars0.githubusercontent.com/u/22962121?v=4","gravatar_id":"","url":"https://api.github.com/users/sk2504","html_url":"https://github.com/sk2504","followers_url":"https://api.github.com/users/sk2504/followers","following_url":"https://api.github.com/users/sk2504/following{/other_user}","gists_url":"https://api.github.com/users/sk2504/gists{/gist_id}","starred_url":"https://api.github.com/users/sk2504/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sk2504/subscriptions","organizations_url":"https://api.github.com/users/sk2504/orgs","repos_url":"https://api.github.com/users/sk2504/repos","events_url":"https://api.github.com/users/sk2504/events{/privacy}","received_events_url":"https://api.github.com/users/sk2504/received_events","type":"User","site_admin":false},"repo":{"id":149264959,"node_id":"MDEwOlJlcG9zaXRvcnkxNDkyNjQ5NTk=","name":"javascript-grade","full_name":"sk2504/javascript-grade","private":false,"owner":{"login":"sk2504","id":22962121,"node_id":"MDQ6VXNlcjIyOTYyMTIx","avatar_url":"https://avatars0.githubusercontent.com/u/22962121?v=4","gravatar_id":"","url":"https://api.github.com/users/sk2504","html_url":"https://github.com/sk2504","followers_url":"https://api.github.com/users/sk2504/followers","following_url":"https://api.github.com/users/sk2504/following{/other_user}","gists_url":"https://api.github.com/users/sk2504/gists{/gist_id}","starred_url":"https://api.github.com/users/sk2504/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sk2504/subscriptions","organizations_url":"https://api.github.com/users/sk2504/orgs","repos_url":"https://api.github.com/users/sk2504/repos","events_url":"https://api.github.com/users/sk2504/events{/privacy}","received_events_url":"https://api.github.com/users/sk2504/received_events","type":"User","site_admin":false},"html_url":"https://github.com/sk2504/javascript-grade","description":"레벨2","fork":true,"url":"https://api.github.com/repos/sk2504/javascript-grade","forks_url":"https://api.github.com/repos/sk2504/javascript-grade/forks","keys_url":"https://api.github.com/repos/sk2504/javascript-grade/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sk2504/javascript-grade/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sk2504/javascript-grade/teams","hooks_url":"https://api.github.com/repos/sk2504/javascript-grade/hooks","issue_events_url":"https://api.github.com/repos/sk2504/javascript-grade/issues/events{/number}","events_url":"https://api.github.com/repos/sk2504/javascript-grade/events","assignees_url":"https://api.github.com/repos/sk2504/javascript-grade/assignees{/user}","branches_url":"https://api.github.com/repos/sk2504/javascript-grade/branches{/branch}","tags_url":"https://api.github.com/repos/sk2504/javascript-grade/tags","blobs_url":"https://api.github.com/repos/sk2504/javascript-grade/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sk2504/javascript-grade/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sk2504/javascript-grade/git/refs{/sha}","trees_url":"https://api.github.com/repos/sk2504/javascript-grade/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sk2504/javascript-grade/statuses/{sha}","languages_url":"https://api.github.com/repos/sk2504/javascript-grade/languages","stargazers_url":"https://api.github.com/repos/sk2504/javascript-grade/stargazers","contributors_url":"https://api.github.com/repos/sk2504/javascript-grade/contributors","subscribers_url":"https://api.github.com/repos/sk2504/javascript-grade/subscribers","subscription_url":"https://api.github.com/repos/sk2504/javascript-grade/subscription","commits_url":"https://api.github.com/repos/sk2504/javascript-grade/commits{/sha}","git_commits_url":"https://api.github.com/repos/sk2504/javascript-grade/git/commits{/sha}","comments_url":"https://api.github.com/repos/sk2504/javascript-grade/comments{/number}","issue_comment_url":"https://api.github.com/repos/sk2504/javascript-grade/issues/comments{/number}","contents_url":"https://api.github.com/repos/sk2504/javascript-grade/contents/{+path}","compare_url":"https://api.github.com/repos/sk2504/javascript-grade/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sk2504/javascript-grade/merges","archive_url":"https://api.github.com/repos/sk2504/javascript-grade/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sk2504/javascript-grade/downloads","issues_url":"https://api.github.com/repos/sk2504/javascript-grade/issues{/number}","pulls_url":"https://api.github.com/repos/sk2504/javascript-grade/pulls{/number}","milestones_url":"https://api.github.com/repos/sk2504/javascript-grade/milestones{/number}","notifications_url":"https://api.github.com/repos/sk2504/javascript-grade/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sk2504/javascript-grade/labels{/name}","releases_url":"https://api.github.com/repos/sk2504/javascript-grade/releases{/id}","deployments_url":"https://api.github.com/repos/sk2504/javascript-grade/deployments","created_at":"2018-09-18T09:45:56Z","updated_at":"2018-09-18T09:45:58Z","pushed_at":"2018-09-18T13:44:56Z","git_url":"git://github.com/sk2504/javascript-grade.git","ssh_url":"git@github.com:sk2504/javascript-grade.git","clone_url":"https://github.com/sk2504/javascript-grade.git","svn_url":"https://github.com/sk2504/javascript-grade","homepage":null,"size":4121,"stargazers_count":0,"watchers_count":0,"language":null,"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":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"code-squad:sk2504","ref":"sk2504","sha":"27fd3882aa00ca6ef22d80b33522b8f68be290f9","user":{"login":"code-squad","id":22832280,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIyODMyMjgw","avatar_url":"https://avatars2.githubusercontent.com/u/22832280?v=4","gravatar_id":"","url":"https://api.github.com/users/code-squad","html_url":"https://github.com/code-squad","followers_url":"https://api.github.com/users/code-squad/followers","following_url":"https://api.github.com/users/code-squad/following{/other_user}","gists_url":"https://api.github.com/users/code-squad/gists{/gist_id}","starred_url":"https://api.github.com/users/code-squad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/code-squad/subscriptions","organizations_url":"https://api.github.com/users/code-squad/orgs","repos_url":"https://api.github.com/users/code-squad/repos","events_url":"https://api.github.com/users/code-squad/events{/privacy}","received_events_url":"https://api.github.com/users/code-squad/received_events","type":"Organization","site_admin":false},"repo":{"id":107010068,"node_id":"MDEwOlJlcG9zaXRvcnkxMDcwMTAwNjg=","name":"javascript-grade","full_name":"code-squad/javascript-grade","private":false,"owner":{"login":"code-squad","id":22832280,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIyODMyMjgw","avatar_url":"https://avatars2.githubusercontent.com/u/22832280?v=4","gravatar_id":"","url":"https://api.github.com/users/code-squad","html_url":"https://github.com/code-squad","followers_url":"https://api.github.com/users/code-squad/followers","following_url":"https://api.github.com/users/code-squad/following{/other_user}","gists_url":"https://api.github.com/users/code-squad/gists{/gist_id}","starred_url":"https://api.github.com/users/code-squad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/code-squad/subscriptions","organizations_url":"https://api.github.com/users/code-squad/orgs","repos_url":"https://api.github.com/users/code-squad/repos","events_url":"https://api.github.com/users/code-squad/events{/privacy}","received_events_url":"https://api.github.com/users/code-squad/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/code-squad/javascript-grade","description":"레벨2","fork":false,"url":"https://api.github.com/repos/code-squad/javascript-grade","forks_url":"https://api.github.com/repos/code-squad/javascript-grade/forks","keys_url":"https://api.github.com/repos/code-squad/javascript-grade/keys{/key_id}","collaborators_url":"https://api.github.com/repos/code-squad/javascript-grade/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/code-squad/javascript-grade/teams","hooks_url":"https://api.github.com/repos/code-squad/javascript-grade/hooks","issue_events_url":"https://api.github.com/repos/code-squad/javascript-grade/issues/events{/number}","events_url":"https://api.github.com/repos/code-squad/javascript-grade/events","assignees_url":"https://api.github.com/repos/code-squad/javascript-grade/assignees{/user}","branches_url":"https://api.github.com/repos/code-squad/javascript-grade/branches{/branch}","tags_url":"https://api.github.com/repos/code-squad/javascript-grade/tags","blobs_url":"https://api.github.com/repos/code-squad/javascript-grade/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/code-squad/javascript-grade/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/code-squad/javascript-grade/git/refs{/sha}","trees_url":"https://api.github.com/repos/code-squad/javascript-grade/git/trees{/sha}","statuses_url":"https://api.github.com/repos/code-squad/javascript-grade/statuses/{sha}","languages_url":"https://api.github.com/repos/code-squad/javascript-grade/languages","stargazers_url":"https://api.github.com/repos/code-squad/javascript-grade/stargazers","contributors_url":"https://api.github.com/repos/code-squad/javascript-grade/contributors","subscribers_url":"https://api.github.com/repos/code-squad/javascript-grade/subscribers","subscription_url":"https://api.github.com/repos/code-squad/javascript-grade/subscription","commits_url":"https://api.github.com/repos/code-squad/javascript-grade/commits{/sha}","git_commits_url":"https://api.github.com/repos/code-squad/javascript-grade/git/commits{/sha}","comments_url":"https://api.github.com/repos/code-squad/javascript-grade/comments{/number}","issue_comment_url":"https://api.github.com/repos/code-squad/javascript-grade/issues/comments{/number}","contents_url":"https://api.github.com/repos/code-squad/javascript-grade/contents/{+path}","compare_url":"https://api.github.com/repos/code-squad/javascript-grade/compare/{base}...{head}","merges_url":"https://api.github.com/repos/code-squad/javascript-grade/merges","archive_url":"https://api.github.com/repos/code-squad/javascript-grade/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/code-squad/javascript-grade/downloads","issues_url":"https://api.github.com/repos/code-squad/javascript-grade/issues{/number}","pulls_url":"https://api.github.com/repos/code-squad/javascript-grade/pulls{/number}","milestones_url":"https://api.github.com/repos/code-squad/javascript-grade/milestones{/number}","notifications_url":"https://api.github.com/repos/code-squad/javascript-grade/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/code-squad/javascript-grade/labels{/name}","releases_url":"https://api.github.com/repos/code-squad/javascript-grade/releases{/id}","deployments_url":"https://api.github.com/repos/code-squad/javascript-grade/deployments","created_at":"2017-10-15T12:27:20Z","updated_at":"2018-09-18T00:05:53Z","pushed_at":"2018-09-18T13:48:19Z","git_url":"git://github.com/code-squad/javascript-grade.git","ssh_url":"git@github.com:code-squad/javascript-grade.git","clone_url":"https://github.com/code-squad/javascript-grade.git","svn_url":"https://github.com/code-squad/javascript-grade","homepage":null,"size":4121,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":19,"mirror_url":null,"archived":false,"open_issues_count":7,"license":null,"forks":19,"open_issues":7,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/code-squad/javascript-grade/pulls/34"},"html":{"href":"https://github.com/code-squad/javascript-grade/pull/34"},"issue":{"href":"https://api.github.com/repos/code-squad/javascript-grade/issues/34"},"comments":{"href":"https://api.github.com/repos/code-squad/javascript-grade/issues/34/comments"},"review_comments":{"href":"https://api.github.com/repos/code-squad/javascript-grade/pulls/34/comments"},"review_comment":{"href":"https://api.github.com/repos/code-squad/javascript-grade/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/code-squad/javascript-grade/pulls/34/commits"},"statuses":{"href":"https://api.github.com/repos/code-squad/javascript-grade/statuses/444c7e3ccb22708ac777aeac2eb0e5d78417e501"}},"author_association":"NONE"}}
{"actor":{"display_login":"sk2504"}}