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 |
|---|---|---|---|---|---|---|
DELETE /gltf_models/1 DELETE /gltf_models/1.json | def destroy
@gltf_model.destroy
respond_to do |format|
format.html { redirect_to gltf_models_url, notice: 'Gltf model was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @model = Model.find(params[:id])\n @model.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_models_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @model = Model.find(params[:id])\n @model.destroy\n\n respond_to do |format|\n ... | [
"0.703142",
"0.70152724",
"0.7012977",
"0.7012977",
"0.7012977",
"0.69774354",
"0.695762",
"0.6933614",
"0.69286406",
"0.69202924",
"0.68830276",
"0.68643343",
"0.6862609",
"0.684401",
"0.6813616",
"0.67322826",
"0.6717871",
"0.6689857",
"0.6684332",
"0.6680368",
"0.66801465"... | 0.7454775 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_gltf_model
if params[:id] != 'scene'
@gltf_model = GltfModel.find(params[:id])
end
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.6165094",
"0.60450804",
"0.5944413",
"0.5915806",
"0.58885634",
"0.5835225",
"0.5775847",
"0.5700531",
"0.5700531",
"0.56543404",
"0.56209993",
"0.54238355",
"0.5410386",
"0.5410386",
"0.5410386",
"0.5394892",
"0.5377769",
"0.53559244",
"0.5339896",
"0.53388095",
"0.533008... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def gltf_model_params
params.require(:gltf_model).permit(:global_path, :bin_global_path, :textures_directory_global_path)
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 |
NOTE: To debug the server, run with sudo ruby d Server.rb To actually run, DON'T USE d! Threads will crash silently without d using d will cause the entire server to crash on client disconnect THIS SHOULD BE FIXED! reads the entire contents of a file or socket | def read_all(container)
buffer = ""
readSize = 128 # amount of data to read at a time
while(!container.eof)
tmp = container.readpartial(readSize)
buffer = buffer + tmp
if tmp.length < readSize
break
end
tmp = ""
end
return buffer
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run\n\t\n\t\twhile true \t\t\t\t\t\t# run forever\n\t\t\n\t\t\tready2read = sockets_ready_for_reading()\n\t\t\t\n\t\t\tnext if not ready2read \t\t\t# if nil, loop again\n\t\n\t\t\tputs \"<Debug> ready2read=#{ready2read.inspect}\" if $DEBUG\n\n\t\t\tready2read.each do |socket|\t\t\n\t\t\t\n\t\t\t\tif socket ==... | [
"0.6818809",
"0.6809213",
"0.6691852",
"0.6690542",
"0.66665477",
"0.6657021",
"0.65788573",
"0.6574315",
"0.65713966",
"0.6530469",
"0.65282047",
"0.64638317",
"0.6441278",
"0.6435358",
"0.6431929",
"0.64170516",
"0.6395501",
"0.6385889",
"0.6357999",
"0.6325857",
"0.6274726... | 0.0 | -1 |
combine two pieces of JSON | def combineJSON(exJSON, incJSON)
# Make sure we don't get parsing errors with new users
if(exJSON == "")
exJSON = "[]"
end
existingData = JSON.parse(exJSON)
newData = JSON.parse(incJSON)
for i in 0..newData.length - 1
newSite = newData[i]
newSitePages = newSite["pages"] # For page comparison
newSiteName = newSite["title"]
newSiteTime = TimeHelper.timeToMs(newSite["time"])
siteFound = false
for j in 0..existingData.length - 1
existingSite = existingData[j]
existingSitePages = existingSite["pages"] # For page comparison
existingSiteName = existingSite["title"]
existingSiteTime = TimeHelper.timeToMs(existingSite["time"])
if newSiteName == existingSiteName
siteFound = true
# add up the site level times together
combinedSiteTime = newSiteTime + existingSiteTime
combinedSiteTimeString = TimeHelper.msToTime(combinedSiteTime)
existingSite["time"] = combinedSiteTimeString
# start comparing the pages
for k in 0..newSitePages.length - 1
newPage = newSitePages[k]
newPageName = newPage["title"]
newPageDate = newPage["date"]
newPageTime = TimeHelper.timeToMs(newPage["time"])
pageFound = false
for l in 0..existingSitePages.length - 1
existingPage = existingSitePages[l]
existingPageName = existingPage["title"]
existingPageDate = existingPage["date"]
existingPageTime = TimeHelper.timeToMs(existingPage["time"])
#if the two pages have the same name and date; add their values together
if newPageName == existingPageName && newPageDate == existingPageDate
pageFound = true
combinedPageTime = newPageTime + existingPageTime
combinedPageTimeString = TimeHelper.msToTime(combinedPageTime)
existingPage["time"] = combinedPageTimeString
existingSitePages[l] = existingPage
end
end
# if the page doesn't match anywhere, add it onto the site object
if !pageFound
existingSitePages << newPage
end
end
existingSite["pages"] = existingSitePages
existingData[j] = existingSite
end
end
# no match; add the new site right inot the existing data
if !siteFound
existingData << newSite
end
end
return existingData
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def append_json_results(second_wrapper)\n\n primary_result_as_ruby = JSON.parse(self.result)\n second_result_as_ruby = JSON.parse(second_wrapper.result)\n merged_result = primary_result_as_ruby + second_result_as_ruby\n\n # The second request might have an URL to point at even more data, so preserve th... | [
"0.69097316",
"0.6777405",
"0.6487326",
"0.6094389",
"0.60699266",
"0.59678346",
"0.58863574",
"0.58633965",
"0.58017206",
"0.5759396",
"0.5711692",
"0.5600398",
"0.55896485",
"0.5571732",
"0.55221087",
"0.55149674",
"0.54893",
"0.548191",
"0.54612494",
"0.54612494",
"0.54612... | 0.576497 | 9 |
Function to read all info from MySQL Database | def readListsDatabase(connection)
data = Array.new
whiteData = Array.new
greenData = Array.new
grayData = Array.new
blackData = Array.new
whiteObj = Hash.new
greenObj = Hash.new
grayObj = Hash.new
blackObj = Hash.new
# Query each table and store all of the data in arrays for JSON Serialization
whiteResults = connection.query("SELECT * FROM whitelist")
whiteResults.each do |row|
whiteData.push(row['WebsiteURL'])
end
greenResults = connection.query("SELECT * FROM greenlist")
greenResults.each do |row|
greenData.push(row['WebsiteURL'])
end
grayResults = connection.query("SELECT * FROM graylist")
grayResults.each do |row|
grayData.push(row['WebsiteURL'])
end
blackResults = connection.query("SELECT * FROM blacklist")
blackResults.each do |row|
blackData.push(row['WebsiteURL'])
end
# Build each hash
whiteObj[:table] = 'white'
whiteObj[:data] = whiteData
greenObj[:table] = 'green'
greenObj[:data] = greenData
grayObj[:table] = 'gray'
grayObj[:data] = grayData
blackObj[:table] = 'black'
blackObj[:data] = blackData
# Push each hash into the bigger data array for serialization
data.push(whiteObj)
data.push(greenObj)
data.push(grayObj)
data.push(blackObj)
databaseJSON = JSON.generate(data)
return databaseJSON
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_info_from_user()\n\n db = connect_to_db(\"db/db.db\")\n\n db.execute(\"SELECT * FROM users\")\n end",
"def db_listing\n lista = [] \n achado = $db.query \"SELECT * FROM produtos\" \n achado.each do |vals| \n lista.push vals\n end\n return lista\nend",
"def est... | [
"0.71093315",
"0.66793156",
"0.6670483",
"0.65333223",
"0.64769554",
"0.64717937",
"0.6440939",
"0.6352146",
"0.6350687",
"0.6300387",
"0.6293557",
"0.6254644",
"0.6224628",
"0.6216295",
"0.6207218",
"0.6202493",
"0.6197675",
"0.61959296",
"0.61959296",
"0.6195303",
"0.617951... | 0.6076559 | 29 |
handle a connection that gives content json | def handleContentData(incomingData)
# Get the user of the incoming data
user = incomingData["User"]
# combine existing data with the new data
incomingJSON = incomingData["Data"]
if(@existingJSON != nil)
# turn the JSON into strings so that they don't get passed by reference
combinedJSON = combineJSON(@existingJSON, JSON.generate(incomingJSON))
toWrite = JSON.generate(combinedJSON)
else
toWrite = JSON.generate(incomingJSON)
end
# write that data back into the database for the right user
@loginDatabase.query("UPDATE users SET data='" +toWrite+"' WHERE username='" + user +"'");
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def configure_connection(conn)\n conn.headers['Accept'] = [JSON_TYPE]\n\n conn.response :json, content_type: JSON_TYPE\n end",
"def twemproxy_data\n stats = TCPSocket.open(host, port)\n JSON.parse(stats.gets)\n end",
"def champs\n conn = Faraday.new(url, request: {open_timeout: 5, ... | [
"0.69958323",
"0.6112866",
"0.6031955",
"0.5889765",
"0.5804131",
"0.57724386",
"0.5742863",
"0.5730512",
"0.57277775",
"0.5713483",
"0.5701724",
"0.5698408",
"0.56697285",
"0.5616843",
"0.55632627",
"0.55054545",
"0.55018336",
"0.5483032",
"0.5483032",
"0.54759866",
"0.54566... | 0.0 | -1 |
handle a connection that gives login json | def handleLoginData(loginJSON, client)
userID = loginJSON["userID"]
passwordHash = loginJSON["passwordHash"]
users = @loginDatabase.query("SELECT * FROM users")
sleep(1) # wait a second so the client has time to wait for the response
# Check the incoming data against all users, and if we have a match, send back an 'okay'
users.each do |user|
if(userID == user["username"] && passwordHash == user["password"])
puts "okay"
client.write("okay")
#get the existingJSON once from the database
@existingJSON = user['data']
return
end
end
# If we haven't given a response by now, send back a "bad" response
client.write("bad")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def login\n #handle unexpected error with status code 500\n begin\n if request.env['CONTENT_TYPE'].include?('application/json') \n @client = Client.new\n errCode = @client.login(params[:user], params[:password])\n if errCode > 0\n dic = {:errCode => 1, :count => errCode}\n ... | [
"0.68455595",
"0.68399125",
"0.6751915",
"0.6710356",
"0.6657797",
"0.66009593",
"0.65896714",
"0.6581137",
"0.65792584",
"0.65792584",
"0.6564972",
"0.6541456",
"0.6511882",
"0.6477313",
"0.6458868",
"0.64472103",
"0.64329714",
"0.642486",
"0.639115",
"0.6383144",
"0.6358098... | 0.6284646 | 35 |
and return a new array consisting of their remainder when divided by three. Exclude any numbers which are actually dividible by three. EXAMPLES: mod_three [0] => [] mod_three [1] => [1] mod_three [2] => [2] mod_three [3] => [] mod_three [4] => [1] mod_three [5] => [2] mod_three [6] => [] mod_three [7] => [1] mod_three [0,1,2,3,4,5,6,7] => [1, 2, 1, 2, 1] | def mod_three(numbers)
numbers.map { |number| number % 3 }.select { |number| number % 3 != 0 }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mod_three(array)\n newarr = []\n\n array.each do |number|\n if number % 3 != 0 # if number divided by three = 0...\n newarr << (number % 3) # Add the remainder of the number divided by three!\n end\n end\n newarr\nend",
"def mod_three my_array\n\t@my_array = my_array\n\tto_return = []\n\tto_re... | [
"0.81493986",
"0.81380904",
"0.80601585",
"0.78981036",
"0.7204338",
"0.7148892",
"0.70838004",
"0.68499357",
"0.67850816",
"0.67822284",
"0.6757516",
"0.6589229",
"0.65765655",
"0.65708345",
"0.65610397",
"0.6556901",
"0.6489185",
"0.6486556",
"0.6471882",
"0.646446",
"0.644... | 0.75824183 | 4 |
Use callbacks to share common setup or constraints between actions. | def set_member
@member = Member.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.6165094",
"0.60450804",
"0.5944413",
"0.5915806",
"0.58885634",
"0.5835225",
"0.5775847",
"0.5700531",
"0.5700531",
"0.56543404",
"0.56209993",
"0.54238355",
"0.5410386",
"0.5410386",
"0.5410386",
"0.5394892",
"0.5377769",
"0.53559244",
"0.5339896",
"0.53388095",
"0.533008... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def member_params
params.require(:member).permit(:user_name, :rank_id, :activity_status_id)
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 |
Format kyc Always receives [Hash] :NOTE Reading data to format from key:'user_kyc' Author: Tejas Date: 24/09/2018 Reviewed By: Sets result_type, user_kyc | def show(data_to_format)
formatted_data = {
result_type: 'user_kyc',
user_kyc: user_kyc_base(data_to_format[:user_kyc_detail], data_to_format[:admin])
}
formatted_data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_kyc_data\n @user_kyc_detail.present? ?\n {\n kyc_status: kyc_status,\n admin_action_types: @user_kyc_detail.admin_action_types_array,\n whitelist_status: @user_kyc_detail.whitelist_status\n }\n :\n {}\n end",
"def user_ky... | [
"0.6807346",
"0.5872701",
"0.5729006",
"0.5681961",
"0.56758815",
"0.5665296",
"0.5606227",
"0.5606227",
"0.5600151",
"0.55636805",
"0.5479883",
"0.5454042",
"0.54291064",
"0.5420745",
"0.53460443",
"0.5343816",
"0.53428787",
"0.5298603",
"0.5291671",
"0.52900153",
"0.5271627... | 0.6669875 | 1 |
Format pre signed url for put Always receives [Hash] :NOTE Reading data to format from key:'file_upload_put' Author: Aniket Date: 20/09/2018 Reviewed By: | def get_pre_singed_url_for_put(data_to_format)
formatted_data = {
result_type: 'file_upload_put',
file_upload_put: data_to_format
}
formatted_data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_signed_put_url(upload, duration)\n # use Fog config\n storage = Fog::Storage.new(Rails.configuration.x.fog_configuration)\n \n # set request attributes\n headers = { \"Content-Type\" => upload.content_type }\n options = { \"path_style\" => \"true\" }\n \n # generate ... | [
"0.67966163",
"0.6775661",
"0.6487616",
"0.6379967",
"0.63140744",
"0.62500286",
"0.62426245",
"0.6237337",
"0.61933255",
"0.6190393",
"0.6108691",
"0.60999954",
"0.60978055",
"0.609427",
"0.60238963",
"0.60124534",
"0.59918123",
"0.59866756",
"0.5971516",
"0.5941019",
"0.593... | 0.8047017 | 0 |
Format pre signed url for put Always receives [Hash] :NOTE Reading data to format from key:'file_upload_put' Author: Aniket Date: 20/09/2018 Reviewed By: | def get_pre_singed_url_for_post(data_to_format)
formatted_data = {
result_type: 'file_upload_post',
file_upload_post: data_to_format
}
formatted_data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_pre_singed_url_for_put(data_to_format)\n formatted_data = {\n result_type: 'file_upload_put',\n file_upload_put: data_to_format\n\n }\n formatted_data\n end",
"def get_signed_put_url(upload, duration)\n # use Fog config\n storage = Fog... | [
"0.80482787",
"0.6796529",
"0.6775898",
"0.64879376",
"0.6379649",
"0.6312997",
"0.6249215",
"0.6241101",
"0.6235996",
"0.6191846",
"0.61889625",
"0.61091083",
"0.6098675",
"0.60962903",
"0.6095206",
"0.60217744",
"0.6014372",
"0.59909844",
"0.5972853",
"0.594197",
"0.5930011... | 0.5989235 | 18 |
Format Kyc :NOTE Should receive user_kyc object Author: Tejas Date: 24/09/2018 Reviewed By: | def user_kyc_base(user_kyc_detail, admin)
{
id: user_kyc_detail[:id],
user_kyc_detail_id: user_kyc_detail[:user_extended_detail_id],
user_id: user_kyc_detail[:user_id],
kyc_status: user_kyc_detail[:kyc_status],
admin_status: user_kyc_detail[:admin_status],
aml_status: user_kyc_detail[:aml_status],
whitelist_status: user_kyc_detail[:whitelist_status],
admin_action_types: user_kyc_detail[:admin_action_types_array],
submission_count: user_kyc_detail[:submission_count],
last_acted_by: admin_name(user_kyc_detail[:last_acted_by], admin),
created_at: user_kyc_detail[:created_at]
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show(data_to_format)\n formatted_data = {\n result_type: 'user_kyc',\n user_kyc: user_kyc_base(data_to_format[:user_kyc_detail], data_to_format[:admin])\n }\n\n formatted_data\n end",
"def created_by\r\n\t\t\t \t\"Lachezar Kostov and Dimitar Baka... | [
"0.58958304",
"0.5592062",
"0.55872744",
"0.5559909",
"0.5452581",
"0.5403339",
"0.53868335",
"0.5314825",
"0.5278651",
"0.52504885",
"0.52265406",
"0.51686174",
"0.51640415",
"0.5137657",
"0.51242703",
"0.5112319",
"0.5100945",
"0.5097432",
"0.5058605",
"0.50490874",
"0.5033... | 0.4930564 | 32 |
Get Admin Name Author: Tejas Date: 24/09/2018 Reviewed By: | def admin_name(last_acted_by, admin)
last_acted_by = last_acted_by.to_i
if (last_acted_by > 0)
admin[:name]
elsif (last_acted_by == Admin::AUTO_APPROVE_ADMIN_ID)
GlobalConstant::Admin.auto_approved_admin_name
else
''
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getAuthorName\n\t\treturn User.find(self.user_id).username\n\tend",
"def attribution\n user = roles.creator.first&.user\n user = roles.administrator.not_creator.first&.user if user.blank?\n return [] if user.blank?\n\n text = user&.name(false)\n orcid = user.identifier_for_scheme(scheme: 'orci... | [
"0.68571734",
"0.67655355",
"0.6757834",
"0.67468387",
"0.6733212",
"0.6718094",
"0.6714925",
"0.66346055",
"0.66316706",
"0.66230094",
"0.6576259",
"0.6576259",
"0.65704286",
"0.6569066",
"0.6560141",
"0.65553147",
"0.6551965",
"0.65485185",
"0.653709",
"0.6532437",
"0.65282... | 0.7266418 | 0 |
Get response for sending KYC approve email Author: Mayur Date: 03/12/2018 Reviewed By: | def email_kyc_approve(data_to_format)
{}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_approve_email\n 'send_approve_email'\n end",
"def approved_notification\n @user = params[:user]\n mail(to: @user.email, subject: 'Library Card Request Approved')\n end",
"def approved\n @req = Request.last\n RequestMailer.approved(@req)\n end",
"def confirm(viper)\n @vip... | [
"0.66857827",
"0.6537127",
"0.6378747",
"0.63589156",
"0.63566065",
"0.63520384",
"0.6348529",
"0.61139035",
"0.6097678",
"0.6060128",
"0.60555786",
"0.6052152",
"0.60403436",
"0.60151994",
"0.59832114",
"0.5970294",
"0.5968385",
"0.59408766",
"0.59185123",
"0.5907257",
"0.59... | 0.74177253 | 0 |
Get response for sending KYC deny email Author: Mayur Date: 14/12/2018 Reviewed By: | def email_kyc_deny(data_to_format)
{}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def email_kyc_approve(data_to_format)\n {}\n end",
"def send_denied_email\n return if (!@client.is_email_setup_done?) || (!@client.client_kyc_config_detail.auto_send_kyc_deny_email?)\n if @user_kyc_detail.kyc_denied?\n @user = User.using_client_shard(client: @client).... | [
"0.6748683",
"0.64014554",
"0.60945463",
"0.6022611",
"0.6021259",
"0.59857285",
"0.5983301",
"0.59740794",
"0.59280777",
"0.58867896",
"0.58419216",
"0.5809495",
"0.5803105",
"0.5749496",
"0.57434714",
"0.5729097",
"0.57074267",
"0.57048213",
"0.5703757",
"0.569166",
"0.5674... | 0.6365447 | 2 |
Get response for sending KYC report issue email Author: Mayur Date: 14/12/2018 Reviewed By: | def email_kyc_report_issue(data_to_format)
{}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def email_kyc_approve(data_to_format)\n {}\n end",
"def email_report_issue(params)\n http_helper.send_post_request(\"#{@url_prefix}/#{get_user_id!(params)}/email/report-issue\", params)\n end",
"def response(expo_attendee_id)\n @expo_attendee = ExpoAttendee.find(expo_attendee_id)... | [
"0.62613153",
"0.60695267",
"0.5953663",
"0.5815612",
"0.58054847",
"0.57805985",
"0.5767882",
"0.57628787",
"0.575934",
"0.57584065",
"0.57250553",
"0.57060987",
"0.56945837",
"0.568172",
"0.5637443",
"0.5605159",
"0.5601538",
"0.55704343",
"0.55512136",
"0.55248755",
"0.552... | 0.68020076 | 0 |
If this test fails, it means that we've added a new type to the ConfigValue | def test_mapping_is_exhaustive
unsupported = [:bytes, :limit_definition, :log_level, :weighted_values, :int_range]
supported = PrefabProto::ConfigValue.descriptor.entries.reject do |entry|
unsupported.include?(entry.name.to_sym)
end.map(&:number)
mapped = Prefab::ContextShape::MAPPING.values.uniq
unless mapped == supported
raise "ContextShape MAPPING needs update: #{mapped} != #{supported}"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ensure_valid_default_value(value)\n if !value.nil? && types && types.none? { |type| type === value }\n raise TypeError, I18n.t(\"lita.config.type_error\", attribute: name, types: types.join(\", \"))\n end\n end",
"def check_types(value)\n if types && types.none? { |type| type === val... | [
"0.611953",
"0.59729046",
"0.572259",
"0.5521056",
"0.5489535",
"0.54321575",
"0.5407505",
"0.53770584",
"0.5319917",
"0.5312386",
"0.52669805",
"0.5233366",
"0.52177745",
"0.5182841",
"0.5179587",
"0.5168866",
"0.51542354",
"0.51450723",
"0.51428026",
"0.5127585",
"0.5127585... | 0.0 | -1 |
GET /brite_td_aswaxman_rt_waxmen GET /brite_td_aswaxman_rt_waxmen.json | def index
@brite_td_aswaxman_rt_waxmen = BriteTdAswaxmanRtWaxman.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @brite_rt_waxmen = BriteRtWaxman.all\n end",
"def index\n @brite_td_asbarabasi_rt_waxmen = BriteTdAsbarabasiRtWaxman.all\n end",
"def set_brite_td_aswaxman_rt_waxman\n @brite_td_aswaxman_rt_waxman = BriteTdAswaxmanRtWaxman.find(params[:id])\n end",
"def set_brite_td_asbarabasi_rt_... | [
"0.7266996",
"0.7229159",
"0.62999576",
"0.6242721",
"0.6136489",
"0.6088682",
"0.5998789",
"0.5962454",
"0.5942457",
"0.5917993",
"0.5908924",
"0.5906845",
"0.5883261",
"0.58676434",
"0.5851696",
"0.5821017",
"0.5816894",
"0.581649",
"0.58136463",
"0.5810217",
"0.58024997",
... | 0.73295295 | 0 |
GET /brite_td_aswaxman_rt_waxmen/1 GET /brite_td_aswaxman_rt_waxmen/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @brite_rt_waxmen = BriteRtWaxman.all\n end",
"def index\n @brite_td_aswaxman_rt_waxmen = BriteTdAswaxmanRtWaxman.all\n end",
"def index\n @brite_td_asbarabasi_rt_waxmen = BriteTdAsbarabasiRtWaxman.all\n end",
"def set_brite_td_asbarabasi_rt_waxman\n @brite_td_asbarabasi_rt_waxman... | [
"0.7053891",
"0.70192426",
"0.7003029",
"0.60400665",
"0.6004092",
"0.5990821",
"0.5965981",
"0.5960337",
"0.5955734",
"0.5950685",
"0.59355325",
"0.5913171",
"0.59027004",
"0.5901739",
"0.5880231",
"0.58584636",
"0.5842854",
"0.5840226",
"0.583635",
"0.5822204",
"0.5812125",... | 0.0 | -1 |
POST /brite_td_aswaxman_rt_waxmen POST /brite_td_aswaxman_rt_waxmen.json | def create
@brite_td_aswaxman_rt_waxman = BriteTdAswaxmanRtWaxman.new(brite_td_aswaxman_rt_waxman_params)
respond_to do |format|
if @brite_td_aswaxman_rt_waxman.save
format.html { redirect_to @brite_td_aswaxman_rt_waxman, notice: 'Brite td aswaxman rt waxman was successfully created.' }
format.json { render :show, status: :created, location: @brite_td_aswaxman_rt_waxman }
else
format.html { render :new }
format.json { render json: @brite_td_aswaxman_rt_waxman.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @brite_td_asbarabasi_rt_waxman = BriteTdAsbarabasiRtWaxman.new(brite_td_asbarabasi_rt_waxman_params)\n\n respond_to do |format|\n if @brite_td_asbarabasi_rt_waxman.save\n format.html { redirect_to @brite_td_asbarabasi_rt_waxman, notice: 'Brite td asbarabasi rt waxman was successfully... | [
"0.7143289",
"0.7027948",
"0.6670264",
"0.6601159",
"0.6490194",
"0.6452989",
"0.6346805",
"0.6303172",
"0.615388",
"0.6103412",
"0.6006599",
"0.5991535",
"0.58698064",
"0.5828309",
"0.58092797",
"0.58057415",
"0.5580395",
"0.5450999",
"0.5449492",
"0.543886",
"0.54376894",
... | 0.7195034 | 0 |
PATCH/PUT /brite_td_aswaxman_rt_waxmen/1 PATCH/PUT /brite_td_aswaxman_rt_waxmen/1.json | def update
respond_to do |format|
if @brite_td_aswaxman_rt_waxman.update(brite_td_aswaxman_rt_waxman_params)
format.html { redirect_to @brite_td_aswaxman_rt_waxman, notice: 'Brite td aswaxman rt waxman was successfully updated.' }
format.json { render :show, status: :ok, location: @brite_td_aswaxman_rt_waxman }
else
format.html { render :edit }
format.json { render json: @brite_td_aswaxman_rt_waxman.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @brite_rt_waxman.update(brite_rt_waxman_params)\n format.html { redirect_to @brite_rt_waxman, notice: 'Brite rt waxman was successfully updated.' }\n format.json { render :show, status: :ok, location: @brite_rt_waxman }\n else\n format.html... | [
"0.6856805",
"0.67771626",
"0.6650239",
"0.65176123",
"0.6372956",
"0.6281362",
"0.6272229",
"0.6253973",
"0.62455356",
"0.62190616",
"0.6189634",
"0.61780995",
"0.6168091",
"0.61661756",
"0.6151665",
"0.6149953",
"0.61417776",
"0.61407286",
"0.61232656",
"0.6098669",
"0.6096... | 0.6817557 | 1 |
DELETE /brite_td_aswaxman_rt_waxmen/1 DELETE /brite_td_aswaxman_rt_waxmen/1.json | def destroy
@brite_td_aswaxman_rt_waxman.destroy
respond_to do |format|
format.html { redirect_to brite_td_aswaxman_rt_waxmen_url, notice: 'Brite td aswaxman rt waxman was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @brite_td_asbarabasi_rt_waxman.destroy\n respond_to do |format|\n format.html { redirect_to brite_td_asbarabasi_rt_waxmen_url, notice: 'Brite td asbarabasi rt waxman was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @brite_rt_waxma... | [
"0.723907",
"0.7148391",
"0.6709805",
"0.66736525",
"0.66564125",
"0.6645162",
"0.6642611",
"0.66244006",
"0.659273",
"0.65717876",
"0.65699446",
"0.65517086",
"0.6549124",
"0.6523843",
"0.65189874",
"0.6508655",
"0.6506563",
"0.65052927",
"0.65009266",
"0.6497982",
"0.648512... | 0.7212478 | 1 |
Use callbacks to share common setup or constraints between actions. | def set_brite_td_aswaxman_rt_waxman
@brite_td_aswaxman_rt_waxman = BriteTdAswaxmanRtWaxman.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.6165094",
"0.60450804",
"0.5944413",
"0.5915806",
"0.58885634",
"0.5835225",
"0.5775847",
"0.5700531",
"0.5700531",
"0.56543404",
"0.56209993",
"0.54238355",
"0.5410386",
"0.5410386",
"0.5410386",
"0.5394892",
"0.5377769",
"0.53559244",
"0.5339896",
"0.53388095",
"0.533008... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def brite_td_aswaxman_rt_waxman_params
params.require(:brite_td_aswaxman_rt_waxman).permit(:name, :edgeconn, :k, :bwinter, :bwintermin, :bwintermax, :bwintra, :bwintramin, :bwintramax, :name, :n, :hs, :ls, :nodeplacement, :growthtype, :m, :alpha, :beta, :bwdist, :bwmin, :bwmax, :name_rtwaxman, :n_waxman, :hs_waxman, :ls_waxman, :nodeplacement, :growthtype_waxman, :m_waxman, :alpha_waxman, :beta_waxman, :bwdist_waxman, :bwmin_waxman, :bwmax_waxman)
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 |
with this Object method we can obtain a hash named "hashinfo" with the gene information (from de Gene Classe) corresponding to the idmutant_gene we have in the StockData Class. | def gene_information(i)
if $gene[i].geneid == $stockdata[i].idmutant_gene
$hashinfo["#{$stockdata[i].stock}"] = $gene[i]
end
return $hashinfo
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash\n [_hash, name, owner].hash\n end",
"def hash\n\n self.h.fei.hash\n end",
"def hash\n data.hash\n end",
"def hash\n\t\treturn self.name.to_s.hash\n\tend",
"def hash\r\n\t\treturn @name.hash() + @type.hash()\r\n\tend",
"def hash\r\n id.hash\r\n end",
"def has... | [
"0.6465471",
"0.6442642",
"0.6309819",
"0.62425673",
"0.62281996",
"0.6226559",
"0.61924684",
"0.61439884",
"0.6132281",
"0.61163396",
"0.6110101",
"0.610977",
"0.610977",
"0.610977",
"0.610977",
"0.610977",
"0.610977",
"0.610977",
"0.610977",
"0.610977",
"0.6106149",
"0.60... | 0.81766635 | 0 |
Given a hash with numeric values, return the key for the smallest value | def key_for_min_value(name_hash)
name_hash = {:chair => 25, :table => 85, :mattress => 450}
name_hash.min do { |key_for_min_value| }
puts "#{key_for_min_value}:"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = Float::INFINITY\n hash.each do |key, value|\n if value < lowest_value\n lowest_value = value\n lowest_key = key\n end\n end\n lowest_key\nend",
"def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = Float::INFINITY\n... | [
"0.8821222",
"0.8777674",
"0.87769854",
"0.8745862",
"0.8689437",
"0.86553806",
"0.865241",
"0.86165065",
"0.8587693",
"0.8572328",
"0.85674095",
"0.8550907",
"0.8529734",
"0.8529734",
"0.85182345",
"0.84936565",
"0.8475531",
"0.8475531",
"0.8466132",
"0.8449126",
"0.84490585... | 0.0 | -1 |
Please use variant_images/config/routes.rb instead for extension routes. def self.require_gems(config) config.gem "gemnamegoeshere", :version => '1.2.3' end | def activate
# admin.tabs.add "Variant Images", "/admin/variant_images", :after => "Layouts", :visibility => [:all]
Variant.class_eval do
has_many :images, :as => :viewable, :order => :position, :dependent => :destroy
end
Spree::BaseHelper.class_eval do
def product_cart_description(product)
truncate(product.description, :length => 90, :omission => "...")
end
end
Admin::VariantsController.class_eval do
after_filter :set_image, :only => [:create, :update]
private
def set_image
return unless params[:image]
return if params[:image][:attachment].blank?
image = Image.create params[:image] if params[:image]
object.images << image
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def require_gems; end",
"def require!\n super do\n gem @gem_name, @version if @version\n end\n end",
"def add_gem_paths; end",
"def gemspec; end",
"def gemspec; end",
"def gemspec; end",
"def gemspec; end",
"def gemspec; end",
"def gemspec; end",
"def gemspec; end",
"def gem... | [
"0.7250635",
"0.672408",
"0.66811126",
"0.6548907",
"0.6548907",
"0.6548907",
"0.6548907",
"0.6548907",
"0.6548907",
"0.6548907",
"0.6548907",
"0.64470065",
"0.64259255",
"0.63521814",
"0.63521814",
"0.63521814",
"0.63521814",
"0.63521814",
"0.63521814",
"0.62421435",
"0.6242... | 0.0 | -1 |
Do we have all the information necessary to subscribe to the list? | def wants_to_subscribe?
source_is_ffcrm? && has_list?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subscribed; end",
"def suscription_on?\n is_subscribed == true\n end",
"def subscribe?\n self.type == :subscribe\n end",
"def subscriptions; end",
"def subscriptions; end",
"def subscriptions; end",
"def subscribed?\n self.type == :subscribed\n end",
"def IsSubscribed=(arg0)",... | [
"0.7369187",
"0.70999265",
"0.7083483",
"0.7030307",
"0.7030307",
"0.7030307",
"0.69052047",
"0.69015425",
"0.69015425",
"0.6881362",
"0.68245757",
"0.6804293",
"0.67777437",
"0.6748859",
"0.67058784",
"0.66932976",
"0.6669622",
"0.66626",
"0.6660518",
"0.66113245",
"0.658001... | 0.7500854 | 0 |
Does a specific group name exist in this subscription | def has_group?(name)
(groupings || []).select{ |grouping| grouping['groups'].include?(name) }.any?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def group_exists?(name)\n @project.groups.where(name: name).count > 0\n end",
"def exists?(name)\n begin\n g = list([name.to_s])\n rescue ::AWS::InvalidGroupNotFound\n return false \n end\n \n !g.empty?\n end",
"def has_group?(name)\n r... | [
"0.83704615",
"0.8261771",
"0.81818604",
"0.8019201",
"0.7843859",
"0.7810116",
"0.7752436",
"0.7723494",
"0.7558666",
"0.754061",
"0.75347483",
"0.75154954",
"0.7513253",
"0.7410376",
"0.74055487",
"0.73747313",
"0.7329222",
"0.728947",
"0.72704476",
"0.72400343",
"0.7203358... | 0.7591528 | 8 |
Retrieves the cell information based on the parameters specified inside the `cell` object | def get_cell(cell)
query_cell_info '/cell/get', cell
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cell(cell)\n @board[cell]\n end",
"def get_cell(row, column)\n @fields[row][column]\n end",
"def getCell(row,col)\n the_row = @rows[row]\n the_cell = the_row.cells[col]\n return the_cell\n end",
"def get_elem cell\n\t\treturn @elements[cell]\n\tend",
"def cell(row, col, sheet ... | [
"0.6700249",
"0.65839696",
"0.65731555",
"0.6518436",
"0.6300283",
"0.6229153",
"0.6165501",
"0.6158154",
"0.6138333",
"0.6138228",
"0.61308724",
"0.6109513",
"0.60202676",
"0.59902996",
"0.5939663",
"0.5932703",
"0.5928645",
"0.5925812",
"0.5908698",
"0.58960766",
"0.5867328... | 0.8008553 | 0 |
Retrieves the cell information and the measures used to calculate its position based on the parameters specified in the cell object | def get_cell_measures(cell)
query_cell_info '/cell/getMeasures', cell
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_coordinates(cell)\n row = @cell_coordinates[cell][0]\n col = @cell_coordinates[cell][1]\n [row, col]\n end",
"def get_cell(cell)\n query_cell_info '/cell/get', cell\n end",
"def cells\n @cells\n end",
"def cells\n @cells\n end",
"def cells\n attributes.fet... | [
"0.62560666",
"0.6222559",
"0.62159985",
"0.62159985",
"0.60673016",
"0.5987495",
"0.5933318",
"0.58349663",
"0.5792557",
"0.57904845",
"0.5641396",
"0.56357855",
"0.56024545",
"0.5574954",
"0.5553867",
"0.5543224",
"0.5542443",
"0.55342656",
"0.55334157",
"0.55284816",
"0.55... | 0.6489639 | 0 |
Retrieves all the cells located inside the bounding box and whose parameters match the ones specified in the options | def get_cells_in_area(bbox, options = {})
raise ArgumentError, 'options must be a Hash' unless options.is_a? Hash
raise ArgumentError, 'bbox must be of type BBox' unless bbox.is_a? BBox
params = {bbox: bbox.to_s, fmt: 'xml'}
params.merge!(options.reject { |key| !GET_IN_AREA_ALLOWED_PARAMS.include? key})
exec_req_and_parse_response '/cell/getInArea', params
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def data(bounding_box)\n top, left, bottom, right = bounding_box.coords\n @table.where(:lng => (left..right), :lat => (bottom..top)).all\n end",
"def cells(options = {}, &block)\n cell_regex = /^cell_([0-9]+)_/\n\n options ||= { }\n\n result = block_given? ? yield : (options[:values] || [''... | [
"0.62607753",
"0.6017512",
"0.58347434",
"0.58320624",
"0.57840544",
"0.54796183",
"0.5473193",
"0.5397516",
"0.5372596",
"0.535785",
"0.5335334",
"0.5335334",
"0.53150153",
"0.53017",
"0.5301368",
"0.5300782",
"0.52827024",
"0.5268867",
"0.52373934",
"0.52369547",
"0.5225494... | 0.68340975 | 0 |
Adds a measure (specified by the measure object) to a given cell (specified by the cell object). In case of success the response object will also contain the cell_id and the measure_id of the newly created measure. Although the library does not check this, a valid APIkey must have been specified while initializing the this object | def add_measure(cell, measure)
raise ArgumentError, "cell must be of type Cell" unless cell.is_a? Cell
raise ArgumentError, "measure must be of type Measure" unless measure.is_a? Measure
params = cell.to_query_hash
params[:lat] = measure.lat
params[:lon] = measure.lon
params[:signal] = measure.signal if measure.signal
params[:measured_at] = measure.taken_on if measure.taken_on
exec_req_and_parse_response "/measure/add", params
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_measure_from_excel(measure)\n hash = {}\n hash[:classname] = measure['measure_file_name']\n hash[:name] = measure['name']\n hash[:display_name] = measure['display_name']\n hash[:measure_type] = measure['measure_type']\n hash[:uid] = measure['uid'] ? measure['uid'] ... | [
"0.57950705",
"0.5664046",
"0.5627946",
"0.5536319",
"0.55269486",
"0.55268526",
"0.54663694",
"0.5388411",
"0.532066",
"0.523672",
"0.51744306",
"0.51744306",
"0.51744306",
"0.5152329",
"0.50993246",
"0.5095497",
"0.50752085",
"0.50752085",
"0.50652915",
"0.4980319",
"0.4941... | 0.78555423 | 0 |
List the measures added with a given API key. | def list_measures
exec_req_and_parse_response "/measure/list"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @kr_measures = KrMeasure.all\n end",
"def stats(api_key = nil)\n if api_key && (!api_key.is_a? String)\n error = InvalidOptions.new(['API key(String)'], ['API key(String)'])\n raise error\n end\n\n # Disable cache for API key status calls\n get_request('/stats/',... | [
"0.6055472",
"0.5997235",
"0.5745264",
"0.5745264",
"0.57444793",
"0.57245135",
"0.57245135",
"0.56308895",
"0.5582681",
"0.5532264",
"0.5520591",
"0.55136263",
"0.54849344",
"0.54823804",
"0.5416524",
"0.5400436",
"0.5388314",
"0.5388314",
"0.5334119",
"0.53151244",
"0.53097... | 0.6961849 | 0 |
Deletes a measure previously added with the same API key. | def delete_measure(measure_id)
raise ArgumentError,"measure_id cannot be nil" unless measure_id
exec_req_and_parse_response "/measure/delete", {id: measure_id}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @measure = Measure.find(params[:id])\n\n respond_to do |format|\n if @measure.destroy\n format.html { redirect_to measures_url,\n notice: (crud_notice('destroyed', @measure) + \"#{undo_link(@measure)}\").html_safe }\n format.json { head :no_cont... | [
"0.70181394",
"0.6752842",
"0.6710834",
"0.65900517",
"0.65266734",
"0.64706707",
"0.6384439",
"0.6384439",
"0.6384439",
"0.63701534",
"0.62971586",
"0.6178128",
"0.61148435",
"0.6089075",
"0.599364",
"0.5984563",
"0.59323937",
"0.590877",
"0.58892596",
"0.5842503",
"0.583474... | 0.76766664 | 0 |
GET /admin/kpi_templates GET /admin/kpi_templates.json | def index
@admin_kpi_templates = Admin::KpiTemplate.paginate(:page=>params[:page],:per_page=>20)
respond_to do |format|
format.html # index.html.erb
format.json { render json: @admin_kpi_templates }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def templates\n response = get \"storage/template\"\n data = JSON.parse response.body\n data\n end",
"def mcget_templates\n # setup_mcapi.folders.list(\"template\")\n setup_mcapi.templates.list({user: true},{include_drag_and_drop: true})\n end",
"def list\n @client.call(method: :get, pa... | [
"0.7611544",
"0.74329525",
"0.74214125",
"0.73192745",
"0.7282916",
"0.7195353",
"0.70129025",
"0.6780964",
"0.6774948",
"0.6719718",
"0.6708284",
"0.66698945",
"0.66660786",
"0.6650021",
"0.6640807",
"0.6623894",
"0.66063",
"0.66053903",
"0.65864986",
"0.65860796",
"0.654930... | 0.72008324 | 5 |
GET /admin/kpi_templates/1 GET /admin/kpi_templates/1.json | def show
@admin_kpi_template = Admin::KpiTemplate.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @admin_kpi_template }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def templates\n response = get \"storage/template\"\n data = JSON.parse response.body\n data\n end",
"def mcget_templates\n # setup_mcapi.folders.list(\"template\")\n setup_mcapi.templates.list({user: true},{include_drag_and_drop: true})\n end",
"def index\n @admin_kpi_templates = Admin::Kp... | [
"0.7437772",
"0.72739434",
"0.7184176",
"0.7163274",
"0.7069067",
"0.70222825",
"0.69964737",
"0.6929837",
"0.6895858",
"0.68114465",
"0.6743925",
"0.6649605",
"0.6595382",
"0.6536871",
"0.6528256",
"0.6518652",
"0.6498555",
"0.6482097",
"0.6478377",
"0.64602774",
"0.6455248"... | 0.7289812 | 1 |
GET /admin/kpi_templates/new GET /admin/kpi_templates/new.json | def new
@admin_kpi_template = Admin::KpiTemplate.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @admin_kpi_template }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @admin_template = Template.new\n @admin_template.build_template_content\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_template }\n end\n end",
"def create\n @admin_kpi_template = Admin::KpiTemplate.new(params[:admin_kpi_templat... | [
"0.7628031",
"0.7491061",
"0.73979896",
"0.7318499",
"0.72550195",
"0.72364664",
"0.7184336",
"0.7154141",
"0.69101703",
"0.68970555",
"0.68610317",
"0.6832197",
"0.6823529",
"0.67503005",
"0.6732363",
"0.67298216",
"0.6721883",
"0.6720589",
"0.66778696",
"0.666765",
"0.66629... | 0.7802102 | 0 |
POST /admin/kpi_templates POST /admin/kpi_templates.json | def create
@admin_kpi_template = Admin::KpiTemplate.new(params[:admin_kpi_template])
respond_to do |format|
if @admin_kpi_template.save
format.html { redirect_to @admin_kpi_template, notice: 'Kpi template was successfully created.' }
format.json { render json: @admin_kpi_template, status: :created, location: @admin_kpi_template }
else
format.html { render action: "new" }
format.json { render json: @admin_kpi_template.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @admin_kpi_template = Admin::KpiTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_kpi_template }\n end\n end",
"def templates\n response = get \"storage/template\"\n data = JSON.parse response.body\n data\n end",
"de... | [
"0.6622259",
"0.6582469",
"0.6530488",
"0.64118797",
"0.6294986",
"0.62941164",
"0.62474686",
"0.617519",
"0.6167039",
"0.6138981",
"0.61165845",
"0.6113474",
"0.6102534",
"0.6098116",
"0.6085632",
"0.6077751",
"0.6077751",
"0.6077629",
"0.6065601",
"0.60522896",
"0.6044563",... | 0.714878 | 0 |
PUT /admin/kpi_templates/1 PUT /admin/kpi_templates/1.json | def update
@admin_kpi_template = Admin::KpiTemplate.find(params[:id])
respond_to do |format|
if @admin_kpi_template.update_attributes(params[:admin_kpi_template])
format.html { redirect_to @admin_kpi_template, notice: 'Kpi template was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @admin_kpi_template.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @admin_kpi_template = Admin::KpiTemplate.new(params[:admin_kpi_template])\n\n respond_to do |format|\n if @admin_kpi_template.save\n format.html { redirect_to @admin_kpi_template, notice: 'Kpi template was successfully created.' }\n format.json { render json: @admin_kpi_templa... | [
"0.6677234",
"0.6605227",
"0.6563711",
"0.6366431",
"0.63474077",
"0.6313986",
"0.6302278",
"0.6235642",
"0.62329364",
"0.6221428",
"0.61613137",
"0.6146442",
"0.613878",
"0.60881495",
"0.60746276",
"0.6053903",
"0.60427064",
"0.6026944",
"0.60222507",
"0.59898096",
"0.597725... | 0.72135085 | 0 |
DELETE /admin/kpi_templates/1 DELETE /admin/kpi_templates/1.json | def destroy
@admin_kpi_template = Admin::KpiTemplate.find(params[:id])
@admin_kpi_template.destroy
respond_to do |format|
format.html { redirect_to admin_kpi_templates_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n super \"/templates/#{template_id}.json\", {}\n end",
"def delete\n response = CreateSend.delete \"/templates/#{template_id}.json\", {}\n end",
"def destroy\n @admin_template = Template.find(params[:id])\n @admin_template.destroy\n\n respond_to do |format|\n format.htm... | [
"0.81895006",
"0.7716338",
"0.76344776",
"0.7569155",
"0.75441825",
"0.7424844",
"0.72418547",
"0.72326523",
"0.7227562",
"0.719766",
"0.71947485",
"0.71778405",
"0.7172795",
"0.7161264",
"0.7155254",
"0.7136468",
"0.71360016",
"0.71345735",
"0.7133789",
"0.7114048",
"0.71082... | 0.81072366 | 1 |
I dont think this belongs here and it will need to eventually be moved to a more approperiate location | def validate_artifact(validators, artifact, options = {})
# TODO: R2P: change R/P model through all validators
file_count = artifact.count do |name, file|
doc = build_document(file)
merged_options = options.merge(file_name: name)
validators.each do |validator|
validator.validate(doc, merged_options)
break unless validator.can_continue
end
true
end
validators.each do |validator|
execution_errors.concat validator.errors
end
conditionally_add_task_specific_errors(file_count)
execution_errors.only_errors.count.positive? ? fail : pass
rescue => e
errored(e)
logger.error("Encountered an exception in Test Execution #{id}: #{e.message}, backgrace:\n#{e.backtrace}")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def probers; end",
"def schubert; end",
"def refutal()\n end",
"def who_we_are\r\n end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def internal; end",
"def implementation; end",
"def implementation; end",
"def formation; end",
"de... | [
"0.7868308",
"0.6778602",
"0.6655623",
"0.64959353",
"0.63604206",
"0.63326985",
"0.63326985",
"0.63326985",
"0.63326985",
"0.63251454",
"0.62973046",
"0.62973046",
"0.615267",
"0.6131147",
"0.611963",
"0.611963",
"0.6024578",
"0.59892607",
"0.5981644",
"0.5979489",
"0.597948... | 0.0 | -1 |
returns combined status including c3 test execution returns passing if both passing, incomplete if either incomplete, failing if both complete and at least one failing | def status_with_sibling
sibling = sibling_execution
return status unless sibling
return status if status == sibling.status
return 'incomplete' if incomplete? || sibling.incomplete?
return 'failing' if failing? || sibling.failing?
return 'errored' if errored? || sibling.errored?
'failing' # failing if status's do not match
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_status(c, on_fail_msg, on_success_msg, dofail = false)\n if !c.status.success?\n fail_msg = on_fail_msg + ' ' + c.stdout + '\\n' + c.stderr\n if dofail\n fail fail_msg\n else\n puts fail_msg\n end\n else\n puts on_success_msg\n end\nend",
"def invisible_testSuccess(c, ci, cv... | [
"0.67120624",
"0.6472583",
"0.6472436",
"0.6385999",
"0.6382669",
"0.63044417",
"0.63044417",
"0.6170361",
"0.616639",
"0.603562",
"0.59400177",
"0.59276897",
"0.5907446",
"0.5870101",
"0.5856742",
"0.5822171",
"0.5822171",
"0.5817759",
"0.58138794",
"0.58112144",
"0.58108103... | 0.0 | -1 |
GET /inventory_plans GET /inventory_plans.json | def index
@inventory_plans = InventoryPlan.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plans(params = {})\n scope 'default'\n get('plans/', params)\n end",
"def index\n @plans = Plan.all\n\n render json: @plans\n end",
"def index\n respond_with(@plans = Plan.all)\n end",
"def index\n @plans = Plan.all\n\n respond_to do |format|\n format.html # index.html.... | [
"0.77916926",
"0.7543112",
"0.73146963",
"0.7312528",
"0.72711605",
"0.71513766",
"0.71465814",
"0.71465814",
"0.7105246",
"0.70671",
"0.70236224",
"0.6997769",
"0.69931203",
"0.6962248",
"0.68519205",
"0.68396896",
"0.6816712",
"0.6749482",
"0.6733172",
"0.67094934",
"0.6641... | 0.76079214 | 1 |
GET /inventory_plans/1 GET /inventory_plans/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @plans = Plan.all\n\n render json: @plans\n end",
"def plans(params = {})\n scope 'default'\n get('plans/', params)\n end",
"def index\n @inventory_plans = InventoryPlan.all\n end",
"def show\n @plan = Plan.find(params[:id])\n\n render json: @plan\n end",
"def ind... | [
"0.7490944",
"0.7470824",
"0.7394055",
"0.73432064",
"0.73340297",
"0.72787637",
"0.7186881",
"0.7180351",
"0.71644866",
"0.7101234",
"0.70892286",
"0.7050326",
"0.7050326",
"0.6925195",
"0.6913076",
"0.68411225",
"0.6809012",
"0.6722106",
"0.6694561",
"0.66778445",
"0.667642... | 0.0 | -1 |
POST /inventory_plans POST /inventory_plans.json | def create
@inventory_plan = InventoryPlan.new(inventory_plan_params)
respond_to do |format|
if @inventory_plan.save
format.html { redirect_to @inventory_plan, notice: 'Inventory plan was successfully created.' }
format.json { render :show, status: :created, location: @inventory_plan }
else
format.html { render :new }
format.json { render json: @inventory_plan.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @plan = Plan.new(params[:plan])\n\n if @plan.save\n render json: @plan, status: :created, location: @plan\n else\n render json: @plan.errors, status: :unprocessable_entity\n end\n end",
"def create\n @plan = Plan.new(plan_params)\n\n if @plan.save\n render json: @pl... | [
"0.69540006",
"0.6920647",
"0.66802293",
"0.66406375",
"0.6632244",
"0.6624152",
"0.6624152",
"0.6559901",
"0.6514302",
"0.6496677",
"0.6468147",
"0.6465878",
"0.6451604",
"0.6436096",
"0.64128935",
"0.63685995",
"0.6365216",
"0.63586235",
"0.63254756",
"0.63206035",
"0.63140... | 0.7369263 | 0 |
PATCH/PUT /inventory_plans/1 PATCH/PUT /inventory_plans/1.json | def update
respond_to do |format|
if @inventory_plan.update(inventory_plan_params)
format.html { redirect_to @inventory_plan, notice: 'Inventory plan was successfully updated.' }
format.json { render :show, status: :ok, location: @inventory_plan }
else
format.html { render :edit }
format.json { render json: @inventory_plan.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @plan = Plan.find(params[:id])\n\n if @plan.update(plan_params)\n head :no_content\n else\n render json: @plan.errors, status: :unprocessable_entity\n end\n end",
"def update\n @plan = Plan.find(params[:id])\n\n if @plan.update(params[:plan])\n head :no_content\n ... | [
"0.6997916",
"0.6967389",
"0.6940506",
"0.69102645",
"0.69102645",
"0.67818505",
"0.67738014",
"0.67738014",
"0.67738014",
"0.67738014",
"0.67738014",
"0.6761353",
"0.6700652",
"0.6686706",
"0.6659432",
"0.66178185",
"0.65859526",
"0.6580674",
"0.657027",
"0.6568275",
"0.6558... | 0.70350343 | 0 |
DELETE /inventory_plans/1 DELETE /inventory_plans/1.json | def destroy
@inventory_plan.destroy
respond_to do |format|
format.html { redirect_to inventory_plans_url, notice: 'Inventory plan was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @plan.destroy\n respond_to do |format|\n format.html { redirect_to plans_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @plan.destroy\n respond_to do |format|\n format.html { redirect_to plans_url }\n format.json { head :no_content }\n e... | [
"0.75575805",
"0.75575805",
"0.7522356",
"0.74864733",
"0.74864733",
"0.74864733",
"0.74313825",
"0.7377303",
"0.7357508",
"0.7325257",
"0.72950375",
"0.72545105",
"0.72545105",
"0.72545105",
"0.72545105",
"0.72545105",
"0.72545105",
"0.72545105",
"0.72545105",
"0.7216642",
"... | 0.7524009 | 2 |
Use callbacks to share common setup or constraints between actions. | def set_inventory_plan
@inventory_plan = InventoryPlan.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 |
Only allow a list of trusted parameters through. | def inventory_plan_params
params.require(:inventory_plan).permit(:Document_number, :Name, :To_id, :description)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def param_whitelist\n [:role, :title]\... | [
"0.69497335",
"0.6812623",
"0.6803639",
"0.6795365",
"0.67448795",
"0.67399913",
"0.6526815",
"0.6518771",
"0.64931697",
"0.6430388",
"0.6430388",
"0.6430388",
"0.63983387",
"0.6356042",
"0.63535863",
"0.63464934",
"0.63444513",
"0.6337208",
"0.6326454",
"0.6326454",
"0.63264... | 0.0 | -1 |
This method gets called many times on every page view so it needs to cache as much as possible. | def has_role?(role_id)
cur_user_id = self.user_id
has_role = false
# puts ""
# Check if we already have the query cached
if Roles_Cache.has_key?(cur_user_id)
# puts "\t1. Checking cache for role_id = #{role_id} in #{Roles_Cache[cur_user_id].to_s}"
if Roles_Cache[cur_user_id].include?(role_id)
has_role = true
# puts "\t 2. Sucessfully retrieved the role from cache"
end
else
the_users_roles = []
self.roles.uniq.each do |role|
the_users_roles << role.role_id
end
# puts "\t1. Queried database for role_id = #{role_id} and got #{the_users_roles.to_s}"
# Store the role array in memory
Roles_Cache[cur_user_id] = the_users_roles
if the_users_roles.include?(role_id)
# puts "\t 2. Successfully retrieved the role from the database"
has_role = true
end
end
return has_role
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cache; end",
"def cache; end",
"def cache; end",
"def cache; end",
"def cache; end",
"def cache; end",
"def cache; end",
"def cached?; end",
"def index\n no_cache\n super\n end",
"def cache_on?; end",
"def cache_on?; end",
"def update_cache\n # Does nothing...up to subclasse... | [
"0.71552026",
"0.71552026",
"0.71552026",
"0.71552026",
"0.71552026",
"0.71552026",
"0.71552026",
"0.6845412",
"0.6766457",
"0.66386235",
"0.66386235",
"0.6630219",
"0.6621704",
"0.6614086",
"0.6560753",
"0.6546248",
"0.6525793",
"0.6514219",
"0.64824677",
"0.64020425",
"0.63... | 0.0 | -1 |
Enter a number and have the program generate PI up to that many decimal places. Keep a limit to how far the program will go. | def chosen_digit
return gets.chomp.to_i
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def my_pi(n)\n\treturn Math::PI.round(n)\nend",
"def my_pi(n)\n\t#p Math::PI\n\tMath::PI.round(n)\nend",
"def compute_pi(digits: 15)\n precision = digits\n result = BigMath.PI(precision)\n result = result.truncate(precision).to_s\n result = result[2..-1] # Remove '0.'\n result = resu... | [
"0.70012957",
"0.6943915",
"0.68257415",
"0.6196292",
"0.6155135",
"0.608952",
"0.59642476",
"0.57550055",
"0.5672456",
"0.56198806",
"0.5612132",
"0.5609172",
"0.5554061",
"0.5470592",
"0.5456151",
"0.5427291",
"0.53780836",
"0.5357305",
"0.53421557",
"0.53379655",
"0.532384... | 0.0 | -1 |
triggered when our twilio number receives a message | def twiml
sms = { from: params[:From],
to: params[:To],
body: params[:Body] }
from_user = User.find_by_phone_number(params[:From])
sms[:from_user_id] = from_user.id if from_user
to_user = User.find_by_phone_number(params[:To])
sms[:to_user_id] = to_user.id if to_user
# save the message into the DB
@sms = Sms.create(sms)
from_user = @sms.from_user
# response logic
# if from_user && from_user.response.nil?
# if sms[:body].downcase.include?("yes")
# twilio.respond_to_yes(sms[:from])
# from_user.response = true
# from_user.save
# elsif sms[:body].downcase.include?("no")
# twilio.send_sms(sms[:from], "Got it. Have a great day!")
# from_user.response = false
# from_user.save
# end
# end
# Empty response to Twilio (Do nothing more)
render xml: Twilio::TwiML::Response.new.text
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def twilio\n @number = params[:phone_number]\n \n #Text message info\n t = {\n \n 'From' => CALLER_ID,\n 'To' => @number,\n 'Body' => (\"Visit uhpartments.com when you walk through an apartment\")\n }\n\n begin\n account = Twilio::RestAccount.new(ACCOUNT_SID, ACCOUNT_TOKEN)... | [
"0.6677721",
"0.6641011",
"0.65686715",
"0.64786357",
"0.6463351",
"0.6381599",
"0.6369843",
"0.632752",
"0.63001657",
"0.6271573",
"0.6203104",
"0.6195237",
"0.6194619",
"0.61725783",
"0.61402947",
"0.613105",
"0.61290985",
"0.6105177",
"0.60967404",
"0.6095124",
"0.6078915"... | 0.0 | -1 |
GET /address_books GET /address_books.json | def index
@address_books = AddressBook.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_address_books\n self.class.get('https://api.yesgraph.com/v0/address-books', :headers => @options)\n end",
"def get_address_book(user_id)\n self.class.get(\"https://api.yesgraph.com/v0/address-book/#{user_id}\",\n {\n :headers => @options\n }\n )\n end",
"def index\n base_url ... | [
"0.81414425",
"0.7130902",
"0.7011227",
"0.66944295",
"0.6541237",
"0.64940757",
"0.6453533",
"0.64527196",
"0.64360535",
"0.6377079",
"0.6365382",
"0.6363231",
"0.63540405",
"0.6348739",
"0.632448",
"0.6281701",
"0.6281066",
"0.62784296",
"0.6267369",
"0.6260016",
"0.6254287... | 0.7406254 | 3 |
GET /address_books/1 GET /address_books/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_address_books\n self.class.get('https://api.yesgraph.com/v0/address-books', :headers => @options)\n end",
"def index\n @address_books = AddressBook.all\n end",
"def index\n @address_books = AddressBook.all\n end",
"def index\n @address_books = AddressBook.all\n end",
"def get_addres... | [
"0.76229805",
"0.6974088",
"0.6974088",
"0.6974088",
"0.697265",
"0.6950635",
"0.6436496",
"0.64208305",
"0.63960457",
"0.63895285",
"0.63481176",
"0.630802",
"0.63050646",
"0.6298104",
"0.62939817",
"0.6275961",
"0.62499386",
"0.62499386",
"0.62499386",
"0.62447834",
"0.6244... | 0.0 | -1 |
PATCH/PUT /address_books/1 PATCH/PUT /address_books/1.json | def update
respond_to do |format|
if @address_book.update(address_book_params)
format.html { redirect_to @address_book, notice: '更新完成!Address book updated!' }
format.json { render :show, status: :ok, location: @address_book }
else
format.html { render :edit }
format.json { render json: @address_book.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_address_book(address_book_id, prop_patch)\n end",
"def update\n respond_to do |format|\n if @address_book.update(address_book_params)\n format.html { redirect_to @address_book, notice: 'Address book was successfully updated.' }\n format.json { render :show, status: :ok, lo... | [
"0.7075766",
"0.70404154",
"0.70404154",
"0.6720292",
"0.6526965",
"0.6356401",
"0.630233",
"0.6225654",
"0.62163633",
"0.6206808",
"0.61862224",
"0.617918",
"0.61743903",
"0.6164094",
"0.6156988",
"0.61536145",
"0.6149754",
"0.61496717",
"0.61496717",
"0.61496717",
"0.614967... | 0.66694844 | 4 |
DELETE /address_books/1 DELETE /address_books/1.json | def destroy
@address_book.destroy
respond_to do |format|
format.html { redirect_to address_books_url, notice: '删除完成!Address book destroyed!' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @address_book.destroy\n respond_to do |format|\n format.html { redirect_to address_books_url, notice: 'Address book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @address_book.destroy\n respond_to do |format|\n format.h... | [
"0.74078155",
"0.74078155",
"0.71942306",
"0.71695435",
"0.7138133",
"0.6975435",
"0.6975435",
"0.6975435",
"0.6975435",
"0.6936777",
"0.6810096",
"0.6809638",
"0.679322",
"0.67807364",
"0.6771209",
"0.6754308",
"0.6743724",
"0.6729169",
"0.6715116",
"0.6704836",
"0.6703558",... | 0.7303331 | 2 |
Use callbacks to share common setup or constraints between actions. | def set_address_book
@address_book = AddressBook.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 address_book_params
params.require(:address_book).permit(:contact_fname, :contact_lname, :email, :phone, :address, :city, :state, :zip,:auth)
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.6981537",
"0.67835593",
"0.6748275",
"0.67436063",
"0.6736311",
"0.65937173",
"0.6503359",
"0.6498499",
"0.6482832",
"0.6478776",
"0.645703",
"0.6439998",
"0.63802195",
"0.6377008",
"0.6366287",
"0.632018",
"0.63016284",
"0.63011277",
"0.62932974",
"0.62919617",
"0.6290564... | 0.0 | -1 |
a list of numbers, and returns a new Array that contains the product of every pair of numbers that can be formed between the elements of the two Arrays. The results should be sorted by increasing value. You may assume that neither argument is an empty Array. | def multiply_all_pairs(numbers1, numbers2)
products = []
numbers1.each do |num1|
numbers2.each { |num2| products << num1 * num2 }
end
products.sort
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def multiply_all_pairs(num_arr1, num_arr2)\n product_arr = []\n\n num_arr1.each do |x|\n num_arr2.each do |y|\n product_arr << x * y\n end\n end\n product_arr.sort\nend",
"def multiply_all_pairs(array1, array2)\n products = []\n array1.each do |num1|\n array2.each do |num2|\n product... | [
"0.78840876",
"0.78523827",
"0.7849471",
"0.7821105",
"0.78120816",
"0.7797833",
"0.7797173",
"0.7797173",
"0.7797173",
"0.7797173",
"0.7794409",
"0.77779186",
"0.7777299",
"0.77712256",
"0.77707493",
"0.7764924",
"0.77628165",
"0.7761185",
"0.7752042",
"0.7731076",
"0.773107... | 0.7759365 | 18 |
GET /answer_respondents GET /answer_respondents.json | def index
@answer_respondents = AnswerRespondent.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_answer_respondent\n @answer_respondent = AnswerRespondent.find(params[:id])\n end",
"def answers\n request('answers')\n end",
"def responses\n question=Question.find(params[:questionId])\n render :json=> question.response\n end",
"def answer_respondent_params\n params.... | [
"0.73055446",
"0.71295285",
"0.68813956",
"0.6850379",
"0.671438",
"0.67118245",
"0.6680594",
"0.663625",
"0.6592341",
"0.6578443",
"0.6578443",
"0.6578443",
"0.6578443",
"0.6513747",
"0.64961135",
"0.6478164",
"0.64075536",
"0.6404816",
"0.6389788",
"0.6372988",
"0.63352245"... | 0.81594193 | 0 |
GET /answer_respondents/1 GET /answer_respondents/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @answer_respondents = AnswerRespondent.all\n end",
"def set_answer_respondent\n @answer_respondent = AnswerRespondent.find(params[:id])\n end",
"def responses\n question=Question.find(params[:questionId])\n render :json=> question.response\n end",
"def index\n\n @answers = A... | [
"0.78993326",
"0.7420731",
"0.7149237",
"0.6772038",
"0.6755213",
"0.67280173",
"0.67280173",
"0.67280173",
"0.6712765",
"0.6687646",
"0.6687646",
"0.6687646",
"0.6687646",
"0.66876227",
"0.6666691",
"0.6657036",
"0.6609106",
"0.66005814",
"0.65898",
"0.6573502",
"0.65633553"... | 0.0 | -1 |
POST /answer_respondents POST /answer_respondents.json | def create
@answer_respondent = AnswerRespondent.new(answer_respondent_params)
respond_to do |format|
if @answer_respondent.save
format.html { redirect_to @answer_respondent, notice: 'Answer respondent was successfully created.' }
format.json { render :show, status: :created, location: @answer_respondent }
else
format.html { render :new }
format.json { render json: @answer_respondent.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def answer_respondent_params\n params.require(:answer_respondent).permit(:answer_id, :respondent_id)\n end",
"def set_answer_respondent\n @answer_respondent = AnswerRespondent.find(params[:id])\n end",
"def index\n @answer_respondents = AnswerRespondent.all\n end",
"def create\n @answe... | [
"0.7431237",
"0.7284853",
"0.7212755",
"0.66907847",
"0.66442853",
"0.6495077",
"0.6491485",
"0.64622796",
"0.64386237",
"0.6377557",
"0.63708645",
"0.63708645",
"0.6366774",
"0.6341342",
"0.63385785",
"0.6307716",
"0.6262253",
"0.6255723",
"0.62530404",
"0.62362015",
"0.6229... | 0.73354363 | 1 |
PATCH/PUT /answer_respondents/1 PATCH/PUT /answer_respondents/1.json | def update
respond_to do |format|
if @answer_respondent.update(answer_respondent_params)
format.html { redirect_to @answer_respondent, notice: 'Answer respondent was successfully updated.' }
format.json { render :show, status: :ok, location: @answer_respondent }
else
format.html { render :edit }
format.json { render json: @answer_respondent.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @question = Question.update(params[:id], { \n :body => params[:body], \n :answer_type => params[:answer_type] }, \n params[:answers].values\n )\n\n respond_to do |format|\n format.json { render :json => @question.as_json({:include => :answers}) }\n\n # if @que... | [
"0.7230572",
"0.7226345",
"0.71595407",
"0.71509564",
"0.7144758",
"0.7116835",
"0.7072119",
"0.70406055",
"0.7026399",
"0.7025212",
"0.7024132",
"0.6972862",
"0.6972862",
"0.6963989",
"0.6931329",
"0.69256085",
"0.69256085",
"0.69256085",
"0.69216883",
"0.6917072",
"0.691536... | 0.7575017 | 0 |
DELETE /answer_respondents/1 DELETE /answer_respondents/1.json | def destroy
@answer_respondent.destroy
respond_to do |format|
format.html { redirect_to answer_respondents_url, notice: 'Answer respondent was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n answer = Answer.find(params[:answer_id])\n answer.destroy\n \n render json: {success: true}\n end",
"def destroy\n @client_answer = ClientAnswer.find(params[:id])\n @client_answer.destroy\n\n respond_to do |format|\n format.html { redirect_to client_answers_url }\n f... | [
"0.77064997",
"0.7694547",
"0.76218575",
"0.76218575",
"0.7612169",
"0.7564523",
"0.75546277",
"0.75546277",
"0.75343424",
"0.7522176",
"0.74898523",
"0.7467054",
"0.742865",
"0.74270797",
"0.74086344",
"0.73985296",
"0.73985296",
"0.73985296",
"0.73985296",
"0.73985296",
"0.... | 0.8105654 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_answer_respondent
@answer_respondent = AnswerRespondent.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 answer_respondent_params
params.require(:answer_respondent).permit(:answer_id, :respondent_id)
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.6981537",
"0.67835593",
"0.6748275",
"0.67436063",
"0.6736311",
"0.65937173",
"0.6503359",
"0.6498499",
"0.6482832",
"0.6478776",
"0.645703",
"0.6439998",
"0.63802195",
"0.6377008",
"0.6366287",
"0.632018",
"0.63016284",
"0.63011277",
"0.62932974",
"0.62919617",
"0.6290564... | 0.0 | -1 |
Set default values if nothing has input for max and backup student | def default_values
self.max_student ||= 0
self.backup_student ||= 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def after_init\n self[:max] ||= DEFAULT_MAX #will set the default value only if it's nil\n self[:current] ||= DEFAULT_ZERO\n self[:percentage] ||= DEFAULT_ZERO\n end",
"def set_defaults\n self.current_score ||= 0\n self.highest_score ||= 0\n self.total_correct ||= 0\n self.total_... | [
"0.6815649",
"0.65635794",
"0.6395689",
"0.61816514",
"0.61816514",
"0.6142738",
"0.6057108",
"0.6021825",
"0.6011223",
"0.5986865",
"0.595286",
"0.595286",
"0.5946054",
"0.591463",
"0.5899782",
"0.58350366",
"0.58257866",
"0.57821053",
"0.5771473",
"0.57642305",
"0.5763239",... | 0.83218783 | 0 |
show how many seats available, show full if left 0 | def seats_available
available = total_student - UserEvent.joined_students_count(self.id)
if available > 0
available
else
"FULL"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def seats_available_over_total\n\t\t\"#{seats_available} / #{total_student}\"\n\tend",
"def remaining_seats\n auditorium.seating_capacity - tickets.count\n end",
"def total_seats_left\n [self.house_capacity - vouchers.size, 0].max\n end",
"def seats_available?\n (capacity - total_enrollments) > 0\... | [
"0.7427944",
"0.7204475",
"0.7068076",
"0.7061295",
"0.7044148",
"0.6988808",
"0.6986715",
"0.69829905",
"0.6982625",
"0.6860024",
"0.66717607",
"0.63720167",
"0.6363908",
"0.6338503",
"0.62845594",
"0.6258467",
"0.6226915",
"0.6166556",
"0.6139675",
"0.605597",
"0.60485965",... | 0.7476062 | 0 |
status for current event, for css styling | def join_status(user)
userevent = UserEvent.where(event_id: self.id, user_id: user.id).first
if userevent
userevent.join_status ? "joined" : (is_expired? ? "expired" : "nojoin")
else
"nojoin"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def status\n end",
"def status\n end",
"def status\n end",
"def status\n end",
"def set_event_status( event, status )\n event.instance_exec( namespace ) { |namespace| set_status(status, namespace) }\n end",
"def status_effect; end",
"def get_status_string(status)\n case status\n ... | [
"0.64846885",
"0.64846885",
"0.64846885",
"0.64846885",
"0.64695346",
"0.64674544",
"0.6450711",
"0.64133316",
"0.64088076",
"0.64088076",
"0.64088076",
"0.64088076",
"0.64088076",
"0.64088076",
"0.64088076",
"0.64088076",
"0.64088076",
"0.6401566",
"0.63875383",
"0.63588667",
... | 0.0 | -1 |
student view of seats available | def seats_available_over_total
"#{seats_available} / #{total_student}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n\t\t#insert logic to rule out seats taken\n\t\trender :index\n\tend",
"def index\n @seats = Seat.all\n end",
"def index\n @seats = Seat.all\n end",
"def show\n @seats = @flight.seats\n end",
"def seats\n respond_to?(:constituencyGroupHasHouseSeat) ? constituencyGroupHasHouseS... | [
"0.7342581",
"0.72967577",
"0.72967577",
"0.7004693",
"0.68944573",
"0.6840483",
"0.6822822",
"0.68118197",
"0.67529637",
"0.6749544",
"0.66963625",
"0.65907043",
"0.64996994",
"0.6476909",
"0.6453216",
"0.6436593",
"0.6429939",
"0.638689",
"0.635079",
"0.6335041",
"0.6296884... | 0.62576956 | 24 |
admin view of seats available | def seats_available_over_max_backup
"#{seats_available} / #{max_student} + #{backup_student}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n\t\t#insert logic to rule out seats taken\n\t\trender :index\n\tend",
"def index\n @seats = Seat.all\n end",
"def index\n @seats = Seat.all\n end",
"def show\n @seats = @flight.seats\n end",
"def index\n @ipc_seats = IpcSeat.all\n end",
"def index\n @class_seats = ClassSeat.a... | [
"0.7693574",
"0.7498798",
"0.7498798",
"0.7061378",
"0.7035723",
"0.6886652",
"0.68367296",
"0.6766817",
"0.66861826",
"0.6643051",
"0.65841615",
"0.6545098",
"0.65206337",
"0.6469575",
"0.638052",
"0.63766176",
"0.6375358",
"0.6357821",
"0.6338564",
"0.6327835",
"0.63195944"... | 0.0 | -1 |
determine if an event is expired | def is_expired?
self.event_date < DateTime.now
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_expired?(date)\n # The event will expires 2 hours after is date\n Time.parse(date).to_f < Time.now.to_f - 2.hours.to_i\n rescue TypeError\n true\n end",
"def expired?(payload)\n Time.at(payload['exp']) < Time.now\n end",
"def is_expired?\n (!end_time.nil? and e... | [
"0.8028491",
"0.79227525",
"0.7835721",
"0.77996075",
"0.77374166",
"0.77341044",
"0.77300525",
"0.77004135",
"0.7689028",
"0.76824254",
"0.76695436",
"0.7639126",
"0.7635659",
"0.761576",
"0.76122284",
"0.7599086",
"0.75877947",
"0.75784826",
"0.75738645",
"0.7571503",
"0.75... | 0.8490823 | 0 |
determine if an event is hidden by admin | def is_hidden?
self.hidden
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hidden?\n not visible\n end",
"def hidden?\n hidden_at?\n end",
"def hidden?\n hidden_at?\n end",
"def hidden?\n hidden_at?\n end",
"def eventunscrape?\n @user.is_admin?\n end",
"def hidden?()\n not visible?()\n end",
"def hidden?\n false\n en... | [
"0.69010645",
"0.6890891",
"0.6890891",
"0.6890891",
"0.6873011",
"0.6852094",
"0.67290497",
"0.67245084",
"0.6713119",
"0.66771126",
"0.6664148",
"0.6664148",
"0.66370064",
"0.66290087",
"0.66233903",
"0.6594885",
"0.6524129",
"0.6523141",
"0.65138566",
"0.64834476",
"0.6399... | 0.6653252 | 12 |
validate end time cannot be earlier than start time | def end_time_cannot_be_earlier_than_start_time
if end_time && start_time
if end_time < start_time
errors.add(:end_time, "End time should not be earlier than start time.")
end
end
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 validate_temporal_sanity\n errors.add(:end_time, \"Must be after Start Time.\") unless self.start_time < self.end_time\n end",
"def... | [
"0.8695012",
"0.8549378",
"0.8511056",
"0.8485147",
"0.84669256",
"0.84273964",
"0.8292079",
"0.8291583",
"0.8275534",
"0.82208645",
"0.82175106",
"0.8195104",
"0.8145219",
"0.8094738",
"0.8056562",
"0.7952406",
"0.79493713",
"0.794894",
"0.7847506",
"0.7829597",
"0.7771807",... | 0.85964435 | 1 |
GET /prod_cotis GET /prod_cotis.json | def index
@prod_cotis = ProdCoti.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @all_products = Product.all.as_json\n @all_currencies = ExchangeRateService.valid_currencies\n @base_url = Rails.env.development? ? 'http://localhost:3000' : 'http://cabifycheckout.com'\n end",
"def index\n @cocktails = Cocktail.where(\"oficial = ?\", false)\n\n respond_to do |format|... | [
"0.61314243",
"0.60986084",
"0.5985435",
"0.59629595",
"0.5894719",
"0.58706814",
"0.58565897",
"0.5829874",
"0.5815771",
"0.57987326",
"0.5790425",
"0.579011",
"0.5754944",
"0.5737547",
"0.57159364",
"0.56977683",
"0.56970215",
"0.56858516",
"0.567605",
"0.5672296",
"0.56291... | 0.68760175 | 0 |
GET /prod_cotis/1 GET /prod_cotis/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @prod_cotis = ProdCoti.all\n end",
"def index\n @cocktails = Cocktail.where(\"oficial = ?\", false)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @cocktails }\n end\n end",
"def index\n @all_products = Product.all.as_json\n @... | [
"0.6832624",
"0.60913813",
"0.6085554",
"0.60687006",
"0.60392344",
"0.60319906",
"0.59790313",
"0.59718484",
"0.59237355",
"0.5909952",
"0.5906853",
"0.5890505",
"0.5866546",
"0.58344215",
"0.58336973",
"0.58090293",
"0.58087796",
"0.5798929",
"0.57960373",
"0.5789576",
"0.5... | 0.0 | -1 |
POST /prod_cotis POST /prod_cotis.json | def create
@prod_coti = ProdCoti.new(prod_coti_params)
respond_to do |format|
if @prod_coti.save
format.html { redirect_to @prod_coti, notice: 'Prod coti was successfully created.' }
format.json { render :show, status: :created, location: @prod_coti }
else
format.html { render :new }
format.json { render json: @prod_coti.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prod_coti_params\n params.require(:prod_coti).permit(:cod_cotiza, :cod_producto)\n end",
"def create\n @service_order = ServiceOrder.new(service_order_params)\n @products = params[:inputprod]\n @quantity = params[:inputcantidad]\n #@cita_id = Citation.where(:id => params[:citation_id])\n ... | [
"0.6184822",
"0.60576785",
"0.5955267",
"0.59391475",
"0.58430254",
"0.5840807",
"0.5837428",
"0.58315563",
"0.5775817",
"0.5759948",
"0.5754532",
"0.5739815",
"0.57256734",
"0.57157534",
"0.5685645",
"0.56800354",
"0.5679995",
"0.5676887",
"0.5661198",
"0.5647367",
"0.563832... | 0.6901862 | 0 |
PATCH/PUT /prod_cotis/1 PATCH/PUT /prod_cotis/1.json | def update
respond_to do |format|
if @prod_coti.update(prod_coti_params)
format.html { redirect_to @prod_coti, notice: 'Prod coti was successfully updated.' }
format.json { render :show, status: :ok, location: @prod_coti }
else
format.html { render :edit }
format.json { render json: @prod_coti.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @cotiz_clo_mul.update(cotiz_clo_mul_params)\n format.html { redirect_to @cotiz_clo_mul, notice: 'Cotiz clo mul was successfully updated.' }\n format.json { render :show, status: :ok, location: @cotiz_clo_mul }\n else\n format.html { render ... | [
"0.64031595",
"0.6370816",
"0.6341285",
"0.6326131",
"0.62558997",
"0.625389",
"0.6234354",
"0.621671",
"0.6194457",
"0.61910784",
"0.61684775",
"0.6134126",
"0.6115542",
"0.6115483",
"0.6103449",
"0.610302",
"0.6086102",
"0.6083888",
"0.6047131",
"0.60440755",
"0.60432106",
... | 0.7189997 | 0 |
DELETE /prod_cotis/1 DELETE /prod_cotis/1.json | def destroy
@prod_coti.destroy
respond_to do |format|
format.html { redirect_to prod_cotis_url, notice: 'Prod coti was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @prod_cli.destroy\n respond_to do |format|\n format.html { redirect_to prod_clis_url, notice: 'produto excluido com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend"... | [
"0.7181901",
"0.7046368",
"0.6710193",
"0.6703705",
"0.66804236",
"0.6603741",
"0.65819955",
"0.6579261",
"0.65738744",
"0.6564295",
"0.65524226",
"0.65429926",
"0.65280515",
"0.6522569",
"0.6521582",
"0.6521582",
"0.6521582",
"0.6521582",
"0.6518832",
"0.6507469",
"0.6502180... | 0.71944636 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_prod_coti
@prod_coti = ProdCoti.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 prod_coti_params
params.require(:prod_coti).permit(:cod_cotiza, :cod_producto)
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 |
progress goal see for testing if an internal or external goal | def is_internal?
return (self.goal_type % 2) == 1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_valid_for_execution\n (@metadata[\"short_dest_repo_name\"] == \"osrf/gazebo\" and @pr_status == :update) ? false : true\n end",
"def in_progress?\n return false unless status\n status.match(/^Generated on/).nil?\n end",
"def calculate_and_change_status\n return @status.not_a_plan! if !ta... | [
"0.60204583",
"0.5907031",
"0.5829508",
"0.5744864",
"0.5739279",
"0.5726153",
"0.5700277",
"0.568418",
"0.568418",
"0.568418",
"0.56838703",
"0.567169",
"0.56065136",
"0.5596979",
"0.5580879",
"0.5560432",
"0.5547503",
"0.5541333",
"0.5537678",
"0.5529024",
"0.5528989",
"0... | 0.62596583 | 0 |
if internal then checks all children, if external then returns state | def is_complete?
if is_internal?
old_state= self.state # hold old state to see if changed
if self.children.empty?
return self.state == Activity::COMPLETE # no children
else
self.children.each do |child|
if !child.is_complete?
if self.expiration_date.nil? or
self.expiration_date >= Date.current
self.state = Activity::INCOMPLETE
else
self.state = Activity::EXPIRED
end
self.completed_date = nil
self.save!
if !self.parent.nil? and old_state != self.state
self.parent.is_complete?
end
return false
end
end
if self.state != Activity::COMPLETE
self.state = Activity::COMPLETE
self.completed_date = DateTime.current
if !self.parent.nil?
self.parent.is_complete?
end
self.save!
end
return true
end
else
return self.state == Activity::COMPLETE
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def child_check\n if @children.nil? or @children.empty?\n get_children unless @already_fetched_children\n @already_fetched_children = true\n end\n end",
"def children\n child_check\n super\n end",
"def check_if_has_children\n self.lookups.count == 0\n end",
"def any_child_open?\n ... | [
"0.67509234",
"0.6607551",
"0.6470046",
"0.63880694",
"0.63592976",
"0.6271162",
"0.62072885",
"0.62072885",
"0.62072885",
"0.62072885",
"0.61886597",
"0.61154556",
"0.6078982",
"0.6006583",
"0.599491",
"0.599491",
"0.599491",
"0.599491",
"0.5994648",
"0.5989432",
"0.5989432"... | 0.61347324 | 11 |
sets goal to ABANDONED and calls remove on children | def remove_act
# outdent children in case remove_act doesn't delete
self.children.each do |child|
if child.type != 'GoalTracker'
child.outdent
child.remove_act
end
end
# check if parent should update completeness
old_parent = self.parent
self.state = Activity::ABANDONED
self.save!
# refresh parent completeness
if !old_parent.nil?
old_parent.is_complete?
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_finished_children\n # We call #to_a to get a copy of children, since we will remove\n # children in the block. Note that we can't use #delete_if here\n # since #children is a relation enumerator (not the relation list\n # itself... | [
"0.7147326",
"0.7066963",
"0.6505253",
"0.647531",
"0.6440399",
"0.6432944",
"0.6367749",
"0.636337",
"0.635204",
"0.6335101",
"0.62772447",
"0.626488",
"0.6210802",
"0.62064195",
"0.61856765",
"0.61571175",
"0.61485565",
"0.6145143",
"0.61316776",
"0.61258465",
"0.6104825",
... | 0.7523682 | 0 |
methods to get data from user | def other_cd
print "Enter CD name: "
cd_name = gets.chomp
print "Enter artist's name: "
a_name = gets.chomp
print "Enter number of tracks: "
num_tracks = gets.chomp.to_i
[cd_name, a_name, num_tracks]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_user_data\n @user = User.find(params[:id])\n end",
"def get_user_data\n raise NotImplementedError\n end",
"def user_data\n User.user_data login\n end",
"def get_user_info\n response = send_method(:get_user_info)\n user_from(response)\n end",
"def get_user_data(id)\n... | [
"0.7612659",
"0.7607462",
"0.7525058",
"0.6979019",
"0.69727874",
"0.6940883",
"0.6833085",
"0.68140984",
"0.67433023",
"0.6695768",
"0.6660948",
"0.6660869",
"0.6647767",
"0.6597876",
"0.65843606",
"0.6573876",
"0.6567287",
"0.65598685",
"0.6542499",
"0.6542499",
"0.65252244... | 0.0 | -1 |
add CD object to the array variable, $cd_arr | def add_cd(a_cd)
$cd_arr << a_cd
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add obj\n\t\t\t@objs2 += [obj] \n\t\tend",
"def added(array)\nend",
"def addComplexObject(var_Object)\n \n Common::Logger.print(Common::VAR_DEBUG, self, \"addig object [\" + var_Object.to_s() + \"] to the array list\")\n \n if(!var_Object.is_a?(SBAStore::SBAComplexObject))\n raise SBA... | [
"0.57683146",
"0.55001056",
"0.54594797",
"0.5423005",
"0.5422432",
"0.5346832",
"0.52584606",
"0.5093057",
"0.5051827",
"0.5028648",
"0.5023771",
"0.50144297",
"0.49987257",
"0.49938908",
"0.49835676",
"0.4971274",
"0.49583435",
"0.49470288",
"0.48972076",
"0.48884988",
"0.4... | 0.7951346 | 0 |
saves data to disk in yaml format | def save_db
File.open($fn, "w") do |f|
f.write($cd_arr.to_yaml)
# YAML.dump($cd_arr, f)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save\n File.open(file_path, 'w') do |file|\n YAML.dump(data, file)\n end\n end",
"def save\n File.open(path, 'w') do |out|\n YAML.dump(data, out)\n end\n end",
"def save_data\n puts \"saving data\"\n\n File.open(generate_filename(self), \"w\") do |f|\n ... | [
"0.8428015",
"0.84194016",
"0.8270237",
"0.8258402",
"0.82200676",
"0.80422634",
"0.7985691",
"0.7929526",
"0.7928438",
"0.79016596",
"0.7837447",
"0.7752755",
"0.7605779",
"0.7594492",
"0.75519294",
"0.75519294",
"0.75519294",
"0.75519294",
"0.75519294",
"0.75519294",
"0.755... | 0.6930513 | 57 |
loads data from disk and recreates the array of cd objects | def load_db
input_data = File.read($fn)
$cd_arr = YAML.load(input_data)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def restore_from_disk\n log(\"Loading Data in...\")\n\n if File.directory?('buckets') then\n entries = Dir.entries(\"buckets\").collect do |f| f unless f.match(\"bucket\").nil? end.compact\n\n entries.each do |e|\n File.open(\"buckets/\" + e) do |f|\n @contents = Marshal.load(f)\n ... | [
"0.61838716",
"0.6133119",
"0.60826916",
"0.6002441",
"0.5861809",
"0.580101",
"0.57330096",
"0.57263875",
"0.5702215",
"0.5701463",
"0.56642497",
"0.5632797",
"0.56065613",
"0.5599126",
"0.559481",
"0.5567548",
"0.5563865",
"0.55603504",
"0.55561924",
"0.5518134",
"0.5513087... | 0.5884355 | 4 |
prints data from the array to screen in human readable yaml format | def show_data
puts $cd_arr.to_yaml
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ouput_yaml\n array = Array.new(@size * @size, 0)\n File.open('test_yaml.out', 'w') { |file| file.puts YAML.dump(array) }\n end",
"def to_yaml() end",
"def yaml_display(env, \n options = {}, \n colors = DbAgile::Core::Schema::STATUS_TO_COLOR, \n ... | [
"0.70132124",
"0.66674596",
"0.665657",
"0.6487097",
"0.63716704",
"0.63599616",
"0.633203",
"0.633203",
"0.6286116",
"0.6279139",
"0.6245281",
"0.62150383",
"0.6193655",
"0.616709",
"0.6161458",
"0.6160394",
"0.61015743",
"0.60969007",
"0.60808796",
"0.6066709",
"0.6015362",... | 0.7932858 | 0 |
Custom name so all handlers share the same redis namespace | def name
"hipchat-extensions"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def redis_prefix\n @redis_prefix ||= name.underscore\n end",
"def handler_base_namespace; end",
"def redis_key\n self.class.redis_key(@name)\n end",
"def name_prefix; end",
"def redis_namespace(server)\n return redis_server(server) if redis_namespace_disabled?\n\n ::Redis:... | [
"0.69133663",
"0.6507947",
"0.60909444",
"0.60702807",
"0.60030454",
"0.59738916",
"0.5914669",
"0.5798597",
"0.5797816",
"0.5778289",
"0.5753019",
"0.57368135",
"0.57074064",
"0.56458944",
"0.5644715",
"0.5625806",
"0.5612596",
"0.5596967",
"0.5583574",
"0.5552245",
"0.55520... | 0.0 | -1 |
Wraps a block catching errors and logging / replying to the source, when they happen before reraising them | def wrapping_errors(response=nil, &block)
begin
yield if block_given?
rescue StandardError => e
"Oh noes, #{e.message}".tap do |message|
log.error message
response.reply message if response
end
e.backtrace.each { |t| e.debug t }
raise e
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _catch_warden(&block); end",
"def wrap_stream_error_handling\n error_context = capture_context\n proc do |csv|\n yield(csv)\n rescue StandardError => e\n CaptureError.log_error(e)\n CaptureError.capture(e, error_context)\n raise e\n end\n end",
"def on_err... | [
"0.6871378",
"0.6762409",
"0.6728202",
"0.6627646",
"0.6582039",
"0.6582039",
"0.6582039",
"0.65709674",
"0.64903224",
"0.64901906",
"0.64554197",
"0.64539593",
"0.643978",
"0.641213",
"0.6408639",
"0.6383421",
"0.63664514",
"0.63662905",
"0.6315504",
"0.6315504",
"0.6308859"... | 0.6880621 | 0 |
Fetches info about a single user | def fetch_user(id)
client.user(id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_user_info\n response = send_method(:get_user_info)\n user_from(response)\n end",
"def info\n\t@user = User.find(params[:id])\n end",
"def get_user_info(user)\n if user.respond_to? :id\n username = Digest::MD5.hexdigest(user.id.to_s)\n else\n username = user\n ... | [
"0.78311265",
"0.7762366",
"0.7651086",
"0.7634371",
"0.7530107",
"0.7524838",
"0.74918705",
"0.7440991",
"0.7420561",
"0.7377862",
"0.73730254",
"0.73653746",
"0.73544115",
"0.73365146",
"0.73365146",
"0.7333228",
"0.73302364",
"0.7320437",
"0.7291734",
"0.7289717",
"0.72435... | 0.7795002 | 1 |
GET /categories GET /categories.json | def index
@collections = GoodCategory.all
@items = Good.all.to_a
if params[:id]
if params[:id] == 'main'
@items.select! { |i| i.on_main }
else
@collection = GoodCategory.find(params[:id])
@items = @items.delete_if { |i| i.good_category.select { |c| c == @collection }.empty? }.sort_by{|g| g.category_good_weight }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def categories\n\t\tbegin\n\t\t\t@categories = Category.select(:id, :name)\n\t\t\trender json: @categories\n\t\trescue Exception => e\n\t\t\terror_handling_bad_request(e)\n\t\tend\n\tend",
"def get_categories\r\n categories = Taxonomy.get_categories\r\n render json: categories, root: 'categories', adapter:... | [
"0.83888507",
"0.8327856",
"0.83211476",
"0.78072983",
"0.7742051",
"0.75669324",
"0.75111455",
"0.74151826",
"0.7386452",
"0.7369945",
"0.7369187",
"0.73691803",
"0.73691803",
"0.73457074",
"0.73304063",
"0.7316772",
"0.72851175",
"0.72663945",
"0.72275496",
"0.7220998",
"0.... | 0.0 | -1 |
GET /categories/1 GET /categories/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetCategories params = {}\n\n params = params.merge(path: 'categories.json')\n APICall(params)\n\n end",
"def get_categories\r\n categories = Taxonomy.get_categories\r\n render json: categories, root: 'categories', adapter: :json, status: :ok\r\n end",
"def GetCategory id\n\n ... | [
"0.7878458",
"0.78664684",
"0.78481597",
"0.7844208",
"0.7417769",
"0.7408837",
"0.7307978",
"0.7307397",
"0.7307397",
"0.7282804",
"0.72363126",
"0.7185741",
"0.7157934",
"0.713444",
"0.7124538",
"0.7066593",
"0.7045173",
"0.7038258",
"0.70353806",
"0.7033002",
"0.701299",
... | 0.0 | -1 |
POST /categories POST /categories.json | def create
@category = GoodCategory.new(category_params)
respond_to do |format|
if @category.save
format.html { redirect_to admin_good_categories_url, notice: 'GoodCategory was successfully created.' }
format.json { render action: 'show', status: :created, location: @category }
else
format.html { render action: 'new' }
format.json { render json: @category.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def CreateCategory params = {}\n \n APICall(path: 'categories.json',method: 'POST',payload: params.to_json)\n \n end",
"def create\n json_create(category_params, Category)\n end",
"def create_category payload\n\t\t\t\t\tFreshdesk::Api::Client.convert_to_hash( @connection.post CATE... | [
"0.7738549",
"0.74339235",
"0.72349083",
"0.71634054",
"0.7124031",
"0.70645165",
"0.705568",
"0.695861",
"0.6956783",
"0.6903891",
"0.6838659",
"0.6821712",
"0.68190134",
"0.6807838",
"0.678525",
"0.66138625",
"0.6566919",
"0.65661913",
"0.65567696",
"0.6523676",
"0.65186286... | 0.0 | -1 |
PATCH/PUT /categories/1 PATCH/PUT /categories/1.json | def update
respond_to do |format|
if @category.update(category_params)
format.html { redirect_to admin_good_categories_url, notice: 'GoodCategory was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json: @category.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def UpdateCategory params = {}\n \n APICall(path: 'categories.json',method: 'PUT',payload: params.to_json)\n \n end",
"def update\n json_update(category,category_params, Category)\n end",
"def update_categories(categories, options = {} )\n options.merge!(:docid => self.doci... | [
"0.76931995",
"0.7600433",
"0.721346",
"0.6943123",
"0.6914936",
"0.6817601",
"0.67816055",
"0.6713112",
"0.66984165",
"0.6693479",
"0.66566056",
"0.66523254",
"0.6651486",
"0.6645902",
"0.66068524",
"0.65989816",
"0.6571709",
"0.6571709",
"0.65543723",
"0.65349466",
"0.65002... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.