Guest User

Untitled

a guest
Jul 17th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.90 KB | None | 0 0
  1. def assign_category(cat, skills = [], outcomes = [], tags = [])
  2. skills.each do |id|
  3. PrimitiveCategory.where(category_id: cat.id,
  4. skill_id: id,
  5. primitive_type: "skill").first_or_create
  6. end
  7. outcomes.each do |id|
  8. PrimitiveCategory.where(category_id: cat.id,
  9. outcome_id: id,
  10. primitive_type: "outcome").first_or_create
  11. end
  12. tags.each do |id|
  13. PrimitiveCategory.where(category_id: cat.id,
  14. tag_id: id,
  15. primitive_type: "tag").first_or_create
  16. end
  17. end
  18.  
  19. comp_id = 47
  20.  
  21. deep_discovery = Category
  22. .where(
  23. {name: "Deep Discovery",
  24. uid: "deep_discovery"}).first_or_create
  25.  
  26. skill_ids = [540]
  27. assign_category(deep_discovery, skill_ids)
  28.  
  29. close_attempt = Category
  30. .where(
  31. {name: "Close Attempts",
  32. uid: "close_attempt"}).first_or_create
  33.  
  34. skill_ids = [12, 79, 68, 379, 436, 437, 455, 456, 474, 475, 541, 608]
  35. assign_category(close_attempt, skill_ids)
  36.  
  37. surface_discovery = Category
  38. .where(
  39. {name: "Surface Discovery",
  40. uid: "surface_discovery"}).first_or_create
  41.  
  42. skill_ids = [332, 327, 411, 431, 432, 450, 451, 469, 470, 550, 551, 563, 564, 572, 539, 540, 611]
  43. assign_category(surface_discovery, skill_ids)
  44.  
  45. pitch = Category
  46. .where(
  47. {name: "Pitches",
  48. uid: "pitch"}).first_or_create
  49.  
  50. skill_ids = [73, 307, 335, 339, 363, 365, 364, 327, 368, 366, 412, 413, 433, 434, 435, 452, 453, 454, 471, 472, 548, 552, 553, 544, 602]
  51. assign_category(pitch, skill_ids)
  52.  
  53. objection = Category
  54. .where(
  55. {name: "Objections",
  56. uid: "objection"}).first_or_create
  57.  
  58. skill_ids = [278, 346, 348, 349, 350, 351, 352, 353, 354, 362, 318, 319, 321, 322, 323, 320, 347, 494, 495, 496, 497, 498, 507, 508, 509, 510, 511, 520, 521, 522, 523, 569, 570, 524, 586, 587, 588, 589, 590, 568, 597, 598, 599, 600, 601, 617, 638]
  59. assign_category(objection, skill_ids)
Add Comment
Please, Sign In to add comment