Guest User

Untitled

a guest
Jul 1st, 2015
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.13 KB | None | 0 0
  1. REOPEN KEY (allow manual completion with date of EVAL in interface as completion date)
  2.  
  3. class Key
  4. def force(date_string)
  5. if activated?
  6. create_event(action: 'completed')
  7. self.completed_at = Time.zone.parse(date_string) # 'Wed, 18 Mar 2015 23:09:22'
  8. completed!
  9. passed!
  10. self
  11. else
  12. raise "Invalid transition from #{self.state} to completed."
  13. end
  14. end
  15. end
  16.  
  17. def keyupdate(email, date)
  18. Key.find_by(user_id: User.find_by(email: email)).force(date)
  19. a = User.find_by(email: email).keys.first.events.last
  20. a.created_at = date
  21. a.save!
  22. end
  23.  
  24.  
  25.  
  26.  
  27. keyupdate("jpiccolo90@gmail.com", "Tue, 26 May 2015 00:25:43 +0000")
  28. keyupdate("jpiccolo90@gmail.com", "Tue, 26 May 2015 00:25:43 +0000")
  29. keyupdate("jpiccolo90@gmail.com", "Tue, 26 May 2015 00:25:43 +0000")
  30. keyupdate("jpiccolo90@gmail.com", "Tue, 26 May 2015 00:25:43 +0000")
  31. keyupdate("jpiccolo90@gmail.com", "Tue, 26 May 2015 00:25:43 +0000")
  32. keyupdate("jpiccolo90@gmail.com", "Tue, 26 May 2015 00:25:43 +0000")
  33. keyupdate("jpiccolo90@gmail.com", "Tue, 26 May 2015 00:25:43 +0000")
  34. keyupdate("jpiccolo90@gmail.com", "Tue, 26 May 2015 00:25:43 +0000")
  35.  
  36. kathleen.steffe@comcast.net
  37. lekkerding54@gmail.com
  38. messickpz@gmail.com
  39. rhauser@stonehaus.net
  40. saralessler@verizon.net
  41. seananderica@triad.rr.com
  42. shelton2031@yahoo.com
  43. skins4life2420@gmail.com
  44. sunitha_60@hotmail.com
  45. svadapalli@gmail.com
  46. virginiadaileys@gmail.com
  47. xjohnniox@triad.rr.com
  48.  
  49. irb(main):059:0> keyupdate("beadolphinswimmer@gmail.com", "Tue, 26 May 2015 00:25:43 +0000")
  50. RuntimeError: Invalid transition from available to completed.
  51.  
  52.  
  53. SEPERATE?
  54.  
  55. Attach Key DPVKJLZZ8 (Sara Mccartney - saramc1210@verizon.net) to the Central Maryland Swim League OKM (Org 14)
  56. Reset key GAFRZRHJC also attached to Sara Mccartney - saramc1210@verizon.net (Need that Key to be back in inventory as available)
  57. Attach Key YWKEJA8KR (Tom Swiss tswiss4636@comcast.net) to the Central Maryland Swim League (Org 14) Instead of Scitent Demo Org (Org 10) + Change the user who assigned the key to Joe Cucchiaro
  58. Reset key YD4E7NN03 (Debbie Swiss - dswiss2871@aol.com) and attach it to Scitent Demo Org (Org 10) instead of Central Maryland Swim League (Org 14)
Add Comment
Please, Sign In to add comment