You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

11-aspects.js 800B

12345678910111213141516171819202122232425
  1. const aspects = require('../generated/prescore_matrix.json')
  2. exports.seed = function (knex) {
  3. // Deletes ALL existing entries
  4. return knex('aspect_labels')
  5. .truncate()
  6. .then(function () {
  7. let rowCount = 1
  8. const rows = []
  9. Object.keys(aspects).forEach(label => {
  10. if(label != '_config') {
  11. const row = {
  12. aspect_id: rowCount
  13. }
  14. const ab = label.split('-')
  15. row.a = parseInt(ab[0])
  16. row.b = parseInt(ab[1])
  17. rows.push(row)
  18. rowCount++
  19. }
  20. })
  21. // Inserts seed entries
  22. return knex('aspect_labels').insert(rows)
  23. })
  24. }