20190626000001_setting_update_karma_level.rb 1003 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. class SettingUpdateKarmaLevel < ActiveRecord::Migration[5.1]
  2. def up
  3. # return if it's a new setup
  4. return if !Setting.exists?(name: 'system_init_done')
  5. Setting.set(
  6. 'karma_levels',
  7. [
  8. {
  9. name: 'Beginner',
  10. start: 0,
  11. end: 499,
  12. },
  13. {
  14. name: 'Newbie',
  15. start: 500,
  16. end: 1999,
  17. },
  18. {
  19. name: 'Intermediate',
  20. start: 2000,
  21. end: 4999,
  22. },
  23. {
  24. name: 'Professional',
  25. start: 5000,
  26. end: 6999,
  27. },
  28. {
  29. name: 'Expert',
  30. start: 7000,
  31. end: 8999,
  32. },
  33. {
  34. name: 'Master',
  35. start: 9000,
  36. end: 18_999,
  37. },
  38. {
  39. name: 'Evangelist',
  40. start: 19_000,
  41. end: 49_999,
  42. },
  43. {
  44. name: 'Hero',
  45. start: 50_000,
  46. end: nil,
  47. }
  48. ],
  49. )
  50. end
  51. end