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 |
|---|---|---|---|---|---|---|
POST /message_outs POST /message_outs.json | def create
@message_out = MessageOut.new(message_out_params)
respond_to do |format|
if @message_out.save
format.html { redirect_to @message_out, notice: 'Message out was successfully created.' }
format.json { render :show, status: :created, location: @message_out }
else
form... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def smssend\n http = get_http_connection() \n post_args = { 'number' => params[:number], 'text' => params[:text],'replyto' => params[:replyto], 'name' => @pysmsd_config.app_name, 'password' => @pysmsd_config.app_password }\n \n request = Net::HTTP::Post.new('/messages/out.json')\n request.set_for... | [
"0.6903816",
"0.62890893",
"0.6182434",
"0.61759156",
"0.61600614",
"0.60449153",
"0.59814",
"0.5951197",
"0.59417355",
"0.5921014",
"0.5870418",
"0.58613354",
"0.58505166",
"0.5814998",
"0.58123255",
"0.5808695",
"0.5763554",
"0.57243544",
"0.56838673",
"0.565115",
"0.564581... | 0.69519955 | 0 |
PATCH/PUT /message_outs/1 PATCH/PUT /message_outs/1.json | def update
respond_to do |format|
if @message_out.update(message_out_params)
format.html { redirect_to @message_out, notice: 'Message out was successfully updated.' }
format.json { render :show, status: :ok, location: @message_out }
else
format.html { render :edit }
forma... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @outmessage = Outmessage.find(params[:id])\n\n respond_to do |format|\n if @outmessage.update_attributes(params[:outmessage])\n format.html { redirect_to @outmessage, :notice => 'Outmessage was successfully updated.' }\n format.json { head :ok }\n else\n format.htm... | [
"0.67088276",
"0.6356212",
"0.6294603",
"0.6271096",
"0.6247161",
"0.6242197",
"0.62195915",
"0.6139679",
"0.6108608",
"0.60467696",
"0.60067254",
"0.60018533",
"0.59900767",
"0.59868795",
"0.5872337",
"0.5866814",
"0.5856719",
"0.5856719",
"0.585349",
"0.5833102",
"0.5822631... | 0.6683412 | 1 |
DELETE /message_outs/1 DELETE /message_outs/1.json | def destroy
@message_out.destroy
respond_to do |format|
format.html { redirect_to message_outs_url, notice: 'Message out was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @outmessage = Outmessage.find(params[:id])\n @outmessage.destroy\n\n respond_to do |format|\n format.html { redirect_to outmessages_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @outgoing_message_log = OutgoingMessageLog.find(params[:id])\n @outgoing_mes... | [
"0.74307024",
"0.72257817",
"0.7157802",
"0.71205676",
"0.70943093",
"0.70638305",
"0.7058172",
"0.7005902",
"0.6969792",
"0.69227165",
"0.6911765",
"0.6890537",
"0.68778795",
"0.68778795",
"0.6865568",
"0.6826625",
"0.6826625",
"0.68194973",
"0.68002",
"0.6778614",
"0.677827... | 0.7323805 | 1 |
Use callbacks to share common setup or constraints between actions. | def set_message_out
@message_out = MessageOut.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.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def message_out_params
params.require(:message_out).permit(:content)
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 |
adds Jenkins, Docker and Kubernetes config files to the application | def copy_initializer
template 'k8s/tests_job.yaml', "k8s/#{app_name}_tests_job.yaml"
template 'k8s/deployment.yaml', "k8s/#{app_name}_deployment.yaml"
template 'k8s/service.yaml', "k8s/#{app_name}_service.yaml"
template 'k8s/setup_job.yaml', "k8s/#{app_name}_setup_job.yaml"
templ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def copy_configuration_files\n replace_file 'config/routes.rb'\n replace_file 'config/environments/development.rb'\n replace_file 'config/environments/test.rb'\n copy_file 'templates/.env', '.env'\n copy_file 'templates/.tool-versions', '.tool-versions'\n replace_file 'config/initializers/dotenv.rb'\n repla... | [
"0.6353735",
"0.6330384",
"0.6316135",
"0.62457645",
"0.6225692",
"0.6154632",
"0.6153644",
"0.6151551",
"0.6066574",
"0.6064772",
"0.60550416",
"0.6023867",
"0.599016",
"0.5899636",
"0.588693",
"0.58795947",
"0.58435315",
"0.58376163",
"0.5837487",
"0.5802724",
"0.5796224",
... | 0.54570174 | 61 |
GET /submission GET /submission.xml | def index
@submissions = Submission.find(:all)
respond_to do |format|
format.html # index.haml
format.xml { render :xml => @submission }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @submission = Submission.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @submission }\n end\n end",
"def show\n @submission = Submission.find(params[:id])\n\n respond_to do |format|\n format.html # show.haml\n ... | [
"0.7274464",
"0.70859605",
"0.66717374",
"0.66618305",
"0.6660504",
"0.6641683",
"0.652066",
"0.6499995",
"0.64836526",
"0.64801383",
"0.64801383",
"0.6471834",
"0.62749624",
"0.62347543",
"0.6213535",
"0.6207054",
"0.62048715",
"0.6165574",
"0.6165574",
"0.60305506",
"0.6030... | 0.69237185 | 2 |
GET /submission/1 GET /submission/1.xml | def show
@submission = Submission.find(params[:id])
respond_to do |format|
format.html # show.haml
format.xml { render :xml => @submission }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @submission = Submission.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @submission }\n end\n end",
"def index\n @submissions = Submission.find(:all)\n\n respond_to do |format|\n format.html # index.haml\n f... | [
"0.7128289",
"0.685183",
"0.66381526",
"0.65334976",
"0.6471589",
"0.63435775",
"0.6316685",
"0.6315651",
"0.6210698",
"0.61896497",
"0.61896497",
"0.61862713",
"0.61342084",
"0.60995966",
"0.6079903",
"0.60533637",
"0.5961079",
"0.5909505",
"0.58529884",
"0.5845093",
"0.5830... | 0.6941431 | 1 |
GET /submission/new GET /submission/new.xml | def new
@submission = Submission.new
respond_to do |format|
format.html # new.haml
format.xml { render :xml => @submission }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @submission_comment = SubmissionComment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @submission_comment }\n end\n end",
"def create\n @submission = Submission.new(params[:submission])\n\n respond_to do |format|\n if @submissi... | [
"0.74332213",
"0.7074458",
"0.7019172",
"0.69804245",
"0.69463885",
"0.69345796",
"0.69345796",
"0.6921083",
"0.69173825",
"0.69098866",
"0.6890191",
"0.68783003",
"0.687734",
"0.686037",
"0.68561286",
"0.68555546",
"0.6855061",
"0.68489915",
"0.684102",
"0.68381727",
"0.6835... | 0.7942215 | 0 |
POST /submission POST /submission.xml | def create
@submission = Submission.new(params[:submission])
respond_to do |format|
if @submission.save
flash[:notice] = 'Submission was successfully created.'
format.html { redirect_to(submission_path(@submission)) }
format.xml { render :xml => @submission, :status => :created, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def do_submission(path, xml = nil)\n if xml.nil?\n form = create(:form, question_types: %w(integer integer))\n form.publish!\n xml = build_odk_submission(form)\n end\n\n # write xml to file\n require 'fileutils'\n FileUtils.mkpath('test/fixtures')\n fixture_file = Rails.root.join('... | [
"0.7185427",
"0.6769586",
"0.6536815",
"0.6521938",
"0.6394957",
"0.638802",
"0.63349056",
"0.63217914",
"0.626405",
"0.6262381",
"0.6243754",
"0.6222123",
"0.62183017",
"0.618068",
"0.61588675",
"0.6127506",
"0.6119407",
"0.6106426",
"0.6095596",
"0.6095596",
"0.60903686",
... | 0.70729274 | 1 |
PUT /submission/1 PUT /submission/1.xml | def update
@submission = Submission.find(params[:id])
respond_to do |format|
if @submission.update_attributes(params[:submission])
flash[:notice] = 'Submission was successfully updated.'
format.html { redirect_to(submission_path(@submission)) }
format.xml { head :ok }
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @submission = Submission.find(params[:id])\n\n respond_to do |format|\n if @submission.update_attributes(params[:submission])\n format.html { redirect_to(@submission, :notice => 'Submission was successfully updated.') }\n format.xml { head :ok }\n else\n format.ht... | [
"0.6590333",
"0.6590333",
"0.658539",
"0.63580906",
"0.63218796",
"0.6203218",
"0.6202254",
"0.6030802",
"0.5976747",
"0.59273374",
"0.59150064",
"0.59150064",
"0.589602",
"0.5894392",
"0.5876261",
"0.5842542",
"0.5837131",
"0.58193016",
"0.5795216",
"0.57890296",
"0.57825613... | 0.65868884 | 2 |
DELETE /submission/1 DELETE /submission/1.xml | def destroy
@submission = Submission.find(params[:id])
@submission.destroy
respond_to do |format|
format.html { redirect_to(submission_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @submission = Submission.find(params[:id])\n @submission.destroy\n\n respond_to do |format|\n format.html { redirect_to(submissions_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @submission = Submission.find(params[:id])\n @submission.destroy\n\n res... | [
"0.7380481",
"0.7380481",
"0.7380481",
"0.69005835",
"0.68519807",
"0.67469066",
"0.67363787",
"0.6726497",
"0.6726497",
"0.67259705",
"0.66746765",
"0.6673411",
"0.666435",
"0.666435",
"0.666435",
"0.6600906",
"0.6573058",
"0.654463",
"0.6509483",
"0.64563006",
"0.64297146",... | 0.74571323 | 0 |
The +MessageOptions+ defined for this message. | def options
message_descriptor_proto.options
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def options(args = nil)\r\n if args\r\n @_message.options.merge!(args)\r\n else\r\n @_message\r\n end\r\n end",
"def default_message_options\n @default_message_options ||= {type: 'message'}\n end",
"def generate_options(message)\n {\n raw_message: ... | [
"0.7453573",
"0.7247541",
"0.7049129",
"0.664804",
"0.6534514",
"0.6418044",
"0.6415079",
"0.6415079",
"0.6415079",
"0.640184",
"0.6399006",
"0.6393965",
"0.6392944",
"0.6391486",
"0.63879585",
"0.63874835",
"0.6385375",
"0.6385375",
"0.63793576",
"0.63530993",
"0.63530993",
... | 0.7984034 | 0 |
The extension ranges defined for this message | def extension_range
message_descriptor_proto.extension_range
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extensions(range)\n extension_ranges << range\n end",
"def extensions(range)\n extension_ranges << range\n end",
"def extensions(range)\n extension_ranges << range\n end",
"def extensions(range)\n @extension_tag = range\n end",
"def range_extensio... | [
"0.72202086",
"0.72202086",
"0.7183523",
"0.6975689",
"0.67840195",
"0.6592586",
"0.6405685",
"0.6001918",
"0.5968311",
"0.59562844",
"0.594816",
"0.59000134",
"0.5830478",
"0.58039474",
"0.5792925",
"0.57710093",
"0.5681345",
"0.56523645",
"0.56175786",
"0.56175786",
"0.5617... | 0.82498056 | 0 |
The extensions defined for this message | def extension
message_descriptor_proto.extension
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extensions\n @@extensions\n end",
"def extensions\n @@extensions\n end",
"def extensions; end",
"def extensions; end",
"def extensions; end",
"def extensions\n self.class.extensions\n end",
"def extensions\n self.class.extensions\n end",
"def extensions\n []... | [
"0.80244327",
"0.80244327",
"0.76979107",
"0.76979107",
"0.76979107",
"0.7610177",
"0.7610177",
"0.7587708",
"0.7587708",
"0.757851",
"0.757851",
"0.7573472",
"0.7558929",
"0.7558929",
"0.7558929",
"0.7449057",
"0.7422389",
"0.7399783",
"0.7399783",
"0.72668743",
"0.72641087"... | 0.7621903 | 5 |
The name of the message | def name
message_descriptor_proto.name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def message\n @name\n end",
"def message_name message\n message.class\n end",
"def type_name\n MESSAGE_TYPE[self.type_id-1][0]\n end",
"def msg(msg)\n if @name\n \"[#{name}] #{msg}\"\n else\n msg\n end\n end",
"def lookup_message(name)\n\t\tend",
"def u... | [
"0.8569938",
"0.83829546",
"0.7272022",
"0.7232701",
"0.71748996",
"0.7041159",
"0.69332194",
"0.69332194",
"0.69332194",
"0.69332194",
"0.69304794",
"0.6901278",
"0.6901278",
"0.6883444",
"0.6882866",
"0.6882866",
"0.6858073",
"0.6858073",
"0.6858073",
"0.6858073",
"0.680013... | 0.72105783 | 4 |
cancels (undos) previously allocated reputation with the given criteria | def cancel(reputable, action, receiver, options={})
result = nil
options.symbolize_keys!
sender = options.delete(:sender)
tier = options.delete(:tier)
# adds receiver's reputation
if receiver_points = find_reputation_points(reputable, :receiver, action, tier)
reputation = fin... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cancel_request\n\t\tuser = current_user\n\n\t\tassignment = Assignment.find_by(request_id: params[:request_id])\n\t\tuser.accepteds.delete(assignment)\n\t\tpending_status = RequestStatus.find_by(description: \"pending accept\")\n\t\tpending_status.assignments << assignment\n\n\t\tredirect_back fallback_locatio... | [
"0.5984106",
"0.589552",
"0.5667011",
"0.56540483",
"0.5639478",
"0.5571842",
"0.5547468",
"0.55344677",
"0.55057526",
"0.5402379",
"0.53883165",
"0.5375299",
"0.53535354",
"0.5341836",
"0.5333722",
"0.53034216",
"0.5302243",
"0.5277681",
"0.52700204",
"0.5257504",
"0.524725"... | 0.5867076 | 2 |
used to sum up reputation count | def find_options_for_visible(options={})
{:conditions => ["reputations.status IN (?)", ['active', 'cashed']]}.merge_finder_options(options)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_reputation\n tally = []\n answers.each do |answer|\n tally.push(answer.answer_votes_total)\n end\n questions.each do |question|\n tally.push(question.question_votes_total)\n end\n tally = tally.inject(:+)\n return tally\n end",
"d... | [
"0.7815094",
"0.7268114",
"0.7019378",
"0.69234204",
"0.6794765",
"0.6661891",
"0.6657117",
"0.6631044",
"0.662276",
"0.66081625",
"0.66060686",
"0.6589175",
"0.65795964",
"0.65647095",
"0.65168804",
"0.65137964",
"0.64962345",
"0.6459192",
"0.64534444",
"0.6452291",
"0.64422... | 0.0 | -1 |
finds the reputation instance which is going to be canceled | def find_for_cancel(reputable, action, receiver, points, tier=nil)
conditions = unless tier
["reputations.status = ? AND reputations.reputable_id = ? AND reputations.reputable_type = ? AND reputations.action = ? AND reputations.receiver_id = ? AND reputations.points = ?",
'active', reputable.id... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cancel(reputable, action, receiver, options={})\n result = nil\n options.symbolize_keys!\n sender = options.delete(:sender)\n tier = options.delete(:tier)\n # adds receiver's reputation\n if receiver_points = find_reputation_points(reputable, :receiver, action, tier)\n repu... | [
"0.58383894",
"0.5668841",
"0.53867704",
"0.5310865",
"0.5302409",
"0.5289924",
"0.52671695",
"0.51230437",
"0.5088346",
"0.5086395",
"0.50514454",
"0.5030025",
"0.5021456",
"0.5020561",
"0.49984324",
"0.49456054",
"0.49353975",
"0.49353975",
"0.49297446",
"0.49204367",
"0.48... | 0.51453835 | 7 |
dummy stub to get reputation reward for action from ReputationReward class | def find_reputation_points(reputable, destination, action, tier=nil)
ReputationReward.action_points(reputable, destination, action, tier=nil)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reward\n @reward ||= 0\n end",
"def reputation_threshold_action\n :offer_reward\n end",
"def default_reward\n\t\tself.rewards.create(:description => \"Thanks!\", :dollar_amount => 1)\n\tend",
"def set_reward_action\n @reward_action = RewardAction.find(params[:id])\n end",
"def reward\n ... | [
"0.6590358",
"0.6572073",
"0.6271812",
"0.60762817",
"0.60190153",
"0.5916497",
"0.5916497",
"0.5916497",
"0.5863684",
"0.58625257",
"0.5759461",
"0.5757546",
"0.56734747",
"0.56624764",
"0.56341195",
"0.5613949",
"0.5597037",
"0.5549308",
"0.5514158",
"0.5496514",
"0.5465094... | 0.5983144 | 5 |
by default validate self is true, meaning that sender cannot be receiver | def validate_self?
@validate_self.is_a?(FalseClass) ? false : true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate!\n super()\n self\n end",
"def valid?\n#calls on the sender and receiver's #valid? methods\n sender.valid? && receiver.valid?\n end",
"def valid?\n self.receiver.valid? && self.sender.valid?\n end",
"def valid?\n self.sender.valid? && self.receiver.valid?\n end",
"def ... | [
"0.722304",
"0.69699526",
"0.6925889",
"0.68423164",
"0.6825513",
"0.6767004",
"0.6629084",
"0.6580988",
"0.6528865",
"0.65166956",
"0.64681745",
"0.6434039",
"0.6424167",
"0.63265467",
"0.632189",
"0.6310125",
"0.6283742",
"0.62496716",
"0.6211189",
"0.6211189",
"0.6211189",... | 0.6098603 | 27 |
returns a Reputation::Threshold instance and validates based on self action and sender | def threshold
@threshold ||= Reputation::Threshold.lookup(self.action, self.sender, :tier => self.tier)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reputation_threshold_action\n :offer_reward\n end",
"def find_tier_threshold_points\n @tier_threshold_points_cache ||= if tp = self.tier.reputation_thresholds.find(:first, \n :conditions => [\"reward_rates.action = ?\", self.action.to_s])\n tp\n elsif self.tier.parent && (ptp = ... | [
"0.69859254",
"0.64288294",
"0.6358009",
"0.58064383",
"0.5729089",
"0.5695526",
"0.5599671",
"0.5571309",
"0.5392161",
"0.53439987",
"0.5334644",
"0.5311986",
"0.5274186",
"0.5268406",
"0.5155847",
"0.51414645",
"0.5139207",
"0.5122872",
"0.5109536",
"0.5108959",
"0.5102317"... | 0.8527558 | 0 |
make sure we convert symbol into string for database | def action=(value)
self[:action] = value.to_s if value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def db_symbol\n return data.db_symbol\n end",
"def turn_symbol_into_string(symbol)\n symbol.to_s\nend",
"def str_to_sym(data); end",
"def str_to_sym(data); end",
"def turn_symbol_into_string(symbol)\n symbol.to_s\nend",
"def turn_symbol_into_string(symbol)\n symbol.to_s\nend",
"def turn_sy... | [
"0.722864",
"0.66631985",
"0.66334015",
"0.66334015",
"0.65718436",
"0.65718436",
"0.65718436",
"0.65639263",
"0.65639263",
"0.65639263",
"0.6543577",
"0.6422389",
"0.6409802",
"0.63896364",
"0.6368763",
"0.63668704",
"0.6352351",
"0.63060796",
"0.6208158",
"0.61603844",
"0.6... | 0.0 | -1 |
return action value as symbol, e.g. :vote_up | def action
self[:action].to_sym if self[:action]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def action\n \treturn self[:action].to_sym\n \n end",
"def action_str(sym)\n\t\t\tact = InvertedActionMap[sym]\n\t\t\tunless act\n\t\t\t\traise \"Unknown action '#{sym}'\"\n\t\t\tend\n\t\t\treturn act\n\t\tend",
"def action_name\n @action.to_s.upcase\n end",
"def get_action_name\n return @a... | [
"0.7591787",
"0.73670536",
"0.7317126",
"0.7175619",
"0.7157442",
"0.7042155",
"0.7025158",
"0.6994332",
"0.6964341",
"0.68318856",
"0.65656465",
"0.65529376",
"0.65529376",
"0.6499518",
"0.64807236",
"0.6445443",
"0.6445443",
"0.6427041",
"0.64198035",
"0.6419347",
"0.641099... | 0.7397721 | 2 |
update reputations count in association as we have to sum only "visible" or "cashed" rewards | def update_receiver_reputation_points
if self.receiver && self.receiver.class.columns.to_a.map {|a| a.name.to_sym}.include?(:reputation_points)
self.receiver.clear_reputation_points_cache
self.receiver.class.transaction do
self.receiver.lock!
self.receiver.update_attribute(:reputation_p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_kase_rewards_count\n if self.kase && self.kase.class.columns.to_a.map {|a| a.name.to_sym}.include?(:rewards_count)\n self.kase.class.transaction do \n self.kase.lock!\n self.kase.update_attribute(:rewards_count, \n self.kase.rewards.count(self.class.find_options_for_visibl... | [
"0.782708",
"0.7424971",
"0.682867",
"0.6755223",
"0.65069085",
"0.6485654",
"0.64424086",
"0.6441498",
"0.6395548",
"0.63257504",
"0.6271995",
"0.62679744",
"0.62039816",
"0.614026",
"0.6136974",
"0.6092749",
"0.60870475",
"0.60735804",
"0.6051914",
"0.6044594",
"0.60174286"... | 0.0 | -1 |
Finds reputation threshold by one or many actions and returns true if at least one is valid, otherwise false E.g. | def valid?(actions, sender, options={})
actions = [actions].flatten
actions.each do |action|
result = lookup(action, sender, options)
return true if result && result.success?
end
false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reputation_threshold_action\n :offer_reward\n end",
"def action_defined?\n # ReputationThreshold.action_defined?(self.action, self.tier)\n !self.action_points.nil?\n end",
"def check_threshold\n max_threshold = @assignment.review_topic_threshold\n # Assignment.find_by_sql([\"SELECT r... | [
"0.6819126",
"0.6432135",
"0.64156944",
"0.6391588",
"0.62981",
"0.60877734",
"0.6086288",
"0.60861146",
"0.59660953",
"0.58336794",
"0.5817255",
"0.57060623",
"0.5702891",
"0.56532884",
"0.56532884",
"0.56532884",
"0.5619449",
"0.56115305",
"0.5567116",
"0.556678",
"0.553615... | 0.0 | -1 |
stuff below makes sure the model validation works without DB table | def columns
@columns ||= [];
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def model_valid?\n true\n end",
"def model_valid?\n true\n end",
"def validation; end",
"def validation; end",
"def validate_on_create; end",
"def validate(vmode=nil)\n # Holding pattern. All models should use super, in principal\n end",
"def pre_validation\n\n end",
"def run_valid... | [
"0.7152186",
"0.7152186",
"0.699806",
"0.699806",
"0.6770157",
"0.67486274",
"0.6668344",
"0.66528827",
"0.6645258",
"0.66212416",
"0.66147786",
"0.66075975",
"0.6586992",
"0.653469",
"0.653469",
"0.653469",
"0.653469",
"0.65279514",
"0.64546704",
"0.6444852",
"0.6428285",
... | 0.0 | -1 |
Override the save method to prevent exceptions. | def save(validate = true)
validate ? valid? : true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _save\n raise NotImplementedError, 'override #_save in a subclass'\n end",
"def save\n super save\n end",
"def save!\n raise \"#{self.inspect} failed to save\" unless self.save\n end",
"def save\n raise NotImplementedError\n end",
"def save\n raise NotImplementedErr... | [
"0.8327659",
"0.82560456",
"0.82142305",
"0.80289155",
"0.8009206",
"0.80025905",
"0.79537135",
"0.7919846",
"0.7901525",
"0.7895052",
"0.78092456",
"0.7759108",
"0.75865835",
"0.7575297",
"0.7575297",
"0.7575297",
"0.7575297",
"0.7575297",
"0.7535155",
"0.7505898",
"0.749749... | 0.0 | -1 |
is this action defined as a reputation action | def action_defined?
# ReputationThreshold.action_defined?(self.action, self.tier)
!self.action_points.nil?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reputation_threshold_action\n :offer_reward\n end",
"def action_defined?(action, tier=nil)\n if tier && !tier.accept_default_reputation_threshold\n if rate = tier.find_reputation_threshold_action_points(action)\n return !!rate.points\n end\n end\n respond_to?(action.... | [
"0.73953027",
"0.70862067",
"0.6136532",
"0.61103255",
"0.6049808",
"0.60334575",
"0.600791",
"0.5976963",
"0.5958899",
"0.59512293",
"0.5941366",
"0.59375584",
"0.5880065",
"0.584357",
"0.58298135",
"0.58221287",
"0.58221287",
"0.58019215",
"0.5797781",
"0.5728047",
"0.56945... | 0.7302406 | 1 |
returns the threshold points that are defined for certain action either in database or globally | def action_points
@threshold_action_points_cache ||= ReputationThreshold.action_points(self.action, self.tier)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_tier_threshold_points\n @tier_threshold_points_cache ||= if tp = self.tier.reputation_thresholds.find(:first, \n :conditions => [\"reward_rates.action = ?\", self.action.to_s])\n tp\n elsif self.tier.parent && (ptp = self.tier.parent.reputation_thresholds.find(:first, \n ... | [
"0.71479875",
"0.6933815",
"0.6827573",
"0.63600874",
"0.6338986",
"0.6283388",
"0.62192",
"0.61403847",
"0.59998006",
"0.5992386",
"0.5949395",
"0.5902614",
"0.58541006",
"0.5770324",
"0.57589537",
"0.56442285",
"0.5610904",
"0.5608768",
"0.5544826",
"0.5541749",
"0.5540912"... | 0.7490711 | 0 |
is a sender assigned? | def sender?
!!self.sender
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sender?\n !!self.sender\n end",
"def receive_sender sender\n true\n end",
"def receive_sender sender\n true\n end",
"def receive_sender sender\n true\n end",
"def sender? usr\n usr.id == user_id\n end",
"def sent?\n sender_id.present?\n end",
"def sen... | [
"0.76944166",
"0.76186776",
"0.76186776",
"0.76186776",
"0.761215",
"0.7483794",
"0.70083576",
"0.6990902",
"0.6962058",
"0.6909903",
"0.6815898",
"0.67791086",
"0.6705199",
"0.6705199",
"0.6694272",
"0.653331",
"0.653331",
"0.65278137",
"0.64955354",
"0.64868957",
"0.6459753... | 0.79234743 | 0 |
retrieves a bonus rate if any is associated with the associated tier | def find_tier_threshold_points
@tier_threshold_points_cache ||= if tp = self.tier.reputation_thresholds.find(:first,
:conditions => ["reward_rates.action = ?", self.action.to_s])
tp
elsif self.tier.parent && (ptp = self.tier.parent.reputation_thresholds.find(:first,
:conditions... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_bonus_rate(beneficiary_type = :receiver)\n BonusReward.action_bonus_rate(self.source.class, beneficiary_type, self.action, self.tier)\n end",
"def getBonus\r\n @bonus = super.getSalario / (2*100)\r\n end",
"def credit_score(tier)\n MEDIAN_SCORE_FOR_TIERS[\"#{tier}\"]\n end",
"def cre... | [
"0.7040691",
"0.61585283",
"0.6015817",
"0.59497535",
"0.59363645",
"0.5859149",
"0.5855255",
"0.5836696",
"0.5778396",
"0.5759117",
"0.57296884",
"0.5723276",
"0.57041246",
"0.5684323",
"0.56801325",
"0.5647507",
"0.56410944",
"0.55321246",
"0.552972",
"0.5518296",
"0.549678... | 0.564582 | 16 |
produces an html href to the faq pages | def link_to_faq(text, options={})
html = "<a"
html += " class=\"#{options[:class]}\"" if options[:class]
html += " href=\"/faq\""
html += ">"
html += text
html += "</a>"
html
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def faq_url\n WALLSOME_SITE_BASE_URL + \"/faq.html\"\n end",
"def faqs\n end",
"def faqs\n end",
"def faq\n end",
"def faq\n end",
"def render\n <<-HTML\n <div class=\"relative\">\n <a href=\"#{url}\"class=\"#{position_classes}f6 link dim br2 ph3 pv2 dib white bg-bl... | [
"0.7262702",
"0.6984959",
"0.6984959",
"0.63352615",
"0.63352615",
"0.6328134",
"0.6242769",
"0.6170071",
"0.6164575",
"0.6066346",
"0.6018735",
"0.59769714",
"0.59391046",
"0.5923673",
"0.59150124",
"0.58892757",
"0.5856246",
"0.57082224",
"0.57082224",
"0.57062006",
"0.5692... | 0.7102768 | 1 |
Dragon now has a name | def chooser(action , aDragon)
if action == 1
aDragon.full?
elsif action == 2
aDragon.feed
elsif action == 3
aDragon.needsToPoop?
elsif action == 4
aDragon.poop
elsif action == 5
aDragon.play?
elsif action == 6
aDragon.play
elsif action == 7
aDragon.sleepy?
elsif action == 8
aDrag... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dragon\n fetch('how_to_train_your_dragon.dragons')\n end",
"def name\n\t\tsuper || game.name\n\tend",
"def dragon; end",
"def dragon; end",
"def dragon; end",
"def new_name; end",
"def change_name(new_name)\n Dropio::Resource.client.change_drop_name(self,new_name)\n end",
"def... | [
"0.64676553",
"0.6372844",
"0.6339533",
"0.6339533",
"0.6339533",
"0.63168865",
"0.6284097",
"0.6274787",
"0.6256376",
"0.6256376",
"0.6256376",
"0.6256376",
"0.6256376",
"0.6256376",
"0.6256376",
"0.6256376",
"0.6256376",
"0.6256376",
"0.6256376",
"0.6256376",
"0.6256376",
... | 0.0 | -1 |
Defines a singleton_method in the receiver. The method parameter can be a Proc or Method object. If a block is specified, it is used as the method body. This block is evaluated using instance_eval. | def define_singleton_method(symbol, method)
# TODO
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def define_singleton_method name, &body\r\n singleton_class = class << self; self; end\r\n singleton_class.send(:define_method, name, &body)\r\n end",
"def define_and_call_method(method, &block)\n self.class.send(:define_method, method, block)\n send method\n end",
"def ensure_method(name, ... | [
"0.65705115",
"0.6448794",
"0.59842664",
"0.5925674",
"0.5833038",
"0.5671119",
"0.56663966",
"0.56383723",
"0.56275105",
"0.5615008",
"0.56046265",
"0.55882794",
"0.55846226",
"0.5533319",
"0.55091405",
"0.5500842",
"0.5488578",
"0.5486694",
"0.54477465",
"0.54208934",
"0.54... | 0.6649878 | 0 |
Same as send but for public methods only. | def public_send(name, *args)
unless self.public_methods.include?(name.to_s)
raise NoMethodError.new("undefined public method '#{name}' for #{self.to_s}", name, *args)
end
self.__send__(name, *args)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send\n puts \"a fake implementation of `send`\"\n end",
"def send(*args); __send__(*args); end",
"def send(options={})\n end",
"def send(message)\n message\n end",
"def send(*rest) end",
"def send(*rest) end",
"def send(*rest) end",
"def send(message)\n ## empty\n end",... | [
"0.81073403",
"0.7674125",
"0.7492846",
"0.73674595",
"0.73284924",
"0.73284924",
"0.73284924",
"0.7256608",
"0.71735346",
"0.71735346",
"0.71454793",
"0.7090753",
"0.70612705",
"0.6964915",
"0.6876524",
"0.68686116",
"0.67569244",
"0.6747323",
"0.6716152",
"0.67084885",
"0.6... | 0.6499719 | 28 |
Invokes the block, passing obj as a parameter. Returns obj. Allows you to write code that takes part in a method chain but that does not affect the overall value of the chain. | def tap
yield self
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def use_block(obj, &method)\n\tmethod.call\nend",
"def insp(obj)\n if block_given? then\n yield obj\n else\n p obj\n end\n obj\n end",
"def insp(obj)\n if block_given? then\n yield obj\n else\n p obj\n end\n obj\n end",
"def invoke *o,&b\n @invoker ||= creat... | [
"0.7445301",
"0.66234696",
"0.66234696",
"0.65384954",
"0.64763844",
"0.64132357",
"0.6406074",
"0.63386893",
"0.6320748",
"0.6318832",
"0.62696034",
"0.62621564",
"0.62588036",
"0.6245531",
"0.62220925",
"0.6215541",
"0.62100714",
"0.61919457",
"0.6184934",
"0.6184552",
"0.6... | 0.0 | -1 |
The default value in the documentation is 1, but in my local Ruby 1.9 it seems to be 1. I think it should match the default behavior of Arrayflatten, so I'm setting it to 1 here. | def flatten(depth = -1)
to_a.flatten(depth)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def using_flatten (array)\n return array.flatten!\nend",
"def using_flatten(array)\n array.flatten()\nend",
"def using_flatten(array)\n array.flatten\nend",
"def using_flatten(array)\n array.flatten\nend",
"def using_flatten(array)\n array.flatten\nend",
"def using_flatten(array)\n array.flatten\ne... | [
"0.73035467",
"0.7284821",
"0.7247959",
"0.7247959",
"0.7247959",
"0.7247959",
"0.7247959",
"0.7247959",
"0.72438383",
"0.72438383",
"0.7182163",
"0.71792734",
"0.7156797",
"0.71361023",
"0.7117705",
"0.70811355",
"0.7044457",
"0.7016554",
"0.7016554",
"0.68250465",
"0.682504... | 0.5834285 | 75 |
Edit a particular Address in the database | def edit_address(edited_address)
address = Address.find(edited_address.uid)
address.attributes = edited_address.attributes
address.save!
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edit\n\t\t@address = current_user.addresses.find(params[:id])\n\tend",
"def edit\n\t@address=Address.new\n\t@address=Address.find(params[:id])\nend",
"def update\n @address = @addressable.addresses.find_by_id(params[:id])\n\n respond_to do |format|\n if @address.update_attributes(params[:address... | [
"0.7819367",
"0.77717304",
"0.7608921",
"0.75805825",
"0.75805825",
"0.75251263",
"0.75176305",
"0.75176305",
"0.75176305",
"0.75176305",
"0.75176305",
"0.75176305",
"0.75176305",
"0.75176305",
"0.75176305",
"0.75176305",
"0.75176305",
"0.75176305",
"0.74903965",
"0.7477694",
... | 0.8174226 | 0 |
Delete a particular Address from the database | def delete_address(address)
address.delete!
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n @address = Address.find(params[:address_id])\n end",
"def delete_address(id)\n delete(\"addresses/#{id}\")\n end",
"def delete\n @carddav_backend.delete_address_book(@address_book_info['id'])\n end",
"def delete_address\n @mailing_list_address.destroy if @ok\n r... | [
"0.8295874",
"0.8109702",
"0.76348406",
"0.756122",
"0.7521462",
"0.73788595",
"0.73546976",
"0.7353126",
"0.7353126",
"0.7353126",
"0.7353126",
"0.7342045",
"0.73061633",
"0.7299389",
"0.7290487",
"0.72902477",
"0.72712773",
"0.7260513",
"0.724764",
"0.7227744",
"0.72251207"... | 0.84705895 | 0 |
Cleanse Address through third party service using SOA pattern (psuedocode) | def cleanse_address(address)
cleansed_address = SOAAddressCleanser.cleanse_address(address)
cleansed_address.save!
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getToolsParseAddress( address, postcode, country, normalise)\n params = Hash.new\n params['address'] = address\n params['postcode'] = postcode\n params['country'] = country\n params['normalise'] = normalise\n return doCurl(\"get\",\"/tools/parse/address\",params)\n end",
"def clean_for_com... | [
"0.6242082",
"0.60627574",
"0.5978242",
"0.5943953",
"0.59070307",
"0.59070307",
"0.5906608",
"0.5845295",
"0.57819074",
"0.5777708",
"0.5678787",
"0.5667282",
"0.56634676",
"0.5639671",
"0.5619848",
"0.56121933",
"0.5599824",
"0.5592019",
"0.55840635",
"0.5571092",
"0.556978... | 0.7425036 | 0 |
Validate zipcode through third party service using SOA pattern (psuedocode) | def validate_zip(address)
return SOAZipValidator(address.city, address.zipcode)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zipvalidate(postcode)\n !!postcode.match(/\\A[1-46][\\d]{5}\\z/)\nend",
"def zip_code\n @zip_code || (@address_line3 if @address_line3 =~ /(?i)^[a-z0-9][a-z0-9\\- ]{0,10}[a-z0-9]$/)\n end",
"def check_zipcode_validity\n\t\tif (zip_code =~ /\\d{5}/) == 0\n\t\t\t#zip_code.length == 5 and \n\t\t\t# !zip_... | [
"0.7463366",
"0.7298691",
"0.72607654",
"0.72205293",
"0.7136198",
"0.7124995",
"0.68900555",
"0.68285197",
"0.67880523",
"0.6695647",
"0.6690848",
"0.6675632",
"0.65642965",
"0.64860547",
"0.6445737",
"0.63939327",
"0.6359967",
"0.63279116",
"0.6292299",
"0.6266898",
"0.6217... | 0.7341014 | 1 |
node_and_bounds_stack = [] node_and_bounds_stack = upper_bound node_and_bounds_stack = upper_bound node_and_bounds_stack = upper_bound node_and_bounds_stack << [node.left, lower_bound, node.value] if node.left node_and_bounds_stack << [node.right, node.value, upper_bound] if node.right end true end Instead of allocatin... | def binary_search_tree?(root, lower_bound = -Float::INFINITY, upper_bound = Float::INFINITY)
if !root
true
elsif root.value >= upper_bound || root.value <= lower_bound
false
else
binary_search_tree?(root.left, lower_bound, root.value) && binary_search_tree?(root.right, root.value, upper_bound)
end
e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_binary_search_tree?(root_node)\n\n stack = [ ]\n\n # Setting lower and upper bounds\n stack << [root_node, -Float::INFINITY, Float::Infinity]\n\n while stack.length != 0\n node, lower_bound, upper_bound = stack.pop\n\n if node.value <= lower_bound || node.value <= upper_bound\n return fa... | [
"0.68675035",
"0.6679439",
"0.63407737",
"0.5869598",
"0.58388907",
"0.56184506",
"0.5616522",
"0.5597054",
"0.55575246",
"0.5498537",
"0.5495119",
"0.5495119",
"0.5495119",
"0.54874444",
"0.54652274",
"0.54620725",
"0.54620725",
"0.5441892",
"0.54412854",
"0.5419707",
"0.541... | 0.58537877 | 4 |
Nathan Tests def run_tests root = BinaryTreeNode.new(50) left = root.insert_left(30) right = root.insert_right(80) left_left = left.insert_left(20) left_right = left.insert_right(40) right_left = right.insert_left(70) right_right = right.insert_right(90) assert_true(root) root = BinaryTreeNode.new(50) left = root.inser... | def run_tests
desc = 'valid full tree'
tree = BinaryTreeNode.new(50)
left = tree.insert_left(30)
right = tree.insert_right(70)
left.insert_left(10)
left.insert_right(40)
right.insert_left(60)
right.insert_right(80)
result = binary_search_tree?(tree)
assert_true(result, desc)
desc = 'both subtrees... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unit_test_binary_tree\n node_a = Node.new('A', nil, nil, nil)\n node_b = Node.new('B', nil, nil, nil)\n node_c = Node.new('C', nil, nil, nil)\n node_d = Node.new('D', nil, nil, nil)\n node_e = Node.new('E', nil, nil, nil)\n node_f = Node.new('F', nil, nil, nil)\n node_g = Nod... | [
"0.7259953",
"0.70194036",
"0.68536365",
"0.68166846",
"0.6759323",
"0.6732959",
"0.67094165",
"0.6514451",
"0.65119976",
"0.65034074",
"0.6474655",
"0.64682364",
"0.6380666",
"0.6340369",
"0.63395727",
"0.6327768",
"0.6322519",
"0.6321463",
"0.62482226",
"0.6245848",
"0.6242... | 0.83192563 | 0 |
=> Constructor of the customer object | def initialize(options)
@id = options['id'].to_i if options['id']
@name = options['name']
@funds = options ['funds']
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(custId, custName,custAddr)\r\n\t\t\t@cust_id=custId\r\n\t\t\t@cust_name=custName\r\n\t\t\t@cust_addr=custAddr\r\n\t\tend",
"def initialize(name, id, addr)\n @cust_name = name\n @cust_id = id\n @cust_addr = addr\n end",
"def initialize(customer_id:)\n @customer_id = customer_id\n en... | [
"0.8038728",
"0.79974174",
"0.7942858",
"0.7917789",
"0.7864983",
"0.7804969",
"0.7702244",
"0.76082593",
"0.74763995",
"0.7425525",
"0.7422287",
"0.73818463",
"0.7289966",
"0.72801864",
"0.7259044",
"0.70525914",
"0.7048887",
"0.70371586",
"0.70371586",
"0.6996196",
"0.69842... | 0.0 | -1 |
=> Save the customer details to the db | def save()
sql = "INSERT INTO customers
(name, funds) VALUES ($1, $2) RETURNING id"
values = [@name,@funds]
customer = SqlRunner.run(sql,values).first
@id = customer['id'].to_i
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_customer_data\n @customer.init_id = self.id\n @customer.external_code = @parsed['buyer']['id']\n @customer.name = @parsed['buyer']['nickname']\n @customer.email = @parsed['buyer']['email']\n @customer.contact = @parsed['buyer']['phone']['area_code'] \n @customer.c... | [
"0.76205015",
"0.7521599",
"0.7414664",
"0.7131636",
"0.68902814",
"0.68871224",
"0.6772116",
"0.6749098",
"0.6727523",
"0.6726734",
"0.67132986",
"0.66882133",
"0.6659555",
"0.66469526",
"0.66467106",
"0.66246176",
"0.6605332",
"0.65962625",
"0.65954125",
"0.65803075",
"0.65... | 0.6644195 | 15 |
=> Update the customer object | def update()
sql = "UPDATE customers (name, funds) = ($1, $2) WHERE id = $3"
values = [@name, @funds, @id]
SqlRunner.run(sql,values)
# => Updating only, no need to return any array
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_customer(id, data)\n put(\"customers/#{id}\", { body: data })\n end",
"def update_customer(customer)\n respond_with customer.to_vaulted_billing\n end",
"def update_customer(customer)\n respond_with customer.to_vaulted_billing\n end",
"def update_customer(customer, id)\n... | [
"0.8015351",
"0.7896655",
"0.7896655",
"0.7823713",
"0.7803696",
"0.7728233",
"0.7728233",
"0.7728233",
"0.7728233",
"0.7711153",
"0.7692726",
"0.7685575",
"0.76518",
"0.7646136",
"0.7643561",
"0.7638084",
"0.76181424",
"0.7614156",
"0.76020837",
"0.75705224",
"0.75455004",
... | 0.0 | -1 |
=> Delete customer from db | def delete()
sql = "DELETE from customers WHERE id = $1"
values = [@id]
SqlRunner.run(sql, values)
# => Deleting customer record, nothing to return
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @customer.destroy\n end",
"def destroy\n @customer.destroy\n redirect_to customers_url\n end",
"def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n redirect_to(action: \"index\")\n end",
"def destroy\n @customer = Customer.find(params[:id])\n @c... | [
"0.8091326",
"0.7685374",
"0.7660621",
"0.7566509",
"0.7473403",
"0.7435382",
"0.73416096",
"0.73031926",
"0.72650564",
"0.72642577",
"0.7258824",
"0.7249436",
"0.7246636",
"0.71850663",
"0.7167352",
"0.7138773",
"0.7124898",
"0.7124898",
"0.71205467",
"0.7119648",
"0.7109989... | 0.79741013 | 1 |
=> Display all the films a particular customer has bought ticket for | def films()
sql = "SELECT films.* FROM films INNER JOIN tickets ON tickets.film_id = films.id WHERE customer_id = $1"
values = [@id]
film_data = SqlRunner.run(sql, values)
return Film.map_items(film_data)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def customers_for_film()\n sql = \"SELECT name FROM customers\n INNER JOIN tickets ON customers.id = tickets.customer_id\n WHERE film_id = $1 ORDER BY name\"\n values = [@id]\n customer_data = SqlRunner.run(sql, values)\n return Customer.map_items(customer_data)\n end",
"def films()\n sql... | [
"0.70514375",
"0.69678015",
"0.69102687",
"0.68326306",
"0.6825748",
"0.68093425",
"0.67934924",
"0.6775241",
"0.66688496",
"0.6593604",
"0.65885574",
"0.6540881",
"0.6534333",
"0.65192235",
"0.649704",
"0.6430018",
"0.6391056",
"0.6298964",
"0.62578",
"0.62064695",
"0.614608... | 0.71264905 | 0 |
=> Number of tickets each customer has bought | def number_of_films()
sql = "SELECT * FROM tickets where customer_id = $1"
values = [@id]
ticket_data = SqlRunner.run(sql, values)
return ticket_data.count
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count_tickets\n tickets = self.tickets\n total_tickets = tickets.count\n return total_tickets\n end",
"def tickets_bought\n sql = \"SELECT COUNT(*)\n FROM tickets\n WHERE tickets.customer_id = $1\"\n values = [@id]\n SqlRunner.run(sql, values)[0][\"count\"].to_i\n end",
... | [
"0.7735213",
"0.7696877",
"0.7692626",
"0.7619266",
"0.7418709",
"0.73740417",
"0.73553294",
"0.72566897",
"0.72186685",
"0.7174014",
"0.71256155",
"0.7105095",
"0.7089441",
"0.70863545",
"0.7001908",
"0.69688874",
"0.6956986",
"0.6923832",
"0.67903054",
"0.67573255",
"0.6752... | 0.653306 | 36 |
=> This method returns array of tickets bought per film | def tickets()
sql = "SELECT * FROM tickets where customer_id = $1"
values = [@id]
ticket_data = SqlRunner.run(sql, values)
return ticket_data.map{|ticket| Ticket.new(ticket)}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tickets_bought()\n tickets_array = films()\n number_of_tickets = tickets_array.count\n return \"#{@name} has bought #{number_of_tickets} tickets.\"\n end",
"def tickets_purchased\n return film().count\n end",
"def tickets()\n sql = \"SELECT * FROM tickets WHERE film_id = $1;\"\n values ... | [
"0.7128044",
"0.703539",
"0.69613135",
"0.68487406",
"0.68409777",
"0.6801151",
"0.6597981",
"0.65151405",
"0.65003645",
"0.6373937",
"0.6288932",
"0.6252599",
"0.6238403",
"0.6206907",
"0.61983687",
"0.6194867",
"0.6192137",
"0.6168034",
"0.6133847",
"0.6099034",
"0.60202897... | 0.6082166 | 20 |
=> buy a ticket, deducts price of ticket per film from customer funds | def buy_a_ticket()
tickets = self.tickets()
ticket_price = tickets.map{|ticket| ticket.price}
return @funds - ticket_price
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def buy()\n #films the customer has tickets to\n all_films = films()\n #sum the films (as there can be more than one) and from each film add the price up and assign it to price\n price = all_films.sum{|film| film.price}\n remaining_funds = @funds - price\n @funds = remaining_funds\n update() #... | [
"0.8161053",
"0.8083271",
"0.8066694",
"0.7943512",
"0.7837962",
"0.76317996",
"0.74703586",
"0.73242724",
"0.7155745",
"0.7136018",
"0.70331156",
"0.6866606",
"0.6864755",
"0.6788225",
"0.67771554",
"0.6751499",
"0.6742171",
"0.6666409",
"0.66032064",
"0.65131843",
"0.650289... | 0.7694071 | 5 |
santa actions that change attributes | def celebrate_birthday
@age += 1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_attraction\n @attraction = Attraction.find(params[:id])\n end",
"def action=(a)\n case a\n when :modify then attributes['action'] = 'modify'\n when :delete then attributes['action'] = 'delete'\n else attributes['action'] = 'add'\n end\n end",
"def update_attrib... | [
"0.6600644",
"0.62340844",
"0.61638635",
"0.61258847",
"0.6112647",
"0.608102",
"0.60578513",
"0.6045623",
"0.6034071",
"0.5986683",
"0.5963839",
"0.59500575",
"0.5933928",
"0.59278834",
"0.59278834",
"0.5906264",
"0.58816075",
"0.58630586",
"0.585532",
"0.5854311",
"0.585319... | 0.0 | -1 |
santa actions that change nothing | def speak
puts "Ho, ho, ho! Haaaaappy holidays! I'm #{@name}!"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def actions; end",
"def run_actions; end",
"def actions\n %w{void}\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action(unit)\n\tend",
"def act\n end",
"def skip_actions; end",
"def action(name)\n nil\n ... | [
"0.6825248",
"0.6770018",
"0.669183",
"0.662561",
"0.662561",
"0.662561",
"0.662561",
"0.662561",
"0.6617723",
"0.6504903",
"0.64317805",
"0.6414104",
"0.6360022",
"0.62848467",
"0.6238447",
"0.62325394",
"0.623005",
"0.6213607",
"0.62011904",
"0.61755025",
"0.61681587",
"0... | 0.0 | -1 |
Creates randomly organized list of magic reindeer | def random_reindeer_list
all_reindeer = ["Rudolph", "Dasher", "Dancer", "Prancer", "Vixen", "Comet", "Cupid", "Donner", "Blitzen"]
new_reindeer = []
while new_reindeer.length < all_reindeer.length
random_number = rand(all_reindeer.length)
if !new_reindeer.include?(all_reindeer[random_number])
new_re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_recipes_list\n recipes = YARD::Registry.all(:recipe).uniq.sort_by {|recipe| recipe.Name.to_s}\n generate_full_list(recipes, 'Recipe', 'recipes')\nend",
"def find_fake_rubies\r\n # Add 1 to max_fake_rubies to make maximum inclusive\r\n @random.rand(@max_fake_rubies + 1)\r\n end",
"def allf... | [
"0.6593049",
"0.62610567",
"0.6071813",
"0.6006191",
"0.60006255",
"0.5962376",
"0.5926925",
"0.58987534",
"0.58652794",
"0.5804481",
"0.5694882",
"0.5677505",
"0.56716573",
"0.5670613",
"0.56701905",
"0.5645982",
"0.56404537",
"0.5624624",
"0.56140167",
"0.5605665",
"0.56038... | 0.605563 | 3 |
Initialize the instance variables. | def initialize(options = {})
@account = options[:account] # optional, required for update
@account_type = options[:account_type] # optional, required for build
@account_params_key = options[:account_params_key] # computed; optional, used for testing
@current_user = options[:current_user] # required
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize\n init\n end",
"def initialize\n \n end",
"def initialize\n end",
"def initialize()\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initiali... | [
"0.8163876",
"0.80891144",
"0.80850136",
"0.79927564",
"0.794209",
"0.794209",
"0.794209",
"0.794209",
"0.794209",
"0.794209",
"0.79157686",
"0.79157686",
"0.79157686",
"0.78670985",
"0.78670985",
"0.78537095",
"0.78278196",
"0.78278196",
"0.78278196",
"0.78278196",
"0.781173... | 0.0 | -1 |
Returns a new account subclassed `Account` object. Can thrown an error if the account_type is invalid. | def build
set_action(:build)
validate_account_type!
new_account
assign_params
build_account_users
set_affiliate
set_created_by
set_facility
after_build
account
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create(type, holder)\n # takes a type and holder args\n type = normalise type\n # normalises type\n fail UnrecognisedAccountType unless types[type]\n # tries to find account type, if it fails, raises an exception\n account_class = types[type]\n # sets account constant equal to account_clas... | [
"0.68101394",
"0.6670921",
"0.6576813",
"0.64980304",
"0.6218536",
"0.61640567",
"0.61101097",
"0.6054463",
"0.59179795",
"0.591192",
"0.58451605",
"0.58028185",
"0.57834893",
"0.57706785",
"0.5708806",
"0.57079804",
"0.5704041",
"0.5660684",
"0.5650584",
"0.5527529",
"0.5507... | 0.0 | -1 |
Returns an updated account subclassed `Account` object. Can thrown an error if the account_type is invalid. | def update
set_action(:update)
set_account_type
validate_account_type!
assign_params
set_affiliate
set_updated_by
after_update
account
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def account_type(account_type_id)\n result = nil\n public_connection(HTTP_GET, \"/api/accounts/#{account_type_id}.xml\") do |xml|\n result = AccountType.new xml\n end\n result\n end",
"def user_account_instance\n Account.new\n end",
"def set_account_type\n @account_type = a... | [
"0.66100925",
"0.64324003",
"0.63210845",
"0.62788147",
"0.62615603",
"0.6165628",
"0.6164341",
"0.6150664",
"0.61357915",
"0.6135556",
"0.6135556",
"0.6135556",
"0.6135556",
"0.6135556",
"0.6135556",
"0.6135556",
"0.6135556",
"0.6135556",
"0.6135556",
"0.6098479",
"0.6086094... | 0.5917768 | 26 |
Given an account type, set the account_params_key. | def account_params_key
@account_params_key ||= Account.config.account_type_to_param(account_type)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_account_type\n @account_type = AccountType.find(params[:id])\n end",
"def accounttype_params\n params.require(:accounttype).permit(:name, :description, :key)\n end",
"def register_account_type_params\n if params[:account][:account_type]\n params.require(:account).require(:account_ty... | [
"0.7022764",
"0.69546366",
"0.6658146",
"0.66553295",
"0.66403574",
"0.6585411",
"0.65810865",
"0.6462391",
"0.64344263",
"0.6424918",
"0.64217556",
"0.6405559",
"0.6390779",
"0.6322264",
"0.6296023",
"0.6167764",
"0.615584",
"0.6148411",
"0.6143317",
"0.6137606",
"0.6114785"... | 0.76216143 | 0 |
Override this method in subclassed builder to extend `build` functionality. | def after_build
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build(**)\n raise NotImplementedError\n end",
"def build\n builder_values = builder.build\n self.use_values(builder_values)\n end",
"def method_missing(method, *args, &block)\n return super unless builder\n\n builder.send(method, *args, &block)\n end"... | [
"0.76993394",
"0.7680568",
"0.7638899",
"0.7638899",
"0.7562441",
"0.7510505",
"0.7434514",
"0.7430104",
"0.7336465",
"0.73127973",
"0.73127973",
"0.73127973",
"0.72477365",
"0.72477365",
"0.7190878",
"0.7165169",
"0.71587276",
"0.7142333",
"0.7070192",
"0.70301557",
"0.70056... | 0.0 | -1 |
Override this method in subclassed builder to extend `update` functionality. | def after_update
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n raise NotImplementedError\n end",
"def update\n raise NotImplementedError\n end",
"def update\n raise NotImplementedError\n end",
"def update\n raise NotImplementedError\n end",
"def update\n super\n end",
"def update\n raise NotImplemente... | [
"0.71597517",
"0.7138017",
"0.71202916",
"0.71202916",
"0.71091527",
"0.70785534",
"0.70659834",
"0.6944534",
"0.68830824",
"0.68361914",
"0.6831079",
"0.68089044",
"0.68089044",
"0.67995644",
"0.6787873",
"0.6767465",
"0.6767465",
"0.6767465",
"0.6767465",
"0.6756778",
"0.67... | 0.0 | -1 |
Override in subclassed builder to define additional strong_param attributes for build action. Returns an array of "permitted" params. | def account_params_for_build
self.class.common_permitted_account_params + [:account_number]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def permitted_params\n @permitted_params ||= declared(params,\n include_missing: false,\n include_parent_namespaces: false)\n end",
"def additional_permitted_params\n []\n end",
"def build_permitted_params\n ... | [
"0.7562044",
"0.75511485",
"0.726671",
"0.7119321",
"0.7104823",
"0.70527065",
"0.70256424",
"0.70054764",
"0.70054764",
"0.7003784",
"0.6985272",
"0.6904872",
"0.68628675",
"0.67994815",
"0.67788035",
"0.6740758",
"0.670578",
"0.6703831",
"0.6667523",
"0.6659665",
"0.6641679... | 0.6362185 | 26 |
Override in subclassed builder to define additional strong_param attributes for update action. Returns an array of "permitted" params. | def account_params_for_update
self.class.common_permitted_account_params.dup
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def additional_permitted_params\n []\n end",
"def permitted_params\n @permitted_params ||= declared(params,\n include_missing: false,\n include_parent_namespaces: false)\n end",
"def permit_params_on_update *keys\... | [
"0.7386648",
"0.7249137",
"0.7162558",
"0.7070101",
"0.70663613",
"0.7031135",
"0.69516516",
"0.69338334",
"0.68930537",
"0.68533415",
"0.6831706",
"0.6789394",
"0.67850703",
"0.67850703",
"0.67675537",
"0.67623067",
"0.67027956",
"0.6698876",
"0.66924614",
"0.66590005",
"0.6... | 0.69629824 | 6 |
Applies strong_param rules to the passed in params based on the current `action`. Assumes params are guarenteed to be an instantiated `ActionController::Parameters` object. Silently returns an empty params hash if the `account_params_key` is missing. | def account_params
return ActionController::Parameters.new unless params.key?(account_params_key)
permitted = send("account_params_for_#{action}")
params.require(account_params_key).permit(*permitted)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def account_params\n @account_params ||= params.require(:account).except(:user)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).... | [
"0.6255454",
"0.6014911",
"0.5959547",
"0.5919349",
"0.59032226",
"0.5898747",
"0.58598787",
"0.57777226",
"0.5776317",
"0.57508504",
"0.57365084",
"0.5727238",
"0.57134247",
"0.5712519",
"0.56805354",
"0.5678277",
"0.56631446",
"0.56222606",
"0.5593027",
"0.5592583",
"0.5591... | 0.74400306 | 0 |
Simply assigns the strong_params to the account new/persisted account object. | def assign_params
account.assign_attributes(account_params)
account
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def account_params\n params.fetch(:account, {}).permit(:current_password, :password, :password_confirmation)\n end",
"def create( params )\n params.delete( :id ) # Prevent overwriting ID\n Account.new( params ).save\n end",
"def account_params\n params.require(:account).permit... | [
"0.6963002",
"0.6961664",
"0.69106436",
"0.6848165",
"0.6837659",
"0.67944485",
"0.6761268",
"0.6687412",
"0.6679951",
"0.6677307",
"0.667075",
"0.6654123",
"0.6640671",
"0.6635405",
"0.66181237",
"0.6611523",
"0.6599604",
"0.65879446",
"0.65874106",
"0.65801793",
"0.6571076"... | 0.7993425 | 0 |
Sets the `action` which is used to load the proper set of account_params. The action should always get set before `account_params` is called. | def set_action(action)
@action = action
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def action=(action)\n validator = EnumAttributeValidator.new('String', [\"None\", \"GeneratePreSignedUploadUrl\", \"GeneratePreSignedDownloadUrl\", \"CompleteImportProcess\", \"MarkImportFailed\", \"PreCache\", \... | [
"0.6679395",
"0.65982026",
"0.6566531",
"0.6449901",
"0.6434612",
"0.62735105",
"0.62001806",
"0.6197067",
"0.61663985",
"0.6137422",
"0.61278105",
"0.61094934",
"0.6081423",
"0.60546964",
"0.60503405",
"0.5999909",
"0.5964624",
"0.59615743",
"0.5939661",
"0.5900196",
"0.5887... | 0.66290647 | 1 |
Given an account, set the account_type. Only used for `update`. | def set_account_type
@account_type = account.class.to_s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def account_type=(account_type)\n validator = EnumAttributeValidator.new('String', [\"C\", \"S\"])\n unless validator.valid?(account_type)\n fail ArgumentError, \"invalid value for \\\"account_type\\\", must be one of #{validator.allowable_values}.\"\n end\n @account_type = account_type\... | [
"0.7769743",
"0.7734451",
"0.77227294",
"0.7722503",
"0.7311412",
"0.70600116",
"0.7044634",
"0.690822",
"0.6901016",
"0.6747927",
"0.66774553",
"0.6595702",
"0.65805143",
"0.64787865",
"0.6453682",
"0.6411728",
"0.6408398",
"0.6379682",
"0.6379682",
"0.63513744",
"0.62595695... | 0.8263673 | 0 |
Build the owner account_user. Only used for `build`. | def build_account_users
account.account_users.build(
user_id: owner_user.id,
user_role: "Owner",
created_by: current_user.id,
)
account
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_user(attributes = {}, options = {})\n @provider_user.build_record(attributes, options)\n end",
"def owner\n @owner ||= User.new(connection, :login => @attributes[:owner])\n end",
"def make_owner(user, org)\n associate_in_groups(user, org, [\"admins\", \"billing-admins\", \"us... | [
"0.67366105",
"0.6534766",
"0.6529248",
"0.63094616",
"0.62501216",
"0.62178934",
"0.62178934",
"0.6211486",
"0.6205372",
"0.6155081",
"0.6086903",
"0.60621643",
"0.60589343",
"0.60346043",
"0.59902084",
"0.5987126",
"0.5974206",
"0.5943992",
"0.5923644",
"0.5850913",
"0.5793... | 0.7838152 | 0 |
Set the affiliate_id if the account type supports affiliates, the affiliate param is present, and the affiliate exists. Also ensure affiliate_other gets wiped out if the affiliate_id does not point to `Other`. | def set_affiliate
if affiliate.present?
account.affiliate_id = affiliate.id
account.affiliate_other = affiliate.subaffiliates_enabled? ? account_params[:affiliate_other] : nil
else
account.affiliate_id = account.affiliate_other = nil
end
account
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def affiliate= affiliate\n if affiliate\n if affiliate.class != affiliate_class # self.class.to_s != \"#{affiliate.class.to_s}Reference\"\n raise \"Attempt to affiliate #{self.class.to_s} reference with #{affiliate.class} object.\"\n elsif affiliate_id && (affiliate_id != affiliate.id)\n ... | [
"0.71535945",
"0.67755854",
"0.6702551",
"0.65431345",
"0.64234036",
"0.64234036",
"0.62347305",
"0.6205583",
"0.6086611",
"0.5946735",
"0.5888641",
"0.58612424",
"0.5811037",
"0.57084227",
"0.5680665",
"0.5662318",
"0.5533677",
"0.55099297",
"0.5326219",
"0.5311682",
"0.5283... | 0.8225072 | 0 |
Set the facility if the account type is scoped to facility. | def set_facility
return unless account.per_facility? && facility&.id
account.account_facility_joins.build(facility: facility)
account
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_facility_type\n @facility_type = FacilityType.find(params[:id])\n end",
"def set_facility\n @facility = Facility.find(params[:id])\n end",
"def set_facility\n @facility = Facility.find(params[:id])\n end",
"def set_facility\n @facility = Facility.find(params[:id])\n en... | [
"0.6779261",
"0.65848863",
"0.65848863",
"0.65848863",
"0.65848863",
"0.65848863",
"0.65848863",
"0.65848863",
"0.65848863",
"0.65848863",
"0.6562685",
"0.6315417",
"0.63153106",
"0.6217873",
"0.6120958",
"0.60601026",
"0.60302186",
"0.60097283",
"0.5844239",
"0.58384955",
"0... | 0.73396176 | 0 |
Set created_by. Only used for `build`. | def set_created_by
account.created_by = current_user.id
account
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def created_by=(value)\n @created_by = value\n end",
"def created_by=(value)\n @created_by = value\n end",
"def created_by=(value)\n @created_by = value\n end",
"def created_by=(value)\n @created_by = value\n end",
"d... | [
"0.8799333",
"0.87266785",
"0.87266785",
"0.87266785",
"0.87266785",
"0.87266785",
"0.87266785",
"0.87266785",
"0.87266785",
"0.8391803",
"0.83294576",
"0.8119757",
"0.7641155",
"0.7586488",
"0.74926955",
"0.73534316",
"0.73534316",
"0.73534316",
"0.73534316",
"0.73534316",
"... | 0.7684822 | 12 |
Set updated_by. Only used for `update`. | def set_updated_by
account.updated_by = current_user.id
account
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUpdatedBy(updatedBy)\r\n\t\t\t\t\t@updatedBy = updatedBy\r\n\t\t\t\tend",
"def updatedby\n\t\t\tif !@@cu.nil? and self.respond_to?(:updated_by)\n\t\t\t\tself[:updated_by] = @@cu\n\t\t\tend\n\t\tend",
"def update_updated_by\n self.updated_by = User.current.id if User.current and not destroyed?\n end"... | [
"0.8543314",
"0.79168355",
"0.7873547",
"0.7873547",
"0.7873547",
"0.72732794",
"0.71650875",
"0.71650875",
"0.71650875",
"0.71650875",
"0.71650875",
"0.7110345",
"0.71007544",
"0.7010657",
"0.6921585",
"0.6899877",
"0.68296325",
"0.6521129",
"0.6509423",
"0.63593334",
"0.635... | 0.77463037 | 5 |
Return true when there is no missing number | def solved?
!@grid.nil? && @grid.missing == 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def missing_one_at_either_end\n [2,3].each { |i|\n return true if @counts[i]>0 && @counts[i+1]>0 && @counts[i+2]>0\n }\n return false\n end",
"def numeric_empty(num)\n false\n end",
"def is_miss?\n sum < 10 && sum >= 0\n end",
"def missing\n ... | [
"0.74755687",
"0.7137668",
"0.69962347",
"0.69578",
"0.6875343",
"0.68661463",
"0.67559326",
"0.67193",
"0.6711755",
"0.67070115",
"0.66544",
"0.6636543",
"0.6551751",
"0.6521057",
"0.6482695",
"0.64476204",
"0.64337045",
"0.64287883",
"0.6415554",
"0.6401273",
"0.63867044",
... | 0.0 | -1 |
define the arguments that the user will input | def arguments(model)
args = OpenStudio::Ruleset::OSArgumentVector.new
delete_existing = OpenStudio::Ruleset::OSArgument::makeBoolArgument('delete_existing', true)
delete_existing.setDisplayName('Delete any existing HVAC equipment?')
args << delete_existing
cop_cooling = OpenStudio::Ruleset::OS... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def arguments; end",
"def arguments; end",
"def arguments; end",
"def arguments\n \"\"\n end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end... | [
"0.73753476",
"0.73753476",
"0.73753476",
"0.70890766",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",... | 0.0 | -1 |
end the arguments method define what happens when the measure is run | def run(model, runner, user_arguments)
super(model, runner, user_arguments)
# use the built-in error checking
if not runner.validateUserArguments(arguments(model), user_arguments)
return false
end
# Retrieve arguments' values
delete_existing = runner.getBoolArgumentValue('delete_exi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def measure=(_arg0); end",
"def measure(*args, &b)\n end",
"def measure; end",
"def communicate_measure_result(_ = nil, _ = nil); end",
"def communicate_measure_result(_ = nil, _ = nil); end",
"def arguments; end",
"def arguments; end",
"def arguments; end",
"def run(model, runner, user_argument... | [
"0.75139344",
"0.6953028",
"0.6925405",
"0.62936574",
"0.62936574",
"0.62231666",
"0.62231666",
"0.62231666",
"0.6147781",
"0.61190116",
"0.6115281",
"0.6041931",
"0.59806466",
"0.5979827",
"0.5972065",
"0.59660065",
"0.596179",
"0.59565085",
"0.594699",
"0.5906013",
"0.59060... | 0.0 | -1 |
return the bank activity for the specified date | def activity(date)
main_ledger_account.activity(date)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def activity(date)\n ledger_entries.for_date(date).sum(:debit) - ledger_entries.for_date(date).sum(:credit)\n end",
"def get_account_activity(start_date, end_date, options = {})\n submit GetAccountActivity.new(options.merge(:start_date => start_date, :end_date => end_date))\n end",
"def activities_... | [
"0.69148326",
"0.6866681",
"0.6711",
"0.6711",
"0.6511803",
"0.6454644",
"0.64540946",
"0.62788147",
"0.62519133",
"0.6086539",
"0.6069161",
"0.6055967",
"0.5982076",
"0.5918181",
"0.5872746",
"0.5864139",
"0.58433294",
"0.5812383",
"0.5749635",
"0.5742037",
"0.56973827",
"... | 0.82403153 | 0 |
return daily balances for a date range... | def daily_balances(start_date, end_date)
LedgerAccountHelper.daily_balances(main_ledger_account, start_date, end_date)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def balance(date = Time.now)\n total = 0\n\n transactions.sort_by(&:transaction_at).each do |transaction|\n break if transaction.transaction_at.end_of_day > date.end_of_day\n\n total += transaction.adjusted_amount\n end\n\n total\n end",
"def balance(date=Date.tomorrow)\n ledger_entries... | [
"0.7316175",
"0.7285797",
"0.6791438",
"0.6625377",
"0.6614883",
"0.65106344",
"0.62950295",
"0.6216034",
"0.6122384",
"0.6084558",
"0.6074286",
"0.6066016",
"0.60606134",
"0.603537",
"0.6014007",
"0.60114545",
"0.5963322",
"0.59528744",
"0.5940237",
"0.5928822",
"0.59189856"... | 0.85685986 | 0 |
Add errors if name_is_valid? returns false | def name_is_valid
errors.add(:name,'Invalid empty string for name.') unless name_is_valid?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name_is_valid\n errors.add(:name,\"Invalid string for name.\") unless name_is_valid?\n end",
"def name_invalid\n errors.add(:name, :unknown)\n end",
"def validate_name\n unless name.length > 0\n add_error :name, 'name of the price item shall be provided'\n end\n\n unless price.to_i > ... | [
"0.8849024",
"0.81621915",
"0.78472495",
"0.7818782",
"0.780932",
"0.76998484",
"0.76245207",
"0.76146877",
"0.7571461",
"0.7513229",
"0.7502683",
"0.7485334",
"0.7476541",
"0.74586964",
"0.7434845",
"0.7434845",
"0.738939",
"0.73345906",
"0.73150057",
"0.7263868",
"0.7228135... | 0.8818862 | 1 |
Tests if the name of course is not nil and is a string and returns true or false. | def name_is_valid?
return false unless not_nil_and_string(self.name)
return self.name.length > 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name?\n @name.is_a?(String) && !@name.empty?\n end",
"def valid?\n valid = true\n\n if self.name.nil? || self.name == \"\"\n valid = false\n end\n\n return valid\n end",
"def valid?\n !name.nil?\n end",
"def valid?\n !name.nil?\n end",
"def valid?\n !n... | [
"0.7013948",
"0.67589116",
"0.6693198",
"0.6693198",
"0.6693198",
"0.6618374",
"0.6543606",
"0.6467556",
"0.6462177",
"0.64107823",
"0.64037585",
"0.63744503",
"0.6357518",
"0.63415873",
"0.63144195",
"0.6290922",
"0.6275527",
"0.6272617",
"0.62617624",
"0.624366",
"0.6232078... | 0.70330954 | 1 |
Add errors if start_time_is_valid? return false | def start_time_is_valid
errors.add(:start_time,'Invalid empty string for start time.') unless start_time_is_valid?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start_time_is_valid?\n return false unless not_nil_and_string(self.start_time)\n return self.start_time.length > 0\n end",
"def check_time\t\n\t\treturn unless errors.blank? #this will ensure the right error count on top area\n\t\tif @start_date.present? && @start_time.present?\n\t\t\t#concatenate sta... | [
"0.7999102",
"0.7996796",
"0.7843696",
"0.77276343",
"0.7530397",
"0.7518192",
"0.75014573",
"0.7498077",
"0.7456445",
"0.7414144",
"0.73869014",
"0.7364325",
"0.73481107",
"0.7343726",
"0.73241955",
"0.7321338",
"0.7305339",
"0.7286456",
"0.72858655",
"0.72568065",
"0.724898... | 0.8787081 | 0 |
Tests if start_time of course is not nil and a string and returns true or false. | def start_time_is_valid?
return false unless not_nil_and_string(self.start_time)
return self.start_time.length > 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_start_time?\n !start_time.blank?\n end",
"def start_time_is_valid\n errors.add(:start_time,'Invalid empty string for start time.') unless start_time_is_valid?\n end",
"def start_time_present?\n if start_time.blank?\n errors.add('start_time',\"Please select appointment time\")\n end\n... | [
"0.7924206",
"0.7236668",
"0.71151656",
"0.69725066",
"0.6866959",
"0.67938334",
"0.6708347",
"0.66759753",
"0.6662058",
"0.6644632",
"0.6598933",
"0.6592477",
"0.6556836",
"0.64680177",
"0.6377812",
"0.636196",
"0.6350664",
"0.6345295",
"0.6282905",
"0.6227318",
"0.6182376",... | 0.8072464 | 0 |
Adds errors if end_time_is_valid? returns false | def end_time_is_valid
errors.add(:end_time,'Invalid empty string for end time.') unless end_time_is_valid?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_end_time\n if self.end_time.present? && self.end_time < self.start_time\n errors.add(:end_time, \"can't be before start time\")\n end\n end",
"def end_time_is_valid?\n return false unless not_nil_and_string(self.end_time)\n return self.end_time.length > 0\n end",
"def ends_after... | [
"0.8372728",
"0.80865073",
"0.7941235",
"0.7939686",
"0.76964194",
"0.7666876",
"0.76550233",
"0.76165175",
"0.75892025",
"0.7441538",
"0.74052954",
"0.74022347",
"0.7362591",
"0.7358371",
"0.73036015",
"0.72367185",
"0.7205526",
"0.71653897",
"0.71572155",
"0.71463424",
"0.7... | 0.89177924 | 0 |
Tests if end_time of course is not nil and a string and returns true or false | def end_time_is_valid?
return false unless not_nil_and_string(self.end_time)
return self.end_time.length > 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def end_time_is_valid\n errors.add(:end_time,'Invalid empty string for end time.') unless end_time_is_valid?\n end",
"def ended?\n end_time < Time.now.utc\n end",
"def end_time_defined?(time)\n if time.empty?\n '24:00'\n else\n time\n end\n end",
"def check_end_tim... | [
"0.75151235",
"0.7071533",
"0.7012782",
"0.69998944",
"0.69763255",
"0.68621856",
"0.67484266",
"0.6702217",
"0.66968906",
"0.6653403",
"0.65554947",
"0.65447974",
"0.6541156",
"0.65404207",
"0.6499381",
"0.6482098",
"0.6481419",
"0.64493936",
"0.64316547",
"0.6426057",
"0.63... | 0.8366072 | 0 |
Adds errors if number_of_classes_is_valid? returns false | def number_of_classes_is_valid
errors.add(:number_of_classes, 'Invalid number of classes') unless number_of_classes_is_valid?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def number_of_classes_is_valid?\n return ((self.number_of_classes != nil) and (self.number_of_classes > 0))\n end",
"def class_max_is_valid\n errors.add(:class_max,'Invalid class max value.') unless class_max_is_valid?\n end",
"def validate!\n validations.each do |name, attributes|\n valid ... | [
"0.7522681",
"0.7069296",
"0.67471296",
"0.656553",
"0.64563817",
"0.6422648",
"0.6338168",
"0.62567747",
"0.62289953",
"0.61848646",
"0.6147791",
"0.605664",
"0.60460085",
"0.6029689",
"0.58844614",
"0.58604866",
"0.5849429",
"0.58055294",
"0.5799057",
"0.57950073",
"0.57642... | 0.85071665 | 0 |
Tests if number_of_classes for course is not nil and is greater than 0 and returns true or false. | def number_of_classes_is_valid?
return ((self.number_of_classes != nil) and (self.number_of_classes > 0))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def class_how_full?\n return [self.students.count, self.class_max]\n end",
"def class_max_is_valid?\n if ((self.class_max == nil) or (self.class_min == nil)); return false; end\n return ((self.class_max > 0) and (self.class_max >= self.class_min))\n end",
"def number_of_classes_is_valid\n errors.... | [
"0.6785777",
"0.6499839",
"0.6447862",
"0.60926414",
"0.60425615",
"0.6017673",
"0.601499",
"0.59928703",
"0.5950029",
"0.59366846",
"0.59196985",
"0.59128827",
"0.582566",
"0.57868314",
"0.57623893",
"0.573326",
"0.5698248",
"0.5665097",
"0.5654583",
"0.5654574",
"0.5652654"... | 0.8152797 | 0 |
Adds errors if days_of_week_are_valid? returns false | def days_of_week_are_valid
errors.add(:days_of_week, "The days of the week are invalid.") unless days_of_week_are_valid?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def holiday_cannot_be_on_weekends\n if (self.date.strftime(\"%u\") == \"6\" or self.date.strftime(\"%u\") == \"7\")\n errors.add(:date, \"Holiday should not be on weekends\")\n end\n end",
"def holiday_cannot_be_on_weekends\n if (self.date.cwday == 6 or self.date.cwday == 7)\n errors.add(... | [
"0.7174689",
"0.7134445",
"0.6684376",
"0.6663943",
"0.6574682",
"0.64387727",
"0.64259505",
"0.6385372",
"0.6326706",
"0.63082343",
"0.6243195",
"0.62150246",
"0.6198207",
"0.6071262",
"0.59911764",
"0.5979931",
"0.59618443",
"0.59327656",
"0.59267604",
"0.59069324",
"0.5903... | 0.90779454 | 0 |
Tests that none of the days for course are nil and that the days's values are either true or false and returns true or false. | def days_of_week_are_valid?
if (self.sunday == nil); return false; end
if (self.monday == nil); return false; end
if (self.tuesday == nil); return false; end
if (self.wednesday == nil); return false; end
if (self.thursday == nil); return false; end
if (self.friday == nil); return false; end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid?\n return false if !@day.nil? && @day > 7\n return false if !@day.nil? && @day < 1\n true\n end",
"def perfectDayChecker day\n\t\t\t# If all five prayers were performed\n\t\t\tif day[:fajr] == 2 && day[:zuhr] == 2 && day[:asr] == 2 && day[:maghrib] == 2 && day[:isha] == 2\n\t\t\t \ttr... | [
"0.6718847",
"0.6342332",
"0.6290253",
"0.6216907",
"0.6163219",
"0.61618423",
"0.61407477",
"0.61189467",
"0.610051",
"0.6086731",
"0.59891325",
"0.5977873",
"0.5975071",
"0.5947247",
"0.5933533",
"0.5908023",
"0.5903136",
"0.5901139",
"0.5900149",
"0.58926564",
"0.5793009",... | 0.70101815 | 0 |
Adds errors if class_min_is_valid? returns false | def class_min_is_valid
errors.add(:class_min,'Invalid class min value.') unless class_min_is_valid?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def class_max_is_valid\n errors.add(:class_max,'Invalid class max value.') unless class_max_is_valid?\n end",
"def number_of_classes_is_valid\n errors.add(:number_of_classes, 'Invalid number of classes') unless number_of_classes_is_valid?\n end",
"def validate!\n validations.each do |name, attribu... | [
"0.7651848",
"0.7138",
"0.6872949",
"0.686868",
"0.65987456",
"0.6569817",
"0.65232015",
"0.6440607",
"0.6436913",
"0.6407076",
"0.63661844",
"0.6311979",
"0.6305959",
"0.62571955",
"0.62362486",
"0.6199062",
"0.6176973",
"0.6117106",
"0.6106732",
"0.6089589",
"0.60867894",
... | 0.84453946 | 0 |
Tests that class_min is not nil or that the class_max has not been set. It checks that the class_min is greater than 0 and that the class_max is greater than the class_min. It returns true or false. | def class_min_is_valid?
if ((self.class_min == nil) or (self.class_max == nil)); return false; end
return ((self.class_min > 0) and (self.class_max >= self.class_min))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def class_max_is_valid?\n if ((self.class_max == nil) or (self.class_min == nil)); return false; end\n return ((self.class_max > 0) and (self.class_max >= self.class_min))\n end",
"def between_min_max?(value, min, max) # TODO Repetido en concern/Methods\n return true if value >= min and value <= max\n ... | [
"0.8976752",
"0.7068911",
"0.69315034",
"0.6750686",
"0.66466933",
"0.65867406",
"0.65733033",
"0.64799",
"0.6456605",
"0.6378076",
"0.6349214",
"0.63116854",
"0.6307662",
"0.6287422",
"0.6140929",
"0.61234784",
"0.61009705",
"0.60757023",
"0.6066163",
"0.6064067",
"0.5995531... | 0.894168 | 1 |
Adds errors if class_max_is_valid? returns false | def class_max_is_valid
errors.add(:class_max,'Invalid class max value.') unless class_max_is_valid?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def number_of_classes_is_valid\n errors.add(:number_of_classes, 'Invalid number of classes') unless number_of_classes_is_valid?\n end",
"def class_min_is_valid\n errors.add(:class_min,'Invalid class min value.') unless class_min_is_valid?\n end",
"def class_max_is_valid?\n if ((self.class_max == nil... | [
"0.76212156",
"0.7602966",
"0.7227967",
"0.66246027",
"0.64286155",
"0.64081997",
"0.6334596",
"0.6237823",
"0.6090215",
"0.6060761",
"0.59815574",
"0.5877955",
"0.58717567",
"0.58577055",
"0.58097744",
"0.58062315",
"0.57630754",
"0.5756526",
"0.575159",
"0.57459027",
"0.569... | 0.89256746 | 0 |
Tests that class_max is not nil or that the class_min has not been set. It checks that the class_max is greater than 0 and that the class_max is greater than the class_min. It returns true or false. | def class_max_is_valid?
if ((self.class_max == nil) or (self.class_min == nil)); return false; end
return ((self.class_max > 0) and (self.class_max >= self.class_min))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def class_min_is_valid?\n if ((self.class_min == nil) or (self.class_max == nil)); return false; end\n return ((self.class_min > 0) and (self.class_max >= self.class_min))\n end",
"def class_max_is_valid\n errors.add(:class_max,'Invalid class max value.') unless class_max_is_valid?\n end",
"def betw... | [
"0.8701463",
"0.7271286",
"0.68165153",
"0.6568958",
"0.64566576",
"0.64448696",
"0.6411269",
"0.63438433",
"0.62115705",
"0.6198311",
"0.6154437",
"0.6086009",
"0.6051319",
"0.6032028",
"0.5990534",
"0.59790343",
"0.5978076",
"0.5970896",
"0.5964176",
"0.5936864",
"0.5927225... | 0.914462 | 0 |
Adds errors if fee_per_meeting_is_valid? returns false | def fee_per_meeting_is_valid
errors.add(:fee_per_meeting, 'The fee per meeting is invalid.') unless fee_per_meeting_is_valid?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def total_fee_is_valid\n errors.add(:total_fee,'The total fee is invalid.') unless total_fee_is_valid?\n end",
"def fee_per_meeting_is_valid?\n return ((self.fee_per_meeting != nil) and (self.fee_per_meeting >= 0))\n end",
"def fee_for_additional_materials_is_valid\n errors.add(:fee_for_additional_m... | [
"0.79279375",
"0.74114054",
"0.7103139",
"0.6207525",
"0.6129603",
"0.60691947",
"0.59894615",
"0.59121746",
"0.58904517",
"0.58663905",
"0.5836151",
"0.5826796",
"0.5826259",
"0.5804788",
"0.57486326",
"0.57260144",
"0.5715971",
"0.5714275",
"0.57007545",
"0.5699851",
"0.569... | 0.91105443 | 0 |
Tests that the fee_per_meeting for course is not nil and greater than or equal to 0 and returns true or false. | def fee_per_meeting_is_valid?
return ((self.fee_per_meeting != nil) and (self.fee_per_meeting >= 0))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def total_fee_is_valid?\n return ((self.total_fee != nil) and (self.total_fee >= 0))\n end",
"def free?\n self.setupFee == 0 && self.laborFee == 0 && self.oneTimeFee == 0 && self.recurringFee == 0 && self.hourlyRecurringFee == 0\n end",
"def fee_per_meeting_is_valid\n errors.add(:fee_per_meeting... | [
"0.7554179",
"0.6729728",
"0.6571799",
"0.6494584",
"0.64643955",
"0.623191",
"0.60558814",
"0.6021846",
"0.5957028",
"0.5939857",
"0.59163016",
"0.5915074",
"0.59145695",
"0.5905023",
"0.5884392",
"0.5862706",
"0.5860865",
"0.5856659",
"0.5826776",
"0.5820091",
"0.5798362",
... | 0.8527851 | 0 |
Adds errors if fee_for_additional_materials returns false | def fee_for_additional_materials_is_valid
errors.add(:fee_for_additional_materials, 'The fee for additional materials is invalid.') unless fee_for_additional_materials_is_valid?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fee_for_additional_materials_is_valid?\n return ((self.fee_for_additional_materials != nil) and (self.fee_for_additional_materials >= 0))\n end",
"def total_fee_is_valid\n errors.add(:total_fee,'The total fee is invalid.') unless total_fee_is_valid?\n end",
"def fee_per_meeting_is_valid\n error... | [
"0.7586528",
"0.7028197",
"0.6256086",
"0.60872483",
"0.58942425",
"0.58825755",
"0.5809041",
"0.5793246",
"0.5720905",
"0.56903046",
"0.56727296",
"0.55360746",
"0.55143297",
"0.5492163",
"0.5482173",
"0.5459941",
"0.54315907",
"0.5414651",
"0.53672326",
"0.5363375",
"0.5329... | 0.89261824 | 0 |
Tests that fee_for_additional_material for course is not nil and greater than or equal to 0 and returns true or false. | def fee_for_additional_materials_is_valid?
return ((self.fee_for_additional_materials != nil) and (self.fee_for_additional_materials >= 0))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def total_fee_is_valid?\n return ((self.total_fee != nil) and (self.total_fee >= 0))\n end",
"def fee_per_meeting_is_valid?\n return ((self.fee_per_meeting != nil) and (self.fee_per_meeting >= 0))\n end",
"def fee_for_additional_materials_is_valid\n errors.add(:fee_for_additional_materials, 'The fee... | [
"0.761037",
"0.714761",
"0.70305824",
"0.67311174",
"0.672941",
"0.6692722",
"0.6377599",
"0.6359446",
"0.63240474",
"0.6311671",
"0.6284458",
"0.6261357",
"0.6254491",
"0.62404966",
"0.61201787",
"0.6103666",
"0.6011824",
"0.5986649",
"0.5969618",
"0.58939934",
"0.58906364",... | 0.8457905 | 0 |
Adds errors if total_fee_is_valid? returns false | def total_fee_is_valid
errors.add(:total_fee,'The total fee is invalid.') unless total_fee_is_valid?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fee_for_additional_materials_is_valid\n errors.add(:fee_for_additional_materials, 'The fee for additional materials is invalid.') unless fee_for_additional_materials_is_valid?\n end",
"def fee_per_meeting_is_valid\n errors.add(:fee_per_meeting, 'The fee per meeting is invalid.') unless fee_per_meeting... | [
"0.7769707",
"0.77040637",
"0.75535625",
"0.6664327",
"0.6526046",
"0.6336517",
"0.62817496",
"0.61141074",
"0.61026436",
"0.6056936",
"0.60406977",
"0.60235614",
"0.6018698",
"0.6001351",
"0.5959651",
"0.5934791",
"0.5877435",
"0.58740693",
"0.586765",
"0.58670926",
"0.58668... | 0.913758 | 0 |
Tests that course's total_fee is not nil and is greater than or equal to 0 and returns true or false. | def total_fee_is_valid?
return ((self.total_fee != nil) and (self.total_fee >= 0))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fee_per_meeting_is_valid?\n return ((self.fee_per_meeting != nil) and (self.fee_per_meeting >= 0))\n end",
"def fee_for_additional_materials_is_valid?\n return ((self.fee_for_additional_materials != nil) and (self.fee_for_additional_materials >= 0))\n end",
"def free?\n self.setupFee == 0 && ... | [
"0.7698745",
"0.7017238",
"0.686757",
"0.68662935",
"0.6678528",
"0.66256934",
"0.6557586",
"0.6436912",
"0.6390961",
"0.63814205",
"0.63697875",
"0.62293804",
"0.62135327",
"0.618787",
"0.6171076",
"0.61420584",
"0.61293584",
"0.6064821",
"0.6049073",
"0.602505",
"0.6005423"... | 0.83600813 | 0 |
Adds errors if ptainstructor_is_valid? returns false | def ptainstructor_is_valid
errors.add(:ptainstructor,'No PTA instructor was selected.') unless ptainstructor_is_valid?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ptainstructor_is_valid?\n return self.ptainstructor_id != nil\n end",
"def teacher_is_valid\n errors.add(:teacher,'No classroom location was selected.') unless teacher_is_valid?\n end",
"def instructor_active\n if self.instructor != nil\n if self.instructor.active == false\n ... | [
"0.7986762",
"0.6713823",
"0.6494201",
"0.6046265",
"0.600162",
"0.59047836",
"0.58997005",
"0.58126855",
"0.5809437",
"0.57614034",
"0.57481265",
"0.5746208",
"0.57296884",
"0.57296884",
"0.57296884",
"0.566712",
"0.5664021",
"0.56560785",
"0.56548095",
"0.56395245",
"0.5607... | 0.8588355 | 0 |
Tests that the course's ptainstructor_id is not nil and returns true or false. | def ptainstructor_is_valid?
return self.ptainstructor_id != nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def CA_only?\n course_assistant? && (not instructor?)\n end",
"def can_create_course?\n ptainstructors = Ptainstructor.find_by_semester_id(self.id)\n teachers = Teacher.find_by_semester_id(self.id)\n if ((ptainstructors == nil) or (teachers == nil))\n return false\n end\n return true\n ... | [
"0.73070735",
"0.72831607",
"0.7220261",
"0.71659905",
"0.65088296",
"0.650151",
"0.6478992",
"0.6473052",
"0.6441444",
"0.63904697",
"0.637861",
"0.6372246",
"0.6317061",
"0.63082796",
"0.62789655",
"0.62364626",
"0.6220693",
"0.6195924",
"0.61431336",
"0.6139531",
"0.610259... | 0.833853 | 0 |
Adds errors if teacher_is_valid? returns false | def teacher_is_valid
errors.add(:teacher,'No classroom location was selected.') unless teacher_is_valid?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def teacher_is_valid?\n return self.teacher_id != nil\n end",
"def check_destroy\n valid=true\n msg=\"\"\n if matters.count > 0\n valid=false\n msg+=\" There are #{matters.count} teacher_matters references\"\n end\n if teachings.count > 0\n valid=false\n msg+=\" There are #... | [
"0.7701353",
"0.65671885",
"0.64631915",
"0.64056695",
"0.6350357",
"0.622444",
"0.6196493",
"0.60277474",
"0.59879917",
"0.59725815",
"0.5956702",
"0.5930681",
"0.59111017",
"0.5903324",
"0.5900726",
"0.5898185",
"0.58875984",
"0.58524483",
"0.5836989",
"0.5834455",
"0.58294... | 0.85017115 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.