<< | Index | >>
Link
Note
ch.oddb> doctors.values.length -> 34663 ch.oddb> doctors.values.select{|d| !d.ean13}.length -> 4058
Algorithm
Updates
alias :ean :ean13
def doctor model = if ean = @session.user_input(:ean) @session.search_doctors(ean).first elsif oid = @session.user_input(:oid) @session.search_doctor(oid) end if model State::Doctors::Doctor.new(@session, model) end end
def doctor model = if ean = @session.user_input(:ean) @session.search_doctors(ean).first elsif oid = @session.user_input(:oid) @session.search_doctor(oid) end if model State::Doctors::RootDoctor.new(@session, model) end end
def name(model) link = View::PointerLink.new(:name, model, @session, self) if ean = @model.ean13 link.href = @lookandfeel._event_url(:doctor, {:ean => ean}) else link.href = @lookandfeel._event_url(:doctor, {:oid => doctor_id}) end link end
Note(IMPORTANT
)
Update
def vcard doctor =if ean_or_oid = @session.user_input(:doctor)
@session.search_doctors(ean_or_oid).first or @session.app.doctor(ean_or_oid)
elsif pointer = @session.user_input(:pointer) pointer.resolve(@session) end State::Doctors::VCard.new(@session, doctor) if doctor end
def name(model) link = View::PointerLink.new(:name, model, @session, self)if ean = model.ean13 and ean.to_s.strip != ""
link.href = @lookandfeel._event_url(:doctor, {:ean => ean})
else
link.href = @lookandfeel._event_url(:doctor, {:oid => model.oid})
end
link end
def vcard(model) link = View::PointerLink.new(:vcard, model, @session, self)ean_or_oid = if ean = model.ean13 and ean.to_s.strip != ""
ean
else
model.oid
end
link.href = @lookandfeel._event_url(:vcard, {:doctor =>ean_or_oid
}) link end
Commit
Update
def suggest_address keys = [:pointer] input = user_input(keys, keys) if pointer = input[:pointer] if(!error?) addr = pointer.resolve(@session) if(addr.nil?) ## simulate an address addr = Address2.new if(parent = pointer.parent.resolve(@session)) addr.name = parent.fullname end addr.pointer = pointer end SuggestAddress.new(@session, addr) end elsedoctor = if oid_or_ean = @session.user_input(:doctor)
@session.search_doctor(oid_or_ean) || @session.search_doctors(oid_or_ean).first
end
if doctor and addr = doctor.address(@session.user_input(:address))
SuggestAddress.new(@session, addr)
end
end end
def correct(model) button = HtmlGrid::Button.new(:correct, model, @session, self)args = if ean = @session.user_input(:ean) and doctors = @session.search_doctors(ean) and doctor = doctors.first \
and address = doctor.addresses.index(model)
[
:doctor, ean,
:address, address,
:zone, @session.zone,
]
elsif doctor_oid = @session.persistent_user_input(:oid) and doctor = @session.search_doctor(doctor_oid) and address = doctor.addresses.index(model) [ :doctor, doctor_oid, :address, address, :zone, @session.zone, ] else { :pointer => model.pointer, :zone => @session.zone, } end url = @lookandfeel._event_url(:suggest_address, args) button.set_attribute('onclick', "document.location.href='#{url}'") button end
Commit
Links
Process
Note
App#update now uses a pointer instance for the update
State::SuggestAddress#save_suggestion still uses Pointer instance
Commit
Link
Update