medivo 0.2.20 → 0.2.21

Sign up to get free protection for your applications and to get access to all the features.
@@ -39,6 +39,7 @@ $(document).ready ->
39
39
  # override this proc to do your own before send handling
40
40
  Appointment.BeforeSendHandler = (form)->
41
41
  form.find('.error_message').empty()
42
+ window.appointment_list.setList([])
42
43
  messages = []
43
44
  date = form.find('input#date').val()
44
45
  valid_date = Date.parseExact(date, "M/d/yyyy")
@@ -28,7 +28,7 @@ module Medivo
28
28
  data = build_fake_data(date)
29
29
  end
30
30
  # filter the hash before returning
31
- filter_data(data, am_pm, date.to_time)
31
+ filter_data(data, am_pm, date)
32
32
  end
33
33
 
34
34
  ##
@@ -70,11 +70,22 @@ module Medivo
70
70
  true unless !Rails.env.test? and @config.real_data == false
71
71
  end
72
72
 
73
- def filter_data(times, am_pm, search_time)
74
- times.collect { |time| AppointmentTime.new(time) }
73
+ ##
74
+ # ordering the times, firstly by proximity to search date, and
75
+ # then by the time in the day
76
+ def filter_data(times, am_pm, search_date)
77
+ # get the times into groups by date
78
+ dates = times
79
+ .collect { |time| AppointmentTime.new(time) }
75
80
  .select { |at| at.match(am_pm, Time.now) }
76
- .sort_by {|at| at.nearness_to_time(search_time) }
77
- .collect { |at| at.time_str }
81
+ .group_by(&:date)
82
+ # order the dates by nearness to search date
83
+ keys = dates.keys.sort_by {|date| (date - search_date).to_i.abs }
84
+ # order the times in each day and return the times as a strings
85
+ keys
86
+ .collect{|date| dates[date].sort_by(&:time) }
87
+ .flatten
88
+ .collect { |at| at.time_str }
78
89
  end
79
90
 
80
91
  def build_fake_data(date)
@@ -101,6 +112,10 @@ class AppointmentTime
101
112
  @time = Time.strptime(time_str, Medivo::Appointment::LABCORP_FORMAT) rescue nil
102
113
  end
103
114
 
115
+ def date
116
+ @time.to_date
117
+ end
118
+
104
119
  def match(am_pm, current_time)
105
120
  time and time_str.match(/#{am_pm}/) and (time >= current_time)
106
121
  end
@@ -1,3 +1,3 @@
1
1
  module Medivo
2
- VERSION = "0.2.20"
2
+ VERSION = "0.2.21"
3
3
  end
@@ -21794,3 +21794,139 @@ Started GET "/medivo/labs/find_appointment?utf8=%E2%9C%93&date=11%2F19%2F2011&la
21794
21794
  Processing by Medivo::LabsController#find_appointment as JS
21795
21795
  Parameters: {"utf8"=>"✓", "date"=>"11/19/2011", "lab_code"=>"23021", "commit"=>"Search for appointments"}
21796
21796
  Completed 200 OK in 3128ms (Views: 4.7ms)
21797
+
21798
+
21799
+ Started GET "/labs/lab_search?zip_code=90210" for 127.0.0.1 at 2011-11-16 18:50:40 -0500
21800
+ Processing by LabsController#lab_search as HTML
21801
+ Parameters: {"zip_code"=>"90210"}
21802
+ Rendered labs/search.html.haml within layouts/application (14.9ms)
21803
+ Compiled application.js (10ms) (pid 14515)
21804
+ Compiled medivo/lab_appointment/application.js (37ms) (pid 14515)
21805
+ Compiled medivo/lab_appointment/handlers.js (184ms) (pid 14515)
21806
+ Completed 200 OK in 5935ms (Views: 304.8ms)
21807
+
21808
+
21809
+ Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2011-11-16 18:50:46 -0500
21810
+ Served asset /application.css - 304 Not Modified (0ms)
21811
+
21812
+
21813
+ Started GET "/assets/jquery_ujs.js?body=1" for 127.0.0.1 at 2011-11-16 18:50:46 -0500
21814
+ Served asset /jquery_ujs.js - 304 Not Modified (0ms)
21815
+
21816
+
21817
+ Started GET "/assets/jquery.js?body=1" for 127.0.0.1 at 2011-11-16 18:50:46 -0500
21818
+ Served asset /jquery.js - 304 Not Modified (0ms)
21819
+
21820
+
21821
+ Started GET "/assets/medivo/handlebars.js?body=1" for 127.0.0.1 at 2011-11-16 18:50:46 -0500
21822
+ Served asset /medivo/handlebars.js - 304 Not Modified (0ms)
21823
+
21824
+
21825
+ Started GET "/assets/medivo/helpers.js?body=1" for 127.0.0.1 at 2011-11-16 18:50:46 -0500
21826
+ Served asset /medivo/helpers.js - 304 Not Modified (0ms)
21827
+
21828
+
21829
+ Started GET "/assets/medivo/models.js?body=1" for 127.0.0.1 at 2011-11-16 18:50:46 -0500
21830
+ Served asset /medivo/models.js - 304 Not Modified (0ms)
21831
+
21832
+
21833
+ Started GET "/assets/medivo/lab_list/models.js?body=1" for 127.0.0.1 at 2011-11-16 18:50:46 -0500
21834
+ Served asset /medivo/lab_list/models.js - 304 Not Modified (0ms)
21835
+
21836
+
21837
+ Started GET "/assets/medivo/views.js?body=1" for 127.0.0.1 at 2011-11-16 18:50:46 -0500
21838
+ Served asset /medivo/views.js - 304 Not Modified (0ms)
21839
+
21840
+
21841
+ Started GET "/assets/medivo/lab_list/views.js?body=1" for 127.0.0.1 at 2011-11-16 18:50:46 -0500
21842
+ Served asset /medivo/lab_list/views.js - 304 Not Modified (0ms)
21843
+
21844
+
21845
+ Started GET "/assets/medivo/lab_list/handlers.js?body=1" for 127.0.0.1 at 2011-11-16 18:50:46 -0500
21846
+ Served asset /medivo/lab_list/handlers.js - 304 Not Modified (0ms)
21847
+
21848
+
21849
+ Started GET "/assets/medivo/lab_list/application.js?body=1" for 127.0.0.1 at 2011-11-16 18:50:46 -0500
21850
+ Served asset /medivo/lab_list/application.js - 304 Not Modified (0ms)
21851
+
21852
+
21853
+ Started GET "/assets/medivo/lab_list/sample/show_labs.js?body=1" for 127.0.0.1 at 2011-11-16 18:50:46 -0500
21854
+ Served asset /medivo/lab_list/sample/show_labs.js - 304 Not Modified (0ms)
21855
+
21856
+
21857
+ Started GET "/assets/medivo/date.js?body=1" for 127.0.0.1 at 2011-11-16 18:50:46 -0500
21858
+ Served asset /medivo/date.js - 304 Not Modified (0ms)
21859
+
21860
+
21861
+ Started GET "/assets/medivo/lab_appointment/models.js?body=1" for 127.0.0.1 at 2011-11-16 18:50:46 -0500
21862
+ Served asset /medivo/lab_appointment/models.js - 304 Not Modified (0ms)
21863
+
21864
+
21865
+ Started GET "/assets/medivo/lab_appointment/views.js?body=1" for 127.0.0.1 at 2011-11-16 18:50:46 -0500
21866
+ Served asset /medivo/lab_appointment/views.js - 304 Not Modified (0ms)
21867
+
21868
+
21869
+ Started GET "/assets/medivo/lab_appointment/handlers.js?body=1" for 127.0.0.1 at 2011-11-16 18:50:46 -0500
21870
+ Served asset /medivo/lab_appointment/handlers.js - 200 OK (3ms)
21871
+
21872
+
21873
+ Started GET "/assets/medivo/lab_appointment/application.js?body=1" for 127.0.0.1 at 2011-11-16 18:50:46 -0500
21874
+ Served asset /medivo/lab_appointment/application.js - 200 OK (7ms)
21875
+
21876
+
21877
+ Started GET "/assets/medivo/lab_appointment/sample/show_appointments.js?body=1" for 127.0.0.1 at 2011-11-16 18:50:46 -0500
21878
+ Served asset /medivo/lab_appointment/sample/show_appointments.js - 304 Not Modified (0ms)
21879
+
21880
+
21881
+ Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2011-11-16 18:50:46 -0500
21882
+ Served asset /application.js - 200 OK (1ms)
21883
+
21884
+
21885
+ Started GET "/assets/medivo/ajax_waiting.gif" for 127.0.0.1 at 2011-11-16 18:50:46 -0500
21886
+ Served asset /medivo/ajax_waiting.gif - 304 Not Modified (0ms)
21887
+
21888
+
21889
+ Started GET "/assets/medivo/markerA.png" for 127.0.0.1 at 2011-11-16 18:50:47 -0500
21890
+ Served asset /medivo/markerA.png - 304 Not Modified (0ms)
21891
+
21892
+
21893
+ Started GET "/assets/medivo/markerB.png" for 127.0.0.1 at 2011-11-16 18:50:47 -0500
21894
+ Served asset /medivo/markerB.png - 304 Not Modified (0ms)
21895
+
21896
+
21897
+ Started GET "/assets/medivo/markerC.png" for 127.0.0.1 at 2011-11-16 18:50:47 -0500
21898
+ Served asset /medivo/markerC.png - 304 Not Modified (0ms)
21899
+
21900
+
21901
+ Started GET "/assets/medivo/arrow.png" for 127.0.0.1 at 2011-11-16 18:50:47 -0500
21902
+ Served asset /medivo/arrow.png - 304 Not Modified (0ms)
21903
+
21904
+
21905
+ Started GET "/medivo/labs?utf8=%E2%9C%93&zip_code=90210&commit=Search" for 127.0.0.1 at 2011-11-16 18:50:52 -0500
21906
+ Processing by Medivo::LabsController#index as JS
21907
+ Parameters: {"utf8"=>"✓", "zip_code"=>"90210", "commit"=>"Search"}
21908
+ Completed 200 OK in 1293ms (Views: 11.2ms)
21909
+
21910
+
21911
+ Started GET "/assets/medivo/markerA.png" for 127.0.0.1 at 2011-11-16 18:50:54 -0500
21912
+ Served asset /medivo/markerA.png - 304 Not Modified (0ms)
21913
+
21914
+
21915
+ Started GET "/assets/medivo/markerB.png" for 127.0.0.1 at 2011-11-16 18:50:54 -0500
21916
+ Served asset /medivo/markerB.png - 304 Not Modified (0ms)
21917
+
21918
+
21919
+ Started GET "/assets/medivo/markerC.png" for 127.0.0.1 at 2011-11-16 18:50:54 -0500
21920
+ Served asset /medivo/markerC.png - 304 Not Modified (0ms)
21921
+
21922
+
21923
+ Started GET "/medivo/labs/find_appointment?utf8=%E2%9C%93&date=11%2F19%2F2011&lab_code=20060&commit=Search+for+appointments" for 127.0.0.1 at 2011-11-16 18:50:58 -0500
21924
+ Processing by Medivo::LabsController#find_appointment as JS
21925
+ Parameters: {"utf8"=>"✓", "date"=>"11/19/2011", "lab_code"=>"20060", "commit"=>"Search for appointments"}
21926
+ Completed 200 OK in 3920ms (Views: 4.7ms)
21927
+
21928
+
21929
+ Started GET "/medivo/labs/find_appointment?utf8=%E2%9C%93&date=11%2F19%2F2011&lab_code=20060&commit=Search+for+appointments" for 127.0.0.1 at 2011-11-16 18:51:05 -0500
21930
+ Processing by Medivo::LabsController#find_appointment as JS
21931
+ Parameters: {"utf8"=>"✓", "date"=>"11/19/2011", "lab_code"=>"20060", "commit"=>"Search for appointments"}
21932
+ Completed 200 OK in 3137ms (Views: 4.5ms)
@@ -3592,3 +3592,73 @@ Started POST "/medivo/labs/make_appointment" for 127.0.0.1 at 2011-11-16 13:57:2
3592
3592
  Processing by Medivo::LabsController#make_appointment as HTML
3593
3593
  Parameters: {"lab_code"=>"20060", "time"=>"2011-11-01 08:30:00 UTC", "user"=>{"first_name"=>"dude", "last_name"=>nil, "date_of_birth"=>"12/28/1980", "email_address"=>"dudeman@dude.com", "phone_number"=>"4155551212"}}
3594
3594
  Completed 200 OK in 2ms (Views: 0.2ms)
3595
+ Processing by OrdersController#download_requisition as HTML
3596
+ Rendered text template (0.0ms)
3597
+ Sent data unitedhealthcare_requisition.pdf (73.9ms)
3598
+ Completed 200 OK in 991ms (Views: 73.4ms)
3599
+ Processing by OrdersController#download_result as HTML
3600
+ Sent data unitedhealthcare_result.pdf (1.8ms)
3601
+ Completed 200 OK in 710ms (Views: 1.0ms)
3602
+
3603
+
3604
+ Started GET "/medivo/labs?zip_code=90210" for 127.0.0.1 at 2011-11-16 19:19:32 -0500
3605
+ Processing by Medivo::LabsController#index as HTML
3606
+ Parameters: {"zip_code"=>"90210"}
3607
+ Completed 200 OK in 204ms (Views: 2.2ms)
3608
+
3609
+
3610
+ Started GET "/labs/lab_search?zip_code=90210" for 127.0.0.1 at 2011-11-16 19:19:35 -0500
3611
+ Processing by LabsController#lab_search as HTML
3612
+ Parameters: {"zip_code"=>"90210"}
3613
+ Completed 200 OK in 199ms (Views: 53.2ms)
3614
+
3615
+
3616
+ Started GET "/assets/application.css" for 127.0.0.1 at 2011-11-16 19:19:36 -0500
3617
+ Served asset /application.css - 200 OK (6ms)
3618
+
3619
+
3620
+ Started GET "/assets/application.js" for 127.0.0.1 at 2011-11-16 19:19:36 -0500
3621
+ Compiled application.js (11ms) (pid 15722)
3622
+ Compiled medivo/lab_appointment/application.js (10ms) (pid 15722)
3623
+ Compiled medivo/lab_appointment/handlers.js (190ms) (pid 15722)
3624
+ Served asset /application.js - 200 OK (729ms)
3625
+
3626
+
3627
+ Started GET "/assets/medivo/ajax_waiting.gif" for 127.0.0.1 at 2011-11-16 19:19:36 -0500
3628
+ Served asset /medivo/ajax_waiting.gif - 200 OK (2ms)
3629
+
3630
+
3631
+ Started GET "/assets/medivo/markerA.png" for 127.0.0.1 at 2011-11-16 19:19:36 -0500
3632
+ Served asset /medivo/markerA.png - 200 OK (2ms)
3633
+
3634
+
3635
+ Started GET "/assets/medivo/markerB.png" for 127.0.0.1 at 2011-11-16 19:19:36 -0500
3636
+ Served asset /medivo/markerB.png - 200 OK (2ms)
3637
+
3638
+
3639
+ Started GET "/assets/medivo/arrow.png" for 127.0.0.1 at 2011-11-16 19:19:37 -0500
3640
+ Served asset /medivo/arrow.png - 200 OK (4ms)
3641
+
3642
+
3643
+ Started GET "/medivo/labs/find_appointment?date=11%2F01%2F2011&lab_code=20060" for 127.0.0.1 at 2011-11-16 19:19:37 -0500
3644
+ Processing by Medivo::LabsController#find_appointment as HTML
3645
+ Parameters: {"date"=>"11/01/2011", "lab_code"=>"20060"}
3646
+ Completed 200 OK in 1ms (Views: 0.4ms)
3647
+
3648
+
3649
+ Started GET "/medivo/labs/find_appointment?date=11%2F01%2F2011&lab_code=20060" for 127.0.0.1 at 2011-11-16 19:19:37 -0500
3650
+ Processing by Medivo::LabsController#find_appointment as HTML
3651
+ Parameters: {"date"=>"11/01/2011", "lab_code"=>"20060"}
3652
+ Completed 200 OK in 1ms (Views: 0.2ms)
3653
+
3654
+
3655
+ Started GET "/medivo/labs/find_appointment?date=11%2F01%2F2011&lab_code=20060" for 127.0.0.1 at 2011-11-16 19:19:37 -0500
3656
+ Processing by Medivo::LabsController#find_appointment as HTML
3657
+ Parameters: {"date"=>"11/01/2011", "lab_code"=>"20060"}
3658
+ Completed 404 Not Found in 1ms (Views: 0.3ms)
3659
+
3660
+
3661
+ Started POST "/medivo/labs/make_appointment" for 127.0.0.1 at 2011-11-16 19:19:37 -0500
3662
+ Processing by Medivo::LabsController#make_appointment as HTML
3663
+ Parameters: {"lab_code"=>"20060", "time"=>"2011-11-01 08:30:00 UTC", "user"=>{"first_name"=>"dude", "last_name"=>nil, "date_of_birth"=>"12/28/1980", "email_address"=>"dudeman@dude.com", "phone_number"=>"4155551212"}}
3664
+ Completed 200 OK in 6ms (Views: 0.3ms)
@@ -49,8 +49,12 @@ describe Medivo::Appointment do
49
49
  end
50
50
 
51
51
  it "orders the time strings by nearness to search date" do
52
- @all_times = ["11/06/2011|12:30 AM", "11/04/2011|08:30 PM", "11/05/2011|08:30 AM"]
53
- returned_times('11/06/2011', '', "11/04/2011").should == ["11/06/2011|12:30 AM", "11/05/2011|08:30 AM", "11/04/2011|08:30 PM"]
52
+ @all_times =
53
+ ["11/06/2011|12:30 AM", "11/04/2011|08:30 PM", "11/05/2011|08:30 AM",
54
+ "11/06/2011|01:30 PM", "11/04/2011|10:00 AM", "11/05/2011|3:30 PM"]
55
+ returned_times('11/06/2011', '', "11/04/2011").should ==
56
+ ["11/06/2011|12:30 AM", "11/06/2011|01:30 PM", "11/05/2011|08:30 AM",
57
+ "11/05/2011|3:30 PM", "11/04/2011|10:00 AM", "11/04/2011|08:30 PM"]
54
58
  end
55
59
  end
56
60
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: medivo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.20
4
+ version: 0.2.21
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -14,7 +14,7 @@ default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails
17
- requirement: &2168896820 !ruby/object:Gem::Requirement
17
+ requirement: &2169175720 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ~>
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: 3.1.0
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *2168896820
25
+ version_requirements: *2169175720
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: jquery-rails
28
- requirement: &2168896380 !ruby/object:Gem::Requirement
28
+ requirement: &2169174260 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ! '>='
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
- version_requirements: *2168896380
36
+ version_requirements: *2169174260
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: coffee-script
39
- requirement: &2168895920 !ruby/object:Gem::Requirement
39
+ requirement: &2169172040 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ! '>='
@@ -44,10 +44,10 @@ dependencies:
44
44
  version: '0'
45
45
  type: :runtime
46
46
  prerelease: false
47
- version_requirements: *2168895920
47
+ version_requirements: *2169172040
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: haml-rails
50
- requirement: &2168895500 !ruby/object:Gem::Requirement
50
+ requirement: &2169170380 !ruby/object:Gem::Requirement
51
51
  none: false
52
52
  requirements:
53
53
  - - ! '>='
@@ -55,10 +55,10 @@ dependencies:
55
55
  version: '0'
56
56
  type: :runtime
57
57
  prerelease: false
58
- version_requirements: *2168895500
58
+ version_requirements: *2169170380
59
59
  - !ruby/object:Gem::Dependency
60
60
  name: geocoder
61
- requirement: &2168895080 !ruby/object:Gem::Requirement
61
+ requirement: &2169169300 !ruby/object:Gem::Requirement
62
62
  none: false
63
63
  requirements:
64
64
  - - ! '>='
@@ -66,10 +66,10 @@ dependencies:
66
66
  version: '0'
67
67
  type: :runtime
68
68
  prerelease: false
69
- version_requirements: *2168895080
69
+ version_requirements: *2169169300
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: rest-client
72
- requirement: &2168894660 !ruby/object:Gem::Requirement
72
+ requirement: &2169168380 !ruby/object:Gem::Requirement
73
73
  none: false
74
74
  requirements:
75
75
  - - ! '>='
@@ -77,10 +77,10 @@ dependencies:
77
77
  version: '0'
78
78
  type: :runtime
79
79
  prerelease: false
80
- version_requirements: *2168894660
80
+ version_requirements: *2169168380
81
81
  - !ruby/object:Gem::Dependency
82
82
  name: pdfkit
83
- requirement: &2168894240 !ruby/object:Gem::Requirement
83
+ requirement: &2169167040 !ruby/object:Gem::Requirement
84
84
  none: false
85
85
  requirements:
86
86
  - - ! '>='
@@ -88,10 +88,10 @@ dependencies:
88
88
  version: '0'
89
89
  type: :runtime
90
90
  prerelease: false
91
- version_requirements: *2168894240
91
+ version_requirements: *2169167040
92
92
  - !ruby/object:Gem::Dependency
93
93
  name: prawn
94
- requirement: &2168880380 !ruby/object:Gem::Requirement
94
+ requirement: &2169156500 !ruby/object:Gem::Requirement
95
95
  none: false
96
96
  requirements:
97
97
  - - ! '>='
@@ -99,7 +99,7 @@ dependencies:
99
99
  version: '0'
100
100
  type: :runtime
101
101
  prerelease: false
102
- version_requirements: *2168880380
102
+ version_requirements: *2169156500
103
103
  description: Use the medivo platform to find lab locations, make labcorp appointments,
104
104
  place lab orders
105
105
  email:
@@ -312,7 +312,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
312
312
  version: '0'
313
313
  segments:
314
314
  - 0
315
- hash: 3011274679794770266
315
+ hash: 949425962482715758
316
316
  required_rubygems_version: !ruby/object:Gem::Requirement
317
317
  none: false
318
318
  requirements:
@@ -321,7 +321,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
321
321
  version: '0'
322
322
  segments:
323
323
  - 0
324
- hash: 3011274679794770266
324
+ hash: 949425962482715758
325
325
  requirements: []
326
326
  rubyforge_project:
327
327
  rubygems_version: 1.6.2