"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = createHtmlRubricItems;

var _utils = require("../../../utils");

/**
 * Create HTML for rubric items
 * @param {object} rubricItems JSON data for rubric items
 * @returns {string} rubric items HTML
 */
function createHtmlRubricItems(rubricItems) {
  let html = '';
  let htmlItems = '';

  for (let i = 0, len = rubricItems.length; i < len; i += 1) {
    const rubric = rubricItems[i];
    let {
      criteria
    } = rubric;
    criteria = (0, _utils.markdownToHtml)(criteria);
    const passedDescription = (0, _utils.markdownToHtml)(rubric.passed_description);
    htmlItems += `
      <tr scope="row">
        <td>
          ${criteria}
        </td>
        <td>
          ${passedDescription}
        </td>
      </tr>
    `;
  }

  html += `
    <tbody>
      ${htmlItems}
    </tbody>
  `;
  return html;
}