Created
April 4, 2019 02:00
-
-
Save haru01/d2b6e92894cd456da317bb9fd70158e5 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
const createReportData = require('./createReportData'); | |
function generateReadReport(readList, recommendList) { | |
const reportData = createReportData(readList, recommendList); | |
return renderPlainText(reportData); | |
} | |
function renderPlainText(reportData) { | |
let report = `name: ${reportData.userName}\n`; | |
report += '-----\n'; | |
for (let book of reportData.readBooks) { | |
if (book.times >= 1) { | |
report += ` - ${book.name}: ${book.point} point\n`; | |
} | |
} | |
report += '-----\n'; | |
report += `total: ${reportData.total} point`; | |
return report; | |
} | |
module.exports = generateReadReport; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment