Advertisement
Guest User

Untitled

a guest
Jul 19th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. module.exports = {
  2.  
  3.  
  4.   friendlyName: 'Seed data',
  5.  
  6.  
  7.   description: 'Seed questions and answers in database',
  8.  
  9.  
  10.   inputs: {},
  11.  
  12.  
  13.   fn: async function (inputs, exits) {
  14.  
  15.     sails.log('Starting question and answers seeder..');
  16.     let seededQuestions = await Question.createEach(data.map(q => ({
  17.       body: q.body
  18.     }))).fetch();
  19.     return exits.success(seededQuestions);
  20.  
  21.   }
  22.  
  23.  
  24. };
  25.  
  26. const data = [{
  27.   body: 'Which of the following statements is true?',
  28.   answers: [{
  29.       value: 'Python is a high level programming language.',
  30.       isCorrect: false
  31.     },
  32.     {
  33.       value: 'Python is an interpreted language.',
  34.       isCorrect: false
  35.     },
  36.     {
  37.       value: 'Python is an object-oriented language.',
  38.       isCorrect: false
  39.     },
  40.     {
  41.       value: 'All of the above.',
  42.       isCorrect: true
  43.     }
  44.   ]
  45. }, {
  46.   body: 'What is used to define a block of code (body of loop, function etc.) in Python?',
  47.   answers: [{
  48.       value: 'Curly braces',
  49.       isCorrect: false
  50.     },
  51.     {
  52.       value: 'Parenthesis',
  53.       isCorrect: false
  54.     },
  55.     {
  56.       value: 'Indentation',
  57.       isCorrect: true
  58.     },
  59.     {
  60.       value: 'Quotation',
  61.       isCorrect: false
  62.     }
  63.   ]
  64. }];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement