Last active
April 4, 2019 01:35
-
-
Save haru01/7ec48f8a0910429b485670b55c162d11 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -6,13 +6,14 @@ function generateReadReport(readList, recommendList) { | |
function createReportData(readList, recommendList) { | |
const reportData = {}; | |
reportData.userName = readList.name; | |
+ reportData.readBooks = readList.books; | |
return reportData; | |
} | |
function renderPlainText(reportData, readList, recommendList) { | |
let report = `name: ${reportData.userName}\n`; | |
report += '-----\n'; | |
- for (let book of readList.books) { | |
+ for (let book of reportData.readBooks) { | |
if (book.times >= 1) { | |
report += ` - ${book.name}: ${point(book)} point\n`; | |
} | |
@@ -22,7 +23,7 @@ function renderPlainText(reportData, readList, recommendList) { | |
return report; | |
function total() { | |
- return readList.books | |
+ return reportData.readBooks | |
.reduce((total, book) => total + point(book), 0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment