query stringlengths 7 9.55k | document stringlengths 10 363k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
Clean up empty directories when the files in them are deleted | def extension_whitelist
Spotlight::Engine.config.allowed_upload_extensions
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n delete_files_and_empty_parent_directories\n end",
"def clean_up\n Dir.foreach(Dir.pwd) do |f|\n if !f.start_with?('tmp_') then next\n elsif File.directory?(f) then FileUtils.rm_rf(f)\n else FileUtils.rm(f)\n end\n end\nend",
"def remove_file_and_clean_directories( path )... | [
"0.8126344",
"0.77983123",
"0.77558273",
"0.7732703",
"0.7728076",
"0.7715031",
"0.7676415",
"0.76661056",
"0.76331836",
"0.7633032",
"0.75877804",
"0.75815266",
"0.7561137",
"0.75327545",
"0.7511288",
"0.7509433",
"0.7448446",
"0.7417443",
"0.7414098",
"0.735447",
"0.7344155... | 0.0 | -1 |
after referrals submitted needs to charge 1 dollar user account screen to see referrals send emails to the contact user for the company active admin to see referrals | def view
binding.pry
# @offer = Offer.find params[:referral_id]
# company = @offer.company
# @offer.build_referral
# @referral = Referral.new
@tags = @offer.tag_list
render 'new'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def call(user, email, reward, shipping_address)\n @user = user\n @reward = reward\n # admin = \"astropowerbox@gmail.com\"\n admin = \"news.article.sysetm@gmail.com\"\n @shipping_address = shipping_address\n mail to: email, subject: 'Redemption details'\n end",
"def referral_success_email(refer... | [
"0.6873842",
"0.68429136",
"0.6793496",
"0.670333",
"0.6516776",
"0.6505875",
"0.64906293",
"0.64680964",
"0.6439451",
"0.64393026",
"0.6409769",
"0.6405752",
"0.64057016",
"0.6395562",
"0.6392053",
"0.6381899",
"0.63735825",
"0.6358249",
"0.63479406",
"0.63442963",
"0.633659... | 0.0 | -1 |
POST /company_shifts POST /company_shifts.json | def create
@company_shift = CompanyShift.new(company_shift_params)
@company_shifts = CompanyShift.all
respond_to do |format|
if @company_shift.save
@company_shift = CompanyShift.new
format.js { @flag = true }
else
flash.now[:alert] = 'Company Shift Already Exist.'
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n busy_shifts = params[:busy_shift]\n if busy_shifts\n busy_shifts[:day].length.times do |index|\n day = busy_shifts[:day][index]\n start_time = busy_shifts[:start_time][index]\n end_time = busy_shifts[:end_time][index]\n @busy_shifts = current_user.busy_shifts.c... | [
"0.6688081",
"0.65495324",
"0.6532994",
"0.64741385",
"0.6418424",
"0.62781125",
"0.6168586",
"0.61309135",
"0.61153823",
"0.6088417",
"0.60284215",
"0.6005881",
"0.60037637",
"0.600183",
"0.6001765",
"0.59704685",
"0.5953893",
"0.5953409",
"0.595021",
"0.5941735",
"0.5936049... | 0.57208574 | 35 |
PATCH/PUT /company_shifts/1 PATCH/PUT /company_shifts/1.json | def update
@company_shift.update(company_shift_params)
@company_shifts = CompanyShift.all
@company_shift = CompanyShift.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n params[:shift].delete(:employee)\n @shift = Shift.find(params[:id])\n @shift.attributes = params[:shift]\n @shift.date = Chronic.parse(params[:shift][:date])\n\n respond_to do |format|\n if @shift.save\n format.html { redirect_to @shift, notice: 'Shift was successfully updat... | [
"0.6743734",
"0.65235937",
"0.6404627",
"0.6389806",
"0.6351272",
"0.62963665",
"0.6255826",
"0.62417376",
"0.6203405",
"0.61973315",
"0.61921746",
"0.6144885",
"0.6106829",
"0.61040837",
"0.60892004",
"0.6087668",
"0.60867226",
"0.60867226",
"0.60867226",
"0.60867226",
"0.60... | 0.713417 | 0 |
DELETE /company_shifts/1 DELETE /company_shifts/1.json | def destroy
@company_shift.destroy
@company_types = CompanyType.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n\n\n @shift.destroy\n respond_to do |format|\n format.html { redirect_to edit_multiple_admin_timesheets_path, notice: 'Shift was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @closed_shift.destroy\n respond_to do |format|\n ... | [
"0.6989541",
"0.696814",
"0.6898898",
"0.68856704",
"0.68725836",
"0.6862499",
"0.6836521",
"0.6834634",
"0.6834634",
"0.6826122",
"0.6808011",
"0.6803566",
"0.67425",
"0.6740696",
"0.6740696",
"0.6691122",
"0.6687945",
"0.6674474",
"0.66690916",
"0.6665249",
"0.6641916",
"... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_company_shift
@company_shift = CompanyShift.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163754",
"0.6045816",
"0.5944853",
"0.59169096",
"0.58892167",
"0.58342934",
"0.5776148",
"0.57057375",
"0.57057375",
"0.56534296",
"0.56209534",
"0.54244673",
"0.54101455",
"0.54101455",
"0.54101455",
"0.53951085",
"0.5378493",
"0.53563684",
"0.53399915",
"0.5338049",
"0... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def company_shift_params
params.require(:company_shift).permit(:name, :in_time, :out_time)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
An iterator that yields each valid row, as a CSVMappingInfo instance | def each_row
mappings_csv.each do |row|
info = CSVMappingInfo.new(row)
yield(info) if info.valid?
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _each\n Engine.new(local_copy.encoded_io, csv_options.merge(headers: headers)).each do |row|\n\n some_value_present = false\n\n if not headers\n\n # represent the row as an array\n array = row.map do |v|\n v = RemoteTable.normalize_whitespace v\n if no... | [
"0.66057307",
"0.6565915",
"0.60905313",
"0.59999245",
"0.59999245",
"0.59498674",
"0.5905667",
"0.59045726",
"0.5892412",
"0.58596873",
"0.58556265",
"0.58288246",
"0.58181924",
"0.57093775",
"0.5648438",
"0.564342",
"0.56305104",
"0.5630107",
"0.56138027",
"0.5589956",
"0.5... | 0.81354845 | 0 |
What items can the item associated with this edition be repositioned to? must be siblings of associated item must be associated with the request of the edition | def displaceable_items
return [] unless fund_item && fund_request
# fund_item.siblings.
# select { |i| fund_request.fund_editions.map(&:fund_item).include? i }
fund_item.siblings.where { |i| i.id.in fund_request.fund_editions.scoped.select { fund_item_id } }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reposition_item\n return true unless displace_item && perspective && perspective == PERSPECTIVES.first\n # Determine insertion point and clear space for move\n insertion_point = displace_item.position + displace_item.subtree.count\n fund_item.fund_grant.fund_items.update_all(\n [ \"position = ... | [
"0.5983622",
"0.5374419",
"0.5356284",
"0.53239363",
"0.5317329",
"0.52716947",
"0.5267188",
"0.5263998",
"0.5261381",
"0.52432865",
"0.5230112",
"0.518521",
"0.51817685",
"0.5179152",
"0.5168443",
"0.5153393",
"0.5104451",
"0.5052966",
"0.50426817",
"0.50413805",
"0.5039999"... | 0.51624626 | 15 |
Returns the index in the PERSPECTIVES sequence for this edition | def perspective_index
return nil unless perspective
PERSPECTIVES.index(perspective)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next_perspective\n return nil unless i = perspective_index\n PERSPECTIVES[i + 1]\n end",
"def idx\n @ob.get_idx\n end",
"def mat_index\n mat_index_vein or stone_layer.mat_index\n end",
"def variants_idx; end",
"def sections_section_index\n return @sections_current_in... | [
"0.605399",
"0.59136665",
"0.5769413",
"0.57262266",
"0.5704773",
"0.5682203",
"0.566657",
"0.56200576",
"0.5611174",
"0.5592594",
"0.54871106",
"0.5432148",
"0.5419046",
"0.5418975",
"0.5418975",
"0.5397104",
"0.53827834",
"0.53802043",
"0.5354266",
"0.5332167",
"0.53293085"... | 0.7412772 | 0 |
Returns the perspective of previous edition in sequence returns nil if this is initial edition | def previous_perspective
i = perspective_index
return nil unless i && i > 0
PERSPECTIVES[i - 1]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def previous_to( edition )\n for_request( edition.fund_request ).\n select { |e| e.perspective == edition.previous_perspective }.first\n end",
"def previous\n return nil unless fund_item && previous_perspective\n fund_item.fund_editions.previous_to( self )\n end",
"def previous_edition_must... | [
"0.7737697",
"0.73219734",
"0.66102594",
"0.6598042",
"0.6578939",
"0.6359814",
"0.6204975",
"0.61508125",
"0.6149064",
"0.6123404",
"0.60993445",
"0.6062543",
"0.5983481",
"0.5973385",
"0.5956944",
"0.59305936",
"0.59098905",
"0.5903615",
"0.58815134",
"0.5872075",
"0.585501... | 0.76223814 | 1 |
Returns the perspective of next_perspective edition in sequence returns nil if this is final edition | def next_perspective
return nil unless i = perspective_index
PERSPECTIVES[i + 1]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def previous_perspective\n i = perspective_index\n return nil unless i && i > 0\n PERSPECTIVES[i - 1]\n end",
"def next_to( edition )\n for_request( edition.fund_request ).\n select { |e| e.perspective == edition.next_perspective }.first\n end",
"def perspective_index\n return nil unl... | [
"0.68127",
"0.68064773",
"0.6439921",
"0.6214101",
"0.61181647",
"0.57111466",
"0.56425285",
"0.55051446",
"0.5480308",
"0.54162145",
"0.53859603",
"0.5072465",
"0.5036942",
"0.5034202",
"0.5031663",
"0.4980995",
"0.48567027",
"0.48474848",
"0.48018762",
"0.4769671",
"0.47684... | 0.7656333 | 0 |
Returns the next edition relative to this edition nil if this edition is last | def next
return nil unless fund_item && next_perspective
fund_item.fund_editions.next_to( self )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next_to( edition )\n for_request( edition.fund_request ).\n select { |e| e.perspective == edition.next_perspective }.first\n end",
"def next\n Expression.where('id > ? AND collection_id = ?', self.id, self.collection_id).order('id ASC').limit(1).first\n end",
"def next_lesson\n lesson =... | [
"0.6882039",
"0.60660666",
"0.6064657",
"0.59875524",
"0.59506786",
"0.5946354",
"0.5946076",
"0.58774585",
"0.58681744",
"0.5836657",
"0.5822708",
"0.57934844",
"0.57925534",
"0.572306",
"0.57220834",
"0.5709581",
"0.57053035",
"0.56845385",
"0.5675045",
"0.5664677",
"0.5648... | 0.6133559 | 1 |
Returns the previous edition relative to this edition nil if this edition is first | def previous
return nil unless fund_item && previous_perspective
fund_item.fund_editions.previous_to( self )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def previous_to( edition )\n for_request( edition.fund_request ).\n select { |e| e.perspective == edition.previous_perspective }.first\n end",
"def previous_revision\n get_revision('PREVIOUS_REVISION')\n end",
"def previous\n self[document.previous_version]\n end",
"d... | [
"0.79039204",
"0.7451857",
"0.7147087",
"0.7135578",
"0.70325875",
"0.70109034",
"0.6996418",
"0.6978191",
"0.6974155",
"0.6962376",
"0.69619954",
"0.6945381",
"0.6945381",
"0.6931341",
"0.6900347",
"0.6891301",
"0.6854726",
"0.68507004",
"0.68462276",
"0.68310887",
"0.681622... | 0.7455394 | 1 |
Returns prior initial editions that this edition would amend returns empty array if no persisted fund_item is associated | def priors
return [] unless fund_item && fund_item.persisted? && fund_request &&
fund_request.persisted?
fund_item.fund_editions.joins { fund_request }.
where { perspective == my { perspective } }.
where { fund_request.created_at < my { fund_request.created_at } }.
merge( FundRequest.uns... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def displaceable_items\n return [] unless fund_item && fund_request\n# fund_item.siblings.\n# select { |i| fund_request.fund_editions.map(&:fund_item).include? i }\n fund_item.siblings.where { |i| i.id.in fund_request.fund_editions.scoped.select { fund_item_id } }\n end",
"def editions\n works.ma... | [
"0.56837493",
"0.55919826",
"0.54680204",
"0.5377061",
"0.5293212",
"0.528254",
"0.51220524",
"0.49602443",
"0.49413267",
"0.4918545",
"0.48971623",
"0.4874449",
"0.48729083",
"0.48711148",
"0.4851337",
"0.48341668",
"0.48306826",
"0.47937712",
"0.47611094",
"0.47561374",
"0.... | 0.6370795 | 0 |
Should not create an fund_edition if there is no previous fund_edition for the fund_item on create only only if the perspective is not first or there is no fund_item | def previous_edition_must_exist
return unless previous_perspective && fund_item
if previous.blank?
errors.add( :perspective, "is not allowed until there is a " +
"#{previous_perspective} fund_edition for the fund_item" )
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parent_must_have_same_perspective_in_request\n return unless perspective && fund_request && fund_item && fund_item.parent\n unless fund_item.parent.fund_editions.for_request( fund_request ).\n map(&:perspective).include? perspective\n errors.add :fund_item, \"parent must be in request\"\n en... | [
"0.6261406",
"0.59662807",
"0.58901405",
"0.5681719",
"0.5626403",
"0.5464684",
"0.54495937",
"0.5411291",
"0.53585285",
"0.532876",
"0.53016484",
"0.528915",
"0.5278043",
"0.52770084",
"0.52730703",
"0.5270749",
"0.5267178",
"0.5267178",
"0.52435213",
"0.5238672",
"0.5221641... | 0.75123936 | 0 |
Assures addition of this item to the request will not exceed the structural quantity limit for the number of actionable peers. It only makes sense to call this when the first edition is created | def fund_item_node_must_be_allowed
return unless fund_item && fund_item.persisted? && appended? &&
perspective && perspective == PERSPECTIVES.first
unless fund_item.allowed_nodes.include? fund_item.node
errors.add :fund_item, "exceeds quantity of #{fund_item.node} that may be appended"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def quantity_max_available_for_amend\n quantity + quantity_rejected\n end",
"def exceeds_appendable_quantity_limit_for_fund_request?( fund_request )\n return false unless fund_request.fund_request_type.appendable_quantity_limit\n return true if ( fund_request.fund_items.appended.where { id != my { id }... | [
"0.6874231",
"0.6671115",
"0.6056067",
"0.586775",
"0.5836694",
"0.5748417",
"0.56923157",
"0.5671349",
"0.56496495",
"0.5633419",
"0.5622628",
"0.5622628",
"0.56104845",
"0.55804783",
"0.55556154",
"0.55345196",
"0.5530679",
"0.5524409",
"0.5513002",
"0.55023754",
"0.5486092... | 0.66089386 | 2 |
Assures displace item is one this item is eligible to displace | def displace_item_must_be_displaceable
return unless displace_item && fund_item
unless displaceable_items.include?( displace_item )
errors.add :displace_item, "cannot be displaced by this item"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def confirm_placement\n return @place_coms.activate && buz if @@place_count < 1 && min_one\n size = $game_party.members.size\n return @place_coms.activate && buz if @@place_count < size && MinAll\n @@place_count = 0\n TactBattleManager.first_turn if !TactBattleManager.party_on_map # 1st units\n T... | [
"0.62690496",
"0.615371",
"0.6083181",
"0.6068247",
"0.5990709",
"0.59387046",
"0.5860245",
"0.5825461",
"0.5798381",
"0.56126845",
"0.5574469",
"0.55659133",
"0.5531644",
"0.55299294",
"0.54988253",
"0.5496196",
"0.5477845",
"0.54742765",
"0.5464684",
"0.54499406",
"0.544979... | 0.7913109 | 0 |
Assures a subitem is not added to a request before its parent | def parent_must_have_same_perspective_in_request
return unless perspective && fund_request && fund_item && fund_item.parent
unless fund_item.parent.fund_editions.for_request( fund_request ).
map(&:perspective).include? perspective
errors.add :fund_item, "parent must be in request"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ignore_parent_exclusion?; end",
"def ignore_parent_exclusion; end",
"def ensure_not_referenced_by_any_item\n\t\tunless items.empty?\n\t\t\terrors.add(:base, 'Na stanie są sztuki tego produktu')\n\t\t\tthrow :abort\n\t\tend\n\tend",
"def parent_exists!\n return if valid_mixin_parent?(params[:parent])\n... | [
"0.59737337",
"0.5844705",
"0.57346356",
"0.57069546",
"0.55932665",
"0.5578463",
"0.5568179",
"0.54938984",
"0.5475223",
"0.5374819",
"0.5346199",
"0.53308296",
"0.5326053",
"0.52890915",
"0.527905",
"0.5260895",
"0.52464944",
"0.5234822",
"0.52225614",
"0.5195864",
"0.51701... | 0.5345264 | 11 |
Repositions item to position of displace_item if displace_item is set Also repositions descendants: to end of list if item is placed at end of list immediately ahead of item if item is not at end of list | def reposition_item
return true unless displace_item && perspective && perspective == PERSPECTIVES.first
# Determine insertion point and clear space for move
insertion_point = displace_item.position + displace_item.subtree.count
fund_item.fund_grant.fund_items.update_all(
[ "position = position + ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def drag_to_order_internal( dimension, items, positions )\n if items.length == 1\n return true\n end\n\n while true\n current=$driver.find_element( items[0][0].to_sym, items[0][1] )\n\n current_loc = current.location.send( dimension )\n jitter = 0\n if dimension == :x\n jit... | [
"0.6029126",
"0.5886067",
"0.56585467",
"0.56436324",
"0.5608612",
"0.5606156",
"0.5593604",
"0.557445",
"0.5549175",
"0.5530068",
"0.5483815",
"0.54716915",
"0.5438279",
"0.54352975",
"0.5426224",
"0.5385948",
"0.5357722",
"0.533242",
"0.52793586",
"0.52786016",
"0.52766246"... | 0.7210604 | 0 |
Use an instance variable to prevent infinite recursion | def set_fund_item_title
return if @set_fund_item_title
if title? && ( perspective == PERSPECTIVES.first )
fund_item.title = title if title? && fund_item.title != title
@set_fund_item_title = true
fund_item.save
@set_fund_item_title = false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def infinite?; end",
"def no_circular_reference\n\n end",
"def parent_variable; end",
"def one_singleton_ancestors_cache; end",
"def one_instance_ancestors_cache; end",
"def initialize\n @instance_variable = 3 # Available in instance methods\n end",
"def nonsense_with_instanc... | [
"0.60482216",
"0.5926169",
"0.59122264",
"0.5905107",
"0.5813291",
"0.58013254",
"0.5682791",
"0.56489855",
"0.5618649",
"0.56053364",
"0.55502665",
"0.5524573",
"0.5523311",
"0.5513155",
"0.5511382",
"0.55035084",
"0.55020756",
"0.5497975",
"0.54856443",
"0.5468405",
"0.5461... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_podcast
@podcast = Podcast.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163754",
"0.6045816",
"0.5944853",
"0.59169096",
"0.58892167",
"0.58342934",
"0.5776148",
"0.57057375",
"0.57057375",
"0.56534296",
"0.56209534",
"0.54244673",
"0.54101455",
"0.54101455",
"0.54101455",
"0.53951085",
"0.5378493",
"0.53563684",
"0.53399915",
"0.5338049",
"0... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def podcast_params
params.require(:podcast).permit(:title, :source, :description, :author, :dateof, :location_id, :file)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
Get city names from the hash | def get_city_names(dial_book)
dial_book.keys
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_city_names(hash)\n \n hash.keys\n \nend",
"def get_city_names(hash)\n\thash.each { |k, v| puts k}\nend",
"def get_city_names(somehash)\n somehash.keys\n end",
"def get_city_name(myhash)\n myhash.keys\nend",
"def get_city_names(hash)\n hash.each{ |k, v| puts k}\nend",
"def get_cit... | [
"0.82532233",
"0.8179079",
"0.7861688",
"0.7727905",
"0.76723766",
"0.7663262",
"0.7639538",
"0.75658274",
"0.7516943",
"0.7432483",
"0.7432483",
"0.74241716",
"0.7383513",
"0.73674905",
"0.73635846",
"0.7300421",
"0.72706527",
"0.723864",
"0.7204035",
"0.7172686",
"0.7134877... | 0.703148 | 22 |
Get area code based on given hash and key | def get_area_code(dial_book, areacode)
dial_book[areacode]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_area_code(hash, k)\n\thash[key]\nend",
"def get_area_code(somehash, key)\n somehash[key]\n end",
"def get_area_code(hash, key)\n \n hash[key]\n \nend",
"def get_area_code(hash, key)\n hash[key]\nend",
"def get_area_code(somehash, key)\n# Write code here\nsomehash[key]\nend",
"def ... | [
"0.83546644",
"0.8275985",
"0.8265433",
"0.81900907",
"0.79980356",
"0.7952049",
"0.79248387",
"0.79248387",
"0.79227644",
"0.7880038",
"0.7821541",
"0.77975863",
"0.7790438",
"0.7685832",
"0.75850207",
"0.7423085",
"0.73710346",
"0.735917",
"0.7281254",
"0.7193891",
"0.71086... | 0.6597191 | 25 |
When a new quote is entered by an agent, test if the price is set | def test_new
quote_details = SAMPLE_QUOTE_DETAILS.deep_dup
quote_details['fixed_price_services_requested']['price'] = 1200
params_hash = {
udprn: SAMPLE_UDPRN,
services_required: SAMPLE_SERVICES_REQUIRED,
payment_terms: SAMPLE_PAYMENT_TERMS,
quote_details: quote_details.to_json
}... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_price\n if self.price.blank?\n raise \"Must supply price for variant or master.price for product.\" if self.is_master\n self.price = calculate_price\n end\n end",
"def check_price\n end",
"def check_price\n if price.nil?\n raise 'Must supply price for variant or ma... | [
"0.69547445",
"0.67651856",
"0.6748587",
"0.6714845",
"0.67146516",
"0.6620478",
"0.66136605",
"0.648939",
"0.6459087",
"0.63538295",
"0.6342111",
"0.63389796",
"0.6214142",
"0.6201827",
"0.6189741",
"0.6121142",
"0.60899544",
"0.60367733",
"0.6006333",
"0.59851444",
"0.59369... | 0.54559135 | 74 |
When a new quote is entered by an agent for rent, test if the price is set | def test_new_rent
quote_details = SAMPLE_QUOTE_DETAILS.deep_dup
quote_details['fixed_price_services_requested']['price'] = 1200
params_hash = {
udprn: '123456',
services_required: SAMPLE_SERVICES_REQUIRED,
payment_terms: SAMPLE_PAYMENT_TERMS,
quote_details: quote_details.to_json
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_price\n if self.price.blank?\n raise \"Must supply price for variant or master.price for product.\" if self.is_master\n self.price = calculate_price\n end\n end",
"def check_price\n if price.nil?\n raise 'Must supply price for variant or master.price for product.' if se... | [
"0.7020729",
"0.6849808",
"0.68244493",
"0.6800947",
"0.6775738",
"0.673583",
"0.67241764",
"0.6471983",
"0.639119",
"0.63538456",
"0.63443816",
"0.6302374",
"0.62973374",
"0.6264567",
"0.6166056",
"0.61503",
"0.61000115",
"0.60621464",
"0.6050279",
"0.6045607",
"0.59831715",... | 0.58636206 | 30 |
When a quote of an agent is accepted by the vendor | def test_submit
quote_details = SAMPLE_QUOTE_DETAILS.deep_dup
quote_details['fixed_price_services_requested']['price'] = 1200
params_hash = {
udprn: SAMPLE_UDPRN,
services_required: SAMPLE_SERVICES_REQUIRED,
payment_terms: SAMPLE_PAYMENT_TERMS,
quote_details: quote_details.to_json
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def accept_quote_from_agent(agent_id, agent_quote)\n klass = Agents::Branches::AssignedAgents::Quote\n new_status = klass::STATUS_HASH['New']\n won_status = klass::STATUS_HASH['Won']\n lost_status = klass::STATUS_HASH['Lost']\n response = nil\n agent = Agents::Branches::AssignedAgent.find(agent_i... | [
"0.76205754",
"0.6126226",
"0.612621",
"0.61214876",
"0.60377556",
"0.59868056",
"0.5866914",
"0.585582",
"0.58384484",
"0.5832543",
"0.57661885",
"0.57504696",
"0.5722477",
"0.56572497",
"0.56063217",
"0.5579411",
"0.5573728",
"0.55569506",
"0.55457705",
"0.5541432",
"0.5537... | 0.0 | -1 |
When a quote of an agent is accepted by the vendor | def test_submit_rent
quote_details = SAMPLE_QUOTE_DETAILS.deep_dup
quote_details['fixed_price_services_requested']['price'] = 1200
params_hash = {
udprn: '123456',
services_required: SAMPLE_SERVICES_REQUIRED,
payment_terms: SAMPLE_PAYMENT_TERMS,
quote_details: quote_details.to_json
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def accept_quote_from_agent(agent_id, agent_quote)\n klass = Agents::Branches::AssignedAgents::Quote\n new_status = klass::STATUS_HASH['New']\n won_status = klass::STATUS_HASH['Won']\n lost_status = klass::STATUS_HASH['Lost']\n response = nil\n agent = Agents::Branches::AssignedAgent.find(agent_i... | [
"0.7621704",
"0.612692",
"0.6126445",
"0.6120377",
"0.603706",
"0.5986807",
"0.5866981",
"0.58567786",
"0.58388877",
"0.5832192",
"0.57654667",
"0.57507116",
"0.5722139",
"0.5657795",
"0.56058663",
"0.5578158",
"0.5573781",
"0.55567974",
"0.5546354",
"0.55416286",
"0.5536791"... | 0.0 | -1 |
to extract snippet details | def parse_snippet_details line, prefix
details = line[prefix.length, line.length - prefix.length]
details_split = details.split('::').map(&:strip)
return nil unless (1..2).cover? details_split.size
{
prefix: details_split[0],
description: details_split[1]
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_book_snippet(book)\nend",
"def snippet_title snippet\n if snippet.description.blank?\n \"Snippet \\##{snippet.id}\"\n else\n snippet.description\n end\n end",
"def snippet\n snippet = text.split(\"\\r\\n\\r\\n\")[0]\n snippet = snippet[0, 500] + ' **[. . .]**' if snippet.lengt... | [
"0.6871315",
"0.6653304",
"0.64274013",
"0.6308639",
"0.6286687",
"0.62132436",
"0.62132096",
"0.6162067",
"0.61417264",
"0.6130236",
"0.61067665",
"0.6012712",
"0.5994749",
"0.59891176",
"0.59769166",
"0.5973021",
"0.5963519",
"0.5933907",
"0.5933557",
"0.591644",
"0.591644"... | 0.7106334 | 0 |
return array of snippets with full details | def snippets filepath, fileext
prefix = snippet_detail_prefix(fileext)
snippet = nil; result = []
readlines(filepath) do |line|
unless line.strip.start_with?(prefix)
snippet[:body] << line unless snippet.nil?
next
end
result << snippet unless snippet.nil?
snippet = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def snippets\n self.mounting_point.snippets\n end",
"def index\n @snippets = Snippet.all\n end",
"def snippets\n @clip = Clip.find(params[:id])\n end",
"def code_snippets\n raise Nanoc3::Errors::DataNotYetAvailable.new('Code snippets', false) unless @code_snippets_loaded\n ... | [
"0.698081",
"0.6980106",
"0.650929",
"0.63259524",
"0.6298091",
"0.61723673",
"0.6017397",
"0.6011615",
"0.6005376",
"0.59950984",
"0.59722006",
"0.59676695",
"0.5928562",
"0.5914433",
"0.5890949",
"0.587035",
"0.58653075",
"0.5862836",
"0.5848987",
"0.5846406",
"0.583702",
... | 0.692172 | 2 |
This method is used on the new thermometer form to populate the notification's list checkboxes | def user_email_list
@email_list = []
EmailList.all.each do |email|
if email.creator_id == current_user.id
@email_list << email
end
end
@email_list
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_hidden_field_for_checkbox; end",
"def notification_field(notifiable)\n tag_data =\n if notifiable.parent.present?\n {:parent_notifiable => notifiable.parent}\n else\n {:disables => \"input[data-parent-notifiable=#{notifiable.name}]\"}\n end\n tag = check_box_tag('sett... | [
"0.5769211",
"0.5617641",
"0.5567835",
"0.54448247",
"0.5402423",
"0.5361615",
"0.5273762",
"0.52312833",
"0.51466024",
"0.514188",
"0.51378745",
"0.51358765",
"0.512013",
"0.51186824",
"0.5095027",
"0.50896746",
"0.5086242",
"0.5068569",
"0.50683165",
"0.50672203",
"0.506459... | 0.0 | -1 |
The history id is `hid`, but this cannot set as primary key or temporal assocations will break. Solutions are welcome. | def id
hid
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash_id\n @hid\n end",
"def set_history\n @history = History.find(params[:id])\n end",
"def set_history\n @history = History.find(params[:id])\n end",
"def set_history\n @history = History.find(params[:id])\n end",
"def set_history\n @history = History.find(params[:id])\n... | [
"0.6448307",
"0.61817586",
"0.61709505",
"0.61699265",
"0.61581206",
"0.61581206",
"0.61581206",
"0.6147013",
"0.6019479",
"0.5999761",
"0.59658414",
"0.59171665",
"0.58898824",
"0.5887509",
"0.586811",
"0.5855467",
"0.58539736",
"0.58376664",
"0.5803827",
"0.58000183",
"0.57... | 0.58157456 | 19 |
Returns the previous history entry, or nil if this is the first one. | def pred
return if self.valid_from.nil?
if self.class.timeline_associations.empty?
self.class.where('id = ? AND upper(validity) = ?', rid, valid_from).first
else
super(:id => rid, :before => valid_from, :table => self.class.superclass.quoted_table_name)
e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def previous_history()\r\n @history_offset!=0 ? @the_history[@history_offset-=1] : nil\r\n end",
"def prev_by_history\n unless has_previous_version?\n # This undo record type has no previous version information.\n return nil\n end\n\n undo_log = roll_ptr[:undo_log]\n older_undo_page = @... | [
"0.8210131",
"0.7800602",
"0.7743594",
"0.76426625",
"0.7548803",
"0.7528796",
"0.7523437",
"0.7430943",
"0.73746586",
"0.73477876",
"0.7272318",
"0.72562563",
"0.72246677",
"0.72114366",
"0.7188047",
"0.7134371",
"0.7131797",
"0.711081",
"0.7086865",
"0.7076077",
"0.70357585... | 0.0 | -1 |
Returns the next history entry, or nil if this is the last one. | def succ
return if self.valid_to.nil?
if self.class.timeline_associations.empty?
self.class.where('id = ? AND lower(validity) = ?', rid, valid_to).first
else
super(:id => rid, :after => valid_to, :table => self.class.superclass.quoted_table_name)
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next_history()\r\n (@history_offset == @history_length) ? nil : @the_history[@history_offset+=1]\r\n end",
"def next(current)\n if (@position < @history.length - 1)\n @position = @position + 1\n return @history[@position]\n end\n return current\n... | [
"0.7419938",
"0.65747213",
"0.6546505",
"0.64429575",
"0.64149827",
"0.6344159",
"0.6325789",
"0.62892705",
"0.62679255",
"0.62404823",
"0.62322515",
"0.6226597",
"0.6199961",
"0.6177919",
"0.6132413",
"0.6084726",
"0.6084726",
"0.6067383",
"0.6058302",
"0.605242",
"0.6035645... | 0.0 | -1 |
Returns the first history entry | def first
self.class.where(:id => rid).order('lower(validity)').first
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def one_history\n history = History.find(@id)\n history\n end",
"def last\n @history.last\n end",
"def last_event\n history.last\n end",
"def last_event\n history.last\n end",
"def current_history()\r\n return ((@history_offset == @history_length)... | [
"0.7355101",
"0.7037917",
"0.6989981",
"0.6989981",
"0.6711839",
"0.67001605",
"0.6606055",
"0.6599983",
"0.6553777",
"0.6472791",
"0.6472791",
"0.6391333",
"0.63729686",
"0.6352639",
"0.63458097",
"0.6328729",
"0.63078886",
"0.63078886",
"0.62996125",
"0.6299601",
"0.6288189... | 0.0 | -1 |
Returns the last history entry | def last
self.class.where(:id => rid).order('lower(validity)').last
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def last\n @history.last\n end",
"def last_event\n history.last\n end",
"def last_event\n history.last\n end",
"def last(n = 1)\n return @history[-n] ;\n end",
"def current_location\n return @history[-1]\n end",
"def last() end",
"def last_id\n ... | [
"0.8610564",
"0.82697845",
"0.82697845",
"0.77995265",
"0.73122287",
"0.72743773",
"0.71804845",
"0.71743417",
"0.71713",
"0.7130785",
"0.7071298",
"0.7071298",
"0.7071298",
"0.70678943",
"0.7053618",
"0.7032173",
"0.7011977",
"0.69974935",
"0.6992565",
"0.6991917",
"0.692913... | 0.0 | -1 |
Returns this history entry's current record | def current_version
self.class.non_history_superclass.find(rid)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_entry\n @currentEntry || @current_entry\n end",
"def current\n @db[:current]\n end",
"def current_entry; end",
"def current_record_id\n @current_record_id\n end",
"def last\n @history.last\n end",
"def current\n\t\t\t\t\t\t@current = where(current: true).order(... | [
"0.7423607",
"0.7047493",
"0.70362717",
"0.6870194",
"0.68140835",
"0.6753778",
"0.67091304",
"0.67091304",
"0.66998523",
"0.66105676",
"0.65978783",
"0.6562919",
"0.65408546",
"0.6508316",
"0.64918745",
"0.6447095",
"0.6358638",
"0.63480747",
"0.634105",
"0.63308614",
"0.631... | 0.56455916 | 86 |
Returns a readonly representation of this record as it was +time+ ago. Returns nil if no record is found. | def as_of(time)
_as_of(time).first
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ago(time = ::Time.now)\n time - self\n end",
"def [](time)\n prev_time = prev_time time\n fetch prev_time if prev_time\n end",
"def last_time\n last = entries.order(Sequel.desc(:time)).first\n if last.nil?\n last_checked\n else\n last.time\n end\n end",
"def last_t... | [
"0.6691538",
"0.6673723",
"0.6360619",
"0.6300261",
"0.62592876",
"0.62592876",
"0.6220446",
"0.6220446",
"0.60736626",
"0.60588",
"0.5965311",
"0.5949435",
"0.5898633",
"0.5894009",
"0.58468014",
"0.5766232",
"0.5766232",
"0.5765034",
"0.5762449",
"0.5752282",
"0.5707895",
... | 0.0 | -1 |
Returns a readonly representation of this record as it was +time+ ago. Raises ActiveRecord::RecordNotFound if no record is found. | def as_of!(time)
_as_of(time).first!
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ago(time = ::Time.now)\n time - self\n end",
"def ago(t = Time.now); t - self; end",
"def ago(t = Time.now); t - self; end",
"def [](time)\n prev_time = prev_time time\n fetch prev_time if prev_time\n end",
"def ago\n Time.now - self\n end",
"def last_time\n @last_time\n end"... | [
"0.68538034",
"0.64907825",
"0.64907825",
"0.64157313",
"0.6273727",
"0.6196134",
"0.61760014",
"0.61416006",
"0.6057444",
"0.6033993",
"0.59532726",
"0.59532726",
"0.59522265",
"0.59522265",
"0.59505635",
"0.5870532",
"0.58483136",
"0.5830741",
"0.5823725",
"0.5802484",
"0.5... | 0.0 | -1 |
Delegates to +HistoryMethods.as_of+ to fetch this instance as it was on +time+. Used both by +as_of+ and +as_of!+ for performance reasons, to | def _as_of(time)
self.class.as_of(time).where(:id => self.id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def as_of(time)\n history.as_of(time)\n end",
"def as_of(time)\n self.class.as_of(time).where(:id => self.id).first!\n end",
"def _as_of(time)\n self.class.as_of(time).where(id: self.id)\n end",
"def as_of(time)\n superclass.from(virtual_table_at(time)).as_of_time!(time)\... | [
"0.7804622",
"0.7419704",
"0.73379743",
"0.71226674",
"0.6870721",
"0.67308253",
"0.66579866",
"0.6657176",
"0.6492876",
"0.6492876",
"0.6313147",
"0.62961406",
"0.62961406",
"0.6279477",
"0.6224774",
"0.6181799",
"0.6167122",
"0.6167122",
"0.6067766",
"0.6067766",
"0.5941304... | 0.73109984 | 3 |
Return the complete readonly history of this instance. | def history
self.class.history.of(self)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def history\n return @history\n end",
"def history\n return @history\n end",
"def history\n @history.dup\n end",
"def history\r\n []\r\n end",
"def history\n History\n end",
"def all_history\n history(history: {})\n end",... | [
"0.7778638",
"0.7778638",
"0.7760832",
"0.75772756",
"0.7504393",
"0.7350167",
"0.72899663",
"0.721835",
"0.71758175",
"0.7162294",
"0.70867103",
"0.7040893",
"0.69961405",
"0.69457936",
"0.67513406",
"0.6729",
"0.6686172",
"0.66154385",
"0.66154385",
"0.66154385",
"0.6603615... | 0.76248187 | 4 |
Returns an Array of timestamps for which this instance has an history record. Takes temporal associations into account. | def timeline(options = {})
self.class.history.timeline(self, options)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def history_timestamps\n self.class.history.timestamps do |query|\n query.where(:id => self)\n end\n end",
"def timestamps\n assocs = reflect_on_all_associations.select {|a|\n [:belongs_to, :has_one, :has_many].include?(a.macro) && a.klass.chrono?\n }\n\n models ... | [
"0.79922706",
"0.7637697",
"0.7094141",
"0.69125617",
"0.65663856",
"0.6515052",
"0.64929706",
"0.64206755",
"0.64200133",
"0.64200133",
"0.6326164",
"0.6326164",
"0.627344",
"0.61779135",
"0.61587995",
"0.6158588",
"0.6108725",
"0.6043202",
"0.59935665",
"0.59794873",
"0.597... | 0.5424004 | 75 |
Returns a boolean indicating whether this record is an history entry. | def historical?
self.attributes.key?('as_of_time') || self.kind_of?(self.class.history)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def history?\n true\n end",
"def history?\n true\n end",
"def should_record_history?\n historiographer_changes? && !@no_history\n end",
"def has_history?\n AdminHistory rescue nil\n end",
"def has_history?\n Ticket.client(client).any?\n end",
"def track_history... | [
"0.7849751",
"0.78141093",
"0.76756006",
"0.7248614",
"0.69474196",
"0.680971",
"0.66794026",
"0.65788937",
"0.6535212",
"0.6484847",
"0.62598026",
"0.6219549",
"0.6217413",
"0.61823046",
"0.6177811",
"0.6169373",
"0.61647314",
"0.6108134",
"0.607195",
"0.607195",
"0.59908366... | 0.7196394 | 4 |
Read the virtual 'as_of_time' attribute and return it as an UTC timestamp. | def as_of_time
Conversions.string_to_utc_time attributes_before_type_cast['as_of_time']
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def as_of_time\n Conversions.string_to_utc_time attributes['as_of_time']\n end",
"def as_of_time\n @_as_of_time\n end",
"def as_of_time\n @_as_of_time\n end",
"def time\n @time ||= incorporate_utc_offset(@utc, utc_offset)\n end",
"def at\n Timestamp.utc(... | [
"0.8716803",
"0.7382482",
"0.7382482",
"0.67233807",
"0.64524525",
"0.64468765",
"0.6410486",
"0.63881093",
"0.6374156",
"0.63538134",
"0.62635976",
"0.6221929",
"0.6193198",
"0.6186081",
"0.61629176",
"0.6158598",
"0.6102574",
"0.60597974",
"0.60246176",
"0.6018449",
"0.6012... | 0.83642083 | 1 |
Inhibit destroy of historical records | def destroy
raise ActiveRecord::ReadOnlyRecord, 'Cannot delete historical records' if historical?
super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n raise ActiveRecord::ReadOnlyRecord, 'Cannot delete historical records'\n end",
"def record_destroy\n paper_trail.record_destroy\n end",
"def before_destroy_with_historic\n before_destroy_without_historic\n historic_copy_to_history\n end",
"de... | [
"0.8470377",
"0.709615",
"0.70774204",
"0.6921788",
"0.6621917",
"0.65967417",
"0.6586898",
"0.6549837",
"0.6457719",
"0.6419643",
"0.6370585",
"0.63575375",
"0.63575375",
"0.6333946",
"0.6331635",
"0.630651",
"0.6302701",
"0.62106514",
"0.6208339",
"0.6204467",
"0.6191763",
... | 0.8418415 | 2 |
Returns the previous record in the history, or nil if this is the only recorded entry. | def pred(options = {})
if self.class.timeline_associations.empty?
history.order('upper(validity) DESC').offset(1).first
else
return nil unless (ts = pred_timestamp(options))
self.class.as_of(ts).order(%[ #{options[:table] || self.class.quoted_table_name}."hid" DESC ]).find(options[:i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def previous_history()\r\n @history_offset!=0 ? @the_history[@history_offset-=1] : nil\r\n end",
"def prev_by_history\n unless has_previous_version?\n # This undo record type has no previous version information.\n return nil\n end\n\n undo_log = roll_ptr[:undo_log]\n older_undo_page = @... | [
"0.7817049",
"0.77409077",
"0.7657401",
"0.74073833",
"0.7303047",
"0.72244376",
"0.71988547",
"0.7188246",
"0.714139",
"0.71204585",
"0.71152747",
"0.7071932",
"0.70504344",
"0.7035816",
"0.70123374",
"0.6990016",
"0.6983041",
"0.6980637",
"0.6970608",
"0.6965267",
"0.694263... | 0.0 | -1 |
Returns the previous timestamp in this record's timeline. Includes temporal associations. | def pred_timestamp(options = {})
if historical?
options[:before] ||= as_of_time
timeline(options.merge(:limit => 1, :reverse => true)).first
else
timeline(options.merge(:limit => 2, :reverse => true)).second
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prev\n unless self.tll_prev.nil?\n return self.class.unscoped.where(_id: self.tll_prev).first\n end\n\n nil\n end",
"def previous\n account.statements.except(:order).chronologically.entered_before( first.entered_at ).last\n end",
"def previous\n a... | [
"0.7416596",
"0.72887236",
"0.6941281",
"0.6893835",
"0.68078953",
"0.67733526",
"0.6744306",
"0.6713796",
"0.66807914",
"0.6667855",
"0.66078055",
"0.6601657",
"0.65639204",
"0.6542541",
"0.65241796",
"0.64872754",
"0.6483085",
"0.64648694",
"0.64433515",
"0.6422222",
"0.641... | 0.64023596 | 21 |
Returns the next record in the history timeline. | def succ(options = {})
unless self.class.timeline_associations.empty?
return nil unless (ts = succ_timestamp(options))
self.class.as_of(ts).order(%[ #{options[:table] || self.class.quoted_table_name}."hid" DESC ]).find(options[:id] || id)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next_history()\r\n (@history_offset == @history_length) ? nil : @the_history[@history_offset+=1]\r\n end",
"def next(current)\n if (@position < @history.length - 1)\n @position = @position + 1\n return @history[@position]\n end\n return current\n... | [
"0.7134676",
"0.70978",
"0.70020896",
"0.6744791",
"0.6682708",
"0.66630775",
"0.65795684",
"0.6478741",
"0.6440745",
"0.6434381",
"0.64307994",
"0.64130837",
"0.63988626",
"0.6306634",
"0.6301002",
"0.62999153",
"0.6283558",
"0.6279795",
"0.6277237",
"0.6229093",
"0.6208998"... | 0.0 | -1 |
Returns the next timestamp in this record's timeline. Includes temporal associations. | def succ_timestamp(options = {})
return nil unless historical?
options[:after] ||= as_of_time
timeline(options.merge(:limit => 1, :reverse => false)).first
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next_time\n\n schedule_info\n end",
"def next_occurrence_time_attr\n next_event_instance? ? next_event_instance.start : nil\n end",
"def timestamp\n first(:timestamp)\n end",
"def next now\n return nil if @empty\n\n today = Date.parse(now.to_s)\n tomorrow = today + ... | [
"0.6507697",
"0.64915425",
"0.59795934",
"0.5942522",
"0.59171003",
"0.5913373",
"0.59019774",
"0.58908516",
"0.5785522",
"0.5640834",
"0.5626949",
"0.5544398",
"0.5526842",
"0.5517942",
"0.5465811",
"0.54218227",
"0.538026",
"0.5380059",
"0.53579265",
"0.5315716",
"0.5304159... | 0.65059894 | 1 |
Returns the current history version | def current_version
self.historical? ? self.class.find(self.id) : self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_version\n version_number rev\n end",
"def current_version\n versions.first\n end",
"def history\n History\n end",
"def history\n @vcs.history\n end",
"def get_latest_revision\n @current_revision\n end",
"def current_version\n find( :first, :order => 'numbe... | [
"0.7685327",
"0.73371464",
"0.72843945",
"0.72782874",
"0.72782606",
"0.72425854",
"0.7219271",
"0.72093",
"0.7199203",
"0.7136455",
"0.7135228",
"0.70959455",
"0.704825",
"0.70135635",
"0.68865955",
"0.68853265",
"0.6855682",
"0.6823928",
"0.6814451",
"0.68125737",
"0.680026... | 0.762657 | 2 |
Returns the differences between this entry and the previous history one. See: +changes_against+. | def last_changes
pred = self.pred
changes_against(pred) if pred
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def previous_history\n history_size = @history.size\n\n @history_index = if @history_index && @history_index < history_size\n [@history_index + 1, history_size - 1].min\n else\n 0\n end\n\n self.value = @hist... | [
"0.68998003",
"0.68909764",
"0.68542576",
"0.66307795",
"0.6619988",
"0.652131",
"0.6445441",
"0.6445441",
"0.6433238",
"0.6433238",
"0.6418304",
"0.6396205",
"0.6378407",
"0.6373064",
"0.63537323",
"0.6351687",
"0.6335963",
"0.6301247",
"0.6270926",
"0.627027",
"0.62297946",... | 0.628822 | 18 |
Returns the differences between this record and an arbitrary reference record. The changes representation is an hash keyed by attribute whose values are arrays containing previous and current attributes values the same format used by ActiveModel::Dirty. | def changes_against(ref)
self.class.attribute_names_for_history_changes.inject({}) do |changes, attr|
old, new = ref.public_send(attr), self.public_send(attr)
changes.tap do |c|
changed = old.respond_to?(:history_eql?) ?
!old.history_eql?(new) : old != new
c[attr]... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attribute_difference_from(reference_record)\n excluded_list = Kernel.const_get('Compare::Records::'+ record.class.to_s.upcase + \"_EXCLUSIONS\")\n diff_record = record\n Compare::Records._attr_diff(reference_record, diff_record, excluded_list)\n end",
"def extract_changes_from(record)\n ... | [
"0.71363354",
"0.6843336",
"0.67951244",
"0.6513844",
"0.64720684",
"0.63765025",
"0.6353679",
"0.6242087",
"0.62411803",
"0.62389874",
"0.61961114",
"0.61961114",
"0.61799157",
"0.61772853",
"0.61524",
"0.6148638",
"0.61175287",
"0.6087458",
"0.6075347",
"0.6069593",
"0.6050... | 0.733429 | 1 |
In the History context, prefill the :on options with the validity interval. | def time_query(match, time, options = {})
options[:on] ||= :validity
super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validity_period\n super\n end",
"def set_validity_period(opts)\n opts = check_params(opts,[:ranges])\n super(opts)\n end",
"def initialize(options)\n @base_url = BASE_URLS[:history]\n validate_keys(options)\n \n @stock_symbol = options[:stock_symbol]\n @start_d... | [
"0.5875241",
"0.5653855",
"0.5558361",
"0.5496065",
"0.548696",
"0.5368735",
"0.5305156",
"0.5260366",
"0.5228948",
"0.52054805",
"0.5175858",
"0.51260984",
"0.51020926",
"0.50803596",
"0.5045978",
"0.50451064",
"0.5042653",
"0.50330156",
"0.5012484",
"0.50066876",
"0.5005455... | 0.5410759 | 5 |
To identify this class as the History subclass | def history?
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_sti_class(type_name)\n super(type_name + \"::History\")\n end",
"def history\n self.class.history.of(self)\n end",
"def history\n self.class.history.of(self)\n end",
"def non_history_superclass(klass = self)\n if klass.superclass.respond_to?(:history?) && k... | [
"0.76419765",
"0.730489",
"0.730489",
"0.69916975",
"0.68631303",
"0.6759691",
"0.6759691",
"0.6759691",
"0.6687542",
"0.6676342",
"0.65522826",
"0.63483155",
"0.6249542",
"0.6247509",
"0.6247509",
"0.6225499",
"0.62141657",
"0.62133837",
"0.61558914",
"0.6151985",
"0.6151985... | 0.59461653 | 30 |
Getting the correct quoted_table_name can be tricky when STI is involved. If Orange < Fruit, then Orange::History < Fruit::History (see define_inherited_history_model_for). This means that the superclass method returns Fruit::History, which will give us the wrong table name. What we actually want is the superclass of F... | def non_history_superclass(klass = self)
if klass.superclass.respond_to?(:history?) && klass.superclass.history?
non_history_superclass(klass.superclass)
else
klass.superclass
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def table_name\n @table_name ||= (superclass == SmallRecord::Base) ? default_table_name : superclass.table_name\n end",
"def table_name\n must_be_defined_in_derived_class\n end",
"def table_name\n self.class.name.demodulize.tableize\n end",
"def undecorated_table_name(clas... | [
"0.6889504",
"0.68645525",
"0.68568254",
"0.67846054",
"0.66774416",
"0.6644395",
"0.66311306",
"0.6500139",
"0.6471211",
"0.64506453",
"0.6408679",
"0.64020324",
"0.6399476",
"0.638482",
"0.63812405",
"0.6371647",
"0.6356668",
"0.6330519",
"0.6315683",
"0.6282341",
"0.628234... | 0.64180225 | 10 |
Fetches as of +time+ records. | def as_of(time, scope = nil)
as_of = non_history_superclass.unscoped.from(virtual_table_at(time))
# Add default scopes back if we're passed nil or a
# specific scope, because we're .unscopeing above.
#
scopes = !scope.nil? ? [scope] : (
superclass.default_scopes.map do... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def at(time)\n from, to = quoted_history_fields\n unscoped.\n select(\"#{quoted_table_name}.*, '#{time}' AS as_of_time\").\n where(\"'#{time}' >= #{from} AND '#{time}' < #{to}\")\n end",
"def at(time)\n time = Conversions.time_to_utc_string(time.utc) if time.kind_of?(T... | [
"0.65151024",
"0.65042514",
"0.6256263",
"0.62534946",
"0.6160908",
"0.6135084",
"0.6036122",
"0.60200423",
"0.58741206",
"0.5837056",
"0.5742429",
"0.5729856",
"0.5672717",
"0.5550107",
"0.55307865",
"0.5486923",
"0.5486923",
"0.54763806",
"0.5442046",
"0.5431439",
"0.542210... | 0.0 | -1 |
Fetches history record at the given time | def at(time)
time = Conversions.time_to_utc_string(time.utc) if time.kind_of?(Time) && !time.utc?
unscoped.
select("#{quoted_table_name}.*, #{connection.quote(time)}::timestamp AS as_of_time").
time_query(:at, time)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def request_history(timestamp=1.day.ago)\n @ws.send({request: \"history\", timestamp: timestamp}.to_json)\n end",
"def at(time)\n from, to = quoted_history_fields\n unscoped.\n select(\"#{quoted_table_name}.*, '#{time}' AS as_of_time\").\n where(\"'#{time}' >= #{from} AND ... | [
"0.67315185",
"0.6708553",
"0.65470165",
"0.65022576",
"0.63956493",
"0.62007165",
"0.61997336",
"0.6172566",
"0.6168423",
"0.6131217",
"0.60683966",
"0.5978555",
"0.5942937",
"0.5890026",
"0.58375883",
"0.57894397",
"0.57854885",
"0.57790476",
"0.5776504",
"0.5774908",
"0.57... | 0.0 | -1 |
Returns the history sorted by recorded_at | def sorted
all.order(%[ #{quoted_table_name}."recorded_at", #{quoted_table_name}."hid" ])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def history\n from = @from.to_i\n limit = @to.to_i - from\n # Excecute the find of comparations\n histories = @to ? History.offset(from).limit(limit) : History.all\n histories\n end",
"def sorted_history(user)\n return (user.apicalls.sort do |a,b| b.created_at <=> a.created_at end)... | [
"0.6989081",
"0.6899587",
"0.68404436",
"0.6803877",
"0.6593376",
"0.6522127",
"0.64832836",
"0.6470811",
"0.645442",
"0.64150465",
"0.6398155",
"0.6367173",
"0.6325826",
"0.6320394",
"0.6248331",
"0.62268466",
"0.6213991",
"0.6207329",
"0.6198692",
"0.61746055",
"0.61746055"... | 0.6376011 | 11 |
Fetches the given +object+ history, sorted by history record time by default. Always includes an "as_of_time" column that is either the upper bound of the validity range or now() if history validity is maximum. | def of(object)
where(:id => object).extend(HistorySelect)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def of(object)\n now = 'LEAST(valid_to, now()::timestamp)'\n readonly.\n select(\"#{table_name}.*, #{now} AS as_of_time\").\n order(\"#{table_name}.recorded_at, hid\").\n where(:id => object)\n end",
"def read_history_for_object(object, field = :created_at)\n ... | [
"0.69956005",
"0.6933499",
"0.635342",
"0.58278257",
"0.56566143",
"0.556842",
"0.5490411",
"0.5362389",
"0.53400666",
"0.52883816",
"0.5266169",
"0.52323115",
"0.5215689",
"0.51557034",
"0.5147986",
"0.51367956",
"0.5089831",
"0.5053833",
"0.5050993",
"0.5005288",
"0.4971060... | 0.5950177 | 3 |
HACK FIXME. When querying history, ChronoModel does not add his timestamps and sorting if there is an aggregate function in the select list as it is likely what you'll want. However, if you have a query that performs an aggregate in a subquery, the code below will do the wrong thing and you'll have to forcibly add back... | def force_history_fields
select(HistorySelect::SELECT_VALUES).order(HistorySelect::ORDER_VALUES[quoted_table_name])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def timestamps\n assocs = reflect_on_all_associations.select {|a|\n [:belongs_to, :has_one, :has_many].include?(a.macro) && a.klass.chrono?\n }\n\n models = [self].concat(assocs.map {|a| a.klass.history})\n fields = models.inject([]) {|a,m| a.concat m.quoted_history_fields}\n\n... | [
"0.6326943",
"0.6107669",
"0.6058868",
"0.6010609",
"0.5861276",
"0.57831836",
"0.5742098",
"0.5736792",
"0.5712105",
"0.5669337",
"0.5648388",
"0.55975187",
"0.5578048",
"0.55738145",
"0.553442",
"0.5508729",
"0.54837847",
"0.5436687",
"0.5425763",
"0.53943086",
"0.5383277",... | 0.61933905 | 1 |
def num_points_scored(player) game_hash.each do |team, stats| team.each do |stat, value| if value == player game_hash[team][stat][:points] end end end end | def shoe_size(player_x)
game_hash.each do |home_away, keys|
keys[:players].each do |player|
return player[:shoe] if player[:player_name] == player_x
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def num_points_scored(player)\n game_hash.each do |k, team|\n team[:players].each do |e|\n if e[:player_name] == player\n return e[:points]\n end\n end\n end\nend",
"def num_points_scored(player)\n game_hash.each_value do |team|\n team[:players].each do |name, player_data|\n if ... | [
"0.9308854",
"0.92875624",
"0.9234497",
"0.9132628",
"0.91320175",
"0.90899175",
"0.90475494",
"0.904335",
"0.9040437",
"0.9008662",
"0.89918584",
"0.8987222",
"0.897153",
"0.8962254",
"0.8960512",
"0.89594555",
"0.89534324",
"0.89513177",
"0.894707",
"0.8915755",
"0.8913466"... | 0.0 | -1 |
distributes the hearing days evenly using the number of rooms specified. allocated_days: [4, 2018] => 11, [9, 2018] => 21, [5, 2018] => 22, [8, 2018] => 23, [6, 2018] => 21, [7, 2018] => 20 available_days: [4, 2018] => 9, [5, 2018] => 19, [6, 2018] => 19, [7, 2018] => 17, [8, 2018] => 21, [9, 2018] => 17 | def distribute_days_evenly(allocated_days, available_days, num_of_rooms)
allocation_keys = allocated_days.keys
j = 0
while j < (allocated_days.size * num_of_rooms)
i = 0
until i >= (allocation_keys.size - 1)
month = allocation_keys[i]
next_month = allocation_keys[i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def available_days\n unavailable = []\n unavailable = collection_of_unavailable_days.split unless collection_of_unavailable_days.blank?\n (self.meeting.calc_tentative_days - unavailable).join(' ')\n end",
"def find_available_rooms(start_date, end_date) \n available_room_ids = []\n \n ... | [
"0.6379933",
"0.6271557",
"0.6210084",
"0.6058481",
"0.6040588",
"0.5951897",
"0.59272814",
"0.58354336",
"0.5822048",
"0.5809066",
"0.57979405",
"0.5778979",
"0.57452184",
"0.5744871",
"0.57315135",
"0.5707399",
"0.57015985",
"0.57011586",
"0.5693784",
"0.56705636",
"0.56682... | 0.8520748 | 0 |
completed Oct 2017 Your code here | def serial_average(str)
b = str.split('-')
"#{b[0]}-#{((b[1].to_f+b[2].to_f)/2).round(2)}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def probers; end",
"def schubert; end",
"def suivre; end",
"def terpene; end",
"def verdi; end",
"def refutal()\n end",
"def villian; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; ... | [
"0.729636",
"0.7212071",
"0.7126171",
"0.70825887",
"0.6674341",
"0.6651248",
"0.66464984",
"0.66084826",
"0.6550438",
"0.6550438",
"0.6550438",
"0.6550438",
"0.6550438",
"0.6550438",
"0.6550438",
"0.6550438",
"0.6550438",
"0.6471417",
"0.64415705",
"0.643303",
"0.64132464",
... | 0.0 | -1 |
Enters conservation ref number | def enter_conservation_ref_num(data_set)
cons_ref_num = data_set[CoreConservationData::CONS_REF_NUM.name]
logger.debug "Entering condition ref number '#{cons_ref_num}'"
wait_for_element_and_type(cons_ref_num_input_locator(0), cons_ref_num) if cons_ref_num
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enter_reference_nbr(test_data)\n hide_notifications_bar\n logger.info \"Entering reference number '#{test_data[CoreUseOfCollectionsData::REFERENCE_NBR.name]}'\"\n wait_for_options_and_type(reference_nbr_input, reference_nbr_options, test_data[CoreUseOfCollectionsData::REFERENCE_NBR.name])\n end",
"... | [
"0.71001947",
"0.69106823",
"0.678389",
"0.6668597",
"0.6668597",
"0.6622709",
"0.6604757",
"0.6368874",
"0.6334552",
"0.6189848",
"0.59956706",
"0.5879171",
"0.5719647",
"0.5659665",
"0.5651867",
"0.5609668",
"0.542765",
"0.5397814",
"0.5346687",
"0.5310656",
"0.5303465",
... | 0.7287929 | 0 |
Clicks the Search link and the Clear button, and selects 'Conservation Treatments' from the record type | def load_search_conservation_form
click_search_link
click_clear_button
select_record_type_option 'Conservation Treatments'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_search_acquisitions_form\n click_search_link\n click_clear_button\n select_record_type_option 'Acquisitions'\n end",
"def load_search_condition_check_form\n click_search_link\n click_clear_button\n select_record_type_option 'Condition Checks'\n end",
"def treatment_treatment_type_c... | [
"0.63015145",
"0.60493165",
"0.56857365",
"0.5586592",
"0.54522765",
"0.5443587",
"0.51003456",
"0.5047435",
"0.50170034",
"0.50084126",
"0.4994454",
"0.4939296",
"0.4908541",
"0.48882028",
"0.4883728",
"0.4883728",
"0.48611635",
"0.48211962",
"0.48151517",
"0.4810816",
"0.48... | 0.8336226 | 0 |
Enters an procedural status date | def enter_procedural_status_date(data_set)
status_date = data_set[CoreConservationData::STATUS_GROUP.name][0][CoreConservationData::STATUS_DATE.name]
if status_date
logger.debug "Enter procedural status date '#{status_date}'"
input = element procedural_status_date_input_locator
input.clear
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enter_foundation_date(test_data)\n test_date = test_data[Org::FOUNDING_DATE.name]\n hide_notifications_bar\n enter_simple_date(foundation_date_input, test_date)\n end",
"def pre_initiation_date_status\n 'Pre-announcement'\n end",
"def enter_date_completed(test_data)\n hide_notifications_ba... | [
"0.66027224",
"0.6550619",
"0.64156026",
"0.6386104",
"0.63183594",
"0.6309036",
"0.6274817",
"0.622416",
"0.6146286",
"0.5969912",
"0.59459037",
"0.5893525",
"0.5891482",
"0.5869546",
"0.58505166",
"0.58242893",
"0.57950026",
"0.5792462",
"0.5775101",
"0.5764507",
"0.5739431... | 0.82650197 | 0 |
Selects a set of acquisition sources | def select_conservator(data_set)
conservators = data_set[CoreConservationData::CONSERVATOR.name]
if conservators
logger.debug "Entering conservator #{conservators}"
conservator_options_locator = input_options_locator([fieldset(CoreConservationData::CONSERVATOR.name, 0)])
enter_auto_complete(co... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def select_acquisition_sources(data_set)\n acquis_sources = data_set[CoreAcquisitionData::ACQUIS_SOURCES.name]\n acquis_sources && acquis_sources.each do |source|\n index = acquis_sources.index source\n logger.debug \"Entering acquisition source #{source} at index #{index}\"\n add_button_locat... | [
"0.79548544",
"0.78207535",
"0.66730523",
"0.63978815",
"0.61772823",
"0.6000227",
"0.58826655",
"0.5816419",
"0.5814767",
"0.5657293",
"0.564078",
"0.5621339",
"0.55796456",
"0.55098",
"0.54965115",
"0.5490843",
"0.54803973",
"0.5468773",
"0.5455394",
"0.5388144",
"0.5381276... | 0.0 | -1 |
Enters one examination note | def enter_examination_note(data_set)
note = data_set[CoreConservationData::EXAMINATION_GROUP.name][0][CoreConservationData::EXAMINATION_NOTE.name]
logger.debug "Entering examination note '#{note}'"
wait_for_element_and_type(examination_note_input_locator(0), note) if note
scroll_to_top
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enter_note(test_data)\n hide_notifications_bar\n logger.info \"Entering note '#{test_data[CoreUseOfCollectionsData::NOTE.name]}'\"\n wait_for_element_and_type(note_text_area, test_data[CoreUseOfCollectionsData::NOTE.name])\n end",
"def enter_new_note_subject(note)\n logger.debug \"Entering new n... | [
"0.6810737",
"0.6606332",
"0.65310395",
"0.65229905",
"0.64896214",
"0.624299",
"0.6196915",
"0.61934716",
"0.61189955",
"0.60981756",
"0.6073182",
"0.60710764",
"0.6020971",
"0.6013494",
"0.5930344",
"0.58850867",
"0.58429056",
"0.58247066",
"0.58092314",
"0.5790081",
"0.576... | 0.7407504 | 0 |
Tracking user clicking Invite Friends option from public Job page | def setup_job_action
if params[:invite_friends].present? && params[:job_id].present?
session[:invite_friends] = true
session[:job_id] = params[:job_id]
end
return if session[:referral_token].blank?
session[:invite_friends] = true if params[:invite_friends].present?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def invite_facebook_friends\n end",
"def friend_request\n\nend",
"def friend_request_accepted_notification(user, friend)\n @user = user\n @friend = friend\n @friend_url = \"http://www.lacquerloveandlend.com/users/#{@friend.id}\"\n\n mail(to: @user.email, subject: \"#{@friend.name} accepted your fr... | [
"0.6738478",
"0.66329676",
"0.6476533",
"0.6460999",
"0.6394236",
"0.6382726",
"0.6379188",
"0.62191004",
"0.6203769",
"0.6198296",
"0.61901474",
"0.6048672",
"0.6024447",
"0.6007176",
"0.5979218",
"0.59768504",
"0.5960866",
"0.5937727",
"0.58940864",
"0.5882719",
"0.5857605"... | 0.6760355 | 0 |
Lists valid options that may be passed on instantiation. | def valid_options
super | [ :controller_matches ]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_options\n []\n end",
"def valid_options\n %i(\n\n ) # end array\n end",
"def valid_options\n self::OPTIONS.map(&:to_s).join(', ')\n end",
"def valid_options\n [:label, :reader, :reader_options, :ingester, :ingester_options]\n end",
"def options... | [
"0.804813",
"0.78126496",
"0.7714921",
"0.73206985",
"0.728186",
"0.725507",
"0.725507",
"0.725507",
"0.725507",
"0.725507",
"0.725507",
"0.725507",
"0.725507",
"0.725507",
"0.725507",
"0.725507",
"0.715806",
"0.715806",
"0.7131111",
"0.71172404",
"0.70660883",
"0.7065183",... | 0.0 | -1 |
Ensures the atlas is valid before allowing consumers to make requests of it. | def validate!
raise InvalidAtlasError, "Atlas is not valid." unless valid?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assert_valid\n check_api_key\n check_application_id\n check_index_name\n\n Algolia.init(\n application_id: application_id,\n api_key: api_key\n )\n\n nil\n end",
"def validate!\n validate\n raise(GeoCerts::ResourceInvalid) unless self.errors.empty?\n self\n end"... | [
"0.5817386",
"0.5540784",
"0.53564507",
"0.5268845",
"0.5225747",
"0.5208203",
"0.5165659",
"0.5152817",
"0.5122765",
"0.5119467",
"0.5100099",
"0.50795674",
"0.5079383",
"0.5048294",
"0.5036638",
"0.5005337",
"0.5004482",
"0.49946213",
"0.4962092",
"0.49620807",
"0.49571797"... | 0.7291503 | 0 |
Returns a list of all routes that pass the user's filtering. | def allowed_routes
introspector.routes.keep_if(&method(:allow_route?))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def routes(filter = nil)\n Rails.application.reload_routes!\n formatted = formatted_routes\n if filter\n formatted.select!{ |r| r.match(filter) }\n end\n puts formatted\n end",
"def all_routes\n matching_routes\n end",
"def show_all_routes\n if @routes.empty?\n routes_void\n ... | [
"0.73089886",
"0.7009671",
"0.67814523",
"0.6720421",
"0.6566195",
"0.6547391",
"0.64401877",
"0.63802046",
"0.627",
"0.627",
"0.6221286",
"0.6127885",
"0.61101115",
"0.60919404",
"0.6082277",
"0.60810405",
"0.60470176",
"0.60470176",
"0.60402685",
"0.6025266",
"0.60149235",
... | 0.61535114 | 11 |
Constructs +Endpoint+ and +Controller wrappers per route. | def parse_routes!
allowed_routes.each do |route|
if (endpoint = endpoints.find_from_route(route))
endpoint.merge_http_methods!(route[:http_methods])
else
controller = controllers.find_or_create_from_route(route)
endpoint = endpoints.create_from_route(r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize app=nil\n @app = app\n\n self.class.endpoints.values.flatten.each do |endpoint|\n endpoint.action_handler ||= method :default_action\n endpoint.api_doc_handler ||= method :default_api_doc\n endpoint.error_handler ||= method :default_error\... | [
"0.61528224",
"0.6038796",
"0.5846577",
"0.5839076",
"0.582597",
"0.5799239",
"0.5768857",
"0.5718377",
"0.5718377",
"0.564876",
"0.564876",
"0.56417215",
"0.56373286",
"0.5633186",
"0.56072134",
"0.5596875",
"0.55189997",
"0.54845446",
"0.5483384",
"0.5480685",
"0.54711276",... | 0.5926258 | 2 |
Extracts declared presents for each endpoint and converts it into a Presenter wrapper object. | def extract_presenters!
valid_presenter_pairs.each do |target_class, const|
presenter = presenters.find_or_create_from_presenter_collection(target_class, const)
endpoints
.select do |ep|
declared_presented_class = ep.declared_presented_class
!declared... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def presenters\n base_presenter_class.constantize.descendants\n end",
"def write_presenter_definitions!\n presenter_definitions = presenters\n .formatted(format)\n .inject({}) do |definitions, object_with_definition|\n\n definitions.merge(object_with_defi... | [
"0.68289524",
"0.65869516",
"0.62760025",
"0.6185648",
"0.60974115",
"0.5975999",
"0.58620197",
"0.5812236",
"0.5615323",
"0.56079465",
"0.55296224",
"0.5357186",
"0.53519315",
"0.52921796",
"0.52856094",
"0.52671397",
"0.52588576",
"0.52588576",
"0.5233112",
"0.5231739",
"0.... | 0.83463717 | 0 |
Whether this Atlas is valid (i.e. if it has at least one endpoint). | def valid?
endpoints.count > 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid?\n JSON::Validator.validate!(schema, to_json, fragment: '#/definitions/layer') &&\n dct_references_validate! &&\n spatial_validate!\n end",
"def valid?\n @errors = self.class.valid_against_schema?(self.class.json_schema, self)\n @errors.empty?\n end",
"d... | [
"0.74080724",
"0.72961754",
"0.72633696",
"0.7236012",
"0.71970105",
"0.7194269",
"0.7172973",
"0.7162294",
"0.71586025",
"0.71502614",
"0.7110634",
"0.7108935",
"0.7108935",
"0.7088703",
"0.7073298",
"0.7053877",
"0.70449555",
"0.70438975",
"0.70295364",
"0.70295364",
"0.702... | 0.80259037 | 0 |
Returns whether a route's controller passes the limiting regexp passed to the generation command. | def allow_route?(route)
introspector.controllers.include?(route[:controller]) &&
controller_matches.all? { |regexp| route[:controller].to_s =~ regexp }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def applies_to?(request)\n return false unless pattern\n request.path =~ Mustermann.new(pattern)\n end",
"def matches?(req)\n\n @method == req.request_method.downcase.to_sym && @pattern.match(req.path)\n end",
"def valid?\n controller_class = begin\n controller_name.constan... | [
"0.6151264",
"0.5989847",
"0.5981864",
"0.5944139",
"0.59261876",
"0.59097314",
"0.5861493",
"0.5854204",
"0.5848194",
"0.5841626",
"0.58264595",
"0.58000475",
"0.57967085",
"0.5790365",
"0.57619774",
"0.574783",
"0.574783",
"0.56897324",
"0.56819063",
"0.5646661",
"0.563183"... | 0.6721052 | 0 |
Returns the cost per unit based on a quantity (usually just the quantity on the line_item) | def per_unit_cost(quantity_total=self.quantity, appointment_completed_date=nil)
if quantity_total == 0 || quantity_total.nil?
0
else
# Calculate the total number of packages that must be purchased.
# If the quantity requested is not an even multiple of the number
# of units per package, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def total_cost\n self.qty * self.unit_cost\n end",
"def total_cost\n # quantity * unit_cost_price\n unit_cost_price\n end",
"def get_total_qnty(line_items)\n line_items.map(&:quantity).sum\n end",
"def get_total_qnty(line_items)\n line_items.map(&:quantity).sum\n end",
"def productio... | [
"0.70506024",
"0.68881536",
"0.6827942",
"0.6827942",
"0.6770836",
"0.675392",
"0.673072",
"0.6722572",
"0.6715646",
"0.6709629",
"0.66888237",
"0.6685259",
"0.6680973",
"0.66311157",
"0.6626676",
"0.6626676",
"0.66212356",
"0.6615921",
"0.6535073",
"0.65207887",
"0.6474713",... | 0.68084395 | 4 |
Get the number of units per package as specified in the pricing map. Assumes 1 as the default, if the pricing map does not have a unit factor. | def units_per_package
unit_factor = self.service.displayed_pricing_map.unit_factor
units_per_package = unit_factor || 1
return units_per_package
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def price_unit_factor\n return 1 if unit_id == price_unit_id\n return pack_size || 1 if price_unit_id == pack_unit_id\n return (pack_size || 1) * (subpack_size || 1) if price_unit_id == subpack_unit_id\n return 1\n end",
"def number_of_units\n dataset_get(:number_of_units) || fetch(:number_of... | [
"0.6677524",
"0.6667875",
"0.61181253",
"0.6117637",
"0.6115532",
"0.60330415",
"0.58509153",
"0.5745491",
"0.57433766",
"0.57148206",
"0.57089937",
"0.57019454",
"0.5675066",
"0.56651914",
"0.5629797",
"0.56185246",
"0.56090367",
"0.5606001",
"0.55948853",
"0.5582335",
"0.55... | 0.8552072 | 0 |
Returns a hash of subtotals for the visits in the line item. Visit totals depend on the quantities in the other visits, so it would be clunky to compute one visit at a time | def per_subject_subtotals(visits=self.visits)
totals = { }
quantity_total = quantity_total()
per_unit_cost = per_unit_cost(quantity_total)
visits.each do |visit|
totals[visit.id.to_s] = visit.cost(per_unit_cost)
end
return totals
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def direct_costs_for_visit_based_service\n total = 0\n self.line_items_visits.each do |line_items_visit|\n total += line_items_visit.subject_count * self.direct_costs_for_visit_based_service_single_subject(line_items_visit)\n end\n total\n end",
"def subtotals\n x = {}\n charges.each ... | [
"0.6513202",
"0.6509577",
"0.6360409",
"0.6351459",
"0.6347497",
"0.61272186",
"0.60548717",
"0.60340124",
"0.59637815",
"0.5952608",
"0.5934431",
"0.5929459",
"0.59234333",
"0.5905125",
"0.58564883",
"0.580267",
"0.5762174",
"0.5762061",
"0.5760548",
"0.57486343",
"0.5746339... | 0.75912726 | 0 |
Determine the direct costs for a visitbased service for one subject | def direct_costs_for_visit_based_service_single_subject(line_items_visit)
# line items visit should also check that it's for the correct protocol
return 0.0 unless service_request.protocol_id == line_items_visit.arm.protocol_id
research_billing_qty_total = line_items_visit.visits.sum(&:research_billing... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def direct_costs_for_visit_based_service\n total = 0\n self.line_items_visits.each do |line_items_visit|\n total += line_items_visit.subject_count * self.direct_costs_for_visit_based_service_single_subject(line_items_visit)\n end\n total\n end",
"def indirect_costs_for_visit_based_service_singl... | [
"0.84832144",
"0.8439122",
"0.7496574",
"0.65926033",
"0.6488632",
"0.62563896",
"0.59618545",
"0.5937583",
"0.5859427",
"0.57090735",
"0.56810284",
"0.56800556",
"0.5673945",
"0.5648506",
"0.56482273",
"0.5631223",
"0.5585452",
"0.55782783",
"0.5572212",
"0.5570663",
"0.5559... | 0.82994384 | 2 |
Determine the direct costs for a visitbased service | def direct_costs_for_visit_based_service
total = 0
self.line_items_visits.each do |line_items_visit|
total += line_items_visit.subject_count * self.direct_costs_for_visit_based_service_single_subject(line_items_visit)
end
total
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def indirect_costs_for_visit_based_service\n if USE_INDIRECT_COST\n self.direct_costs_for_visit_based_service * self.indirect_cost_rate\n else\n return 0\n end\n end",
"def indirect_costs_for_visit_based_service_single_subject\n if USE_INDIRECT_COST\n total = 0\n self.line_items_... | [
"0.82886654",
"0.82157636",
"0.75980145",
"0.70547277",
"0.64495856",
"0.63489157",
"0.6289742",
"0.62134784",
"0.61844724",
"0.6171577",
"0.61507416",
"0.61093265",
"0.60905224",
"0.5966385",
"0.5940232",
"0.5940081",
"0.5916724",
"0.59060913",
"0.5877591",
"0.58767176",
"0.... | 0.82290876 | 1 |
Determine the direct costs for a onetimefee service | def direct_costs_for_one_time_fee
# TODO: It's a little strange that per_unit_cost divides by
# quantity, then here we multiply by quantity. It would arguably be
# better to calculate total cost here in its own method, then
# implement per_unit_cost to call that method.
num = self.quantity || 0.0
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def indirect_costs_for_one_time_fee\n if self.service.displayed_pricing_map.exclude_from_indirect_cost || !USE_INDIRECT_COST\n return 0\n else\n self.direct_costs_for_one_time_fee * self.indirect_cost_rate\n end\n end",
"def indirect_costs_for_visit_based_service\n if USE_INDIRECT_COST\n ... | [
"0.79117453",
"0.74389374",
"0.74379385",
"0.7019929",
"0.6450203",
"0.6435972",
"0.6415616",
"0.64151424",
"0.639506",
"0.6370376",
"0.6293491",
"0.6292454",
"0.62230283",
"0.6218934",
"0.6199745",
"0.61924857",
"0.61760294",
"0.61644566",
"0.615279",
"0.61463064",
"0.612893... | 0.74963546 | 1 |
Determine the indirect cost rate related to a particular line item | def indirect_cost_rate
if USE_INDIRECT_COST
self.service_request.protocol.indirect_cost_rate.to_f / 100
else
return 0
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def indirect_costs_for_visit_based_service_single_subject\n if USE_INDIRECT_COST\n total = 0\n self.line_items_visits.each do |line_items_visit|\n total += self.direct_costs_for_visit_based_service_single_subject(line_items_visit) * self.indirect_cost_rate\n end\n return total\n el... | [
"0.75623345",
"0.7261477",
"0.70729136",
"0.697427",
"0.6580971",
"0.65402335",
"0.65315145",
"0.6492484",
"0.64575654",
"0.6418575",
"0.63710856",
"0.6338805",
"0.6310189",
"0.628241",
"0.6240039",
"0.6229389",
"0.6226491",
"0.6221371",
"0.620796",
"0.61343384",
"0.6006583",... | 0.73829937 | 1 |
Determine the indirect cost rate for a visitbased service for one subject | def indirect_costs_for_visit_based_service_single_subject
if USE_INDIRECT_COST
total = 0
self.line_items_visits.each do |line_items_visit|
total += self.direct_costs_for_visit_based_service_single_subject(line_items_visit) * self.indirect_cost_rate
end
return total
else
ret... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def indirect_costs_for_visit_based_service\n if USE_INDIRECT_COST\n self.direct_costs_for_visit_based_service * self.indirect_cost_rate\n else\n return 0\n end\n end",
"def direct_costs_for_visit_based_service\n total = 0\n self.line_items_visits.each do |line_items_visit|\n total ... | [
"0.8016305",
"0.7832896",
"0.771577",
"0.73777515",
"0.69479495",
"0.6171454",
"0.60371244",
"0.58979833",
"0.58553",
"0.5833121",
"0.5777377",
"0.5765983",
"0.57531905",
"0.5692381",
"0.5676435",
"0.56346923",
"0.55630744",
"0.55451167",
"0.55358034",
"0.55358034",
"0.553204... | 0.8486765 | 0 |
Determine the indirect costs for a visitbased service | def indirect_costs_for_visit_based_service
if USE_INDIRECT_COST
self.direct_costs_for_visit_based_service * self.indirect_cost_rate
else
return 0
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def indirect_costs_for_visit_based_service_single_subject\n if USE_INDIRECT_COST\n total = 0\n self.line_items_visits.each do |line_items_visit|\n total += self.direct_costs_for_visit_based_service_single_subject(line_items_visit) * self.indirect_cost_rate\n end\n return total\n el... | [
"0.8569301",
"0.7763295",
"0.74668264",
"0.71013504",
"0.699309",
"0.60374904",
"0.6030641",
"0.59599125",
"0.59570843",
"0.5934632",
"0.588897",
"0.5828539",
"0.58249825",
"0.57948804",
"0.5747416",
"0.57113457",
"0.57038397",
"0.57026494",
"0.5699097",
"0.5670926",
"0.56521... | 0.88143235 | 0 |
Determine the indirect costs for a onetimefee service | def indirect_costs_for_one_time_fee
if self.service.displayed_pricing_map.exclude_from_indirect_cost || !USE_INDIRECT_COST
return 0
else
self.direct_costs_for_one_time_fee * self.indirect_cost_rate
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def indirect_costs_for_visit_based_service\n if USE_INDIRECT_COST\n self.direct_costs_for_visit_based_service * self.indirect_cost_rate\n else\n return 0\n end\n end",
"def indirect_costs_for_visit_based_service_single_subject\n if USE_INDIRECT_COST\n total = 0\n self.line_items_... | [
"0.79128456",
"0.77630025",
"0.71054006",
"0.67975575",
"0.6545144",
"0.63984585",
"0.6014631",
"0.5978513",
"0.59561294",
"0.5955878",
"0.5955244",
"0.59462374",
"0.59443265",
"0.5921989",
"0.59218276",
"0.5909784",
"0.59066945",
"0.59005386",
"0.589523",
"0.5857348",
"0.584... | 0.8178432 | 0 |
end audit reporting methods Need this for filtering ssr's by user on the cfw home page | def core
self.service.organization
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter_by_schedule()\n return if authorise_for_web(program_name?,'read') == false\n render_filter_by_schedule\n end",
"def audit\n @patient=User.find_by_wedgetail(params[:wedgetail],:order =>\"created_at DESC\")\n authorize_only (:patient) {@patient.wedgetail == @user.wedgetail}\n ... | [
"0.6054393",
"0.6038529",
"0.5916071",
"0.5848729",
"0.57691145",
"0.56943136",
"0.56893593",
"0.5677524",
"0.5594803",
"0.55831766",
"0.5575688",
"0.55423146",
"0.5531865",
"0.5514561",
"0.55125844",
"0.5501164",
"0.5483513",
"0.5455198",
"0.54302734",
"0.54302734",
"0.54192... | 0.0 | -1 |
Don't like duplicate code but this will make it easier to to check for service relations when doing mass visit assignment like ServiceRequestselect_calendar_row | def has_service_relation
# Get the relations for this line item and others to this line item
service_relations = ServiceRelation.find_all_by_service_id(self.service_id)
related_service_relations = ServiceRelation.find_all_by_related_service_id(self.service_id)
# Narrow the list to those with linked qua... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setCalendarDaySpecialAvailability(service_id)\n @service = ServiceType.find(service_id)\n #Delete previous calendar specials\n ServiceCalendar.where(service_type_id: service_id).delete_all\n\n #IF there's a special event\n if (@service.available_from && @service.available_to)... | [
"0.5708466",
"0.56387705",
"0.56050694",
"0.55425996",
"0.5445236",
"0.53986377",
"0.5396631",
"0.5380964",
"0.5367101",
"0.53578866",
"0.5347067",
"0.5338467",
"0.53289235",
"0.53282654",
"0.5290398",
"0.5290398",
"0.5246694",
"0.52394176",
"0.52375066",
"0.52235466",
"0.518... | 0.6010993 | 0 |
Longens a shortened URL by passing it to the Long URL Please API ( Can either be called with a single URL, or an array of URLs. Returns a Hash where the keys are the shortened URLs, and the values are the longened URLs. | def longen(urls)
# Make sure it's an array
urls = [*urls]
result = {}
# We can pass 10 URLs at once
urls.each_slice(10) do |the_urls|
query_string = the_urls.map{|url| "q=#{url}"}.join("&")
response = Net::HTTP.get(URI.parse("http://longurlplease.appspot.com/api/v1.1?#{query_string}"))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shorten(long_url)\n http_response = @httpclient.get_content(build_url(\"shorten\", \"longUrl=#{CGI::escape(long_url)}\"))\n data = JSON.parse(http_response)\n raise BitlyError.new(data[\"errorMessage\"]) unless data[\"statusCode\"] == \"OK\"\n data[\"results\"][long_url]\n end",
"def s... | [
"0.7709678",
"0.7686985",
"0.75182253",
"0.7429818",
"0.7174934",
"0.6879307",
"0.666529",
"0.6620562",
"0.6547896",
"0.6522625",
"0.6425352",
"0.64070785",
"0.64005786",
"0.6374227",
"0.6309984",
"0.6224831",
"0.6204166",
"0.61907524",
"0.61426914",
"0.6114716",
"0.6031862",... | 0.6926098 | 5 |
GET /alerts GET /alerts.json | def index
@alerts = Alert.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @alerts }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n authorize! :read, ItemAlert\n @item_alerts = ItemAlert.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @item_alerts }\n end\n end",
"def alerts(query)\n get_json(\"#{api_url}/alerts/#{url_settings}/q/#{parse_query(query)}.#{... | [
"0.73201513",
"0.73112833",
"0.7170591",
"0.715613",
"0.70566237",
"0.70566237",
"0.70566237",
"0.69466615",
"0.6893946",
"0.68926346",
"0.68926346",
"0.67442906",
"0.6726785",
"0.65339047",
"0.65157604",
"0.65054065",
"0.648085",
"0.638276",
"0.63718206",
"0.6351387",
"0.634... | 0.7764868 | 1 |
GET /alerts/1 GET /alerts/1.json | def show
@alert = Alert.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @alert }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @alerts = Alert.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @alerts }\n end\n end",
"def index\n @alerts = Alert.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @alerts }\n ... | [
"0.7429729",
"0.7429729",
"0.70043015",
"0.6885315",
"0.6885315",
"0.6885315",
"0.6877481",
"0.6865696",
"0.6777184",
"0.6690649",
"0.6549195",
"0.6477564",
"0.64674395",
"0.64064425",
"0.64055717",
"0.6401686",
"0.6386438",
"0.6330484",
"0.63285565",
"0.6326714",
"0.6298146"... | 0.70321286 | 2 |
GET /alerts/new GET /alerts/new.json | def new
@alert = Alert.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @alert }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @alert = Alert.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @alert }\n end\n end",
"def new\n @alert = Alert.new\n @selected = params[:alert_ids]\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { rend... | [
"0.79675686",
"0.7374839",
"0.72332454",
"0.71542853",
"0.7073005",
"0.70015174",
"0.6849007",
"0.68441105",
"0.6828909",
"0.6814098",
"0.6781329",
"0.67684674",
"0.6762712",
"0.6739767",
"0.67347854",
"0.67347854",
"0.6726812",
"0.6722718",
"0.668636",
"0.66856706",
"0.66781... | 0.7964242 | 1 |
POST /alerts POST /alerts.json | def create
@alert = Alert.new(params[:alert])
@alert.sent = false
if @alert.save
if @alert.hit_web
@alert.update_attribute(:sent, true)
redirect_to new_alert_url, notice: "¡Hey! Ya hay trenes para esta fecha. Visita <a href='http://www.renfe.com'>Renfe</a>".html_safe
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @alert = Alert.new(alert_params)\n\n respond_to do |format|\n if @alert.save\n format.html { redirect_to alerts_path, notice: 'Alert was successfully created.' }\n #format.json { render action: 'show', status: :created, location: @alert }\n else\n format.html { ren... | [
"0.67716634",
"0.67368543",
"0.65711796",
"0.64088476",
"0.62779516",
"0.62646735",
"0.62646735",
"0.61992675",
"0.61629605",
"0.61519676",
"0.60987437",
"0.6086675",
"0.6067948",
"0.6023344",
"0.6018554",
"0.599362",
"0.5974415",
"0.5906006",
"0.58956724",
"0.58536065",
"0.5... | 0.5578375 | 37 |
PUT /alerts/1 PUT /alerts/1.json | def update
@alert = Alert.find(params[:id])
respond_to do |format|
if @alert.update_attributes(params[:alert])
format.html { redirect_to @alert, notice: 'Alert was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
fo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @alert = Alert.find(params[:id])\n notifiers = Hash.new\n User.find(params[:notifiers]).each{|user| notifiers[user.id] = 0}\n @alert.notifiers = notifiers\n @alert.host = params[:host]\n @alert.trigger = params[:trigger]\n respond_to do |format|\n if @alert.update_attributes(... | [
"0.6692582",
"0.66444546",
"0.6612804",
"0.6578426",
"0.6562028",
"0.6542592",
"0.65256447",
"0.6434279",
"0.63423514",
"0.62929034",
"0.6177847",
"0.61674505",
"0.61215633",
"0.60876477",
"0.59970987",
"0.5979202",
"0.5948153",
"0.59434456",
"0.5912183",
"0.5882306",
"0.5860... | 0.6758529 | 0 |
DELETE /alerts/1 DELETE /alerts/1.json | def destroy
@alert = Alert.find(params[:id])
@alert.destroy
respond_to do |format|
format.html { redirect_to alerts_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @alert.destroy\n respond_to do |format|\n format.html { redirect_to alerts_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @alert = Alert.find(params[:id])\n @alert.destroy\n\n respond_to do |format|\n format.html { redirect_to(alerts_url) }\... | [
"0.75533926",
"0.7402847",
"0.72546446",
"0.7242602",
"0.7242602",
"0.72362703",
"0.71129966",
"0.7072523",
"0.7023298",
"0.700771",
"0.6999723",
"0.69447595",
"0.69408935",
"0.69165075",
"0.69119793",
"0.6826267",
"0.68196595",
"0.6804329",
"0.6784824",
"0.6748909",
"0.67406... | 0.7595061 | 0 |
GET /imageforhomes GET /imageforhomes.json | def index
@imageforhomes = Imageforhome.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @home_images = HomeImage.all\n end",
"def get_images\n @command = :get_images\n # set a flag indicating whether or not the user wants to see all images,\n # including the hidden ones\n show_hidden = (@prev_args.peek(0) == \"-i\" || @prev_args.peek(0) == \"--hidden\")\n... | [
"0.71927285",
"0.71696043",
"0.7105862",
"0.6998393",
"0.69122386",
"0.6892173",
"0.6858398",
"0.6843227",
"0.6827173",
"0.6810696",
"0.68091154",
"0.6800189",
"0.6784029",
"0.6705016",
"0.66679096",
"0.66672575",
"0.66644573",
"0.66638374",
"0.66599697",
"0.66535145",
"0.662... | 0.72207296 | 0 |
GET /imageforhomes/1 GET /imageforhomes/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/photos/#{params[:id]}.json?token=#{ENV['API_KEY']}\"\n\t response = RestClient.get(url)\n\t @photo = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/photos.json?token=#{ENV['API_KEY']}\"\n response = RestClient.get(url)\n @ph... | [
"0.71409094",
"0.7081303",
"0.70564604",
"0.70564604",
"0.70535994",
"0.7042552",
"0.7024728",
"0.69611096",
"0.69544286",
"0.69290346",
"0.69160515",
"0.68786705",
"0.6845642",
"0.6840281",
"0.68230385",
"0.6794505",
"0.67857474",
"0.67857474",
"0.67857474",
"0.67857474",
"0... | 0.0 | -1 |
POST /imageforhomes POST /imageforhomes.json | def create
@imageforhome = Imageforhome.new(imageforhome_params)
respond_to do |format|
if @imageforhome.save
format.html { redirect_to @imageforhome, notice: 'Imageforhome was successfully created.' }
format.json { render :show, status: :created, location: @imageforhome }
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @home_image = HomeImage.new(home_image_params)\n\n respond_to do |format|\n if @home_image.save\n format.html { redirect_to home_images_path, notice: 'Home image was successfully created.' }\n format.json { render :show, status: :created, location: @home_image }\n else\n ... | [
"0.70007193",
"0.65447724",
"0.65245265",
"0.64577824",
"0.64478374",
"0.644564",
"0.64273494",
"0.639792",
"0.635436",
"0.6294653",
"0.6282768",
"0.6279943",
"0.6279613",
"0.62768006",
"0.6268067",
"0.62662244",
"0.620447",
"0.61461914",
"0.6134001",
"0.611724",
"0.6099316",... | 0.69537455 | 1 |
PATCH/PUT /imageforhomes/1 PATCH/PUT /imageforhomes/1.json | def update
respond_to do |format|
if @imageforhome.update(imageforhome_params)
format.html { redirect_to @imageforhome, notice: 'Imageforhome was successfully updated.' }
format.json { render :show, status: :ok, location: @imageforhome }
else
format.html { render :edit }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n params[:image].delete :created_at\n params[:image].delete :updated_at\n params[:image].delete :id\n @image = Image.find(params[:id])\n if @image.update_attributes(params[:image])\n render json: @image\n else\n render json: @image.errors, status: :unprocessable_entity\n e... | [
"0.70326453",
"0.7012612",
"0.67642",
"0.6664601",
"0.6600788",
"0.65922165",
"0.658921",
"0.658921",
"0.658921",
"0.658921",
"0.65846705",
"0.6552921",
"0.6552921",
"0.6552921",
"0.6552921",
"0.6552921",
"0.6552921",
"0.6552921",
"0.6551355",
"0.65342957",
"0.65132034",
"0... | 0.65870905 | 10 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.