Advertisement
Guest User

Untitled

a guest
Apr 19th, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.72 KB | None | 0 0
  1. questions_template = [];
  2.  
  3. getQuestionsTemplate() {
  4. let template = require('./datamodel_questions_template.json');
  5.  
  6. for (var key in template) {
  7. if (!template.hasOwnProperty(key)) continue;
  8. if (key === "questions") {
  9. var obj = template[key];
  10. for (var prop in obj) {
  11. if (!obj.hasOwnProperty(prop)) continue;
  12. obj[prop].number = prop;
  13. this.questions_template.push(obj[prop]);
  14. }
  15. }
  16. }
  17.  
  18. console.log(this.questions_template);
  19. }
  20.  
  21. // File: "datamodel_questions_template.json"
  22. {
  23. "_id": "datamodel_questions_template",
  24. "questions": {
  25. "004": {
  26. "description": "Is billing calendar based?",
  27. "example": "(quarterly Jan 1st - March 31st), (monthly Feb 1st - Feb 28th), (weekly Sunday - Saturday).",
  28. "parent_question_id": "003",
  29. "questiontype": "radiobutton",
  30. "answer_options": [
  31. "Yes",
  32. "No"
  33. ],
  34. "next_question": "005",
  35. "actions": {
  36. "Yes": {
  37. "selecttables": [],
  38. "selecttags": []
  39. }
  40. }
  41. },
  42. "005": {
  43. "description": "Is there special holiday billing, rates or handling for this contract?",
  44. "parent_question_id": "004",
  45. "questiontype": "radiobutton",
  46. "answer_options": [
  47. "Yes",
  48. "No"
  49. ],
  50. "next_question": "006",
  51. "actions": {
  52. "Yes": {
  53. "selecttables": [
  54. "holiday_dim"
  55. ],
  56. "selecttags": [
  57. "holiday_dim.holiday_id.display_ui",
  58. "holiday_dim.holiday_id.selected"
  59. ]
  60. }
  61. }
  62. }
  63. }
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement