-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/issue#2' into staging
- Loading branch information
Showing
17 changed files
with
135 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<% cache(@surgeon) do %> | ||
<div class="media"> | ||
<div class="media-left"> | ||
<%= fa_icon "user-md", class: "fa-5x media-object" %> | ||
</div> | ||
<div class="media-body"> | ||
<h4 class="media-heading"> | ||
<%= link_to @surgeon.to_s, @surgeon.url %> | ||
<br><%= (fa_icon('star') * Pin.where(surgeon_id: @surgeon.id).average(:satisfaction)).html_safe %> | ||
</h4> | ||
<address> | ||
<%= @surgeon.address %><br> | ||
<%= @surgeon.city %>, <%= @surgeon.state %> <%= @surgeon.zip %><br> | ||
<%= @surgeon.country %><br> | ||
</address> | ||
<% if @surgeon.notes %> | ||
<div class="panel panel-default"> | ||
<div class="panel-body"> | ||
Notes: <%= @surgeon.notes %></div> | ||
</div> | ||
<% end %> | ||
<% @surgeon.satisfaction_by_procedure.each do |procedure_id, satisfaction| %> | ||
<div class="panel panel-default"> | ||
<div class="panel-heading"> | ||
<h3 class="panel-title"><%= Procedure.find(procedure_id).name.to_s %> | ||
<%= link_to Pin.where(surgeon_id: @surgeon.id).where(procedure_id: procedure_id).count, pins_path(procedure: procedure_id, surgeon: @surgeon.id), { style: 'border-radius: 100%; background: #ffffcc; display:inline-block; padding:5px;' } %> | ||
</h3> | ||
</div> | ||
<div class="panel-body"> | ||
Average patient satisfaction is <%= satisfaction.to_i.to_s %> | ||
<label class="label-with-popover" data-placement="right" data-content="Overall procedure satisfaction across all surgeons is: <%= Procedure.find(procedure_id).avg_satisfaction %>" data-title="Satisfaction Compared" data-trigger="hover" data-original-title="" title=""> | ||
<%= fa_icon("bar-chart") %> | ||
</label> | ||
</div> | ||
</div> | ||
<% end %> | ||
</div> | ||
</div> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
class AddSlugToSurgeon < ActiveRecord::Migration | ||
def change | ||
add_column :surgeons, :slug, :string | ||
add_index :surgeons, :slug, unique: true | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
class MakeSurgeonZipString < ActiveRecord::Migration | ||
def up | ||
change_column :surgeons, :zip, :string | ||
end | ||
|
||
def down | ||
change_column :surgeons, :zip, 'integer USING CAST(zip AS integer)' | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
namespace :addresses do | ||
desc "wherever we have a zipcode but lack other address info, fill it in" | ||
task :populate => :environment do | ||
require 'zip-codes' | ||
require 'rake-progressbar' | ||
|
||
|
||
surgeons_w_zips = Surgeon.where.not(zip: nil) | ||
bar = RakeProgressbar.new(surgeons_w_zips.count) | ||
|
||
surgeons_w_zips.find_each do |surgeon| | ||
# zipcodes were stored as integers at one point | ||
# which cut off leading zeroes we need | ||
zipcode = surgeon.zip.rjust(5, '0') | ||
address = ZipCodes.identify(zipcode) | ||
|
||
next if address.nil? | ||
bar.inc | ||
surgeon.update_attributes!( | ||
state: address[:state_code], | ||
city: address[:city], | ||
zip: zipcode | ||
) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters