Skip to content

@jwo /bad.html.erb secret

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
BAD CODE. BAD!
<script>
screenWidth= screen.width;
screenHeight = screen.height;
function openThis(passedID) {
window.open("/coders/coder_form?surg_id=" + passedID,"mywindow","width=" + screenWidth + ",height=675,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,top=0,left=0,resizable=no")
}
</script>
<%
@mydocs = SurgeonCoder.find(:all, :conditions => ["coder_id=?", params[:userId])
if @mydocs.size > 0
@mydocs.each do |doc|
doctorid = doc.surgeon_id
@reports = PermanentSurgery.find(:all, :conditions => "id in (select permanent_surgery_id from permanent_attributes where attribute_desc='Surgeon' and user_id=#{doctorid}) and coded=0")
if @reports.size > 0 %>
<table border=0 cellpadding=0 cellspacing=0><%
@reports.each do |surg| %>
<tr>
<td width="150"><%= surg.patient_first_name %> <%= surg.patient_last_name %></td>
<td width="250"><%= surg.created_at %></td>
<td>[<a href="javascript:openThis(<%= surg.id %>)">create form</a>]</td>
</tr><%
end %>
</table><%
else %>
No Surgeries Available for Coding<%
end
end
else %>
No doctors assigned<%
end %>
def create_lambdas(attrs)
attrs.map do |attr|
lambda{|model| model.send(attr.to_sym).present? if model.respond_to? attr.to_sym}
end
end
page_calls = create_lambdas ["title_tag", "description", "meta_keywords" ]
post_calls = create_lambdas ["meta_title", "meta_description", "keywords" ]
empty_post = Post.all.reject do |model|
post_calls.all? {|c| c.call(model)}
end
empty_page = Page.all.reject do |model|
page_calls.all? {|c| c.call(model)}
end
puts "Posts"
empty_post.map(&:title).map{|t| puts t}; nil
puts "\n\n\npages"
empty_page.map(&:title).map{|t| puts t}; nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.