query
stringlengths 7
6.41k
| document
stringlengths 12
28.8k
| metadata
dict | negatives
listlengths 30
30
| negative_scores
listlengths 30
30
| document_score
stringlengths 5
10
| document_rank
stringclasses 2
values |
---|---|---|---|---|---|---|
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_template, status: :created, location: @admin_kpi_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @admin_kpi_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @admin_kpi_category_template = Admin::KpiCategoryTemplate.find(params[:id])\n\n respond_to do |format|\n if @admin_kpi_category_template.update_attributes(params[:admin_kpi_category_template])\n format.html { redirect_to @admin_kpi_category_template, notice: 'Kpi category template was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admin_kpi_category_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_template\n @template = Spree::Template.find(params[:id])\n # puts \"ddsfsfsdfsdf\",@template.inspect\n # puts \"ddsfsfsdfsdf\",@template.inspect\n # put\n end",
"def update(id, values, update_published = false)\n @client.call(method: :put, path: \"templates/#{id}\", body_values: values, query_values: { update_published: update_published })\n end",
"def update\n current_site.grid_templates.find(params[:id]).update(params.require(:grid_template).permit(:name, :description))\n index\n end",
"def update_template_files(opts)\n template_id = opts.delete(:template_id)\n path = \"/template/update_files/#{template_id}\"\n prepare_files opts\n\n HelloSign::Resource::Template.new post(path, body: opts)\n end",
"def destroy\n @admin_kpi_template = Admin::KpiTemplate.find(params[:id])\n @admin_kpi_template.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_kpi_templates_url }\n format.json { head :no_content }\n end\n end",
"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 update\n @admin_template = Template.find(params[:id])\n\n respond_to do |format|\n if @admin_template.update_attributes(params[:notice])\n format.html { redirect_to admin_templates_url, notice: '공지사항이 수정되었습니다.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admin_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n Spree::Template.update_all(:selected => false)\n @template = Spree::Template.find(params[:id])\n @template.selected = true\n @template.theme_color = params[:template][:theme_color]\n @template.variant_display_type = params[:template][:variant_display_type]\n @template.is_allowed_custom_theme = params[:template][:is_allowed_custom_theme]\n \n respond_to do |format|\n if @template.save!\n format.html { redirect_to admin_templates_path, notice: 'Template was successfully updated.' }\n format.json { head :no_content }\n else\n flash[:error] = \"#{@template.errors.full_messages.first}\"\n format.html { redirect_to admin_templates_path }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @_template = @site.templates.find(params[:id])\n @_template.updated_by = current_user\n\n respond_to do |format|\n if @_template.update_attributes(params[:template])\n flash[:notice] = \"Template was successfully updated.\"\n format.html { redirect_to([:admin, @site, @_template]) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @_template.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def delete\n super \"/templates/#{template_id}.json\", {}\n end",
"def update\n @mytemplate = Mytemplate.get(params[:id])\n \n @mytemplate.name = params[:mytemplate][:name]\n @mytemplate.folder = params[:mytemplate][:folder]\n @mytemplate.description = params[:mytemplate][:description]\n \n respond_to do |format|\n if @mytemplate.save\n format.html { redirect_to mytemplates_path }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @mytemplate.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n authorize! :manage, :all\n respond_to do |format|\n if @question_template.update(question_template_params)\n format.html do redirect_to question_template_path(@question_template),\n notice: 'Question template was successfully updated.'\n end\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @question_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @request_template.update(request_template_params)\n respond format, 'Request template was successfully updated.'\n else\n format.html { render :edit }\n format.json { render json: @request_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n puts template_params\n respond_to do |format|\n if @template.update(template_params)\n format.html { redirect_to @template, notice: 'Template was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def template_update(id, type, filename)\n check_id_or_raise id\n check_template_type_or_raise type\n check_filename_or_raise filename\n response = http_request_multipart :put, @base_url + \"/templates/#{id}.xml\", 200,\n { :provider_key => @provider_key,\n :draft => File.read(filename), \n :multipart => true}\n puts 'at update call'\n _id, _updated_at = parse_response response, type\n response = http_request :put, \"#{@base_url}/templates/#{id}/publish\", 200,\n { :params => { :provider_key => @provider_key } }\n puts 'at publish call'\n parse_response response, 'page'\n end",
"def update\n @project_template = ProjectTemplate.find(params[:id])\n\n respond_to do |format|\n if @project_template.update_attributes(params[:project_template])\n format.html { redirect_to @project_template, notice: 'Project template was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n update_elements if elements_params.present?\n @template.update(name: template_params[:name]) if template_params[:name].present?\n\n if @template.errors.empty?\n render :show, status: :ok, location: @template\n else\n render json: @template.errors, status: :unprocessable_entity\n end\n end",
"def show\n @admin_kpi_template = Admin::KpiTemplate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_kpi_template }\n end\n end",
"def create\n @admin_kpi_category_template = Admin::KpiCategoryTemplate.new(params[:admin_kpi_category_template])\n\n respond_to do |format|\n if @admin_kpi_category_template.save\n format.html { redirect_to @admin_kpi_category_template, notice: 'Kpi category template was successfully created.' }\n format.json { render json: @admin_kpi_category_template, status: :created, location: @admin_kpi_category_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @admin_kpi_category_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @exercise_template = ExerciseTemplate.find(params[:id])\n\n if @exercise_template.update(exercise_template_params)\n head :no_content\n else\n render json: @exercise_template.errors, status: :unprocessable_entity\n end\n end",
"def update\n if @template.update(template_params)\n handle_save_success @template, :ok, t('templates.update_success')\n else\n handle_save_error @template.errors, :edit\n end\n end",
"def update\n respond_to do |format|\n if @item_template.update(item_template_params)\n format.html { redirect_to @item_template, notice: 'Item template was successfully updated.' }\n format.json { render :show, status: :ok, location: @item_template }\n else\n format.html { render :edit }\n format.json { render json: @item_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if params[:name].blank?\n updated=@configuration_template.update(configuration_template_params)\n else\n updated=@configuration_template.update(name: params[:name], description: params[:description])\n end\n\n respond_to do |format|\n if updated\n format.html { redirect_to @configuration_template, notice: 'Blueprint was successfully updated.' }\n\n format.json { render json: @configuration_template }\n else\n puts @configuration_template.errors.inspect\n format.html { render :edit }\n format.json { render json: @configuration_template.errors, status: :unprocessable_entity }\n\n end\n end\n end",
"def update\n @template = Template.find(params[:id])\n\n respond_to do |format|\n if @template.update_attributes(params[:template])\n format.html { redirect_to @template, notice: 'Template was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @product_template.update(product_template_params)\n format.html { redirect_to @product_template, notice: 'Product template was successfully updated.' }\n format.json { render :show, status: :ok, location: @product_template }\n else\n format.html { render :edit }\n format.json { render json: @product_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def template_params\n params.require(:template).permit(:name, :description, :template_type, :accounting_plan, :accounting_plan_id)\n end",
"def set_template\n Settings.reload!\n @template = Template.find(params[:id])\n end",
"def template_params\n params.require(:template).permit(:name, :path, elements: [:key, :type, :content])\n end"
]
| [
"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.59766084",
"0.59707457",
"0.59543395",
"0.5945782",
"0.5921592",
"0.5920157",
"0.5919075",
"0.59110564",
"0.591022"
]
| 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.html { redirect_to admin_templates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_kpi_category_template = Admin::KpiCategoryTemplate.find(params[:id])\n @admin_kpi_category_template.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_kpi_category_templates_url }\n format.json { head :no_content }\n end\n end",
"def delete(options={})\n DNSimple::Client.delete \"templates/#{id}\", options\n end",
"def delete_course_template(org_unit_id)\n path = \"/d2l/api/lp/#{$lp_ver}/coursetemplates/#{org_unit_id}\"\n _delete(path)\n puts '[+] Course template data deleted successfully'.green\nend",
"def delete(name)\n r = request('DeleteTemplate', { :name => name })\n return r['status'] == ' ok ' \n end",
"def delete_content_template(id)\n # TODO: Inform ContentTemplateController.destroy method has been modified\n @client.raw('delete', \"/content/templates/#{id}\")\n end",
"def destroy\n @rcadmin_email_template.destroy\n respond_to do |format|\n\t flash[:notice] = 'Email template was successfully deleted.'\n format.html { redirect_to rcadmin_email_templates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @_template = @site.templates.find(params[:id])\n @_template.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_site_templates_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @template.destroy\n respond_to do |format|\n format.html { redirect_to templates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_template_software = TemplateSoftware.find(params[:id])\n @admin_template_software.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_template_software_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cf_template.destroy\n respond_to do |format|\n format.html { redirect_to cf_templates_url, notice: I18n.t('cf_templates.msg.deleted') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @docu_template.destroy\n respond_to do |format|\n format.html { redirect_to docu_templates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @template = Template.find(params[:id])\n @template.destroy\n\n respond_to do |format|\n format.html { redirect_to templates_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @project_template = ProjectTemplate.find(params[:id])\n @project_template.destroy\n\n respond_to do |format|\n format.html { redirect_to project_templates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invoice_template = InvoiceTemplate.find(params[:id])\n @invoice_template.destroy\n\n respond_to do |format|\n format.html { redirect_to invoice_templates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n authorize! :manage, :all\n @question_template.destroy\n respond_to do |format|\n format.html { redirect_to question_templates_url, notice: 'Question template was successfully removed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n destroy_resource @template, templates_url, t('templates.delete_success')\n end",
"def delete(id)\n @client.call(method: :delete, path: \"templates/#{id}\")\n end",
"def delete(options={})\n DNSimple::Client.delete(\"/v1/templates/#{id}\", options)\n end",
"def destroy\n @attr_template.destroy\n respond_to do |format|\n format.html { redirect_to attr_templates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @template_package.destroy\n\n respond_to do |format|\n format.html { redirect_to templates_url }\n format.json { head :no_content }\n end\n end",
"def delete_template(opts)\n post(\"/template/delete/#{opts[:template_id]}\")\n end",
"def destroy\n @template = set_template\n @template.destroy\n respond_to do |format|\n format.html { redirect_to templates_url, notice: 'Template was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item_template.destroy\n respond_to do |format|\n format.html { redirect_to item_templates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @inventory_template = InventoryTemplate.find(params[:id])\n @inventory_template.destroy\n\n respond_to do |format|\n format.html { redirect_to inventory_templates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @induction_template.destroy\n respond_to do |format|\n format.html { redirect_to induction_templates_url, notice: 'Induction template was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete(data)\n result = @client.api_request(:method => \"template.delete\", :params => [data])\n result.empty? ? nil : result['templateids'][0].to_i\n end",
"def destroy\n @node_template = NodeTemplate.find(params[:id])\n @node_template.destroy\n\n respond_to do |format|\n format.html { redirect_to node_templates_url }\n format.json { head :no_content }\n end\n end"
]
| [
"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.71082777",
"0.7102994",
"0.71003926",
"0.7093442",
"0.7080431",
"0.7064838",
"0.7060137",
"0.70540303",
"0.7045134",
"0.7040093"
]
| 0.81072366 | 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.erb\n format.json { render json: @plans }\n end\n end",
"def index\n @site_plans = @product.site_plans\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @site_plans }\n end\n end",
"def show\n @plans = @event.plans\n \n respond_to do |format|\n format.html {}\n format.json { render json: @event.to_json}\n end\n end",
"def index\n @plans = Plan.all\n end",
"def index\n @plans = Plan.all\n end",
"def index\n @floor_plans = @product.floor_plans\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @floor_plans }\n end\n end",
"def show\n @plans = Stripe::Plan.all\n end",
"def show\n @plan = Plan.find(params[:id])\n\n render json: @plan\n end",
"def show\n render json: @plan\n end",
"def read_service_plans()\n @client.service_plans\n end",
"def fetch_plans (id = nil)\n @plans = []\n parameters = {}\n @networks_by_plan = {}\n parameters[:_profile] = 'http://hl7.org/fhir/us/davinci-pdex-plan-net/StructureDefinition/plannet-InsurancePlan' \n if(id)\n parameters[:_id] = id\n end\n\n @client.search(\n FHIR::InsurancePlan,\n search: { parameters: parameters }\n )&.resource&.entry&.map do |entry|\n @plans << {\n value: entry&.resource&.id,\n name: entry&.resource&.name\n }\n @networks_by_plan [ entry&.resource&.id] = entry&.resource&.network\n end\n @plans.sort_by! { |hsh| hsh[:name] }\n rescue => exception\n redirect_to root_path, flash: { error: 'Please specify a plan network server' }\n\n end",
"def index\n @test_plans = @project.test_plans\n end",
"def all_plans\n file = File.read('./data/bundle.json')\n plan_hash = JSON.parse(file)\n plans = plan_hash['plans']\n end",
"def plans\n return @plans\n end",
"def url\n resource.url + '/application_plans'\n end",
"def plans\r\n @plans ||= PlansController.new(configuration: @configuration)\r\n end",
"def show\n @planitem = Planitem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @planitem }\n end\n end",
"def index\n @billing_plans = BillingPlan.all\n end",
"def index\n @plans = Plan.where(user_id: current_user.id)\n end",
"def index\n @page_plans = PagePlan.all\n end",
"def index\n @art_plans = current_user.art_plans\n end",
"def plans_available_bam(country)\n plan = Plan.select('id, name, detail, price').where('country= ? AND item= ?',\n country, 'bam')\n # Format to show in view\n plans = plan.map { |m| [m.name, m.id] }\n # Format to display details of plans\n details = plan.map {|m| [m.id, m.detail]}\n return [plans, details]\n end",
"def show\n @test_plan = TestPlan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test_plan }\n end\n end",
"def index\n @local_plans = LocalPlan.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @local_plans }\n end\n end",
"def plans=(value)\n @plans = value\n end",
"def show\n @sslplan = Sslplan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @sslplan }\n end\n end",
"def index\n plan = Plan.find_by(url:params[:plan_id])\n stories = plan.stories\n render json: stories\n end"
]
| [
"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.6641385",
"0.6610005",
"0.6597323",
"0.6536044",
"0.6500376",
"0.64973575",
"0.6494923",
"0.64612746",
"0.64523864",
"0.6437893"
]
| 0.76079214 | 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: @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(params[:plan])\n respond_to do |format|\n if @plan.save\n format.html { redirect_to @plan, notice: 'Plan was successfully created.' }\n format.json { render json: @plan, status: :created, location: @plan }\n else\n format.html { render action: \"new\" }\n format.json { render json: @plan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @plan = Plan.create(plan_params)\n @incident = Incident.find(params[:incident_id])\n respond_to do |format|\n if @plan.save\n format.html { redirect_to incident_plan_path(@incident, @plan) }\n format.json { redirect_to incident_plan_path(@incident, @plan) }\n else\n format.html { render :new }\n format.json { render json: @plan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @planitem = Planitem.new(planitems_params)\n\n respond_to do |format|\n if @planitem.save\n format.html { redirect_to \"#{plan_path(@planitem.sprint.quarter.name)}\", notice: 'Plan item was successfully created.' }\n format.json { render json: @planitem, status: :created, location: @planitem }\n else\n\t\t@sprint = Sprint.find(@planitem.sprint_id)\n\t\t@teams = Team.order(:name)\n\t\t@initiatives = Initiative.where(:quarter_id => @sprint.quarter_id)\n\t\t@sprints = Sprint.where(:quarter_id => @sprint.quarter_id)\n format.html { render action: \"new\" }\n format.json { render json: @planitem.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @plan = Plan.new(plan_params)\n\n respond_to do |format|\n if @plan.save\n format.html { redirect_to @plan, notice: 'Plan was successfully created.' }\n format.json { render :show, status: :created, location: @plan }\n else\n format.html { render :new }\n format.json { render json: @plan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @plan = Plan.new(plan_params)\n\n respond_to do |format|\n if @plan.save\n format.html { redirect_to @plan, notice: 'Plan was successfully created.' }\n format.json { render :show, status: :created, location: @plan }\n else\n format.html { render :new }\n format.json { render json: @plan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @plan = Plan.new(plan_params)\n @plan.add_ident\n @plan.user_id = current_user.id\n unless @plan.save\n render json: {status: 'failed', message: '创建失败,请稍后重试 !'}\n end\n end",
"def index\n @inventory_plans = InventoryPlan.all\n end",
"def create\n @plan = Plan.new(params[:plan])\n \n respond_to do |format|\n if @plan.save\n flash[:notice] = \"Plan successfully submitted.\"\n format.html { redirect_to :back }\n format.mobile { redirect_to :back }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @plan.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @plan = Plan.new(plan_params)\n\n respond_to do |format|\n if @plan.save\n format.html { redirect_to @plan, notice: 'Plan creado exitosamente.' }\n format.json { render action: 'show', status: :created, location: @plan }\n else\n format.html { render action: 'new' }\n format.json { render json: @plan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @site_plan = @product.site_plans.new(site_plan_params)\n\n respond_to do |format|\n if @site_plan.save\n format.html { redirect_to \"#{product_path(@product)}/#site_plan-tab\", notice: 'Site plan was successfully created.' }\n format.json { render json: @site_plan, status: :created }\n else\n format.html { render action: 'new' }\n format.json { render json: @site_plan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @plan = Plan.new(plan_params)\n @plan.user_id = current_user.id\n respond_to do |format|\n if @plan.save\n format.html { redirect_to @plan, notice: 'Plan was successfully created.' }\n format.json { render :show, status: :created, location: @plan }\n else\n format.html { render :new }\n format.json { render json: @plan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_plan(body,\r\n idempotency_key = nil)\r\n # Prepare query url.\r\n _path_url = '/plans'\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << _path_url\r\n _query_url = APIHelper.clean_url _query_builder\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json',\r\n 'ServiceRefererName' => Configuration.service_referer_name,\r\n 'Content-Type' => 'application/json',\r\n 'idempotency-key' => idempotency_key\r\n }\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.post(\r\n _query_url,\r\n headers: _headers,\r\n parameters: body.to_json\r\n )\r\n BasicAuth.apply(_request)\r\n _context = execute_request(_request)\r\n # Validate response against endpoint and global error codes.\r\n if _context.response.status_code == 400\r\n raise ErrorException.new(\r\n 'Invalid request',\r\n _context\r\n )\r\n elsif _context.response.status_code == 401\r\n raise ErrorException.new(\r\n 'Invalid API key',\r\n _context\r\n )\r\n elsif _context.response.status_code == 404\r\n raise ErrorException.new(\r\n 'An informed resource was not found',\r\n _context\r\n )\r\n elsif _context.response.status_code == 412\r\n raise ErrorException.new(\r\n 'Business validation error',\r\n _context\r\n )\r\n elsif _context.response.status_code == 422\r\n raise ErrorException.new(\r\n 'Contract validation error',\r\n _context\r\n )\r\n elsif _context.response.status_code == 500\r\n raise ErrorException.new(\r\n 'Internal server error',\r\n _context\r\n )\r\n end\r\n validate_response(_context)\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\r\n PlansResponse1.from_hash(decoded)\r\n end",
"def create\n @panel_plan = Panel::Plan.new(params[:panel_plan])\n\n respond_to do |format|\n if @panel_plan.save\n format.html { redirect_to(@panel_plan, :notice => 'Plan was successfully created.') }\n format.json { render :json => @panel_plan, :status => :created, :location => @panel_plan }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @panel_plan.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @test_plan = TestPlan.new(test_plan_params)\n @test_plan.project_id = @project.id\n\n respond_to do |format|\n if @test_plan.save\n format.html { redirect_to project_test_plans_path(@project), flash: {success: 'LoadTest plan was successfully created.'} }\n format.json { render :show, status: :created, location: @test_plan }\n else\n format.html { render :new }\n format.json { render json: @test_plan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sales_plan = SalesPlan.new(sales_plan_params)\n\n respond_to do |format|\n if @sales_plan.save\n format.html { redirect_to @sales_plan, notice: 'Sales plan was successfully created.' }\n format.json { render :show, status: :created, location: @sales_plan }\n else\n format.html { render :new }\n format.json { render json: @sales_plan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def plan_params\n params.require(:plan).permit(:title, :body, :is_pending, :team_ids, :plan_status, :user_id, team_ids: [])\n end",
"def create\n @billing_plan = BillingPlan.new(billing_plan_params)\n\n respond_to do |format|\n if @billing_plan.save\n format.html { redirect_to @billing_plan, notice: 'Billing plan was successfully created.' }\n format.json { render action: 'show', status: :created, location: @billing_plan }\n else\n format.html { render action: 'new' }\n format.json { render json: @billing_plan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @single_plan = SinglePlan.new(params[:single_plan])\n @single_plan.workout_plans << @workout_plan\n\n respond_to do |format|\n if @single_plan.save\n flash[:notice] = 'Single Plan was successfully created.'\n format.html { redirect_to(@single_plan) }\n format.xml { render :xml => @single_plan, :status => :created, :location => @single_plan }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @single_plan.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @admin_subscription_plan = Admin::SubscriptionPlan.new(admin_subscription_plan_params)\n\n respond_to do |format|\n if @admin_subscription_plan.save\n format.html { redirect_to @admin_subscription_plan, notice: 'Subscription plan was successfully created.' }\n format.json { render :show, status: :created, location: @admin_subscription_plan }\n else\n format.html { render :new }\n format.json { render json: @admin_subscription_plan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create # rubocop:disable Metrics/AbcSize\n attrs = params.require(plan_type).permit(CREATE_PARAMS)\n @plan = collection.build(attrs)\n\n if plan.save\n if block_given?\n yield\n else\n plan.reload\n\n respond_to do |format|\n format.html do\n flash[:notice] = \"Created #{plan.class.model_name.human} #{plan.name}\"\n # collection.build to create new record to properly generate path to index action (rails)\n redirect_to plans_index_path\n end\n end\n end\n\n else\n render :new\n end\n end",
"def create\n @page_plan = PagePlan.new(page_plan_params)\n respond_to do |format|\n if @page_plan.save\n format.html { redirect_to @page_plan, notice: 'Page plan was successfully created.' }\n format.json { render :show, status: :created, location: @page_plan }\n else\n format.html { render :new }\n format.json { render json: @page_plan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create(attrs, user = @@default_user)\n attrs = { project_token: @project_token }.merge(attrs)\n @attributes = send_request('test_plans', :post) do |req|\n req.body = {\n test_plan: attrs.except(:project_token),\n token: attrs[:project_token],\n auth_token: user.auth_token\n }\n end\n end",
"def create\n assessment = Assessment.find(plan_create_params.fetch(:assessment_id))\n disease_ids = plan_create_params.fetch(:disease_ids).to_s.split(\"-\")\n\n if plan_create_params[:indicators].values.map(&:to_i).any?(&:zero?)\n flash[:alert] = \"Every score and goal must be 1 or higher.\"\n return redirect_back fallback_location: root_path\n end\n\n @plan =\n Plan.create_from_goal_form(\n indicator_attrs: plan_create_params.fetch(:indicators),\n assessment: assessment,\n is_5_year_plan: plan_create_params.fetch(:term).start_with?(\"5\"),\n plan_name: \"#{assessment.country.name} draft plan\",\n disease_ids: disease_ids,\n user: current_user\n )\n unless @plan.persisted?\n flash[:notice] = \"Could not save your plan, something went wrong.\"\n redirect_back fallback_location: root_path\n return\n end\n session[:plan_id] = @plan.id unless current_user\n redirect_to @plan\n rescue Exceptions::InvalidDiseasesError => e\n flash[:notice] = e.message\n redirect_back fallback_location: root_path\n end",
"def new\n @project_procurement_management_plan = current_user.project_procurement_management_plans.build\n 1.times { @project_procurement_management_plan.projects.build }\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project_procurement_management_plan }\n end\n end",
"def create\n @plan = Plan.new(params[:plan])\n @plan.user = current_user\n @plan.request = Request.find( params[:request_id] )\n\n respond_to do |format|\n if @plan.save\n @plan.request.days.times do |day|\n @plan.plan_days << PlanDay.create( { plan_id: @plan.id, day: day+1 } )\n end\n\n format.html { redirect_to @plan, notice: 'Plan was successfully created.' }\n format.json { render json: @plan, status: :created, location: @plan }\n else\n format.html { render action: \"new\" }\n format.json { render json: @plan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @floor_plan = @product.floor_plans.new(floor_plan_params)\n\n respond_to do |format|\n if @floor_plan.save\n format.html { redirect_to \"#{product_path(@product)}/#floor_plan-tab\", notice: 'Floor plan was successfully created.' }\n format.json { render json: @floor_plan, status: :created }\n else\n format.html { render action: 'new' }\n format.json { render json: @floor_plan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @plan = Plan.new(plan_params)\n respond_to do |format|\n if @plan.save\n # expire_fragment(\"plans\")\n expire_action :action => 'index'\n UserMailer.create_plan(current_user, @plan).deliver\n format.html { redirect_to @plan, notice: 'Plan was successfully created.' }\n format.json { render action: 'show', status: :created, location: @plan }\n else\n format.html { render action: 'new' }\n format.json { render json: @plan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sslplan = Sslplan.new(params[:sslplan])\n\n respond_to do |format|\n if @sslplan.save\n format.html { redirect_to @sslplan, :notice => 'Sslplan was successfully created.' }\n format.json { render :json => @sslplan, :status => :created, :location => @sslplan }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @sslplan.errors, :status => :unprocessable_entity }\n end\n end\n end"
]
| [
"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.6314085",
"0.62940407",
"0.6278589",
"0.6278441",
"0.6276371",
"0.62762415",
"0.6269528",
"0.6266955",
"0.6264164",
"0.62592775"
]
| 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 else\n render json: @plan.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @plan.update(plan_params)\n format.html { redirect_to @plan }\n format.json { respond_with_bip(@plan) }\n else\n format.html { render :edit }\n format.json { render json: @plan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @plan = Plan.find(params[:id])\n\n respond_to do |format|\n if @plan.update_attributes(params[:plan])\n format.html { redirect_to @plan, notice: 'Plan was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @plan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @plan = Plan.find(params[:id])\n\n respond_to do |format|\n if @plan.update_attributes(params[:plan])\n format.html { redirect_to @plan, notice: 'Plan was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @plan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n unless @plan.update(plan_params)\n render json: {status: 'failed', message: '更新失败,请稍后重试 !'}\n end\n end",
"def update\n respond_to do |format|\n if @plan.update(plan_params)\n format.html { redirect_to @plan, notice: 'Plan was successfully updated.' }\n format.json { render :show, status: :ok, location: @plan }\n else\n format.html { render :edit }\n format.json { render json: @plan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @plan.update(plan_params)\n format.html { redirect_to @plan, notice: 'Plan was successfully updated.' }\n format.json { render :show, status: :ok, location: @plan }\n else\n format.html { render :edit }\n format.json { render json: @plan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @plan.update(plan_params)\n format.html { redirect_to @plan, notice: 'Plan was successfully updated.' }\n format.json { render :show, status: :ok, location: @plan }\n else\n format.html { render :edit }\n format.json { render json: @plan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @plan.update(plan_params)\n format.html { redirect_to @plan, notice: 'Plan was successfully updated.' }\n format.json { render :show, status: :ok, location: @plan }\n else\n format.html { render :edit }\n format.json { render json: @plan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @plan.update(plan_params)\n format.html { redirect_to @plan, notice: 'Plan was successfully updated.' }\n format.json { render :show, status: :ok, location: @plan }\n else\n format.html { render :edit }\n format.json { render json: @plan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @plan = Plan.find(params[:id])\n respond_to do |format|\n if @plan.update(plan_params)\n format.html { redirect_to @plan, notice: 'Plan was successfully updated.' }\n format.json { render :show, status: :ok, location: @plan }\n else\n format.html { render :edit }\n format.json { render json: @plan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n plan = Plan.find_by_id!(params.fetch(:id))\n benchmark_action_ids =\n JSON.parse(plan_update_params.fetch(:benchmark_action_ids))\n name = plan_update_params.fetch(:name)\n plan.update!(name: name, benchmark_action_ids: benchmark_action_ids)\n redirect_to plans_path\n end",
"def update\n @test_plan = TestPlan.find(params[:id])\n\n respond_to do |format|\n if @test_plan.update_attributes(params[:test_plan])\n format.html { redirect_to @test_plan, notice: 'Test plan was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @test_plan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tasks = @plan.tasks\n\n @goals = @plan.goals\n respond_to do |format|\n if @plan.update(plan_params)\n format.html { redirect_to back_index_case_url, notice: 'Plan was successfully updated.' }\n # format.json { render :show, status: :ok, location: @plan }\n else\n format.html { render :edit }\n format.json { render json: @plan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @plan.update(plan_params)\n format.html { redirect_to @plan, notice: 'Plan actualizado exitosamente.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @plan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @plan = Plan.find(params[:id])\n\n respond_to do |format|\n if @plan.update_attributes(params[:plan])\n format.html { redirect_to(@plan, :notice => 'Plan was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @plan.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @master_plan = MasterPlan.find(params[:id])\n\n respond_to do |format|\n if @master_plan.update_attributes(params[:master_plan])\n format.html { redirect_to master_plan_path(@master_plan), notice: 'Master plan was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @master_plan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sslplan = Sslplan.find(params[:id])\n\n respond_to do |format|\n if @sslplan.update_attributes(params[:sslplan])\n format.html { redirect_to @sslplan, :notice => 'Sslplan was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @sslplan.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @panel_plan = Panel::Plan.find(params[:id])\n\n respond_to do |format|\n if @panel_plan.update_attributes(params[:panel_plan])\n format.html { redirect_to(@panel_plan, :notice => 'Plan was successfully updated.') }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @panel_plan.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @billing_plan.update(billing_plan_params)\n format.html { redirect_to @billing_plan, notice: 'Billing plan was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @billing_plan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @plan = Plan.find(params[:id])\n authorize @plan\n\n respond_to do |format|\n if @plan.update_attributes(params[:plan])\n format.html { redirect_to @plan, :editing => false, notice: _('Plan was successfully updated.') }\n format.json { head :no_content }\n else\n flash[:notice] = failed_update_error(@plan, _('plan'))\n format.html { render action: \"edit\" }\n end\n end\n end",
"def update\n @plan = Plan.find(params[:id])\n\n respond_to do |format|\n if @plan.update_attributes(params[:plan])\n flash[:notice] = 'Plan was successfully updated.'\n format.html { redirect_to(@plan) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @plan.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @plan.update(plan_params)\n format.html { redirect_to @plan, notice: '基本情報を編集しました' }\n format.json { render :show, status: :ok, location: @plan }\n else\n format.html { render :edit }\n format.json { render json: @plan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(attrs, user = @@default_user)\n attrs = { id: @id, project_token: @project_token }.merge(attrs)\n @attributes = send_request(\"test_plans/#{attrs[:id]}\", :put) do |req|\n req.body = {\n test_plan: attrs.except(:project_token, :id),\n token: attrs[:project_token],\n auth_token: user.auth_token\n }\n end\n end",
"def update\n @exercise_plan = ExercisePlan.find(params[:id])\n\n respond_to do |format|\n if @exercise_plan.update_attributes(params[:exercise_plan])\n format.html { redirect_to @exercise_plan, notice: 'Exercise plan was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exercise_plan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @plans = @goal.plans\n @tasks = @plans.map(&:tasks).flatten.uniq\n\n @needs = @goal.needs\n respond_to do |format|\n if @goal.update(goal_params)\n format.html { redirect_to back_index_case_url, notice: 'Goal was successfully updated.' }\n # format.json { render :show, status: :ok, location: @goal }\n else\n format.html { render :edit }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @planitem = Planitem.find(params[:id])\n\n respond_to do |format|\n if @planitem.update_attributes(planitems_params)\n format.html { redirect_to \"#{plan_path(@planitem.sprint.quarter.name)}\", notice: 'Plan item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @planitem.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @plan = Plan.find(params[:id])\n respond_to do |format|\n if @plan.update(plan_params)\n # expire_fragment(\"plans\")\n expire_action :action => 'index'\n expire_action :action => 'show'\n expire_page action: 'show', id: params[:id]\n # redirect_to action: 'show', id: params[:id]\n format.html { redirect_to @plan, notice: 'Plan was successfully updated.' }\n format.json { respond_with_bip(@plan) }\n else\n format.html { render action: 'edit' }\n format.json { render json: @plan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @plan.update(plan_params)\n format.html { redirect_to planslink_path(@plan.family_group.id) }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @plan.errors, status: :unprocessable_entity }\n end\n end\n end"
]
| [
"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.65586036",
"0.6536029",
"0.6517542",
"0.64723134",
"0.64669997",
"0.64084715",
"0.63995",
"0.6397229",
"0.6394849",
"0.63819516"
]
| 0.70350343 | 0 |
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.require(:answer_respondent).permit(:answer_id, :respondent_id)\n end",
"def answers(options={})\n parse_answers(request(singular(id) + \"answers\", options))\n end",
"def index\n @reply_answers = ReplyAnswer.all\n end",
"def list_answer_responses\n article = find_entity # questionnaire article\n receive_and_set_background_params\n @display_mode = params[:display_mode]\n @is_answer_response = true # choose only answer response article to questionnaire article\n @question_entities = article.questionnaires\n find_detail_of_thread(article.a_thread)\n render :partial => \"detail_with_answer_responses\", :layout => \"base_layout\"\n end",
"def index\n @answers = @question.answers\n respond_with( @answers )\n end",
"def index\n\n @answers = Answer.current\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @answers }\n end\n end",
"def index\n @answers = Answer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @answers }\n end\n end",
"def index\n @answers = Answer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @answers }\n end\n end",
"def index\n @answers = Answer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @answers }\n end\n end",
"def index\n @answers = Answer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @answers }\n end\n end",
"def replies\n Reply.find_by_question_id(@id)\n end",
"def answers\n @celebrity = Celebrity.find(params[:id])\n @answers = @celebrity.answers\n render json: @answers\n end",
"def index\n @question_answers = Question::Answer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @question_answers }\n end\n end",
"def show\n render json: @answer\n end",
"def show\n authorize! :answer, @questionnaire\n\n respond_to do |format|\n format.html {\n @answer_set = AnswerSet.new()\n @answer_set.questionnaire_id = @questionnaire.id\n @answer_set.init_questionnaire(@questionnaire)\n }\n format.json { render :json => @questionnaire.questions.to_json }\n end\n end",
"def index\n redirect_user\n @respondents = Respondent.all\n end",
"def answers(options={})\n self.class.parse_answers(request(singular(user_id) + \"/answers\", options))\n end",
"def answers(options={})\n @answers = self.class.parse_answers(request(singular(question_id) + \"/answers\", options))\n end",
"def replies\n Reply.find_by_question_id(self.id)\n end",
"def index\n if get_event\n @v1_answers = @event.alternatives\n render json: @v1_answers\n else\n @v1_answers = V1::Answer.all\n render json: @v1_answers\n end\n end",
"def answer_a_question\n user = current_user\n render_401 and return unless user\n question = ShortQuestion.find_by_id(params[:id])\n render_404 and return unless question\n\n obj = {\n :qid => params[:id],\n :answer => params[:choice]\n }\n \n answers = {}\n $r.multi do\n $r.lpush(\"user:#{user.id}:questions\", obj)\n $r.hincrby(\"question:#{question.id}:answers\", \"choice#{params[:choice]}\", 1)\n choices = $r.hget(\"question:#{question.id}:answers\", :num_choices)\n for i in 1..choices\n answers[i] = $r.hget(\"question:#{question.id}:answers\", \"choice#{i}\")\n end\n end\n render :json => {\n :success => true,\n :answers => answers\n }\n end",
"def show\n @answer = Answer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @answer }\n end\n end",
"def show\n @answer = Answer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @answer }\n end\n end",
"def show\n @answer = Answer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @answer }\n end\n end",
"def answer_buttons\n render json: @current_user.answer_buttons\n end",
"def index\n @replies = Reply.all\n\n render json: @replies\n end",
"def index\n @replies = Reply.all\n\n render json: @replies\n end"
]
| [
"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.6309484",
"0.6270466",
"0.62627125",
"0.6257614",
"0.6257614",
"0.6257614",
"0.62433064",
"0.6204309",
"0.6204309"
]
| 0.81594193 | 0 |
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 @answer = @question.answers.build(answer_params)\n @answer.save\n respond_with( [ :admin, @survey, @section, @question, @answer ] )\n end",
"def add_answer\n request('answers/add')\n end",
"def answers\n request('answers')\n end",
"def answer_params\n params.require(:answer).permit(:content, :question_id, :response_id)\n end",
"def response_params\n params.require(:response).permit(:user, :questionnaire_id, answers_attributes: [:id, :content, :question_id])\n end",
"def reply_answer_params\n params.require(:reply_answer).permit(:body, :user_id, :question_id, :answer_id)\n end",
"def create\n @answer = @question.answers.new(answer_params)\n\n if @answer.save\n respond_to_save_success(@answer, [@question, @answer])\n else\n respond_to_save_failure(:new, @answer)\n end\n end",
"def answer question\n\n # find the value that should be entered\n data = request[question[:reference_identifier]]\n\n response_set.responses.where(question_id: question).delete_all\n\n case question.type\n\n when :none\n answer = question.answers.first\n response_set.responses.create({\n answer: answer,\n question: question,\n answer.value_key => data\n })\n\n when :one\n # the value is the reference identifier of the target answer\n answer = question.answers.where(reference_identifier: data).first\n\n unless answer.nil?\n response_set.responses.create({\n answer: answer,\n question: question\n })\n end\n\n when :any\n # the value is an array of the chosen answers\n answers = question.answers.where(reference_identifier: data)\n answers.each do |answer|\n response_set.responses.create({\n answer: answer,\n question: question\n })\n end\n\n when :repeater\n # the value is an array of answers\n answer = question.answers.first\n i = 0\n data.each do |value|\n response_set.responses.create({\n answer: answer,\n question: question,\n answer.value_key => value,\n response_group: i\n })\n i += 1\n end\n\n else\n throw \"not handled> #{question.inspect}\"\n end\n\n end",
"def answer question\n\n # find the value that should be entered\n data = request[question[:reference_identifier]]\n\n response_set.responses.where(question_id: question).delete_all\n\n case question.type\n\n when :none\n answer = question.answers.first\n response_set.responses.create({\n answer: answer,\n question: question,\n answer.value_key => data\n })\n\n when :one\n # the value is the reference identifier of the target answer\n answer = question.answers.where(reference_identifier: data).first\n\n unless answer.nil?\n response_set.responses.create({\n answer: answer,\n question: question\n })\n end\n\n when :any\n # the value is an array of the chosen answers\n answers = question.answers.where(reference_identifier: data)\n answers.each do |answer|\n response_set.responses.create({\n answer: answer,\n question: question\n })\n end\n\n when :repeater\n # the value is an array of answers\n answer = question.answers.first\n i = 0\n data.each do |value|\n response_set.responses.create({\n answer: answer,\n question: question,\n answer.value_key => value,\n response_group: i\n })\n i += 1\n end\n\n else\n throw \"not handled> #{question.inspect}\"\n end\n\n end",
"def create\n \n respond_to do |format|\n \n if !params[:questions].nil? \n params[:questions].each {\n |q| \n type = Question.find_by_id(q[0]).question_type\n answer = (type == 2 ? Answer.find_by_id(q[1]).correct : nil)\n Response.new( \n {\n \"question_id\" => q[0],\n \"answer_id\" => type == 2 ? q[1] : nil,\n \"text\" => type == 1 ? q[1] : nil,\n \"user_id\" => current_user.id,\n \"question_group_id\" => params[:response][:question_group_id],\n \"correct\" => answer\n }\n ).save\n }\n format.html { redirect_to '/responses', notice: 'Your responses were successfully saved.' }\n else\n @response = Response.new(params[:response])\n if @response.save\n format.html { redirect_to @response, notice: 'Response was successfully created.' }\n format.json { render json: @response, status: :created, location: @response }\n end\n end\n end\n end",
"def create\n @answer = AttemptAnswer.new(answer_params) \n \n if @answer.save\n render json: @answer, status: :created \n else\n head(:unprocessable_entity)\n end\n end",
"def create\n @question = Question.find(params[:question_id])\n @answer = @question.answers.new(answer_params)\n\n respond_to do |format|\n if @answer.save\n format.html { redirect_to question_answer_url(@question, @answer), notice: \"Answer was successfully created.\" }\n format.json { render :show, status: :created, location: @answer }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def answers(options={})\n parse_answers(request(singular(id) + \"answers\", options))\n end",
"def answer_a_question\n user = current_user\n render_401 and return unless user\n question = ShortQuestion.find_by_id(params[:id])\n render_404 and return unless question\n\n obj = {\n :qid => params[:id],\n :answer => params[:choice]\n }\n \n answers = {}\n $r.multi do\n $r.lpush(\"user:#{user.id}:questions\", obj)\n $r.hincrby(\"question:#{question.id}:answers\", \"choice#{params[:choice]}\", 1)\n choices = $r.hget(\"question:#{question.id}:answers\", :num_choices)\n for i in 1..choices\n answers[i] = $r.hget(\"question:#{question.id}:answers\", \"choice#{i}\")\n end\n end\n render :json => {\n :success => true,\n :answers => answers\n }\n end",
"def create\n @response = Response.new(params[:response])\n @response.ip_address = request.remote_ip\n @response.survey_id = @survey.id\n @response.user_id = current_user\n \n for param in params do\n if param[0] =~ /^question_id_/\n # handle all question parameters\n # $' represents the value of the question_id\n if param[1].is_a? Hash\n # Valid keys include country, option, year, month, day and numeric option_id\n if param[1].has_key? \"year\" && \"month\" && \"day\"\n # concat year, month and day into one answer\n @response.answers.build(:question_id => $', :answer => Date.new(param[1][\"year\"].to_i, param[1][\"month\"].to_i, param[1][\"day\"].to_i) )\n elsif param[1].has_key? \"option\"\n # look up option id for radio & select questions and build answer\n option_id = Option.find_by_label_and_question_id(param[1][\"option\"], $').id\n @response.answers.build(:question_id => $', :answer => param[1][\"option\"], :option_id => option_id)\n elsif param[1].has_key? \"country\"\n # build country answer\n @response.answers.build(:question_id => $', :answer => param[1][\"country\"])\n else\n # build checkbox and likert answers\n param[1].each do |key, value|\n @response.answers.build(:question_id => $', :answer => value, :option_id => key) unless value == \"0\"\n end\n end\n else\n # build answer without option ie text, textarea\n @response.answers.build(:question_id => $', :answer => param[1] ) #unless param[1].blank?\n end \n end\n if param[0] == 'token'\n @response.survey.update_invitation(param[1])\n end\n end\n\n respond_to do |format|\n if @response.save!\n flash[:notice] = 'Response was successfully created.'\n format.html { redirect_to([@survey, @response]) }\n format.xml { render :xml => @response, :status => :created, :location => @response }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @response.errors, :status => :unprocessable_entity }\n end\n end\n rescue ActiveRecord::RecordInvalid => invalid\n render :action => \"new\"\n end",
"def create\n @reply_answer = ReplyAnswer.new(reply_answer_params)\n\n @answer = Answer.find_by_id(@reply_answer.answer_id)\n @replyer = User.find_by_id(@reply_answer.user_id)\n @answerer = User.find_by_id(@answer.user_id)\n @question = Question.find_by_id(@reply_answer.question_id)\n\n\n # Sends email to original answerer letting them know that a reply has been made.\n UserMailer.reply_to_answer_question(@question, @answerer, @replyer, @answer, @reply_answer).deliver\n\n respond_to do |format|\n if @reply_answer.save\n format.html { redirect_to question_path(@reply_answer.question_id), notice: 'Reply answer was successfully created.' }\n format.json { render :show, status: :created, location: @reply_answer }\n else\n format.html { render :new }\n format.json { render json: @reply_answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n\t\trespond_to do |format|\n\t\t\tif @answer.save\n\t\t\t\tformat.html { redirect_to @answer, notice: 'Survey was successfully created.' }\n\t\t\t\tformat.json { render action: 'show', status: :created, location: @answer }\n\t\t\telse\n\t\t\t\tformat.html { render action: 'new' }\n\t\t\t\tformat.json { render json: @answer.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def create\n workout = Workout.find params[:workout_id]\n result = Question.create(workout, { \n :body => params[:body], \n :answer_type => params[:answer_type] }, \n params[:answers].values\n )\n\n @question = result[:question]\n\n respond_to do |format|\n unless @question.persisted?\n format.json { render :json => @question.errors.full_messages, :status => :unprocessable_entity }\n else\n format.json { render :json => @question.as_json({:include => :answers}) }\n end\n \n end\n\n end",
"def answer_params\n params.require(:answer).permit(:answer, :response, :survey_id, :question_id, :response_id, :user_id)\n end",
"def create\n @answer = Form::Answer.new(answer_params)\n respond_to do |format|\n if @answer.save\n format.html { redirect_to thanks_path, notice: 'Answer was successfully created.' }\n format.json { render :show, status: :created, location: @answer }\n else\n format.html { render :new }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def response_params\n params.require(:response).permit(:survey_id,\n :answers_attributes => [:id, :answer, :question_id]\n )\n end",
"def answer_params\n params.require(:answer).permit(:user_id, :question_id, :content, :is_tweet, :is_anonymous)\n end",
"def response_params\n params.require(:response).permit(\n :ip, \n :survey_id, \n :answers_attributes => [\n :id, \n :answer, \n {:resp => []}, \n :survey_id, \n :question_id, \n :response_id, \n :user_id \n ])\n end",
"def answered\n @the_question = Question.find(params[:id])\n @the_question.answered = true\n @the_question.save\n render json: [{question: @the_question}]\n end",
"def answer_params\n params.require(:answer).permit(:body, :question_id, :status)\n end",
"def answer_params\n params.permit(:body, :user_id, :question_id, :question_accepted_id)\n end",
"def update\n respond_to do |format|\n if @answer_respondent.update(answer_respondent_params)\n format.html { redirect_to @answer_respondent, notice: 'Answer respondent was successfully updated.' }\n format.json { render :show, status: :ok, location: @answer_respondent }\n else\n format.html { render :edit }\n format.json { render json: @answer_respondent.errors, status: :unprocessable_entity }\n end\n end\n end"
]
| [
"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.62299997",
"0.62203",
"0.62192935",
"0.62048686",
"0.61920947",
"0.61915606",
"0.6185461",
"0.61806065",
"0.6163727",
"0.6159328"
]
| 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 @question.update_attributes(params[:question])\n # format.html { redirect_to @question, :notice => 'Question was successfully updated.' }\n # format.json { head :no_content }\n # else\n # format.html { render :action => \"edit\" }\n # format.json { render :json => @question.errors, :status => :unprocessable_entity }\n # end\n end\n end",
"def update\n @answer = current_user.answers.find(params[:id])\n\n respond_to do |format|\n if @answer.update_attributes(params[:answer])\n format.json { head :no_content }\n else\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_answer_respondent\n @answer_respondent = AnswerRespondent.find(params[:id])\n end",
"def update\n @answer.update(answer_params)\n respond_with( [ :admin, @survey, @section, @question, @answer ] )\n end",
"def update\n @answer = Answer.find(params[:id])\n\n if @answer.update(answer_params)\n head :no_content\n else\n render json: @answer.errors, status: :unprocessable_entity\n end\n end",
"def update_correct_answer\n question_params = params.permit(:question_id, :question_type_id, :option_id)\n \n render json: Question.update_correct_option(question_params)\n end",
"def update\n\t\trespond_to do |format|\n\t\t\tif @answer.update(answer_params)\n\t\t\t\tformat.html { redirect_to @answer, notice: 'Survey was successfully updated.' }\n\t\t\t\tformat.json { head :no_content }\n\t\t\telse\n\t\t\t\tformat.html { render action: 'edit' }\n\t\t\t\tformat.json { render json: @answer.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def update\n respond_to do |format|\n if @answer.update(answer_params)\n format.html { redirect_to questions_url, notice: 'Answer edited.' }\n else\n format.json {\n render json: @answer.errors,\n status: :unprocessable_entity\n }\n end\n end\n end",
"def update\n respond_to do |format|\n if @answer.update(answer_params)\n format.html { redirect_to @answer, notice: 'Answer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_answer\n respond_to do |format|\n if @answer.update(answer_params)\n format.html { redirect_to :planner, notice: 'Answer was successfully updated.' }\n format.json { respond_with_bip(@answer) }\n else\n format.html { render :edit }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @reply_answer.update(reply_answer_params)\n format.html { redirect_to @reply_answer, notice: 'Reply answer was successfully updated.' }\n format.json { render :show, status: :ok, location: @reply_answer }\n else\n format.html { render :edit }\n format.json { render json: @reply_answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @answer = Answer.find(params[:id])\n\n respond_to do |format|\n if @answer.update_attributes(params[:answer])\n format.html { redirect_to @answer, notice: 'Answer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @answer = Answer.find(params[:id])\n\n respond_to do |format|\n if @answer.update_attributes(params[:answer])\n format.html { redirect_to @answer, notice: 'Answer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n def answer_given(question_id)\n return (params[:answer] and params[:answer][question_id.to_s] and\n params[:answer][question_id.to_s].length > 0)\n end\n \n @resp = Response.find(params[:id])\n\n @questionnaire.questions.each do |question|\n if question.kind_of? Questions::Field\n ans = Answer.find_answer(@resp, question)\n if answer_given(question.id)\n if ans.nil?\n ans = Answer.new :question_id => question.id, :response_id => @resp.id\n end\n ans.value = params[:answer][question.id.to_s]\n ans.save\n else\n # No answer provided\n if not ans.nil?\n ans.destroy\n end\n end\n end\n end\n\n respond_to do |format|\n if @resp.update_attributes(params[:response])\n format.html { redirect_to(response_url(@questionnaire, @resp)) }\n format.js { redirect_to(response_url(@questionnaire, @resp, :format => \"js\")) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.js { render :action => \"edit\" }\n format.xml { render :xml => @resp.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @question_answer = Question::Answer.find(params[:id])\n\n respond_to do |format|\n if @question_answer.update_attributes(params[:question_answer])\n format.html { redirect_to @question_answer, notice: 'Answer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question_answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @answer.update(answer_params)\n format.html { redirect_to @answer, notice: 'Answer was successfully updated.' }\n format.json { render :show, status: :ok, location: @answer }\n else\n format.html { render :edit }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @answer.update(answer_params)\n format.html { redirect_to @answer, notice: 'Answer was successfully updated.' }\n format.json { render :show, status: :ok, location: @answer }\n else\n format.html { render :edit }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @answer.update(answer_params)\n format.html { redirect_to @answer, notice: 'Answer was successfully updated.' }\n format.json { render :show, status: :ok, location: @answer }\n else\n format.html { render :edit }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @answer = Answer.find(params[:id])\n\n respond_to do |format|\n if @answer.update_attributes(answer_params)\n format.html { redirect_to @answer, notice: 'Answer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @answer.update(answer_params)\n format.html { redirect_to answers_path, notice: 'Answer was successfully updated.' }\n format.json { render :show, status: :ok, location: @answer }\n else\n format.html { render :edit }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @answer = Answer.find(params[:id])\n\n respond_to do |format|\n if @answer.update_attributes(params[:answer])\n format.html { redirect_to @answer, notice: 'Respuesta actualizada correctamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @question = Question.find(params[:question_id])\n @answer = @question.answers.new(answer_params)\n respond_to do |format|\n if @answer.update(answer_params)\n format.html { redirect_to question_answer_url(@question, @answer), notice: \"Answer was successfully updated.\" }\n format.json { render :show, status: :ok, location: @answer }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @client_answer = ClientAnswer.find(params[:id])\n\n respond_to do |format|\n if @client_answer.update_attributes(params[:client_answer])\n format.html { redirect_to @client_answer, notice: 'Client answer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @client_answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @answer = Answer.find_by_uuid(params[:id])\n @question = @answer.question\n\n respond_to do |format|\n begin\n if @answer.update_attributes(params[:answer])\n format.html { redirect_to answer_path(@answer.uuid), notice: 'Your answer was successfully saved.' }\n format.json { render json: @answer, status: :created, location: answer_path(@answer.uuid) }\n else\n format.html { render action: \"edit\", location: edit_answer_path(@answer.uuid) }\n format.json { render json: @answer.errors, status: :unprocessable_entity, location: edit_answer_path(@answer.uuid) }\n end\n rescue ActiveRecord::ReadOnlyRecord\n format.html { redirect_to answer_path(@answer.uuid), notice: \"You cannot change the answer\" }\n format.json { render json: @answer.errors, status: :unprocessable_entity, location: answer_path(@answer.uuid) }\n end\n end\n end",
"def update\n respond_to do |format|\n if @answer.update(answer_params)\n format.html { redirect_to @answer.question, notice: 'Respuesta actualizada satisfactoriamente' }\n format.json { render :show, status: :ok, location: @answer }\n else\n format.html { render :edit }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @answer = Answer.find(params[:id])\n\n respond_to do |format|\n if @answer.update_attributes(params[:comment])\n format.html { redirect_to @answer }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @asked_to_answer.update(asked_to_answer_params)\n format.html { redirect_to @asked_to_answer, notice: 'Asked to answer was successfully updated.' }\n format.json { render :show, status: :ok, location: @asked_to_answer }\n else\n format.html { render :edit }\n format.json { render json: @asked_to_answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @answer.update(answer_params)\n respond_to_save_success(@answer, [@question, @answer])\n else\n respond_to_save_failure(:edit, @answer)\n end\n end",
"def answer_respondent_params\n params.require(:answer_respondent).permit(:answer_id, :respondent_id)\n end",
"def update\n appointment_request = current_user.pending_requests.find(\n params[:request_id]\n )\n\n case params[:answer]\n when 'accept'\n if appointment_request.accept!\n redirect_to root_path\n else\n render status: 500\n end\n when 'reject'\n if appointment_request.reject!\n redirect_to root_path\n else\n render status: 500\n end\n else\n render json: { appointment_request: appointment_request, status: 200 }\n end\n end"
]
| [
"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.6915368",
"0.68441343",
"0.6819583",
"0.6812929",
"0.6811525",
"0.6799917",
"0.6780385",
"0.6778598",
"0.67648447",
"0.673389"
]
| 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 format.json { head :no_content }\n end\n end",
"def destroy\n @answer.destroy\n respond_to do |format|\n format.html { redirect_to answers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @answer.destroy\n respond_to do |format|\n format.html { redirect_to answers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @answer = current_user.answers.find(params[:id])\n @answer.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @answer = Answer.find_by_key(params[:id])\n @answer.destroy\n\n respond_to do |format|\n format.html { redirect_to answers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @answer = Answer.find(params[:id])\n @answer.destroy\n\n respond_to do |format|\n format.html { redirect_to answers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @answer = Answer.find(params[:id])\n @answer.destroy\n\n respond_to do |format|\n format.html { redirect_to answers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @answer = Answer.find(params[:id])\n @answerable = @answer\n @answer.destroy\n\n respond_to do |format|\n format.html { redirect_to @answerable }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question_answer = Question::Answer.find(params[:id])\n @question_answer.destroy\n\n respond_to do |format|\n format.html { redirect_to question_answers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n\t\t#@answer.destroy\n\t\t#respond_to do |format|\n\t\t#\tformat.html { redirect_to answers_url }\n\t\t#\tformat.json { head :no_content }\n\t\t#end\n\n\tend",
"def destroy\n @answer.destroy\n\n head :no_content\n end",
"def destroy\n @answer.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Answer deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @answer.destroy\n respond_with( [ :admin, @survey, @section, @question, @answer ] )\n end",
"def destroy\n @reply_answer.destroy\n respond_to do |format|\n format.html { redirect_to reply_answers_url, notice: 'Reply answer was successfully destroyed.' }\n format.json { head :no_content }\n format.js { render :layout => false }\n end\n end",
"def destroy\n @answer.destroy\n respond_to do |format|\n format.html { redirect_to answers_url, notice: 'Answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @answer.destroy\n respond_to do |format|\n format.html { redirect_to answers_url, notice: 'Answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @answer.destroy\n respond_to do |format|\n format.html { redirect_to answers_url, notice: 'Answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @answer.destroy\n respond_to do |format|\n format.html { redirect_to answers_url, notice: 'Answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @answer.destroy\n respond_to do |format|\n format.html { redirect_to answers_url, notice: 'Answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n\n @m_answer.destroy\n respond_to do |format|\n format.html { redirect_to m_question_path(@m_question) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @icebreaker_answer.destroy\n respond_to do |format|\n format.html { redirect_to icebreaker_answers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @given_answer.destroy\n respond_to do |format|\n format.html { redirect_to given_answers_url, notice: 'Given answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @responder = Responder.find(params[:id])\n @responder.destroy\n\n respond_to do |format|\n format.html { redirect_to responders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @answer.destroy\n\n respond_to_destroy(@answer, [@question, :answers])\n end",
"def destroy\n @v1_answer.destroy\n end",
"def destroy\n @questionnaire.destroy\n respond_to do |format|\n format.html { redirect_to questionnaires_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @survey_answer_item = SurveyAnswerItem.find(params[:id])\n @survey_answer_item.destroy\n\n respond_to do |format|\n format.html { redirect_to survey_answer_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n answer = Answer.find params[:id]\n \n if can? :delete, answer\n answer.destroy\n render json: { status: 200 }, status: 200\n else\n render json: { status: 403 }, status: 403\n end\n end",
"def destroy\n @answer.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end"
]
| [
"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.7398415",
"0.7390615",
"0.735494",
"0.73535943",
"0.7343676",
"0.7326353",
"0.7320324",
"0.73090017",
"0.73029715",
"0.72727716"
]
| 0.8105654 | 0 |
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_worth_credit ||= 0\n end",
"def default_values\n self.avg_rating ||= -1\n end",
"def set_default_values\n self.base_exp ||= 0\n self.time_bonus_exp ||= 0\n end",
"def set_default_values\n self.base_exp ||= 0\n self.time_bonus_exp ||= 0\n end",
"def set_default_values\n self.base_exp ||= 0\n self.time_bonus_exp ||= 0\n self.extra_bonus_exp ||= 0\n end",
"def set_default_values\n if self.price.nil?\n self.price = 0.0\n end\n if self.rating.nil?\n self.rating = 0\n end\n if self.enabled.nil?\n self.enabled = false\n end\n if self.no_of_reviews.nil?\n self.no_of_reviews = 0\n end\n if self.no_of_registrations.nil?\n self.no_of_registrations = 0\n end\n end",
"def default_values\n \tself.total_worth ||= 0\n \tend",
"def set_creation_defaults\n if self.max_days == 0\n self.max_days = nil\n self.end_date = nil\n else\n self.end_date = self.start_date + self.max_days\n end\n self.percent = 0\n end",
"def set_defaults\n self.mmr ||= 1500\n self.k_value ||= 40\n self.home_mmr ||= self.mmr\n self.away_mmr ||= self.mmr\n self.active ||= true\n self.total_games ||= 0\n end",
"def update!(**args)\n @default_value = args[:default_value] if args.key?(:default_value)\n @max_value = args[:max_value] if args.key?(:max_value)\n @min_value = args[:min_value] if args.key?(:min_value)\n end",
"def update!(**args)\n @default_value = args[:default_value] if args.key?(:default_value)\n @max_value = args[:max_value] if args.key?(:max_value)\n @min_value = args[:min_value] if args.key?(:min_value)\n end",
"def assign_defaults\n\t\t## WHICH OF OUR EMPLOYEES CAN RESIGN, BECOMES THE SAME AS WHO CAN VERIFY.\n\t\tself.which_of_our_employees_will_resign_outsourced_reports = self.who_can_verify_reports if self.which_of_our_employees_will_resign_outsourced_reports.blank?\n\tend",
"def set_defaults\n self.balance ||= 0\n end",
"def setDefault\n self.monthlyCost ||= 0.0 # will set the default value only if it's nil\n self.annualCost ||= 0.0\n end",
"def default\n @default ||= highest\n end",
"def default=(value); end",
"def default_values\n rating = 0\n if user_id.nil?\n user_id = User.find(1)\n end\n end",
"def set_defaults\n super\n self.seating_capacity ||= 0\n self.standing_capacity ||= 0\n self.wheelchair_capacity ||= 0\n end",
"def update!(**args)\n @max_value = args[:max_value] if args.key?(:max_value)\n @min_value = args[:min_value] if args.key?(:min_value)\n end",
"def set_max(max)\n self[:max] = (max > 0 ? max : 1)\n end",
"def update!(**args)\n @max_value = args[:max_value] if args.key?(:max_value)\n @min_value = args[:min_value] if args.key?(:min_value)\n end",
"def max=\n end",
"def defaults\n self.leaver ||= 0\n end",
"def create\n authorize Student\n student_params[:fines]=0\n @student = Student.new(student_params)\n @user = User.new({email:@student.email,password:@student.password,password_confirmation:@student.password})\n respond_to do |format|\n if @student.save\n if(@student[:education]==\"Masters\")\n @student.update({max_books:4})\n elsif (@student[:education]==\"PhD\")\n @student.update({max_books:6})\n else\n @student.update({max_books:2})\n end\n @user.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def defaultHack\n #save only if i change something, so need this almost redundant if statement\n if(self.num_downvotes == nil || self.num_upvotes == nil || self.name == nil || self.name.blank? || self.num_downloads == nil)\n self.num_downvotes ||= 0\n self.num_upvotes ||= 0\n self.num_downloads ||=0\n self.name ||= \"???\"\n self.save\n end\n end",
"def set_Maximum(value)\n set_input(\"Maximum\", value)\n end",
"def default_values \n self.credited_date = Time.now\n self.leave_period_id = 0 if self.leave_period_id.nil?\n end",
"def default_values\n self.unread_entries = 0 if self.unread_entries.blank? || self.unread_entries < 0\n end",
"def default_values\n self.unread_entries = 0 if self.unread_entries.blank? || self.unread_entries < 0\n end"
]
| [
"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.57620215",
"0.5752578",
"0.57513547",
"0.5719214",
"0.5717409",
"0.5708223",
"0.5704613",
"0.570142",
"0.570142"
]
| 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\n end",
"def seats_length\n @seats.length\n end",
"def seats_left\n student_limit - students.count\n end",
"def seats_available_over_max_backup\n\t\t\"#{seats_available} / #{max_student} + #{backup_student}\"\n\tend",
"def num_of_seats_available\n self.movie.capacity > self.movie.seats_sold ? (self.movie.seats_sold += 1) : false\n self.movie.save\n end",
"def available_seats\n return -1 if @axes.reduce(false) { |acc, ax| acc || ax.available_seats < 0 }\n\n @axes.reduce(0) { |sum, ax| sum + ax.available_seats }\n end",
"def total_seats\n\t\tseats + waitlist_seats\n\tend",
"def seats_remaining(counter, capacity)\n capacity - counter\n end",
"def seats_waitlisted_same_user_same_tour\n waitlist_same_user_same_tour ? waitlist_same_user_same_tour.num_seats : 0\n end",
"def house_capacity\n has_reserved_seating? ? seatmap.seat_count : attributes['house_capacity']\n end",
"def availableSeats\n jsonChunk[\"seats\"]\n end",
"def seats_booked_same_user_same_tour\n return booking_same_user_same_tour ? booking_same_user_same_tour.num_seats : 0\n end",
"def seats_left?\n student_limit == students.count\n end",
"def add_passanger\n @seats_available -= 1 unless full?\n end",
"def print_seats_unavailable\n puts \"#{@unavailable_seats} Not available, Please select different seats \"\n end",
"def availability(seats, time, restaurant, user)\n taken_seats = reservations.where(time: ((time-2.hours+1.minute)..(time+2.hours-1.minute))).sum(:seats)\n puts taken_seats\n taken_seats + seats <= capacity\n end",
"def slots_available\n 5 - users.size\n end",
"def check_for_unavailable_seats\n @unavailable_seats = (@seat_numbers - eval(\"$AUDI_#{@show_no}_SEATS\")).join(', ')\n end",
"def remaining_ads_slots\n #num de anuncios dos pacotes - num de anuncios que possui ativos\n self.max_ads - self.active_ads_count\n end",
"def apportion\n 385.times do |n|\n state = find_highest_priority\n @seats[state] += 1\n\n seat_number = 51 + n\n puts \"Assigning Seat #{seat_number} to #{state}\"\n end\n\n puts \"Just missed the cut...\"\n state = find_highest_priority\n puts \"Seat 436 would be assigned to #{state}\"\n\n @seats.each do |state, seats|\n printf(\"%20s\\t%3d\\n\", state, seats)\n end\n end",
"def capacity_check(film)\n if film.num_customers_in_film < @capacity\n return \"tickets available\"\n else\n return \"this showing is full\"\n end\n end",
"def book_seats_if_available\n check_for_unavailable_seats\n if @unavailable_seats.empty?\n book_selected_seats \n else \n print_seats_unavailable\n book_tickets\n end \n end",
"def remaining_slots\n @count = 0\n self.booked_customers.each do |booked_customer|\n @count += booked_customer.number_students.to_i\n end\n return self.cap - @count\n\n end",
"def percent_full\n capacity.to_f > 0 ? (accepted_count.to_f / capacity.to_f) * 100 : 0\n end",
"def occupied_seats\n return [] unless seatmap\n # basically, collect seat info from all vouchers for this showdate\n vouchers.map(&:seat).compact.map(&:to_s).sort\n end",
"def shoe_count\n count = @shoe.count\n positive = count >= 0\n \"Current Deck Count: #{positive ? \"+\" : \"-\"}#{count.abs}\"\n end",
"def full?\n\t\t\t\t@available <= 0\n\t\t\tend"
]
| [
"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.60225767",
"0.6014307",
"0.6001958",
"0.5985098",
"0.5975108",
"0.59234625",
"0.59219",
"0.59207946",
"0.58693635"
]
| 0.7476062 | 0 |
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 end_time < Clock.time)\n end",
"def expired?\n Time.now > self.to_be_expired_at\n end",
"def expired?\n exp < Time.now.to_i\n end",
"def expired?\n expiration_date <= Time.now\n end",
"def expired?\n Time.now > expiration if expiration\n end",
"def expired?\n false\n end",
"def expired?\n end",
"def expired?\n Time.now > valid_until\n end",
"def expired?\n self.expiration.past? || self[:expired]\n end",
"def expired?\n @expiry_time < Time.now\n end",
"def expired?\n !respond_to?(:expires_at) || expires_at < Time.current\n end",
"def time_expired?\n (Time.now - @duration) > @start_time\n end",
"def expired?\n\n end",
"def expired?\n Time.current >= expires_at\n end",
"def expired?\n self.expires_at && Time.now.utc > self.expires_at\n end",
"def expired?\n self.expires_at && Time.now > self.expires_at\n end",
"def expired?\n self.expires_on? and self.expires_on < Time.now\n end",
"def expired?\n expires_at && expires_at <= Time.now\n end",
"def expired?\n DateTime.now.utc >= self.expires_at\n end",
"def expired?\n @expires_at <= Time.now\n end",
"def expired?\n Time.now > @expiration if @expiration\n end",
"def not_expired?\n self.expires_at && Time.now <= self.expires_at\n end",
"def expired(payload)\n Time.zone.at(payload['exp']) < Time.zone.now\n end",
"def expired?\n @expired\n end",
"def is_expired?\n self.end_date < DateTime.now\n end",
"def expired?\n Time.now > @expires\n end",
"def has_expired?\n self.expires_at ? self.expires_at < Time.now.utc : false\n end",
"def has_expired?\n self.expires_at ? self.expires_at < Time.now.utc : false\n end"
]
| [
"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.75690466",
"0.75689536",
"0.7566959",
"0.7551737",
"0.7547853",
"0.75301576",
"0.75239074",
"0.752096",
"0.7519339",
"0.7519339"
]
| 0.8490823 | 0 |
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 end_time_must_be_after_start_time\n if self.start_time > self.end_time\n errors.add(:end_time, 'must be after start time')\n end\n end",
"def end_time_after_start_time\n return if end_time.blank? || start_time.blank?\n\n if end_time < start_time\n errors.add(:end_time, \"must be after the start time\")\n end\n end",
"def start_time_before_end_time\n return true unless start_time && end_time\n\n errors.add(:start_time, 'must be before end time') unless start_time < end_time\n end",
"def start_time_before_end_time\n if start_time and end_time and start_time >= end_time\n errors.add(:start_time, \"Must be before end time\")\n errors.add(:end_time, \"Must be after start time\")\n end\n end",
"def end_time_after_start_time\n if self.end_time && self.end_time < self.start_time\n self.errors.add(:end_time, \"The end time must be after the start time\")\n end\n end",
"def validate_timings\n p start_time, end_time\n if (start_time > end_time)\n errors[:base] << \"Start Time must be less than End Time\"\n end\n end",
"def validate_start_end_time\n if start_time && end_time && start_time.to_i >= end_time.to_i\n errors.add(:base, \"Start At cannot be greater than End At\")\n end\n\n if end_time.to_i > api_duration_seconds.to_i\n errors.add(:base, \"End At cannot be longer than the video duration: \" + api_duration_seconds.to_s)\n end\n end",
"def end_time_after_start_time\n if start_time && end_time && end_time < start_time\n errors.add :end_time, \"must be after the start of shift\"\n errors.add :start_time, \"must be before the end of shift\"\n end\n end",
"def is_correct_time? #:doc:\n if(self.endTime && self.startTime && (self.endTime<=>self.startTime)==-1)\n errors.add([:starTime,:endTime],\"Attenzione l'ora di inizio è piu grande dell'ora di fine\")\n end\n end",
"def ends_after_start\n unless end_time.nil? || start_time.nil?\n errors[:end_time] << \"can't be before start time\" if end_time < start_time\n end\n end",
"def validate_start_date_before_end_date\n\t\tif end_time <= start_time\n\t\t\terrors.add(:end_time, \"must be after start time\")\n\t\tend\n\tend",
"def start_before_end\n if start_time > end_time\n errors.add :start_time, s_(\"BookingValidationError|must be before end time\")\n end\n end",
"def start_end_time\n errors[:start_time] << _('errors.invalid_shift_time') if start_time.to_i > end_time.to_i\n end",
"def end_time_after_start_time\n if self.event_start_time && self.event_end_time\n errors.add(:event_end_time, \"must be after the event start time\") unless\n self.event_end_time >= self.event_start_time\n end\n end",
"def check_future\n current_start = DateTime.strptime(self.start_time,\"%m/%d/%y %H:%M\").to_time\n current_end = DateTime.strptime(self.end_time,\"%m/%d/%y %H:%M\").to_time \n\n # checks start time of appt is before end time #\n if current_start < current_end\n if current_start > Time.now && current_end > Time.now\n @valid = true\n else\n @valid = false\n end\n end\n @valid\n p @valid\n end",
"def validate(record)\n if !record.start_time.nil? && !record.end_time.nil? && record.start_time >= record.end_time\n record.errors[:end_time] << 'End date should be greater that start date!'\n end\n \n if !record.start_time.nil? && record.start_time < Time.now\n record.errors[:start_time] << 'Start time must be greater than current time'\n end\n end",
"def ends_after_it_starts\n if !starts_before_it_ends?\n errors.add(:start_time, 'must be before the end time')\n end\n end",
"def start_must_be_before_end_time\n unless active_start_time.nil? or active_stop_time.nil?\n errors.add(:active_start_time, \"must be before stop time\") unless\n active_start_time < active_stop_time\n end\n end",
"def date_consistency\n\t\treturn if [start_time.blank?, end_time.blank?].any?\n\t\terrors.add(:start_time, 'must be after end_time') if start_time > end_time\n\tend",
"def date_consistency\n\t\treturn if [start_time.blank?, end_time.blank?].any?\n\t\terrors.add(:start_time, 'must be after end_time') if start_time > end_time\n\tend",
"def validate_time(start_time, end_time)\n\t\t\t\ttime_now = Time.now.strftime(\"%m/%d/%Y %H:%M\")\n\t\t\t\tappointments = Appointment.all\n\t\t\t\ttoday = start_time.split[0]\n\t\t\t\ttoday_appts = appointments.where(start_time: today)\n\t\t\t\tresult = false\n\n\t\t\t\tif start_time > time_now\n\t\t\t\t\tif today_appts.length == 0\n\t\t\t\t\t\treturn true\n\t\t\t\t\tend\n\t\t\t\t\ttoday_appts.each do |appt|\n\t\t\t\t\t\tif start_time <= appt.end_time && appt.start_time <= end_time\n\t\t\t\t\t\t\treturn false\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tresult = true\n\t\t\t\t\t\tend\n\t\t\t\t\tend#end of each loop\n\t\t\t\tend#end of if start_time\n\t\t\t\tresult\n\t\t\tend",
"def start_must_be_before_end_date\n if(self.start_date && self.end_date)\n valid = self.start_date < self.end_date\n errors.add(:start_date, \"must be before end time\") unless valid\n end\n end",
"def start_must_be_before_end_date\n if(self.start_date && self.end_date)\n valid = self.start_date < self.end_date\n errors.add(:start_date, \"must be before end time\") unless valid\n end\n end",
"def less_than_2_hours\n two_hours_later = start_time + 2.hours\n errors.add(:end_time, 'should be at most 2 hours after start time (interviews must be shorter than 2 hours in duration)') if end_time > two_hours_later\n end",
"def start_after_now\n unless start_time.nil? || end_time.nil?\n errors[:start_time] << \"can't be in the past\" if start_time < Time.now\n end\n end",
"def valid_venue_time?\n valid_time = self.venue.matches.all? do |match|\n !(match.start_time >= self.start_time && match.start_time <= self.end_time || match.end_time >= self.start_time && match.end_time <= self.end_time)\n end\n errors.add(:start_time, \"The venue is not available for this time\") unless valid_time\n end",
"def shift_end_hour\n if self.start_time.hour >= 0 && self.start_time.hour <= 2 && self.end_time.hour > 2 \n errors.add(:end_time, 'must be between 7am and 3am')\n end\n if self.end_time.hour > 2 && self.end_time.hour < 7\n errors.add(:end_time, 'must be between 7am and 3am')\n end \n end",
"def validate_start_and_stop_time\n if active_time\n if active_start_time.nil? or active_stop_time.nil?\n errors.add(:active_time, \"start time or end time not set\")\n end\n end\n end"
]
| [
"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.7771807",
"0.7701556",
"0.7597398",
"0.7597398",
"0.7587011",
"0.75805146",
"0.7551149",
"0.75381696",
"0.75034386"
]
| 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|\n format.html # index.html.erb\n format.json { render :json => @cocktails }\n end\n end",
"def index\n url = \"https://data.cityofchicago.org/resource/x2n5-8w5q.json\"\n options = { :body => {:status => text}, :basic_auth => @auth }\n @response = HTTParty.get(url, options)\n\n @crime = Hash.new\n\n #@crime['block'] = @response[0]['block']\n @crime = @response\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @gittos }\n end\n end",
"def index\n @commemts = Commemt.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @commemts }\n end\n end",
"def index\n @colegios = Colegio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @colegios }\n end\n end",
"def index\n #@csosns = Csosn.all\n @csosns = Csosn.paginate(:page => params[:page], :per_page => 10)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @csosns }\n end\n end",
"def show\n @contato_produto = ContatoProduto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contato_produto }\n end\n end",
"def index\n @coupons = Coupon.where('shop_id = ?', params[:shop_id])\n\n respond_to do |format|\n format.html { show_from_resource('index', 'shop_index') }\n format.json { render json: @coupons }\n end\n end",
"def set_prod_coti\n @prod_coti = ProdCoti.find(params[:id])\n end",
"def index\n @bill_cargos = @bill.bill_cargos\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bill_cargos }\n end\n end",
"def index\n if is_my_resource(params[:prossumer_id])\n @products = Product.where(prossumer_id: params[:prossumer_id]).as_json({\n cycle_id: params[:cycle_id],\n include: {\n prossumer: {\n except: [:encrypted_password, :salt, :confirm_hash]\n },\n product_category: {}\n }\n })\n render json: @products\n end\n end",
"def index\n @carts_products = @cart.carts_products.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @carts_products }\n end\n end",
"def index\n @products = @co.products\n end",
"def index\n @peticion_servicio_tis = Peticion::ServicioTi.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @peticion_servicio_tis }\n end\n end",
"def show\n @csosn = Csosn.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @csosn }\n end\n end",
"def show\n @productonegocio = Productonegocio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @productonegocio }\n end\n end",
"def index\n @cofis = Cofi.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cofis }\n end\n end",
"def show\n # @ccbs_product = CcbsProduct.find(params[:id])\n\n prd_attribute = PrdAttribute.find(params[:id], :include => :products)\n product = Product.find(prd_attribute.products[0].id, :include => [:prd_subscriptions, :prd_additional_services])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ccbs_product }\n format.json {\n\n ccbs_product = CcbsProduct.new\n tariff_list = ccbs_product.set_fields(prd_attribute, product.prd_subscriptions, product.prd_additional_services)\n\n # product에 대해 전달\n results = mapping_to_hash(ccbs_product,CcbsProduct.json_mapping_table)\n ccbs_product.send_to_ccbs('POST', results.to_json)\n\n # tariff에 대해서 전달\n tariff_list.each { |product_tariff| \n to_ccbs_hash = mapping_to_hash(product_tariff, CcbsProductTariff.json_mapping_table)\n product_tariff.send_to_ccbs(\"POST\", to_ccbs_hash.to_json) }\n\n render :json => results\n } \n end\n end",
"def index\n @congressos = Congresso.all\n end",
"def get_products()\n\tputs \"Getting products\"\n\tresponse = request_get(\"/api/product\")\n\tputs response.body\nend",
"def show\n @colegio = Colegio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @colegio }\n end\n end",
"def listCon\n @opportunities = Opportunity.where(\"status = ?\", \"Publish\")\n render json: @opportunities\n end",
"def index\n @mixproductos = Mixproducto.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mixproductos }\n end\n end",
"def index\n @cotiz_clo_muls = CotizCloMul.all\n end",
"def show\n @cso = Cso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cso }\n end\n end",
"def show \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contract_product }\n end\n end",
"def create\n @prod_coti = ProdCoti.new(prod_coti_params)\n\n respond_to do |format|\n if @prod_coti.save\n format.html { redirect_to @prod_coti, notice: 'Prod coti was successfully created.' }\n format.json { render :show, status: :created, location: @prod_coti }\n else\n format.html { render :new }\n format.json { render json: @prod_coti.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @cec_complaint = CecComplaint.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cec_complaint }\n end\n end",
"def index\n @concursos = Concurso.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @concursos }\n end\n end",
"def index\n if params[:site_id].nil? or params[:site_id].empty?\n @comentarios = Comentario.all # path: /types\n else\n @comentarios = Site.find(params[:site_id]).comentarios # path: /sites/id/comentarios\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @comentarios }\n end\n end"
]
| [
"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.5629139",
"0.56262577",
"0.5621512",
"0.5614486",
"0.5613188",
"0.5610498",
"0.5609415",
"0.5608129",
"0.56043303",
"0.5574161"
]
| 0.68760175 | 0 |
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 \n respond_to do |format|\n if @service_order.save\n cont =0\n @products.each do |p|\n detalle = ServiceOrderDetail.new(product_id: p, quantity: @quantity[cont], service_order_id:@service_order.id)\n detalle.save\n cont +=1\n end\n \n format.html { redirect_to @service_order, notice: 'Service order was successfully created.' }\n format.json { render :show, status: :created, location: @service_order }\n else\n format.html { render :new }\n format.json { render json: @service_order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cotiz_clo_mul = CotizCloMul.new(cotiz_clo_mul_params)\n\n respond_to do |format|\n if @cotiz_clo_mul.save\n GeneradorCorreoMailer.confirmarCotizCloMul(@cotiz_clo_mul).deliver_now\n format.html { redirect_to @cotiz_clo_mul, notice: 'Cotiz clo mul was successfully created.' }\n format.json { render :show, status: :created, location: @cotiz_clo_mul }\n else\n format.html { render :new }\n format.json { render json: @cotiz_clo_mul.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @copon = Copon.new(copon_params)\n get_product(@copon, params.require(:copon)[:product])\n set_associative_criteria @copon, params.require(:copon)\n\n respond_to do |format|\n if @copon.save\n format.html { redirect_to @copon, notice: 'Copon was successfully created.' }\n format.json { render :show, status: :created, location: @copon }\n else\n format.html { render :new }\n format.json { render json: @copon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cotizacione = Cotizacione.new(cotizacione_params)\n\n respond_to do |format|\n if @cotizacione.save\n format.html { redirect_to @cotizacione, notice: 'Cotizacione was successfully created.' }\n format.json { render :show, status: :created, location: @cotizacione }\n else\n format.html { render :new }\n format.json { render json: @cotizacione.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @troca_produto = TrocaProduto.new(troca_produto_params)\n\n respond_to do |format|\n if @troca_produto.save\n format.html { redirect_to @troca_produto, notice: \"Troca produto was successfully created.\" }\n format.json { render :show, status: :created, location: @troca_produto }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @troca_produto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n product_name = competitor_params[:title]\n honestbee_datas = get_honestbee_data (product_name)\n predict_catalog = get_predict_catalog ( product_name )\n save_data_in_postgres (predict_catalog)\n render :json => honestbee_datas\n end",
"def create\n @produto = Produto.new(params[:produto])\n @produto.empresa = session[:usuario].empresa\n \n params[:produto][:preco_compra] = converte_valor_banco params[:produto][:preco_compra]\n params[:produto][:preco_venda] = converte_valor_banco params[:produto][:preco_venda]\n\n respond_to do |format|\n if @produto.save\n format.html { redirect_to @produto, notice: 'Produto was successfully created.' }\n format.json { render json: @produto, status: :created, location: @produto }\n else\n format.html { render action: \"new\" }\n format.json { render json: @produto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @intranet_financeiro_tipos_cobanca = Intranet::FinanceiroTiposCobanca.new(intranet_financeiro_tipos_cobanca_params)\n\n respond_to do |format|\n if @intranet_financeiro_tipos_cobanca.save\n format.html { redirect_to @intranet_financeiro_tipos_cobanca, notice: \"Financeiro tipos cobanca was successfully created.\" }\n format.json { render :show, status: :created, location: @intranet_financeiro_tipos_cobanca }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @intranet_financeiro_tipos_cobanca.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @productonegocio = Productonegocio.new(params[:productonegocio])\n\n respond_to do |format|\n if @productonegocio.save\n format.html { redirect_to @productonegocio, notice: 'Productonegocio was successfully created.' }\n format.json { render json: @productonegocio, status: :created, location: @productonegocio }\n else\n format.html { render action: \"new\" }\n format.json { render json: @productonegocio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @congresso = Congresso.new(congresso_params)\n\n respond_to do |format|\n if @congresso.save\n format.html { redirect_to @congresso, notice: 'Congresso was successfully created.' }\n format.json { render :show, status: :created, location: @congresso }\n else\n format.html { render :new }\n format.json { render json: @congresso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @caracteristica_cartum = CaracteristicaCartum.new(params[:caracteristica_cartum])\n\n respond_to do |format|\n if @caracteristica_cartum.save\n format.html { redirect_to @caracteristica_cartum, notice: 'Caracteristica cartum was successfully created.' }\n format.json { render json: @caracteristica_cartum, status: :created, location: @caracteristica_cartum }\n else\n format.html { render action: \"new\" }\n format.json { render json: @caracteristica_cartum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cotact = Cotact.new(cotact_params)\n\n respond_to do |format|\n if @cotact.save\n format.html { redirect_to @cotact, notice: 'Cotact was successfully created.' }\n format.json { render :show, status: :created, location: @cotact }\n else\n format.html { render :new }\n format.json { render json: @cotact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def confirmer_cart\n _user = current_client\n _confirmation = rand(36**10).to_s(36)\n _cart = Commande.new()\n _cart.client_id = _user.id\n if params[:addr_id] != '-1'\n _cart.adresse_id = params[:addr_id]\n else\n _cart.adresse_id = client_adresse.id \n end\n _cart.no_confirmation = _confirmation\n _cart.date_de_commande = params[:date_de_commande]\n _cart.heure_de_commande = params[:heure_de_commande]\n _cart.prix_total = params[:prix_total]\n _cart.status_pret = false\n _cart.save\n render json: _cart\n end",
"def create\n @centro_costo = CentroCosto.new(centro_costo_params)\n\n respond_to do |format|\n if @centro_costo.save\n format.html { redirect_to centro_costos_path, notice: 'Centro de Costo creado exitosamente' }\n format.json { render :show, status: :created, location: @centro_costo }\n else\n format.html { render :new }\n format.json { render json: @centro_costo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cooco = Cooco.new(cooco_params)\n\n respond_to do |format|\n if @cooco.save\n format.html { redirect_to @cooco, notice: 'Cooco was successfully created.' }\n format.json { render :show, status: :created, location: @cooco }\n else\n format.html { render :new }\n format.json { render json: @cooco.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @consorciot = Consorciot.new(consorciot_params)\n\n respond_to do |format|\n if @consorciot.save\n format.html { redirect_to @consorciot, notice: 'Consorciot was successfully created.' }\n format.json { render :show, status: :created, location: @consorciot }\n else\n format.html { render :new }\n format.json { render json: @consorciot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def postContractCreate( entity_id, user_id, payment_provider, basket, billing_period, source, channel, campaign, referrer_domain, referrer_name, flatpack_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['user_id'] = user_id\n params['payment_provider'] = payment_provider\n params['basket'] = basket\n params['billing_period'] = billing_period\n params['source'] = source\n params['channel'] = channel\n params['campaign'] = campaign\n params['referrer_domain'] = referrer_domain\n params['referrer_name'] = referrer_name\n params['flatpack_id'] = flatpack_id\n return doCurl(\"post\",\"/contract/create\",params)\n end",
"def create\n @secco = @curso.seccos.build(secco_params)\n\n respond_to do |format|\n if @secco.save\n format.html { redirect_to curso_secco_path(@curso, @secco), notice: 'Seccao was successfully created.' }\n format.json { render :show, status: :created, location: @secco }\n else\n format.html { render :new }\n format.json { render json: @secco.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_prod_coti\n @prod_coti = ProdCoti.find(params[:id])\n end",
"def create\n @ccosto = Ccosto.new(ccosto_params)\n\n respond_to do |format|\n if @ccosto.save\n format.html { redirect_to @ccosto, notice: 'Ccosto was successfully created.' }\n format.json { render :show, status: :created, location: @ccosto }\n else\n format.html { render :new }\n format.json { render json: @ccosto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def cotizacione_params\n params.require(:cotizacione).permit(:token, :paqueteria, :producto, :precio)\n end",
"def create\n @services = params[:inputserv]#[:inputcantidad]\n @quantity = params[:inputcantidad]\n @citation = Citation.new(citation_params)\n @client = Client.where(:id => @citation.client_id).select(:email)\n @client_name = Client.where(:id => @citation.client_id).select(:name, :firstlastname)\n\n respond_to do |format|\n if @citation.save\n cont = 0\n @services.each do |p|\n detalle = CitationDetail.new(service_id: p, quantity: @quantity[cont], citation_id:@citation.id)\n detalle.save\n cont +=1\n end\n #NotifyMailer.notify_mail(@citation).deliver\n \n format.html { redirect_to @citation, notice: 'Citation was successfully created.' }\n format.json { render :show, status: :created, location: @citation }\n else\n @clients = Client.all.map{|p| [ p.name, p.id ] }\n @services_combo = Service.all.map{|p| [ p.name, p.id ] }\n @citation_details = CitationDetail.where(:service_id => params[:id])\n #@services = params[:inputserv][:inputcantidad]\n format.html { render :new }\n format.json { render json: @citation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @copropietario = Copropietario.new(copropietario_params)\n\n respond_to do |format|\n if @copropietario.save\n format.html { redirect_to @copropietario, notice: 'Copropietario was successfully created.' }\n format.json { render :show, status: :created, location: @copropietario }\n else\n format.html { render :new }\n format.json { render json: @copropietario.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @prodorcarealizado = Prodorcarealizado.new(prodorcarealizado_params)\n\n respond_to do |format|\n if @prodorcarealizado.save\n format.html { redirect_to @prodorcarealizado, notice: 'Prodorcarealizado was successfully created.' }\n format.json { render :show, status: :created, location: @prodorcarealizado }\n else\n format.html { render :new }\n format.json { render json: @prodorcarealizado.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @trein_consul_comercial = TreinConsulComercial.new(trein_consul_comercial_params)\n\n respond_to do |format|\n if @trein_consul_comercial.save\n format.html { redirect_to @trein_consul_comercial, notice: 'Trein consul comercial was successfully created.' }\n format.json { render action: 'show', status: :created, location: @trein_consul_comercial }\n else\n format.html { render action: 'new' }\n format.json { render json: @trein_consul_comercial.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @prod_servi = ProdServi.new(prod_servi_params)\n\n respond_to do |format|\n if @prod_servi.save\n format.html { redirect_to @prod_servi, notice: 'Prod servi was successfully created.' }\n format.json { render :show, status: :created, location: @prod_servi }\n else\n format.html { render :new }\n format.json { render json: @prod_servi.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @csosn = Csosn.new(params[:csosn])\n\n respond_to do |format|\n if @csosn.save\n format.html { redirect_to @csosn, notice: 'Csosn was successfully created.' }\n format.json { render json: @csosn, status: :created, location: @csosn }\n else\n format.html { render action: \"new\" }\n format.json { render json: @csosn.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \n \n @cocktail = Cocktail.new(params[:cocktail])\n @cocktail.prise = 20000\n @cocktail.grade = 0\n @cocktail.oficial = false\n respond_to do |format|\n if @cocktail.save\n format.html { redirect_to @cocktail, :notice => 'Cocktail was successfully created.' }\n format.json { render :json => @cocktail, :status => :created, :location => @cocktail }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @cocktail.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n\n @company = Company.find(1)\n\n @cout = Cout.new(cout_params)\n\n\n @cout[:code] = @cout.generate_cout_number\n @puntos = @company.get_puntos()\n @employees = @company.get_employees2() \n @trucks = @company.get_trucks\n\n respond_to do |format|\n if @cout.save\n format.html { redirect_to @cout, notice: 'Cout was successfully created.' }\n format.json { render :show, status: :created, location: @cout }\n else\n format.html { render :new }\n format.json { render json: @cout.errors, status: :unprocessable_entity }\n end\n end\n end"
]
| [
"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.5638326",
"0.56334126",
"0.5609733",
"0.5607298",
"0.5595942",
"0.5586975",
"0.5585054",
"0.55826664",
"0.55713016",
"0.5558561"
]
| 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 :edit }\n format.json { render json: @cotiz_clo_mul.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @productonegocio = Productonegocio.find(params[:id])\n\n respond_to do |format|\n if @productonegocio.update_attributes(params[:productonegocio])\n format.html { redirect_to @productonegocio, notice: 'Productonegocio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @productonegocio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @prod_servi.update(prod_servi_params)\n format.html { redirect_to @prod_servi, notice: 'Prod servi was successfully updated.' }\n format.json { render :show, status: :ok, location: @prod_servi }\n else\n format.html { render :edit }\n format.json { render json: @prod_servi.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n set_associative_criteria @copon, params.require(:copon)\n get_product(@copon, params.require(:copon)[:product])\n respond_to do |format|\n if @copon.update(copon_params)\n format.html { redirect_to @copon, notice: 'Copon was successfully updated.' }\n format.json { render :show, status: :ok, location: @copon }\n else\n format.html { render :edit }\n format.json { render json: @copon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contract_product.update_attributes(params[:contract_product])\n format.html { redirect_to @contract_product, notice: 'Contract product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contract_product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # { clinic: {id: references, \"license_id\"=>nil, \"name\"=>string } }\n \n if @clinic.update_attributes(params[:clinic].except(:api_license_id))\n head :no_content\n else\n render json: clinic.errors.full_messages, status: :unprocessable_entity\n end\n end",
"def update\n @produto.update(produto_params)\n respond_with @produto\n end",
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def editProd()\n if(!authenticateAdmin(params[:admin_id], params[:admin_auth_key]))\n render json: {status: false, reason: \"Authentication Failed\", data: \"\"}\n return\n end\n p = Product.find(params[:id])\n status = p.update(name: params[:name], price: params[:price].to_f, category_id: params[:cat_id])\n error = \"\"\n if(p.errors.full_messages.count > 0)\n error = c.errors.full_messages[0]\n end\n render json: {status: status, reason: error, data: \"\"}\n end",
"def edit_pro\n customer_id = params[\"customer_id\"]\n siret = params[\"siret\"]\n cip = params[\"cip\"]\n raison_sociale = params[\"raison_sociale\"]\n puts params\n puts \"----------------------------------------MAKES NO SENSE\"\n puts params[\"raison_sociale\"]\n puts customer_id\n puts cip\n puts siret\n puts raison_sociale\n puts \"I am in edit pro\"\n\n metafields = ShopifyAPI::Customer.find(customer_id).metafields\n puts metafields[0].key\n puts metafields[0].value\n puts metafields[1].key\n puts metafields[1].value\n puts metafields[2].key\n puts metafields[2].value\n\n metafields[0].value = siret\n metafields[1].value = cip\n metafields[2].value = raison_sociale\n\n puts metafields[0].key\n puts metafields[0].value\n puts metafields[1].key\n puts metafields[1].value\n puts metafields[2].key\n puts metafields[2].value\n\n p metafields[0].save\n p metafields[1].save\n p metafields[2].save\n\n p metafields[0].errors\n p metafields[1].errors\n p metafields[2].errors\n\n puts \"editing tag\"\n\n cus = ShopifyAPI::Customer.find(customer_id)\n p cus\n p cus.tags\n\n cus.tags = \"cip- #{metafields[1].value}, PRO\"\n\n p cus.save\n\n\n\n render json: { metafields: metafields }\n end",
"def update\n @produto = Produto.find(params[:id])\n \n params[:produto][:preco_compra] = converte_valor_banco params[:produto][:preco_compra]\n params[:produto][:preco_venda] = converte_valor_banco params[:produto][:preco_venda]\n\n respond_to do |format|\n if @produto.update_attributes(params[:produto])\n format.html { redirect_to @produto, notice: 'Produto was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @produto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @carts_product = @cart.carts_products.find(params[:id])\n\n respond_to do |format|\n if @carts_product.update_attributes(params[:carts_product])\n format.html { redirect_to @cart, notice: 'Carts product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @carts_product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @complaint = Complaint.find(params[:id])\n\n if @complaint.update_attributes(params[:complaint])\n head :no_content\n else\n render json: @complaint.errors, status: :unprocessable_entity\n end\n end",
"def update\n @mixproducto = Mixproducto.find(params[:id])\n\n respond_to do |format|\n if @mixproducto.update_attributes(params[:mixproducto])\n format.html { redirect_to @mixproducto, notice: 'Mixproducto was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mixproducto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @contato_produto = ContatoProduto.find(params[:id])\n\n respond_to do |format|\n if @contato_produto.update_attributes(params[:contato_produto])\n format.html { redirect_to [:admin, @contato_produto], notice: 'Contato produto was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contato_produto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @troca_produto.update(troca_produto_params)\n format.html { redirect_to @troca_produto, notice: \"Troca produto was successfully updated.\" }\n format.json { render :show, status: :ok, location: @troca_produto }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @troca_produto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"def update\n @prod_cli = ProdCli.find(params[:id])\n respond_to do |format|\n if @prod_cli.update(prod_cli_params)\n #ATUALIZOU DADOS\n log = Loginfo.new(params[:loginfo])\n log.employee = current_user.name\n log.task = 'Atualizou os dados do produto no cliente: ' + @prod_cli.client.company.to_s\n log.save! \n \n format.html { redirect_to clients_path, notice: 'produto atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @prod_cli }\n else\n format.html { render :edit }\n format.json { render json: @prod_cli.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @caracteristica_cartum = CaracteristicaCartum.find(params[:id])\n\n respond_to do |format|\n if @caracteristica_cartum.update_attributes(params[:caracteristica_cartum])\n format.html { redirect_to @caracteristica_cartum, notice: 'Caracteristica cartum was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @caracteristica_cartum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @prod = Prod.find(params[:id])\n\n respond_to do |format|\n if @prod.update_attributes(params[:prod])\n format.html { redirect_to @prod, :notice => 'Prod was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @prod.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @cotact.update(cotact_params)\n format.html { redirect_to @cotact, notice: 'Cotact was successfully updated.' }\n format.json { render :show, status: :ok, location: @cotact }\n else\n format.html { render :edit }\n format.json { render json: @cotact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def activo_update\n respond_to do |format|\n activo = params[:producto][:activo]\n id = params[:id]\n Producto.where(id: id).update_all(activo: activo )\n msg = { :status => \"ok\", :message => \"Actualizado!\" }\n format.json { render :json => msg }\n end\n end",
"def update\n respond_to do |format|\n if @recipe_prod.update(recipe_prod_params)\n format.html { redirect_to @recipe_prod, notice: 'Recipe prod was successfully updated.' }\n format.json { render :show, status: :ok, location: @recipe_prod }\n else\n format.html { render :edit }\n format.json { render json: @recipe_prod.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @produto.update(produto_params)\n format.html { redirect_to edit_produto_path(@produto), notice: 'Produto was successfully updated.' }\n format.json { render :show, status: :ok, location: @produto }\n else\n format.html { render :edit }\n format.json { render json: @produto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n nueva_cantidad = compra_params[:cantidad].to_i\n\n respond_to do |format|\n if @compra.edit_stock(nueva_cantidad) && @compra.update(compra_params)\n format.html { redirect_to @compra, notice: 'Compra was successfully updated.' }\n format.json { render :show, status: :ok, location: @compra }\n else\n format.html { render :edit }\n format.json { render json: @compra.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @produto.update(produto_params)\n format.html { redirect_to @produto, notice: 'Produto was successfully updated.' }\n format.json { render :show, status: :ok, location: @produto }\n else\n format.html { render :edit }\n format.json { render json: @produto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @produto.update(produto_params)\n format.html { redirect_to @produto, notice: 'Produto was successfully updated.' }\n format.json { render :show, status: :ok, location: @produto }\n else\n format.html { render :edit }\n format.json { render json: @produto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @produto.update(produto_params)\n format.html { redirect_to @produto, notice: 'Produto was successfully updated.' }\n format.json { render :show, status: :ok, location: @produto }\n else\n format.html { render :edit }\n format.json { render json: @produto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @catalogo.update(catalogo_params)\n format.html { redirect_to @catalogo, notice: 'Catalogo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @catalogo.errors, status: :unprocessable_entity }\n end\n end\n end"
]
| [
"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.6041952",
"0.6041138",
"0.602894",
"0.59961903",
"0.59960574",
"0.5993274",
"0.5993274",
"0.5993274",
"0.5976411"
]
| 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",
"def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end",
"def destroy\n @trein_consul_comercial.destroy\n respond_to do |format|\n format.html { redirect_to trein_consul_comercials_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @contato_produto = ContatoProduto.find(params[:id])\n @contato_produto.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_contato_produtos_url }\n format.json { head :no_content }\n end\n end",
"def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end",
"def destroy\n @prod_servi.destroy\n respond_to do |format|\n format.html { redirect_to prod_servis_url, notice: 'Prod servi was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cotiz_clo_mul.destroy\n respond_to do |format|\n format.html { redirect_to cotiz_clo_muls_url, notice: 'Cotiz clo mul was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @productonegocio = Productonegocio.find(params[:id])\n @productonegocio.destroy\n\n respond_to do |format|\n format.html { redirect_to productonegocios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cartum = Cartum.find(params[:id])\n @cartum.destroy\n\n respond_to do |format|\n format.html { redirect_to carta_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @caracteristica_cartum = CaracteristicaCartum.find(params[:id])\n @caracteristica_cartum.destroy\n\n respond_to do |format|\n format.html { redirect_to caracteristica_carta_url }\n format.json { head :no_content }\n end\n end",
"def delete(path)\n RestClient.delete request_base+path\n end",
"def delete\n res = HTTParty.get URL, headers: HEADERS\n message = JSON.parse res.body, symbolize_names: true\n if res.code == 200\n numSubs = message[:data].count\n if numSubs > 0\n message[:data].each do |sub|\n id = sub[:id]\n delRes = HTTParty.delete \"#{URL}/#{id}\", headers: HEADERS\n #TODO handle status codes\n end\n end\n end\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete\n response = WebPay.client.delete(path)\n response['deleted']\n end",
"def delete\n request(:delete)\n end",
"def destroy\n @commtent1 = Commtent1.find(params[:id])\n @commtent1.destroy\n\n respond_to do |format|\n format.html { redirect_to commtent1s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @small_concert.destroy\n respond_to do |format|\n format.html { redirect_to '/admin/small_concerts' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @produtc = Produtc.find(params[:id])\n @produtc.destroy\n\n respond_to do |format|\n format.html { redirect_to produtcs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @produto = Produto.find(params[:id])\n @produto.destroy\n\n respond_to do |format|\n format.html { redirect_to produtos_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @curso.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def destroy\n @thermo_oil_production = ThermoOilProduction.find(params[:id])\n @thermo_oil_production.destroy\n\n respond_to do |format|\n format.html { redirect_to thermo_oil_productions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contract_product.destroy\n\n respond_to do |format|\n format.html { redirect_to contract_products_url(:contract_id => @contract_product.contract_id) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mixproducto = Mixproducto.find(params[:id])\n @mixproducto.destroy\n\n respond_to do |format|\n format.html { redirect_to mixproductos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @iti_cust_dest_poa_detail.destroy\n respond_to do |format|\n format.html { redirect_to iti_cust_dest_poa_details_url }\n format.json { head :no_content }\n end\n end"
]
| [
"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.65021807",
"0.64965034",
"0.64961344",
"0.6490583",
"0.64807284",
"0.64783263",
"0.64692456",
"0.6465398",
"0.64633626",
"0.64543355"
]
| 0.71944636 | 0 |
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 !task.basis_plan?\n return @status.singular! if task.singular_basis_matrix?\n return @status.optimal! if task.sufficient_for_optimal?\n return @status.unlimited! if task.positive_z_index == nil # if z <= 0, target function is unlimited\n @status.step_completed!\n end",
"def running_test_step; end",
"def work_in_progress\n has_wip_label = danger_file.github.pr_labels.any? { |label| label.include? 'WIP' }\n has_wip_title = danger_file.github.pr_title.include? '[WIP]'\n\n danger_file.warn('PR is classed as Work in Progress') if has_wip_label || has_wip_title\n end",
"def test_ut_t4_mtv_pu_002\n pj = Pj.find(3)\n assert_equal FALSE, pj.has_analyzed_task?\n end",
"def inform_goal_of_new_contribution\n self.goal.check_for_completion!(self.goal_participant)\n end",
"def passed?; end",
"def passed?; end",
"def passed?; end",
"def check_project\n return if project.dataset_names.empty?\n return unless project.done_preprocessing?(false)\n to_run = project.next_distances(true)\n to_run = project.next_inclade(true) if to_run.nil?\n queue_job(to_run) unless to_run.nil?\n end",
"def passing?\n completed? && !has_failures? && !has_errors?\n end",
"def in_progress?\n progressconditions.any?(&:met?)\n end",
"def is_active(effort)\n if effort.deliverable and effort.deliverable.project_phase and effort.deliverable.project_phase.project\n return effort.deliverable.project_phase.project.status == 'Active'\n end\nend",
"def pending?; end",
"def Goal(conditions)\r\n\t\t@goal = conditions\r\n\t\t@open_preconditions = @goal\r\n\tend",
"def passed?\n !failed?\n end",
"def incomplete\n puts \"not a feature of GoalTracker\"\n end",
"def check_progress\n if self.can_check_progress\n on_db :adage do\n self.completed = !AdaData.with_game(self.name).where(user_id: self.user_id).last.nil?\n self.save\n end\n end\n return self.completed\n end",
"def pri_goal_percentage\n shots_on_goal > 0 ? goals.to_f / shots_on_goal : 1.0\n end",
"def progressable; end",
"def passed?\n !failed?\n end",
"def test_ut_t4_mtv_pj_001\n pj = Pj.find(1)\n assert_equal TRUE, pj.has_analyzed_task?\n end",
"def private_goal(user)\n create_goal(\"Learn to paint\", \"true\")\n create_goal(\"Play the piano\")\n click_link 'Sign Out'\n other_user(user)\n click_link 'Wilbur'\n end",
"def passing?\n return false if self.test_executions.empty?\n \n most_recent_execution = self.ordered_executions.first\n return !most_recent_execution.nil? && most_recent_execution.passing?\n end",
"def in_progress?\n @in_progress\n end",
"def in_progress?\n @in_progress\n end",
"def task_for_project_leaders\n return @_action_name == \"index\" || @_action_name == \"edit\" || @_action_name == \"new\" || @_action_name == \"create\"\n end",
"def target; true; end",
"def external_test_runs_passed_for?(test_type)\n test_types = ExternalTestType.get(test_type).with_related_types\n current_runs = current_external_test_runs_for(test_types)\n current_runs.any? && current_runs.all?(&:passed_ok?)\n end"
]
| [
"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.55264866",
"0.55226773",
"0.5519033",
"0.55067605",
"0.55028844",
"0.55028844",
"0.54988706",
"0.54944634",
"0.5491612"
]
| 0.62596583 | 0 |
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)\n children = each_child.to_a\n for child in children\n child, info = child\n if info[:success].evaluate(child)\n remove_child(child)\n end\n end\n end",
"def remove_act\n # outdent children in case remove_act doesn't delete\n self.children.each do |child|\n child.outdent\n child.remove_act\n end\n \n # check if parent should update completeness\n old_parent = self.parent\n\n self.permissions.destroy_all\n self.destroy\n \n # refresh parent completeness\n if !old_parent.nil?\n old_parent.is_complete?\n end\n end",
"def remove\n each { |x| x.parent.children.delete(x) }\n end",
"def mark_children_for_removal\n work_graphics.each do |work_graphic|\n work_graphic.destroy\n end\n end",
"def children() []; end",
"def remove_illegitimate_children\n puts \"Destroying illegitimate children of response #{id}: #{text}\" if illegitimate_children.length > 1\n illegitimate_children.select {|q| q != child_question }.each do |q|\n puts \" Destroying illegitimate child question #{q.id}: #{q.text}\"\n q.destroy\n end\n end",
"def clear_children!\n @children.clear\n end",
"def destroy\n super\n\n @children.each do |_child_name, child_group|\n child_group.each(&:destroy)\n end\n\n @children = {}\n end",
"def remove_child child\n @children.delete child\n end",
"def finish\n @children.each { |kid| \n kid[:link].finish()\n kid[:link] = nil\n kid[:residue].finish()\n kid[:residue] = nil\n }\n\n @ring_positions.each { |pos,node| \n node.finish()\n }\n\n remove_relations\n \n end",
"def remove_all\n @peer.remove_all\n# @children.each { |child| scene.unindex_prop(child) } if scene\n# @children = []\n end",
"def remove_child(le)\n\t\t\[email protected] le\n\t\t\tle.parent = nil\n\t\tend",
"def retrieve_all_children\n self.to_be_removed = false\n self.save\n\n self.tags.each do |i|\n i.to_be_removed = false\n i.save\n end\n end",
"def remove_from_descendants\n # TODO\n end",
"def remove(child)\n# if children.delete(child)\n# scene.unindex_prop(child) if scene\n @peer.remove(child.peer)\n# end\n end",
"def destroy\n #TODO: rewrite this method to actually \"archive\" the goals and include a note on why it was archived.\n #do some separate, more secure method for actually deleting them.\n\n if([email protected]?)\n redirect_to @goal, error: \"Goals may only be deleted if they have no sub-goals. Please delete the #{pluralize(@Goals.children.count,\"sub-goal\")} of this goal and try again.\"\n end\n\n @goal.destroy\n #orphan children on destroying\n #NOTE: use :dependent :nullify, instead\n #@goal.children.each do |c|\n # c.update!(parent_id: nil)\n #end\n\n redirect_url = (@goal.parent) ? @goal.parent : goals_path\n\n respond_to do |format|\n format.html { redirect_to redirect_url, notice: 'Goal was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def remove_children\n\t\tinterests.destroy_all\n\tend",
"def remove_act\n # select rep_parent if it exists\n node = self\n if !self.rep_parent.nil?\n node = self.rep_parent\n end\n\n # outdent children in case remove_act doesn't delete\n node.children.each do |child|\n child.outdent\n child.remove_act\n end\n\n # hold parent in case it need be updated\n old_parent = node.parent\n \n node.repititions.destroy_all\n node.destroy\n\n if !old_parent.nil?\n old_parent.is_complete?\n end\n end",
"def children; []; end",
"def orphan_children\n self.class.transaction do\n children(true).each{|child| child.orphan}\n end\n end",
"def demolish\n @children.each_value(&:demolish)\n end",
"def removing_plan_relation(transaction, parent, child, relations); end",
"def remove_children(relation = nil)\n if !relation\n for rel in sorted_relations\n remove_children(rel)\n end\n return\n end\n\n children = child_objects(relation).to_a\n for child in children\n remove_child_object(child, relation)\n end\n\tend",
"def child_tree\n child_check\n child_tree = self.clone\n child_tree.removeFromParent!\n child_tree\n end",
"def remove_child node, idx, opts={}\n no('no') unless node.children[idx]\n removed = node.children[idx]\n removed.parent_clear!\n tomb = Tombstone.build removed, opts\n node.children[idx] = tomb\n removed\n end",
"def clean_children\n\n return unless @children\n\n @children.each do |child_fei|\n #next unless child.is_a?(FlowExpressionId)\n get_expression_pool.remove(child_fei)\n end\n end",
"def update_children_when_delete\n if self.to_be_removed == true\n self.tag_types.each do |m|\n if m.to_be_removed == false\n m.to_be_removed = true\n m.save\n end\n end\n end\n end",
"def prune!\n return if root? #you cannot prune the root\n if normal?\n parent.normal_children.delete(self)\n else\n parent.fallback_child = nil\n end\n old_parent = parent\n @parent = nil\n old_parent.prune! if old_parent.useless?\n end",
"def remove!(child)\n @last_items_count -= +1 if child && child.last\n super\n end",
"def orphan_child_categories\n self.children.each do |child|\n child.parent_id = nil\n child.save\n end\n end"
]
| [
"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.60790026",
"0.6073781",
"0.6065633",
"0.60583204",
"0.6008439",
"0.59788036",
"0.5956688",
"0.59477335",
"0.5908808"
]
| 0.7523682 | 0 |
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 SBATypeError.new(\"SBAStore::SBAComplexObject expected\")\n end\n\n @VAR_COMPLEX_OBJECT_INDEX+=1\n \n # Add object to the array\n @VAR_COMPLEX_OBJECTS[@VAR_COMPLEX_OBJECT_INDEX-1] = var_Object\n @VAR_COMPLEX_OBJECTS_NAMES[@VAR_COMPLEX_OBJECT_INDEX-1] = var_Object.VAR_NAME\n @VAR_COMPLEX_OBJECTS_INDEXES[@VAR_COMPLEX_OBJECT_INDEX-1] = var_Object.VAR_ID\n \n # Add complex object to the previous complex object\n if(@VAR_COMPLEX_OBJECT_INDEX > 1)\n @VAR_COMPLEX_OBJECTS[@VAR_COMPLEX_OBJECT_INDEX-2].add(var_Object.VAR_ID)\n end\n \n Common::Logger.print(Common::VAR_DEBUG, self, \"puts [#{var_Object.to_s()}] to the array\") \n end",
"def add(rc)\n # iterate over given rc and store each item in this Bag's list\n rc.items.each do |item|\n # use the Bag's store method to ensure items are reset\n self.store(item)\n end\n # empty the given rc using its own empty method\n rc.items = []\n end",
"def add_item(item)\r\n \[email protected](item)\r\n end",
"def add chromosome\n\t\t@arrayChromosomes << chromosome\n\tend",
"def concat(array)\n updated(@children + array.to_a)\n end",
"def add(new_element)\n\n case new_element\n when DrawingGroup\n @drawingArray = (@drawingArray << new_element.drawingArray).flatten\n when Drawing\n @drawingArray << new_element\n else\n raise Argument \"New_element (#{@new_element}) is not a valid input\"\n end\n \n end",
"def store_concert_details_data(concert_details_array, output_file)\n CSV.open(output_file, 'a') do |csv|\n concert_details_array.each{|x| csv << x.toArray()} \n end\n end",
"def add array\n #$log.debug \"tabular got add #{array.count} #{array.inspect} \" if $log\n @list ||= []\n @list << array\n end",
"def add_item(array, item)\n\tarray << item\nend",
"def add(mod,id)\n @@records[mod] = [] unless @@records[mod].class == Array\n @@records[mod] << id\n end",
"def initialize(name, breed, age) #initialize with 3 arguments.\n @name = name\n @breed = breed\n @age = age\n DOGS << self #showell into empty DOGS array. \nend",
"def add_item(array, item)\n\tarray.push(item)\nend",
"def add_item(elective_array, item)\n elective_array.push(item)\n puts elective_array\nend",
"def initialize(input_arr=[])\n @internal_arr = []\n \n # take the input_arr and pass each value to add \n input_arr.each{|new_ele| add(new_ele)}\n\n end",
"def add_diagnosis_obj(obj)\n @diagnoses << obj\n end",
"def add_to_array(array, item)\n\tarray += [item]\n\tp array\nend",
"def add array\n $log.debug \"tabular got add #{array.count} #{array.inspect} \" if $log\n @list ||= []\n @list << array\n end",
"def add_value(item)\n array.push(item)\n end",
"def add_items_with_content(content_array)\n vci_array = []\n content_array.each { |content| vci_array << add_item_with_content(content) }\n vci_array\n end",
"def add_character(character_obj)\n # instance.cast << character_obj\n # self.cast << character_obj\n character_obj.series = self\n end",
"def add_cards(cs)\n\t\tcards.concat cs\n\tend",
"def append(cue)\n cue.serialize(@fps)\n @list << cue\n end",
"def add_stop_to_end(stops_array, new_stop)\n result = stops_array.push(new_stop)\n return result\nend",
"def get_cartridge_array\n cs = Array.new\n\n cartridges.each do |c|\n cs << c.name\n end\n\n cs\n end",
"def add_card(card)\n \t@cards << card\n end",
"def initialize(input_arr = [])\n @internal_arr = []\n input_arr.each {|new_ele| add(new_ele)}\n\n end",
"def add card\n @cards.push card\n end",
"def add_to_array(array, item)\n array << item\nend"
]
| [
"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.48813173",
"0.48742673",
"0.48738602",
"0.48581028",
"0.48538783",
"0.4853162",
"0.4822832",
"0.48152483",
"0.4810821",
"0.4794508"
]
| 0.7951346 | 0 |
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 indent = 0)\n env.display(\"---\\nlogical:\")\n logical.yaml_display(env, options, colors, indent + 1)\n env.display(\"\\n---\\nphysical:\")\n physical.yaml_display(env, options, colors, indent + 1)\n end",
"def to_yaml\n # write yaml\n end",
"def yaml\n config = fetch(@variable, {})\n stringified = if config.respond_to?(:deep_stringify_keys)\n config.deep_stringify_keys\n else\n # TODO: remove when dropping rails 3 support\n # two level stringify for rails 3 compatibility\n config.stringify_keys.each_value(&:stringify_keys!)\n end\n stringified.to_yaml\n end",
"def to_yaml\n return @data.to_yaml\n end",
"def y(obj)\n puts obj.to_yaml\nend",
"def y(obj)\n puts obj.to_yaml\nend",
"def to_yaml\n longest_track_name_length =\n @tracks.keys.inject(0) do |max_length, name|\n (name.to_s.length > max_length) ? name.to_s.length : max_length\n end\n ljust_amount = longest_track_name_length + 7\n \n yaml = \"#{@name.to_s.capitalize}:\\n\"\n @tracks.keys.sort.each do |track_name|\n yaml += \" - #{track_name}:\".ljust(ljust_amount)\n yaml += \"#{@tracks[track_name].rhythm}\\n\"\n end\n \n return yaml\n end",
"def to_yaml\n @main.to_yaml\n end",
"def paml(x)\n\n puts(YAML.dump(x))\nend",
"def print_fixture\n values = columns.sort_by(&:name).each_with_object({}) do |column, memo|\n next if primary_key_column?(column)\n next if timestamp_column?(column)\n memo[column.name] = column.default || \"value\"\n end\n\n hash = { self.name.underscore => values }\n puts hash.to_yaml\n nil\n end",
"def to_yaml()\n @var_set.values.to_yaml\n end",
"def array_printer(array)\n array.each do | language |\n puts \"Language: #{language.name} | Age: #{language.age} | Type System: #{language.type}\"\n end\nend",
"def inspect\n properties.to_yaml\n end",
"def to_yaml\n to_h.to_yaml\n end",
"def to_yaml\n\t\t\[email protected]{|entry| { :vtresult => entry } }.to_yaml\n\t\tend",
"def to_yaml\n dump(:x)\n end",
"def yaml\n @config.to_yaml\n end",
"def to_s\n @content.to_yaml(:indentation => 4)\n end",
"def to_yaml\n to_hash.to_yaml\n end",
"def to_yaml\n to_h.to_yaml\n end",
"def to_yaml_s\n fail '@key is empty' if \"#{@key}\".empty?\n\n x = \"=== #{@key} ===\\n\"\n x += \"#{(description || 'FIXME: NO DESCRIPTION GIVEN')}\\n\"\n\n # comment every line that describes the item:\n x = x.each_line.map{ |y| \"# #{y}\" }.join\n\n # add yaml (but stripped of frontmatter and first indent)\n # TODO: should we be using SafeYAML? http://danieltao.com/safe_yaml/\n x += { @key => @value }.to_yaml.gsub(/^---\\s*\\n/m, '').gsub(/^ /, '' )\n x += \"\\n\"\n\n if @skip_yaml\n x.gsub( /^/, '### ' )\n else\n x\n end\n end",
"def to_yaml\n self.to_h.to_yaml\n end",
"def to_yaml\n self.to_h.to_yaml\n end",
"def dump_file(array)\n # flush to YAML file\n File.open(File.dirname(__FILE__) + \"/ars_dump.yml\", \"a\") do |file|\n puts \"review_buffer: #{array.size} || reviews: #{self.reviews.size} || page_count: #{self.limit_count}\"\n array.each do |review|\n file.puts YAML::dump(review)\n end\n end\n end",
"def minimal_yaml(prop, spaces)\n [\n \"#{Google::StringUtils.underscore(prop.name)}:\",\n indent(\n [\n 'description:',\n # + 8 to compensate for name + description.\n indent(bullet_lines(prop.description, spaces + 8), 4)\n ], 4\n )\n ]\n end",
"def print(arr_name)\n\ti = 0\n\twhile i < arr_name.length \n\t\tputs \"#{i+1}: #{arr_name[i][:names]} (#{arr_name[i][:cohort]} cohort), #{arr_name[i][:hobbies]} hobbies\"\n\t\ti += 1\n\tend\nend",
"def to_s\n puts @name\n puts @vcenter.to_yaml\n puts @components.to_yaml\n puts @nodenameconvention.to_yaml\n end",
"def show(arr, desc)\n printf \"%20s:\", desc;\n arr.each { |v| printf \" %d\", v }\n printf \"\\n\";\nend"
]
| [
"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.6012175",
"0.6011247",
"0.59982306",
"0.59982306",
"0.5996812",
"0.59927315",
"0.59869224",
"0.5975874",
"0.593459"
]
| 0.7932858 | 0 |
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_error(&block)\n @@error_block = block\n end",
"def errback(&block)\n super do |*args|\n safe_deferrable_block(*args, &block)\n end\n end",
"def on_error(&block)\n block_given? ? @_on_error = block : @_on_error\n end",
"def on_error(&block)\n block_given? ? @_on_error = block : @_on_error\n end",
"def on_error(&block)\n block_given? ? @_on_error = block : @_on_error\n end",
"def safely(&block)\r\n begin\r\n yield\r\n rescue Exception => e\r\n if e.message =~ /connection was aborted/\r\n puts \" [yp searcher] Error: #{e} #{e.message}. Continuing.\"\r\n end\r\n end\r\n end",
"def capture(&block)\n if block\n begin\n block.call\n rescue Error => e\n raise # Don't capture Opbeat errors\n rescue Exception => e\n self.captureException(e)\n raise\n end\n else\n # Install at_exit hook\n at_exit do\n if $!\n logger.debug \"Caught a post-mortem exception: #{$!.inspect}\"\n self.capture_exception($!)\n end\n end\n end\n end",
"def safe_call# (&block)\n yield\n rescue Sunra::Utils::Recording::DBProxy::DBProxyError,\n Sunra::Recording::RecorderManager::RecorderError,\n APIError => e\n _error e\n end",
"def try_operation(&block)\n log = \"\"\n begin\n yield(log)\n rescue Exception => e\n log << e.message + '\\n'\n success = false\n return success, log\n end\nend",
"def render_or_pass(&block)\n begin yield\n rescue Exception => e\n logger.error e.message\n pass\n end\n end",
"def try(&block)\n begin\n yield\n rescue Errno::ETIMEDOUT, Timeout::Error, Net::HTTPNotFound\n log \"Connection Error\"\n rescue Exception => exc\n log exc.message\n log exc.backtrace\n end\n end",
"def catch_simple\n begin\n yield\n rescue => e\n Rails.logger.info e.message\n end\n end",
"def on_error(&block)\n if block_given?\n @on_error = block\n self\n else\n @on_error\n end\n end",
"def try &bk\n yield\n rescue Exception => ex\n ex\n end",
"def with_error_handling\n yield\n rescue => error\n report_error(error)\n Process.exit(false)\n end",
"def yield_rescued\n begin\n yield\n rescue Exception => e\n MONITORING_LOG.error e\n end\n end",
"def errback &block\n super\n end",
"def errback &block\n super\n end",
"def do_yield(&block)\n begin\n block.call\n rescue Exception => e\n puts \"Exception! #{e.to_s}\"\n Rails.logger.error \"Caught exception: #{e.to_s}\"\n raise e\n end\n end",
"def on_error(&block)\n @on_error = block\n end",
"def log_error(&block)\n return if @logger.nil?\n @logger.error(yield)\n end",
"def on_error(&a_proc)\n @@error_block = a_proc\n end",
"def wrap\n old_enabled, old_inline = enabled, inline\n self.inline = false\n self.enabled = true\n yield\n rescue Exception => ex\n if ex.should_intercept?\n enter_exception(ex)\n else\n raise ex\n end\n ensure\n self.enabled = old_enabled\n self.inline = old_inline\n end",
"def error_hander\n @error_block\n end",
"def log_on_error\n begin\n yield if block_given?\n rescue Exception => e\n logger.error \"IronNails Error: #{e}\"\n raise e\n end\n end",
"def regardless(&block)\n yield\nrescue\nend",
"def on_error(&block)\n @error_handler = block\n end",
"def error(&block)\n @runner.set_error(@current_platform, block)\n end"
]
| [
"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.62969583",
"0.62910354",
"0.6264089",
"0.6248386",
"0.62417674",
"0.62337244",
"0.6229561",
"0.6213045",
"0.62071854"
]
| 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 end\n\n begin\n url = \"#{DOMAIN}/#{ORG}/#{APP}/users/#{username}\"\n response = RestClient.get(url, \"Authorization\" => \"Bearer #{access_token}\", content_type: :json, accept: :json)\n res = JSON.parse(response.body)\n p res[\"entities\"]\n rescue => e\n puts e.response\n end\n end",
"def user(id)\n self.class.get(\"/user/#{id}\", @options).parsed_response\n end",
"def show\n\t\t@user = User.find(params[:id]) rescue nil\n\t\tif @user\n\t\t\tapi_response(@user, 'User Details', :ok)\n\t\telse\n\t\t\tapi_response(nil, 'User id not present in the database', :bad_request)\n\t\tend\n\tend",
"def show\n @user = UserService.getUserById(params[:id])\n end",
"def get_user_info\n get(\"/api/v1/oauth_user_info.json\")\n end",
"def get_user(user_id:)\n parse(JSON.parse(connection.get(\"users/#{user_id}\").body))\n end",
"def user_info\n @user = @github.users.get user: params[:username]\n render json: Hash[@user]\n end",
"def retrieve(user_id:)\n User.new get_request(\"users/#{user_id}\").body.dig(\"user\")\n end",
"def user(user_id)\n response = connection.get do |req|\n req.url \"/user/#{user_id}\", simple_params\n end\n response.body[0]\n end",
"def show(id)\n response = request(:get, \"/users/#{id}.json\")\n response[\"user\"]\n end",
"def user_info\n response = from_server \"api/user.json\"\n response.data\n end",
"def show_user(id)\n BrickFTP::API::User.find(id)\n end",
"def show_user(id)\n BrickFTP::API::User.find(id)\n end",
"def show\n # loads one user in the database\n @user = User.find(params[:id])\n end",
"def user(user_id, params = {})\n make_get_request(\"/users/#{user_id}\", params)\n end",
"def show\n render json: get_full_user_details(user), status: :ok\n rescue => e\n log_and_render_users_controller_error(e, \"get user details failed\")\n end",
"def fetch_latest_user_info\n\t\t@user_info = @client.execute(api_method: @info.userinfo.get).data\n\tend",
"def get_user_data\n @user = User.find(params[:id])\n end",
"def fetch_one_user_data\n get_url(\"/api/v1/users/#{@filter}\")\n end",
"def user\n UserRepository.find(user_id)\n end",
"def user(username_or_id)\n puts \"Getting Info about User %s\" % username_or_id.to_s\n begin\n u = @MT.user(username_or_id)\n string_data = {\n :name => u.name,\n :screen_name => u.screen_name,\n :location => u.location,\n :description => u.description,\n :url => u.url \n }\n user_data = {\n :id => u.id,\n :followers_count => u.followers_count,\n :friends_count => u.friends_count,\n :protected => u.protected,\n :listed_count => u.listed_count,\n :created_at => u.created_at,\n :favourites_count => u.favourites_count,\n :utc_offset => u.utc_offset,\n :time_zone => u.time_zone,\n :geo_enabled => u.geo_enabled,\n :verified => u.verified,\n :statuses_count => u.statuses_count,\n :lang => u.lang,\n :is_translator => u.is_translator\n }\n string_data.each { |k,v| v.nil? ? (user_data[k] = nil) : (user_data[k] = v) }\n user_data\n rescue Twitter::Error::Unauthorized, Twitter::Error::Forbidden, Twitter::Error::NotFound\n puts \"Suspended?\"\n nil\n end\n end",
"def get_user(id)\n conn = @client.get do |req|\n req.url \"/api/v2/user/#{id}\"\n req.headers[\"Authorization\"] = @token\n end\n conn.body\n end",
"def get_user id, options={}, headers={}\n @connection.get \"users/#{id}.json\", options, headers\n end",
"def user_information(username)\n response = get \"v1/market/user:#{username}.json\"\n response[:user]\n end",
"def get_user\n @user = User.find(params[:user_id])\n end",
"def fetch_user\n @user = User.using_client_shard(client: @client).get_from_memcache(@user_id)\n @user_token_sale_state = @user.get_token_sale_state_page_name\n end",
"def get_info(user_name)\n uri = create_api_uri(@@base_uri, user_name, 'getInfo')\n return get(uri)\n end",
"def get_user(id)\n @client.raw('get', \"/config/users/#{id}\")\n end"
]
| [
"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.7243566",
"0.7229663",
"0.7229298",
"0.71924925",
"0.71799123",
"0.71700484",
"0.7159798",
"0.7129957",
"0.7127818",
"0.711749"
]
| 0.7795002 | 1 |
Consumes an input array and returns a balanced binary tree. | def build_tree(input_array)
sorted_set = input_array.sort.uniq
build_tree_aux(sorted_set, 0, sorted_set.length - 1)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def array_to_binary(arr)\n node = Node.new(arr[0])\n arr.slice(1..-1).each {|el| insert_into_tree(node, el) }\n node\nend",
"def build_tree(array)\n return nil if array.empty?\n\n mid = (array.length - 1) / 2\n node = Node.new(array[mid])\n node.left = build_tree(array[0...mid])\n node.right = build_tree(array[mid+1..-1])\n node\n end",
"def make_binary_tree(sorted_array)\n if sorted_array.length == 0\n return nil\n elsif sorted_array.length == 1\n return TreeNode.new(sorted_array[0])\n end\n divide_index = sorted_array.length / 2\n tree_node = TreeNode.new(sorted_array[divide_index])\n tree_node.left = make_binary_tree(sorted_array[0..divide_index-1])\n tree_node.right = make_binary_tree(sorted_array[divide_index+1..sorted_array.length-1])\n return tree_node\nend",
"def balanced_binary_with_sorted_array(arr, min, max)\n return nil if min > max\n mid = (min + max) / 2\n # Always passes the next middle as next root, so the tree stays balanced.\n root = TreeNode.new(arr[mid])\n root.left = balanced_binary_with_sorted_array(arr, min, mid - 1)\n root.right = balanced_binary_with_sorted_array(arr, mid + 1, max)\n root\n end",
"def build_tree(array)\n return nil if array.empty?\n \n middle = (array.size - 1) / 2\n root_node = Node.new(array[middle])\n \n root_node.left = build_tree(array[0...middle])\n root_node.right = build_tree(array[(middle + 1)..-1])\n \n root_node\n end",
"def build_tree(array)\n tree = TreeNode.new(array[0], 0)\n (1..array.length-1).each {|i|\n insert_into_tree(tree, array[i], i)\n }\n tree\nend",
"def build_tree(sorted_array)\n return if sorted_array.length.zero?\n\n return Node.new(sorted_array[0]) if sorted_array.length == 1\n\n midpoint = (sorted_array.length - 1) / 2\n subtree_root = Node.new(sorted_array[midpoint])\n # Don't include the root in the left subtree.\n subtree_root.left = build_tree(sorted_array[0...midpoint])\n subtree_root.right = build_tree(sorted_array[midpoint + 1..-1])\n\n subtree_root\n end",
"def build_tree(array)\n\t\t@root = Node.new(array.shift)\n\t\tarray.each { |value| add_node(value, @root)}\n\tend",
"def build_tree(array)\n array.sort!.uniq!\n left = 0\n right = array.length\n\n return build_driver(array, left, right)\n end",
"def build_tree(arr)\n #take array, turn into bt with node objs\n return nil if arr.empty?\n\n mid = (arr.size - 1)/2\n current_node = Node.new(arr[mid])\n\n current_node.left = build_tree(arr[0...mid])\n current_node.right = build_tree(arr[(mid+1)..-1])\n \n current_node\n end",
"def build_tree(array)\n\t\t@root_node = Node.new(array[array.length / 2])\n\t\tarray[array.length / 2] = nil\n\t\tcounter = 0\n\t\tuntil counter == array.length\n\t\t\tset_value(array[counter], @root_node) if array[counter] != nil\n\t\t\tcounter += 1\n\t\tend\n\n\tend",
"def array_to_bst(array, l, r, parent=nil, d=1)\n return if l > r\n mid = (l + r)/2\n node = Node.new(array[mid], nil, nil, nil, d)\n node.l = array_to_bst(array, l, mid - 1, node, d + 1)\n node.r = array_to_bst(array, mid + 1, r, node, d + 1)\n node.parent = parent\n node\n end",
"def build_tree_arbitrary(arr)\n node = Node.new(arr[0])\n queue = [node]\n @root = node\n i = 0\n\n until queue.empty?\n node = queue.shift\n children = node_children(node, i, arr)\n queue.concat(children)\n i += 2\n end\n end",
"def produce_tree(ary); end",
"def build_tree(arr)\n @root = insert_node(nil, arr.shift)\n arr.each { |value| insert_node(@root, value) }\n end",
"def buildTree(node,arr)\n node.value = arr.shift\n size = (arr.size/2.0).round\n if size > 0\n left, right = arr.each_slice( size ).to_a\n if left and left.count > 0\n node.left = TreeNode.new\n buildTree(node.left, left)\n end\n if right and right.count > 0\n node.right = TreeNode.new\n buildTree(node.right, right)\n end\n end\nend",
"def build_tree(arr)\n\tend",
"def build_tree array\n\t\t@root = Node.new(array.shift)\n\t\tparent = @root\n\t\tarray.each do |el|\n\t\t\twhile true\n\t\t\t\tif el <= parent.value\n\t\t\t\t\tif parent.left_child.nil?\n\t\t\t\t\t\tparent.left_child = Node.new(el,parent)\n\t\t\t\t\t\tbreak\n\t\t\t\t\telse\n\t\t\t\t\t\tparent = parent.left_child\n\t\t\t\t\tend\n\t\t\t\telsif el > parent.value\n\t\t\t\t\tif parent.right_child.nil?\n\t\t\t\t\t\tparent.right_child = Node.new(el,parent)\n\t\t\t\t\t\tbreak\n\t\t\t\t\telse\n\t\t\t\t\t\tparent = parent.right_child\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend",
"def build_tree(ary)\n # If the array is sorted, the tree will not be balanced\n ary.shuffle!\n ary.each { |item| insert(item) }\n end",
"def build_tree(array)\n\t\t@root = Node.new(array[0])\n\t\ttemp_root = @root\n\n\t\tarray[1..-1].each do |node_value|\n\t\t\tinsert_node(node_value, temp_root)\n\t\tend\n\tend",
"def build_tree(arr)\n @root = Node.new(arr.shift)\n arr.each { |data| insert_data(data, @root) }\n end",
"def construct_tree(arr)\n root = TreeNode.new(arr.shift)\n xtd = [root]\n while !xtd.empty? && !arr.empty?\n cur_node = xtd.shift\n a, b = arr.shift(2) # doesn't matter if arr.size < 2. in this case, a, b might be nil\n cur_node.left = a.nil? ? nil : TreeNode.new(a)\n cur_node.right = b.nil? ? nil : TreeNode.new(b)\n xtd << cur_node.left unless cur_node.left.nil?\n xtd << cur_node.right unless cur_node.right.nil?\n end\n root\nend",
"def build_tree( arr, first_index = 0, last_index = arr.length - 1 )\n return nil if first_index > last_index\n \n middle_of_array = (first_index + last_index)/2\n \n root = Node.new(arr[middle_of_array])\n \n root.left_child = build_tree(arr, first_index, middle_of_array - 1)\n root.right_child = build_tree(arr, middle_of_array + 1, last_index)\n \n return root \n end",
"def build_tree(array)\n first_node = Node.new(nil, nil, array[0])\n this_node = first_node\n i = 1\n\n finished = false\n while !finished\n if array[i] == nil\n finished = true\n elsif array[i] < this_node.data\n if this_node.left_child == nil\n this_node.left_child = Node.new(nil, nil, array[i])\n this_node = first_node\n i += 1\n else\n this_node = this_node.left_child\n end\n elsif array[i] > this_node.data\n if this_node.right_child == nil\n this_node.right_child = Node.new(nil, nil, array[i])\n this_node = first_node\n i += 1\n else\n this_node = this_node.right_child\n end \n elsif array[i] == this_node.data\n i += 1\n end\n end\n return first_node\nend",
"def minimal_tree(array)\n raise \"Please enter an array of at least one element\" if array.empty?\n\n midpoint = array.length/2\n root = BinaryTreeNode.new(array[midpoint])\n\n add_node = lambda do |left, right|\n return if left > right\n\n mid = left + (right-left) / 2\n\n node = BinaryTreeNode.new(array[mid])\n\n node.left = add_node.call(left, mid - 1)\n node.right = add_node.call(mid + 1, right)\n\n node\n end\n\n root.left = add_node.call(0, midpoint - 1)\n root.right = add_node.call(midpoint + 1, array.length - 1)\n\n root\nend",
"def create_bst(sorted_arr)\n\n return nil if sorted_arr.length == 0\n return BinaryNode.new(sorted_arr[0]) if sorted_arr.length == 1\n if sorted_arr.length == 2\n child = BinaryNode.new(sorted_arr[0])\n parent = BinaryNode.new(sorted_arr[1])\n parent.left = child\n return parent\n end\n\n middle = sorted_arr.length / 2\n left_start = 0\n left_end = (sorted_arr.length / 2) - 1\n right_start = left_end + 2\n right_end = sorted_arr.length\n\n cur_root = BinaryNode.new(sorted_arr[middle])\n cur_root.left = create_bst(sorted_arr[left_start..left_end])\n cur_root.right = create_bst(sorted_arr[right_start..right_end])\n\n return cur_root\n\nend",
"def build_tree(data_array)\n @root = nil # overwrites tree, even if array is empty\n data_array.each_with_index do |data, index|\n if index == 0\n @root = Node.new(data)\n else\n set_next_node(data)\n end\n end\n end",
"def build_tree_from_unsorted(arr)\n return nil if arr.empty?\n @root = Node.new(arr.shift)\n\n until arr.empty?\n child_node = Node.new(arr.shift)\n assign_children(@root, child_node)\n end\n end",
"def build_tree(arr)\n if arr.empty?\n return nil\n end\n\n mid = arr.length/2\n root = Node.new(arr[mid])\n\n root.left = build_tree(arr[0...mid])\n root.right = build_tree(arr[(mid+1)..-1])\n\n root\nend",
"def build_tree_from_sorted(arr)\n return nil if arr.empty?\n left, right, middle = get_left_right_middle(arr)\n @root = Node.new(middle)\n make_children(@root, left)\n make_children(@root, right)\n end"
]
| [
"0.7178468",
"0.7052835",
"0.6953921",
"0.69506204",
"0.6894124",
"0.68749267",
"0.68042964",
"0.6784026",
"0.67772186",
"0.67171127",
"0.66846347",
"0.66815245",
"0.6665387",
"0.6660863",
"0.6652068",
"0.66337943",
"0.65953887",
"0.65851086",
"0.6578991",
"0.65423375",
"0.6517616",
"0.6513462",
"0.65122753",
"0.6433106",
"0.641883",
"0.6392821",
"0.6388658",
"0.6373657",
"0.6359865",
"0.63455546"
]
| 0.7092395 | 1 |
POST /barks or /barks.json | def create
@bark = current_user.barks.build(bark_params)
respond_to do |format|
if @bark.save
format.html { redirect_to root_path, notice: "Bark was successfully created." }
format.json { render :show, status: :created, location: @bark }
else
format.html { render :new, status: :unprocessable_entity }
format.json { render json: @bark.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @barrack = Barrack.new(params[:barrack])\n\n respond_to do |format|\n if @barrack.save\n format.html { redirect_to @barrack, notice: 'Barrack was successfully created.' }\n format.json { render json: @barrack, status: :created, location: @barrack }\n else\n format.html { render action: \"new\" }\n format.json { render json: @barrack.errors, status: :unprocessable_entity }\n end\n end\n end",
"def bark_params\n params.require(:bark).permit(:bark)\n end",
"def create\n @barn = Barn.new(barn_params)\n\n respond_to do |format|\n if @barn.save\n format.html { redirect_to @barn, notice: 'Barn was successfully created.' }\n format.json { render :show, status: :created, location: @barn }\n else\n format.html { render :new }\n format.json { render json: @barn.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @barrack = Barrack.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @barrack }\n end\n end",
"def create\n @bok = Bok.new(bok_params)\n\n respond_to do |format|\n if @bok.save\n format.html { redirect_to @bok, notice: 'Bok was successfully created.' }\n format.json { render :show, status: :created, location: @bok }\n else\n format.html { render :new }\n format.json { render json: @bok.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @non_smoking_bar = NonSmokingBar.new(params[:non_smoking_bar])\n\n respond_to do |format|\n if @non_smoking_bar.save\n format.html { redirect_to root_url, notice: 'Successfully created.' }\n format.json { render json: @non_smoking_bar, status: :created, location: @non_smoking_bar }\n else\n format.html { render action: \"new\" }\n format.json { render json: @non_smoking_bar.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @kb = Kb.new(params[:kb])\n\n respond_to do |format|\n if @kb.save\n format.html { redirect_to @kb, :notice => 'Kb was successfully created.' }\n format.json { render :json => @kb, :status => :created, :location => @kb }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @kb.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @bbhk = Bbhk.new(bbhk_params)\n\n respond_to do |format|\n if @bbhk.save\n format.html { redirect_to @bbhk, notice: 'Bbhk was successfully created.' }\n format.json { render action: 'show', status: :created, location: @bbhk }\n else\n format.html { render action: 'new' }\n format.json { render json: @bbhk.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bark.update(bark_params)\n format.html { redirect_to @bark, notice: \"Bark was successfully updated.\" }\n format.json { render :show, status: :ok, location: @bark }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @bark.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bar42 = Bar42.new(bar42_params)\n\n respond_to do |format|\n if @bar42.save\n format.html { redirect_to @bar42, notice: \"Bar42 was successfully created.\" }\n format.json { render :show, status: :created, location: @bar42 }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @bar42.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bar = Bar.new(bar_params)\n\n respond_to do |format|\n if @bar.save\n format.html { redirect_to @bar, notice: 'Bar was successfully created.' }\n format.json { render :show, status: :created, location: @bar }\n else\n format.html { render :new }\n format.json { render json: @bar.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bar82 = Bar82.new(bar82_params)\n\n respond_to do |format|\n if @bar82.save\n format.html { redirect_to @bar82, notice: \"Bar82 was successfully created.\" }\n format.json { render :show, status: :created, location: @bar82 }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @bar82.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @barn = Barn.new(params[:barn])\n\n respond_to do |format|\n if @barn.save\n BarnConfiguration.create_default(@barn)\n format.html { redirect_to '/barns/'[email protected]_s+'/controller_admins/new' }\n format.json { render json: @barn, status: :created, location: @barn }\n else\n format.html { render action: \"new\" }\n format.json { render json: @barn.errors, status: :unprocessable_entity }\n end\n end\n end",
"def api_post(action, data, binary_key = nil)\n api_request(action, data, 'POST', binary_key)\n end",
"def bar_params\n params.require(:bar).permit(:widget, :sprocket, :crank)\n end",
"def create\n @boat = Boat.new(boat_params)\n\n if @boat.save\n render json: @boat, status: :created, location: @boat\n else\n render json: @boat.errors, status: :unprocessable_entity\n end\n end",
"def create\n @kingsizeb = Kingsizeb.new(kingsizeb_params)\n\n respond_to do |format|\n if @kingsizeb.save\n format.html { redirect_to @kingsizeb, notice: 'Kingsizeb was successfully created.' }\n format.json { render :show, status: :created, location: @kingsizeb }\n else\n format.html { render :new }\n format.json { render json: @kingsizeb.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @barco = Barco.new(barco_params)\n\n respond_to do |format|\n if @barco.save\n format.html { redirect_to @barco, notice: 'Barco was successfully created.' }\n format.json { render action: 'show', status: :created, location: @barco }\n else\n format.html { render action: 'new' }\n format.json { render json: @barco.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bike_rack = BikeRack.new(bike_rack_params)\n\n respond_to do |format|\n if @bike_rack.save\n flash[:success] = 'Bike rack was successfully created.'\n format.html { redirect_to @bike_rack }\n format.json { render :show, status: :created, location: @bike_rack }\n else\n flash[:danger] = 'There was a problem with creating Bike rack.'\n format.html { render :new }\n format.json { render json: @bike_rack.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\tboat = Boat.new(boat_params)\n \tif boat.save\n \t\trender json: boat, status: 201\n \tend\n\tend",
"def post(path, data = {})\n request 'POST', path, body: data.to_json\n end",
"def create\n @baz42 = Baz42.new(baz42_params)\n\n respond_to do |format|\n if @baz42.save\n format.html { redirect_to @baz42, notice: \"Baz42 was successfully created.\" }\n format.json { render :show, status: :created, location: @baz42 }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @baz42.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_bark\n @bark = Bark.find(params[:id])\n end",
"def create\n @bar8 = Bar8.new(bar8_params)\n\n respond_to do |format|\n if @bar8.save\n format.html { redirect_to @bar8, notice: \"Bar8 was successfully created.\" }\n format.json { render :show, status: :created, location: @bar8 }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @bar8.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bar18 = Bar18.new(bar18_params)\n\n respond_to do |format|\n if @bar18.save\n format.html { redirect_to @bar18, notice: \"Bar18 was successfully created.\" }\n format.json { render :show, status: :created, location: @bar18 }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @bar18.errors, status: :unprocessable_entity }\n end\n end\n end",
"def api_post(path, data = {})\n api_request(:post, path, :data => data)\n end",
"def create\n @baz94 = Baz94.new(baz94_params)\n\n respond_to do |format|\n if @baz94.save\n format.html { redirect_to @baz94, notice: \"Baz94 was successfully created.\" }\n format.json { render :show, status: :created, location: @baz94 }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @baz94.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @boook = Boook.new(boook_params)\n\n respond_to do |format|\n if @boook.save\n format.html { redirect_to @boook, notice: 'Boook was successfully created.' }\n format.json { render :show, status: :created, location: @boook }\n else\n format.html { render :new }\n format.json { render json: @boook.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_tenant_circle(args = {}) \n post(\"/tenantcircles.json/\", args)\nend",
"def create\n @brave_burst = BraveBurst.new(brave_burst_params)\n\n respond_to do |format|\n if @brave_burst.save\n format.html { redirect_to @brave_burst, notice: 'Brave burst was successfully created.' }\n format.json { render action: 'show', status: :created, location: @brave_burst }\n else\n format.html { render action: 'new' }\n format.json { render json: @brave_burst.errors, status: :unprocessable_entity }\n end\n end\n end"
]
| [
"0.64246625",
"0.6424445",
"0.6054478",
"0.5923874",
"0.5910778",
"0.59107625",
"0.5903337",
"0.5902356",
"0.5887644",
"0.5884899",
"0.585661",
"0.58294487",
"0.5823725",
"0.57541114",
"0.5738117",
"0.57277936",
"0.5719391",
"0.56941056",
"0.5692517",
"0.5685203",
"0.56814486",
"0.5677195",
"0.56604195",
"0.5653917",
"0.56491333",
"0.56197983",
"0.5599463",
"0.5594438",
"0.5589474",
"0.5580617"
]
| 0.68822765 | 0 |
PATCH/PUT /barks/1 or /barks/1.json | def update
respond_to do |format|
if @bark.update(bark_params)
format.html { redirect_to @bark, notice: "Bark was successfully updated." }
format.json { render :show, status: :ok, location: @bark }
else
format.html { render :edit, status: :unprocessable_entity }
format.json { render json: @bark.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @barrack = Barrack.find(params[:id])\n\n respond_to do |format|\n if @barrack.update_attributes(params[:barrack])\n format.html { redirect_to @barrack, notice: 'Barrack was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @barrack.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bar42.update(bar42_params)\n format.html { redirect_to @bar42, notice: \"Bar42 was successfully updated.\" }\n format.json { render :show, status: :ok, location: @bar42 }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @bar42.errors, status: :unprocessable_entity }\n end\n end\n end",
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"def update\n respond_to do |format|\n if @bar.update(bar_params)\n format.html { redirect_to @bar, notice: 'Bar was successfully updated.' }\n format.json { render :show, status: :ok, location: @bar }\n else\n format.html { render :edit }\n format.json { render json: @bar.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bar22.update(bar22_params)\n format.html { redirect_to @bar22, notice: \"Bar22 was successfully updated.\" }\n format.json { render :show, status: :ok, location: @bar22 }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @bar22.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @baz42.update(baz42_params)\n format.html { redirect_to @baz42, notice: \"Baz42 was successfully updated.\" }\n format.json { render :show, status: :ok, location: @baz42 }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @baz42.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @barco.update(barco_params)\n format.html { redirect_to @barco, notice: 'Barco was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @barco.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bar18.update(bar18_params)\n format.html { redirect_to @bar18, notice: \"Bar18 was successfully updated.\" }\n format.json { render :show, status: :ok, location: @bar18 }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @bar18.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bar8.update(bar8_params)\n format.html { redirect_to @bar8, notice: \"Bar8 was successfully updated.\" }\n format.json { render :show, status: :ok, location: @bar8 }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @bar8.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @baristum.update(baristum_params)\n format.html { redirect_to @baristum, notice: 'Baristum was successfully updated.' }\n format.json { render :show, status: :ok, location: @baristum }\n else\n format.html { render :edit }\n format.json { render json: @baristum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @boat.update(boat_params)\n head :no_content\n else\n render json: @boat.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @bar34.update(bar34_params)\n format.html { redirect_to @bar34, notice: \"Bar34 was successfully updated.\" }\n format.json { render :show, status: :ok, location: @bar34 }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @bar34.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bar77.update(bar77_params)\n format.html { redirect_to @bar77, notice: \"Bar77 was successfully updated.\" }\n format.json { render :show, status: :ok, location: @bar77 }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @bar77.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @boook.update(boook_params)\n format.html { redirect_to @boook, notice: 'Boook was successfully updated.' }\n format.json { render :show, status: :ok, location: @boook }\n else\n format.html { render :edit }\n format.json { render json: @boook.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @foobar = Foobar.find(params[:id])\n\n respond_to do |format|\n if @foobar.update_attributes(params[:foobar])\n format.html { redirect_to @foobar, notice: 'Foobar was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @foobar.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @baz1.update(baz1_params)\n format.html { redirect_to @baz1, notice: \"Baz1 was successfully updated.\" }\n format.json { render :show, status: :ok, location: @baz1 }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @baz1.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bar76.update(bar76_params)\n format.html { redirect_to @bar76, notice: \"Bar76 was successfully updated.\" }\n format.json { render :show, status: :ok, location: @bar76 }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @bar76.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bar74.update(bar74_params)\n format.html { redirect_to @bar74, notice: \"Bar74 was successfully updated.\" }\n format.json { render :show, status: :ok, location: @bar74 }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @bar74.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(&block)\n validate_request()\n\n # Params includes all of the PATCH data at the top level along with other\n # other Rails-injected params like 'id', 'action', 'controller'. These\n # are harmless given no namespace collision and we're only interested in\n # the 'Operations' key for the actual patch data.\n #\n render(json: yield(self.safe_params()[:id], self.safe_params().to_hash()))\n end",
"def update\n respond_to do |format|\n if @bar81.update(bar81_params)\n format.html { redirect_to @bar81, notice: \"Bar81 was successfully updated.\" }\n format.json { render :show, status: :ok, location: @bar81 }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @bar81.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bar90.update(bar90_params)\n format.html { redirect_to @bar90, notice: \"Bar90 was successfully updated.\" }\n format.json { render :show, status: :ok, location: @bar90 }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @bar90.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bar84.update(bar84_params)\n format.html { redirect_to @bar84, notice: \"Bar84 was successfully updated.\" }\n format.json { render :show, status: :ok, location: @bar84 }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @bar84.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @foobar.update(foobar_params)\n format.html { redirect_to @foobar, notice: 'Foobar was successfully updated.' }\n format.json { render :show, status: :ok, location: @foobar }\n else\n format.html { render :edit }\n format.json { render json: @foobar.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bar80.update(bar80_params)\n format.html { redirect_to @bar80, notice: \"Bar80 was successfully updated.\" }\n format.json { render :show, status: :ok, location: @bar80 }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @bar80.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bar30.update(bar30_params)\n format.html { redirect_to @bar30, notice: \"Bar30 was successfully updated.\" }\n format.json { render :show, status: :ok, location: @bar30 }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @bar30.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def update # PATCH\n raise NotImplementedError\n end",
"def update\n respond_to do |format|\n if @baz8.update(baz8_params)\n format.html { redirect_to @baz8, notice: \"Baz8 was successfully updated.\" }\n format.json { render :show, status: :ok, location: @baz8 }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @baz8.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end",
"def update\n @kb = Kb.find(params[:id])\n\n respond_to do |format|\n if @kb.update_attributes(params[:kb])\n format.html { redirect_to @kb, :notice => 'Kb was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @kb.errors, :status => :unprocessable_entity }\n end\n end\n end"
]
| [
"0.66103864",
"0.6525338",
"0.6412469",
"0.63037306",
"0.6233765",
"0.62271506",
"0.62136483",
"0.62129813",
"0.61933815",
"0.61432594",
"0.6134164",
"0.61065763",
"0.6066356",
"0.6062231",
"0.6054456",
"0.60389256",
"0.6028534",
"0.6025036",
"0.6017557",
"0.60162574",
"0.6016005",
"0.6011613",
"0.6004887",
"0.6000888",
"0.5990169",
"0.59900934",
"0.597294",
"0.5972894",
"0.5959705",
"0.59548146"
]
| 0.67966646 | 0 |
takes a string preposistion and turns it into a 2d array ands of ors with id numbers + depending on negation | def string_to_internal(preposition)
temp_kb =Array.new
#string input of format literal_name LOGICAL_PREPOSISTION
preposition_array = preposition.split
next_negated = false
sentence = []
preposition_array.each do |word|
#####################################3
# puts " word: " + word
#don't need to handle "or" as long as it is in right format, will look to "and" and the end as limiters
if (word == "AND" || word == "and")
temp_kb << sentence
sentence = []
elsif(word == "NOT" || word == "not")
next_negated = true
elsif(word == "OR" || word =="or")
else
temp = @name_hash[word]
#add variable if doesnt exist
if(temp == nil)
temp_var = Literalzs.new(word,@total_variables)
@id_array.push(temp_var)
@name_hash[word] = @total_variables
temp = @total_variables
@total_variables+=1
end
if(next_negated)
temp = temp.to_i * -1
#########################################################3333
#puts " temp negated, now is: " + temp.to_s
next_negated = false
end
sentence << temp
end
end
#need to grab last sentence since it wont be ended with and
temp_kb << sentence
return temp_kb
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def contain_all_rots(strng, arr)\n array = strng.chars\n number = 0\n result = []\n (array.size - 1).times do \n array.rotate!\n result << array\n end\n result.map! {|y| y.join(\"\")}\n # result.all?{|x| arr.include?(x)}\nend",
"def convert_to_ar(str)\n bgn = 0\n cur = str[bgn]\n ar = []\n unless str.empty?\n str.length.times do |ind|\n next unless str[ind] != cur\n\n ar.append(str[bgn, ind - bgn])\n bgn = ind\n cur = str[ind]\n end\n ar.append(str[bgn, str.length])\n end\n ar\n end",
"def solution(str)\n str.scan(/.{1,2}/).map { |e| e[1].nil? ? e + '_' : e }\nend",
"def mask_array\n @mask.split('')\n end",
"def create_non_redundant_array(polyAs0,condition0,polyAs1,condition1,polyAs2,condition2,polyAs3,condition3)\n old_polyAs = (polyAs0 + polyAs1 + polyAs2 + polyAs3).uniq!\n polyAs = []\n for old_polyA in old_polyAs\n polyA = old_polyA + \"conditions=\"\n polyA = polyA + condition0 + \",\" if polyAs0.include?(old_polyA)\n polyA = polyA + condition1 + \",\" if polyAs1.include?(old_polyA)\n polyA = polyA + condition2 + \",\" if polyAs2.include?(old_polyA)\n polyA = polyA + condition3 + \",\" if polyAs3.include?(old_polyA)\n polyA.chomp!(\",\")\n polyAs << polyA\n end\n return polyAs\nend",
"def pig_it(string)\n string2 = string.split.map{|e|e == '!' || e == '?' ? e : e.to_s << (e[0]) }.join(' ')\n\n string3 = string2.split.map{|e|e == '!' || e == '?' ? e : e.to_s << 'ay'}.join(' ')\n\n string3.split.map{|e| e == '!' || e == '?' ? e : e = e[1..-1]}.join(' ')\nend",
"def word_to_coordinates(row_name, word)\n coordinates = []\n 5.times do |i|\n coordinates << \"#{row_name}#{i+1}\" if (word & (1 << i)) > 0\n end\n\n coordinates\n end",
"def get_and_or_not_of str\n # @param str is a string (not normalized!)\n # ie. ['big','OR','middle','OR','large','sandwich','NOT','cheese']\n # @returns and_phrases -- list of normalized words\n # @returns or_phrases -- list of lists of normalized words\n # @returns not_phrases -- list of normalized words\n # actually and_phrases is the same to or_phrases but in and_phrases\n # single words have replaced or-sublists\n \n r = str.split\n \n # returns or-words and indexes of already analyzed words\n def getOr_ r\n or_= []; del_ = []; cur = []\n status = :start\n x = 0\n while x < r.length do\n if r[x] == OR_OPERATOR\n if status == :start\n cur = [r[x-1]]\n status = :cont\n del_.push x-1\n end\n cur.push r[x+1]\n del_ += [x, x+1]\n x += 2\n else\n if status == :cont\n status = :start\n or_.push cur\n cur = []\n end\n x += 1\n end\n end\n if not cur.empty?\n or_.push cur\n end\n return or_, del_\n end\n \n def getAndNot_ r, skip\n and_ = []; not_ = []\n r.length.times do |x|\n if not skip.include?(x)\n # if previous or last (if x = 0) in array is NOT\n if r[x-1] == NOT_OPERATOR\n not_ |= [r[x]]\n elsif r[x] != NOT_OPERATOR\n and_ |= [r[x]]\n end\n end\n end\n return and_, not_\n end\n \n or_phrases, skip = getOr_ r\n and_phrases, not_phrases = getAndNot_ r, skip\n \n return normalize_list(and_phrases), normalize_list(or_phrases), normalize_list(not_phrases)\n end",
"def make_pyramid_array(str)\n str.split(\"\\n\").map { |line| line.split(' ').map { |ch| ch.to_i } }.reverse\nend",
"def contain_all_rots(strng, arr)\n i = 0\n empty = []\n\n if strng.length == 0\n return true\n elsif strng.length > 0\n array = strng.split('')\n\n (0...strng.length).each {|num|\n rotate = array.rotate(num)\n joined_string = rotate.join('')\n\n i += 1 if arr.include?(joined_string)\n }\n end\n\n if i == strng.length\n return true\n else\n return false\n end\nend",
"def croon (string)\n second = []\n array = string.split.each { |i|\n second.push(i.split(//).join(\"-\"))\n }\n second.join(\" \")\nend",
"def toptag2array(str)\n sep = \"\\001\"\n str.gsub(/\\n([A-Za-z\\/\\*])/, \"\\n#{sep}\\\\1\").split(sep)\n end",
"def canolical(palabra)\n#convierte string a array y ordena las letras alfabeticamente\n palabra.split('').sort.join\nend",
"def split_input (input)\n return false if input == ''\n array_input = input.split('')\n row_input = convert_input(array_input[0].downcase)\n column_input = (array_input[1].to_i) - 1 if (/[\\d]/ === array_input[1])\n coordinate = Array.new([row_input, column_input])\n return coordinate\n end",
"def parse_mask(mask)\n and_mask = mask.gsub(\"X\", \"1\").to_i(2)\n or_mask = mask.gsub(\"X\", \"0\").to_i(2)\n\n [and_mask, or_mask]\nend",
"def transpose(string)\n arr = string.split(//)\n new_arr = ''\n\n i = 0\n while i < string.length\n if arr[i] == 'n' && arr[i - 1] == 'g'\n arr[i], arr[i - 1] = arr[i - 1], arr[i]\n i -= 2\n end\n i += 1\n end\n\n arr.each { |n| new_arr += n }\n new_arr\nend",
"def pseudoIsomorphicSubstrings(s)\n\n size = 1 # this show the current size of the set i\n graph = { 0 => {} } # representation of the set sequences\n sizes = []\n\n string_size = s.size\n matrix = []\n\n s_chars = s.chars\n \n s.size.times do |pi| # Si' : Prefix i\n matrix << []\n\n i = 0\n while i <= pi do\n matrix[pi] << s_chars[i..pi].join.ljust(string_size)\n i += 1\n end\n\n matrix[pi] = matrix[pi].join(' | ')\n end\n\n puts matrix\n\n sizes\nend",
"def pig_it(str)\r\n str.split.map { |w| w =~ /[a-z]/i ? w[1..-1] + w[0] + 'ay' : w }.join(' ')\r\nend",
"def string_to_matrix(string)\n to_nums(string.split(\"\\n\").map { |row| row.strip.split })\n end",
"def croon(string)\n arr = string.split(\" \")\n arr = arr.map do |word|\n \tword = word.split(\"\").join(\"-\")\n p word\n end\n arr.join(\" \")\n end",
"def array_from_string string\n # takes the string found when params tries to return an array, and reconstruct the array.\n array = string.split(/[^Q1234567890]+/)\n array.delete(\"\")\n array\n end",
"def experimental_layout(string, matrix)\n matrix.each_with_index do |row, idx|\n if row.include? string\n matrix = matrix[idx..(idx + 8)] \n # Removing rows and columns from 96 well format\n arr = matrix[1..matrix.length].map do |row|\n if string == 'sample_id_mat'\n row[1..row.length].map {|i| i.to_i}\n else\n row[1..row.length].map {|i| i}\n end\n end\n return arr\n end\n end\n end",
"def convert(s, num_rows)\n return s if num_rows == 1\n result = Array.new(num_rows) {Array.new}\n forward = false\n i = 0\n\n s.chars.each do |el|\n result[i] << el\n forward = !forward if i == num_rows - 1 || i == 0\n i += 1 if forward\n i -= 1 unless forward\n end\n\n result.flatten.join\nend",
"def get_letter_mask(array, valid_array)\n array = array.split(/[ ,\\.:;\\-+]/) if array.class != Array\n \n str = ''\n array.each do |word|\n word.upcase!\n next if word == 'AND'\n str += word[0].chr if valid_array.include? word[0].chr\n end\n return str\n end",
"def sentence_to_array (string)\n string_split = string.split('.')\n string_split.map! do |words|\n words.split('!') \n end\n string_split.flatten!\n\n string_split.map! do |words|\n words.split('?') \n end\n string_split.flatten\nend",
"def chess_coords_to_indices(coord_string)\n if m = coord_string.match(/(\\w)(\\d)/)\n col = m[1]\n row = m[2]\n\n columns = { a: 0, b: 1, c: 2, d: 3, e: 4, f: 5, g: 6, h: 7 }\n\n if ('a'..'h').include?(col) && (1..8).include?(row.to_i)\n [row.to_i - 1, columns[col.to_sym]]\n else\n false\n end\n else\n false\n end\n end",
"def array_from_rows(str)\n str.split(\"\\n\").map { |x| x.split(' ').map { |y| y.to_i } }\n end",
"def prediction_to_array(string)\n segments = []\n string.scan(/[io](\\d+)-(\\d+)/) do |m1, m2|\n segments << { :start => m1.to_i, :stop => m2.to_i }\n end\n segments\n end",
"def listify(str)\n str.split(/(~\\[\\w*\\])/).inject(List.new) do |list, s|\n if @cfg.nonterm s then\n list << s\n else\n # This also handles the s.empty? case.\n s.split('').each { |c| list << c }\n end\n list\n end\n end",
"def droppre s\n if s.select{|i|i=~/^# *!intermediate/}.size>0\n flag=false\n s.map{|i|\n i=~/^# *!intermediate/\n flag=true if $&\n flag ? i : nil\n }-[nil]\n else\n s\n end\n end"
]
| [
"0.5680787",
"0.5576906",
"0.5546782",
"0.554677",
"0.5517356",
"0.5515137",
"0.54760414",
"0.54503244",
"0.5427184",
"0.5394476",
"0.53865373",
"0.53825337",
"0.53650457",
"0.536414",
"0.53584665",
"0.53492194",
"0.5336559",
"0.5335094",
"0.5331078",
"0.53201073",
"0.5318915",
"0.5296759",
"0.52913076",
"0.52871895",
"0.5281065",
"0.5280245",
"0.5264741",
"0.52628434",
"0.52623194",
"0.52582175"
]
| 0.613412 | 0 |
turns the propositions to CNF(if needed) | def toCNF
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cnf\n r = []\n @table.each {|inputs, output|\n return output.to_s if inputs.empty?\n next if output\n term = []\n each_input(inputs) {|name, input|\n if input\n term << \"!#{name}\"\n else\n term << name\n end\n }\n if term.length == 1\n r << term.join('|')\n else\n r << \"(#{term.join('|')})\"\n end\n }\n return \"true\" if r.empty?\n r.join(' & ')\n end",
"def propositional_symbols\n symbols = []\n @classified.each do |el|\n symbols.push el if el.instance_of? Proposition\n end\n symbols\n end",
"def doProduction(lhs)\n if lhs == BNF.void\n progress(\"\\nvoid\")\n return\n end\n if lhs == BNF.eof\n progress( \"\\nEOF\")\n return\n end\n if lhs.is_a?(RDF::Literal)\n literalTerminals[lhs.value()] = 1\n return\n end\n\n branchDict = {}\n\n rhs = graph.first_object(:subject => lhs, :predicate => BNF.matches)\n if rhs\n chatty(\"\\nToken #{lhs} matches regexp #{rhs}\")\n tokenRegexps[lhs] = rhs.value\n\n cc = graph.query(:subject => lhs, :predicate => BNF.canStartWith)\n progress(recordError(\"No record of what token #{lhs} can start with\")) if cc.empty?\n cc.each {|statement| chatty(\" Can start with: #{statement.object}\")}\n return\n end\n \n rhs = graph.first_object(:subject => lhs, :predicate => BNF.mustBeOneSequence)\n unless rhs\n progress(recordError(\"No definition of #{lhs}\"))\n # raise RuntimeError(\"No definition of %s in\\n %s\" %(`lhs`, `g`))\n return\n end\n\n options = rhs\n progress(\"\\nProduction #{lhs} :: #{options}\")\n graph.query(:subject => lhs, :predicate => BNF.canPrecede) do |statement|\n chatty(\" Can precede '#{statement.object}'\")\n end\n\n graph.query(:subject => lhs, :predicate => BNF.branch) do |statement|\n branch = statement.object\n sequence = graph.first_object(:subject => statement.object, :predicate => BNF.sequence)\n option = RDF::List.new(sequence, graph).to_a\n progress(\" option: #{option}\")\n \n option.each do |part|\n agenda << part unless already.include?(part) || agenda.include?(part)\n end\n \n conditions = graph.query(:subject => branch, :predicate => BNF.condition).map(&:object)\n if conditions.empty?\n progress(recordError(\"NO SELECTOR for #{lhs} option #{option}\"))\n if option.empty?\n # Void case - the tricky one\n graph.pattern(:subject => lhs, :predicate => BNF.canPrecede) do |st|\n progress(\" Can precede #{st.object}\")\n end\n end\n end\n \n progress(\" Conditions: #{conditions.to_a.map(&:to_s)}\")\n conditions.each do |str1|\n if branchDict.has_key?(str1)\n progress(\n \"Conflict: #{str1} is also the condition for #{branchDict[str1]}\")\n end\n branchDict[str1] = option\n end\n end\n \n branchDict.keys.each do |str1|\n branchDict.keys.each do |str2|\n s1, s2 = str1.to_s, str2.to_s\n if (s1.index(s2) == 0 || s2.index(s1) == 0) && branchDict[str1] != branchDict[str2]\n progress(\"WARNING: for #{lhs}, #{str1} indicates #{branchDict[str1]}, but #{str2} indicates #{branchDict[str2]}\")\n end\n end\n end\n \n branchTable[lhs] = branchDict\n end",
"def to_peg\n new_rules = []\n\n # Look for rules containing sub-sequences\n if expr.any? {|e| e.is_a?(Array) && e.first.is_a?(Symbol)}\n # duplicate ourselves for rewriting\n this = dup\n new_rules << this\n\n expr.each_with_index do |e, index|\n next unless e.is_a?(Array) && e.first.is_a?(Symbol)\n new_rule = build(e)\n this.expr[index] = new_rule.sym\n new_rules << new_rule\n end\n\n # Return new rules after recursively applying #to_bnf\n new_rules = new_rules.map {|r| r.to_peg}.flatten\n elsif expr.first == :diff && !terminal?\n this = dup\n new_rule = build([:not, expr[2]])\n this.expr = [:seq, new_rule.sym, expr[1]]\n new_rules << this\n new_rules << new_rule\n elsif [:hex, :istr, :range].include?(expr.first)\n # This rules are fine, they just need to be terminals\n raise \"Encountered #{expr.first.inspect}, which is a #{self.kind}, not :terminal\" unless self.terminal?\n new_rules << self\n else\n new_rules << self\n end\n \n return new_rules.map {|r| r.extend(EBNF::PEG::Rule)}\n end",
"def coma!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 9 )\n\n\n\n type = COMA\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 289:3: ','\n match( 0x2c )\n\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 9 )\n\n\n end",
"def to_bnf\n result = []\n last_symbol = nil\n productions.sort.each do |production|\n if production.symbol != last_symbol\n result << \"\"\n result << \"#{production.symbol.name.inspect} :\"\n last_symbol = production.symbol\n end\n result << \" | #{production.expansion.collect{|symbol| symbol.name.inspect}.join(' ')}\"\n end\n result.join(\"\\n\")\n end",
"def parse_grammar \n\t\tnormalize\n\n\t\t@grammar_string.each do |line|\n\t\t\tlhs, placeholder, rhs = line.partition \"->\"\n\t\t\t# get rid of extra white space\n\t\t\tlhs.strip!\n\t\t\trhs.strip!\n\n\t\t\t# catch line with goal symbol\n\t\t\t@goal = lhs if rhs.include? \"$\"\n\n\t\t\trhs.split(\"|\").each do |rule|\n\t\t\t\t@production_rules[lhs] ||= []\n\t\t\t\t@production_rules[lhs] << rule.split(\" \")\n\t\t\tend\n\t\tend\n\tend",
"def to_s\n\t\tmap { |k,v|\n\t\t\tv.to_s + \" ::= \" + v.rules.map { |r| r.map{|e| e.inspect}.join(\" \") }.join(\" | \")\n\t\t}.join(\"\\n\")\n\tend",
"def condicion\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 23 )\n\n\n return_value = CondicionReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n\n root_0 = nil\n\n __OP_REL114__ = nil\n valor113 = nil\n valor115 = nil\n\n\n tree_for_OP_REL114 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 123:4: valor OP_REL valor\n @state.following.push( TOKENS_FOLLOWING_valor_IN_condicion_545 )\n valor113 = valor\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, valor113.tree )\n end\n\n __OP_REL114__ = match( OP_REL, TOKENS_FOLLOWING_OP_REL_IN_condicion_547 )\n if @state.backtracking == 0\n tree_for_OP_REL114 = @adaptor.create_with_payload( __OP_REL114__ )\n @adaptor.add_child( root_0, tree_for_OP_REL114 )\n\n end\n\n @state.following.push( TOKENS_FOLLOWING_valor_IN_condicion_549 )\n valor115 = valor\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, valor115.tree )\n end\n\n\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n\n if @state.backtracking == 0\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 23 )\n\n\n end\n\n return return_value\n end",
"def to_bnf\n return [self] unless rule?\n new_rules = []\n\n # Look for rules containing recursive definition and rewrite to multiple rules. If `expr` contains elements which are in array form, where the first element of that array is a symbol, create a new rule for it.\n if expr.any? {|e| e.is_a?(Array) && (BNF_OPS + TERM_OPS).include?(e.first)}\n # * Transform (a [n] rule (op1 (op2))) into two rules:\n # (a.1 [n.1] rule (op1 a.2))\n # (a.2 [n.2] rule (op2))\n # duplicate ourselves for rewriting\n this = dup\n new_rules << this\n\n expr.each_with_index do |e, index|\n next unless e.is_a?(Array) && e.first.is_a?(Symbol)\n new_rule = build(e)\n this.expr[index] = new_rule.sym\n new_rules << new_rule\n end\n\n # Return new rules after recursively applying #to_bnf\n new_rules = new_rules.map {|r| r.to_bnf}.flatten\n elsif expr.first == :opt\n this = dup\n # * Transform (rule a (opt b)) into (rule a (alt _empty b))\n this.expr = [:alt, :_empty, expr.last]\n this.cleanup = :opt\n new_rules = this.to_bnf\n elsif expr.first == :star\n # * Transform (rule a (star b)) into (rule a (alt _empty (seq b a)))\n this = dup\n this.cleanup = :star\n new_rule = this.build([:seq, expr.last, this.sym], cleanup: :merge)\n this.expr = [:alt, :_empty, new_rule.sym]\n new_rules = [this] + new_rule.to_bnf\n elsif expr.first == :plus\n # * Transform (rule a (plus b)) into (rule a (seq b (star b)\n this = dup\n this.cleanup = :plus\n this.expr = [:seq, expr.last, [:star, expr.last]]\n new_rules = this.to_bnf\n elsif [:alt, :seq].include?(expr.first)\n # Otherwise, no further transformation necessary\n new_rules << self\n elsif [:diff, :hex, :range].include?(expr.first)\n # This rules are fine, they just need to be terminals\n raise \"Encountered #{expr.first.inspect}, which is a #{self.kind}, not :terminal\" unless self.terminal?\n new_rules << self\n else\n # Some case we didn't think of\n raise \"Error trying to transform #{expr.inspect} to BNF\"\n end\n \n return new_rules\n end",
"def corder!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 11 )\n\n\n\n type = CORDER\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 297:3: ']'\n match( 0x5d )\n\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 11 )\n\n\n end",
"def pour\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 20 )\n pour_start_index = @input.index\n\n success = false # flag used for memoization\n\n begin\n # rule memoization\n if @state.backtracking > 0 and already_parsed_rule?( __method__ )\n success = true\n return \n end\n # at line 297:7: ( 'P' | 'p' ) ( 'O' | 'o' ) ( 'U' | 'u' ) ( 'R' | 'r' )\n if @input.peek( 1 ).between?( T__12, T__13 )\n @input.consume\n @state.error_recovery = false\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n mse = MismatchedSet( nil )\n raise mse\n end\n\n\n if @input.peek( 1 ).between?( T__18, T__19 )\n @input.consume\n @state.error_recovery = false\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n mse = MismatchedSet( nil )\n raise mse\n end\n\n\n if @input.peek( 1 ).between?( T__14, T__15 )\n @input.consume\n @state.error_recovery = false\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n mse = MismatchedSet( nil )\n raise mse\n end\n\n\n if @input.peek( 1 ).between?( T__20, T__21 )\n @input.consume\n @state.error_recovery = false\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n mse = MismatchedSet( nil )\n raise mse\n end\n\n\n\n success = true\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 20 )\n memoize( __method__, pour_start_index, success ) if @state.backtracking > 0\n\n end\n \n return \n end",
"def simplification_rules_for_conjunction\n if is_formula_and_formula?\n copy @left_sentence\n update\n elsif is_formula_and_not_formula?\n @left_sentence, @right_sentence, @operator = nil,nil,nil\n update(Constant::VALUES[:bottom])\n elsif is_formula_and_up?\n if @left_sentence.is_constant?\n copy @right_sentence\n else\n copy @left_sentence\n end\n update\n elsif is_formula_and_bottom?\n @left_sentence, @right_sentence, @operator = nil,nil,nil\n update(Constant::VALUES[:bottom])\n end\n end",
"def to_prolog\n prolog_clauses = []\n words = {} \n sentence_number = 1\n\n prolog_clauses << \"%% Unique tags in the corpus:\\n\"\n tags.map { |t,| prolog_clauses << \"brown_tag(#{t.to_prolog}).\" }\n\n @sentences.each do |s|\n prolog_clauses << \"brown_sentence(#{sentence_number},#{s.to_prolog}).\\n\"\n s.each { |e| words[\"brown_word(#{e[0].to_prolog}).\"] = true }\n sentence_number += 1\n end\n\n prolog_clauses << \"%% Unique words in the corpus\"\n words.map { |w,| prolog_clauses << w }\n\n (parse_tag_descriptions + prolog_clauses).join(\"\\n\")\n end",
"def pcdata!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 50 )\n\n type = PCDATA\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 406:9: {...}? => (~ '<' )+\n raise FailedPredicate( \"PCDATA\", \" !@tagMode \" ) unless ( ( !@tagMode ) )\n # at file 406:25: (~ '<' )+\n match_count_8 = 0\n while true\n alt_8 = 2\n look_8_0 = @input.peek( 1 )\n\n if ( look_8_0.between?( 0x0, 0x3b ) || look_8_0.between?( 0x3d, 0xffff ) )\n alt_8 = 1\n\n end\n case alt_8\n when 1\n # at line 406:26: ~ '<'\n if @input.peek( 1 ).between?( 0x0, 0x3b ) || @input.peek( 1 ).between?( 0x3d, 0xff )\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n end\n\n\n\n else\n match_count_8 > 0 and break\n eee = EarlyExit(8)\n\n\n raise eee\n end\n match_count_8 += 1\n end\n\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 50 )\n\n end",
"def comilla!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 16 )\n\n\n\n type = COMILLA\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 317:3: '\\\\''\n match( 0x27 )\n\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 16 )\n\n\n end",
"def ciclos\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 19 )\n\n\n return_value = CiclosReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n\n root_0 = nil\n\n ciclo_times92 = nil\n ciclo_each93 = nil\n\n\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 107:4: ( ciclo_times | ciclo_each )\n # at line 107:4: ( ciclo_times | ciclo_each )\n alt_12 = 2\n look_12_0 = @input.peek( 1 )\n\n if ( look_12_0 == DecimalLiteral )\n alt_12 = 1\n elsif ( look_12_0 == DOUBLEDOT || look_12_0 == Identificador )\n alt_12 = 2\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n\n\n raise NoViableAlternative( \"\", 12, 0 )\n\n end\n case alt_12\n when 1\n # at line 107:5: ciclo_times\n @state.following.push( TOKENS_FOLLOWING_ciclo_times_IN_ciclos_461 )\n ciclo_times92 = ciclo_times\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, ciclo_times92.tree )\n end\n\n\n when 2\n # at line 107:17: ciclo_each\n @state.following.push( TOKENS_FOLLOWING_ciclo_each_IN_ciclos_463 )\n ciclo_each93 = ciclo_each\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, ciclo_each93.tree )\n end\n\n\n end\n\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n\n if @state.backtracking == 0\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 19 )\n\n\n end\n\n return return_value\n end",
"def transformation_into_apnf\n self.simplification\n unless @operator.nil?\n old_left = ( @left_sentence ? Sentence.new(@left_sentence) : nil )\n old_right = ( @right_sentence ? Sentence.new(@right_sentence) : nil )\n\n if @operator.is_negation?\n unless @right_sentence.operator.nil?\n case @right_sentence.operator.type\n when :implication\n apnf_rules_for_negated_implication\n\n # ******* NEW APNF RULES FOR NEGATED IMPLICATION FORMULA CAN BE ADDED HERE AS A METHOD JUST LIKE THE METHOD ABOVE *******\n # ******* FOR EXAMPLE:\n new_apnf_rules_for_negated_implication()\n\n when :conjunction\n apnf_rules_for_negated_conjunction\n\n # ******* NEW APNF RULES FOR NEGATED CONJUNCTION FORMULA CAN BE ADDED HERE AS A METHOD JUST LIKE THE METHOD ABOVE *******\n # ******* FOR EXAMPLE:\n new_apnf_rules_for_negated_conjunction()\n\n when :disjunction\n apnf_rules_for_negated_disjunction\n\n # ******* NEW APNF RULES FOR NEGATED DISJUNCTION FORMULA CAN BE ADDED HERE AS A METHOD JUST LIKE THE METHOD ABOVE *******\n # ******* FOR EXAMPLE:\n new_apnf_rules_for_negated_disjunction()\n\n when :new_operator\n # ******* OR A NEW OPERATOR NOT USED BEFORE CAN BE ADDED IN THE SIMPLIFICATION - LIKE NEGATION FOR EXAMPLE *******\n\n # ******* AND A NEW SIMPLIFICATION RULE CAN BE ADDED TO THIS OPERATOR *******\n # ******* FOR EXAMPLE: *******\n apnf_rules_for_negated_new_operator()\n end\n @left_sentence.transformation_into_apnf if @left_sentence\n @right_sentence.transformation_into_apnf if @right_sentence\n end\n else\n case @operator.type\n when :implication\n apnf_rules_for_implication\n\n # ******* NEW APNF RULES FOR IMPLICATION CAN BE ADDED HERE AS A METHOD JUST LIKE THE METHOD ABOVE *******\n # ******* FOR EXAMPLE:\n new_apnf_rules_for_implication()\n\n # ******* OR NEW RULES FOR CONJUNCTION AND DISJUNCTION CAN BE ADDED TOO, IN A NEW OPTION FOR THE CASE\n # ******* FOR EXAMPLE:\n when :conjunction\n new_apnf_rules_for_conjunction()\n\n when :disjunction\n new_apnf_rules_for_disjunction()\n\n when :new_operator\n # ******* OR A NEW OPERATOR NOT USED BEFORE CAN BE ADDED IN THE SIMPLIFICATION - LIKE NEGATION FOR EXAMPLE *******\n\n # ******* AND A NEW SIMPLIFICATION RULE CAN BE ADDED TO THIS OPERATOR *******\n # ******* FOR EXAMPLE: *******\n apnf_rules_for_new_operator()\n\n end\n @left_sentence.transformation_into_apnf if @left_sentence\n @right_sentence.transformation_into_apnf if @right_sentence\n end\n\n unless Sentence.equals?(old_left, @left_sentence) && Sentence.equals?(old_right, @right_sentence)\n update\n end\n end\n self.simplification\n end",
"def cfparsedformula(io)\n cce = io.read(2).unpack('v').first\n io.read(cce)\n\n {\n cce: cce, # cce (2 bytes): An unsigned integer that specifies the length of rgce in bytes.\n rgce: :not_implemented # rgce (variable): An Rgce that specifies the sequence of Ptg structures for the formula.\n }\n end",
"def gen_requirements\n @parser.requirements.each do |name, value|\n editor = ModelEditor.new(name.snake_case)\n editor.insert(AFTER_RELATIONSHIPS, value.collect{|v| \" # #{v}\"}.join(\"\\n\"))\n end\n end",
"def process(problem)\n @id = 0\n problem.constraints.each do |c|\n puts print_expression(c.expression)\n puts \"\\n\\n\"\n end\n problem\n end",
"def to_PLParser(startSym)\n\n thePLP = TextRect.new\n\n @ntIndex.each do |nt, s|\n\n theNT = TextRect.new(\"#{nt.name} ::= \")\n before = ' '\n\n s[:rules].each do |i|\n rhs = @ruleTable[i][:rule].rhs\n rhs.each { |sym| before << sym.name << ' ' }\n theNT.below!(before)\n before = ' | '\n end\n\n theNT.below!(' ;')\n thePLP.below!(theNT)\n\n end\n\n thePLP.below!('&G')\n\n end",
"def condicional\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 17 )\n\n\n return_value = CondicionalReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n\n root_0 = nil\n\n __LLAIZQ80__ = nil\n __LLADER82__ = nil\n __K_IF83__ = nil\n __LPAR84__ = nil\n __RPAR86__ = nil\n bodyexp81 = nil\n condicion_exp85 = nil\n elseb87 = nil\n\n\n tree_for_LLAIZQ80 = nil\n tree_for_LLADER82 = nil\n tree_for_K_IF83 = nil\n tree_for_LPAR84 = nil\n tree_for_RPAR86 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 99:4: LLAIZQ bodyexp LLADER K_IF LPAR condicion_exp RPAR ( elseb )?\n __LLAIZQ80__ = match( LLAIZQ, TOKENS_FOLLOWING_LLAIZQ_IN_condicional_415 )\n if @state.backtracking == 0\n tree_for_LLAIZQ80 = @adaptor.create_with_payload( __LLAIZQ80__ )\n @adaptor.add_child( root_0, tree_for_LLAIZQ80 )\n\n end\n\n @state.following.push( TOKENS_FOLLOWING_bodyexp_IN_condicional_417 )\n bodyexp81 = bodyexp\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, bodyexp81.tree )\n end\n\n __LLADER82__ = match( LLADER, TOKENS_FOLLOWING_LLADER_IN_condicional_419 )\n if @state.backtracking == 0\n tree_for_LLADER82 = @adaptor.create_with_payload( __LLADER82__ )\n @adaptor.add_child( root_0, tree_for_LLADER82 )\n\n end\n\n __K_IF83__ = match( K_IF, TOKENS_FOLLOWING_K_IF_IN_condicional_421 )\n if @state.backtracking == 0\n tree_for_K_IF83 = @adaptor.create_with_payload( __K_IF83__ )\n @adaptor.add_child( root_0, tree_for_K_IF83 )\n\n end\n\n __LPAR84__ = match( LPAR, TOKENS_FOLLOWING_LPAR_IN_condicional_423 )\n if @state.backtracking == 0\n tree_for_LPAR84 = @adaptor.create_with_payload( __LPAR84__ )\n @adaptor.add_child( root_0, tree_for_LPAR84 )\n\n end\n\n @state.following.push( TOKENS_FOLLOWING_condicion_exp_IN_condicional_425 )\n condicion_exp85 = condicion_exp\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, condicion_exp85.tree )\n end\n\n __RPAR86__ = match( RPAR, TOKENS_FOLLOWING_RPAR_IN_condicional_427 )\n if @state.backtracking == 0\n tree_for_RPAR86 = @adaptor.create_with_payload( __RPAR86__ )\n @adaptor.add_child( root_0, tree_for_RPAR86 )\n\n end\n\n # at line 99:55: ( elseb )?\n alt_10 = 2\n look_10_0 = @input.peek( 1 )\n\n if ( look_10_0 == K_ELSE )\n alt_10 = 1\n end\n case alt_10\n when 1\n # at line 99:55: elseb\n @state.following.push( TOKENS_FOLLOWING_elseb_IN_condicional_429 )\n elseb87 = elseb\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, elseb87.tree )\n end\n\n\n end\n\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n\n if @state.backtracking == 0\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 17 )\n\n\n end\n\n return return_value\n end",
"def condicion_exp\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 22 )\n\n\n return_value = CondicionExpReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n\n root_0 = nil\n\n __OP_LOG111__ = nil\n condicion110 = nil\n condicion112 = nil\n\n\n tree_for_OP_LOG111 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 119:4: condicion ( OP_LOG condicion )*\n @state.following.push( TOKENS_FOLLOWING_condicion_IN_condicion_exp_527 )\n condicion110 = condicion\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, condicion110.tree )\n end\n\n # at line 119:14: ( OP_LOG condicion )*\n while true # decision 14\n alt_14 = 2\n look_14_0 = @input.peek( 1 )\n\n if ( look_14_0 == OP_LOG )\n alt_14 = 1\n\n end\n case alt_14\n when 1\n # at line 119:15: OP_LOG condicion\n __OP_LOG111__ = match( OP_LOG, TOKENS_FOLLOWING_OP_LOG_IN_condicion_exp_530 )\n if @state.backtracking == 0\n tree_for_OP_LOG111 = @adaptor.create_with_payload( __OP_LOG111__ )\n @adaptor.add_child( root_0, tree_for_OP_LOG111 )\n\n end\n\n @state.following.push( TOKENS_FOLLOWING_condicion_IN_condicion_exp_532 )\n condicion112 = condicion\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, condicion112.tree )\n end\n\n\n else\n break # out of loop for decision 14\n end\n end # loop for decision 14\n\n\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n\n if @state.backtracking == 0\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 22 )\n\n\n end\n\n return return_value\n end",
"def find_parents(t)\n # puts \"Inside find_parents.. text #{t}\"\n tp = TextPreprocessing.new \n unTaggedString = t.split(\" \")\n parents = Array.new\n # t = text[i]\n t = StanfordCoreNLP::Text.new(t) #the same variable has to be passed into the Textx.new method\n @pipeline.annotate(t)\n #for each sentence identify theparsed form of the sentence\n sentence = t.get(:sentences).toArray\n parsed_sentence = sentence[0].get(:collapsed_c_c_processed_dependencies)\n #puts \"parsed sentence #{parsed_sentence}\" \n #iterating through the set of tokens and identifying each token's parent\n #puts \"unTaggedString.length #{unTaggedString.length}\"\n for j in (0..unTaggedString.length - 1)\n #puts \"unTaggedString[#{j}] #{unTaggedString[j]}\"\n if(tp.is_punct(unTaggedString[j]))\n next\n end\n if(tp.contains_punct(unTaggedString[j]))\n unTaggedString[j] = tp.contains_punct(unTaggedString[j])\n # puts \"unTaggedString #{unTaggedString[j]} and #{tp.contains_punct_bool(unTaggedString[j])}\"\n end\n if(!unTaggedString[j].nil? and !tp.contains_punct_bool(unTaggedString[j]))\n pat = parsed_sentence.getAllNodesByWordPattern(unTaggedString[j])\n pat = pat.toArray\n parent = parsed_sentence.getParents(pat[0]).toArray\n end\n #puts \"parent of #{unTaggedString[j]} is #{parent[0]}\"\n if(!parent.nil? and !parent[0].nil?)\n parents[j] = (parent[0].to_s)[0..(parent[0].to_s).index(\"-\")-1]#extracting the name of the parent (since it is in the foramt-> \"name-POS\")\n #puts \"parents[#{j}] = #{parents[j]}\"\n else\n parents[j] = nil\n end\n end\n return parents\nend",
"def verbalise\n \"Constellation over #{vocabulary.name}:\\n\" +\n vocabulary.object_type.keys.sort.map do |object_type|\n klass = vocabulary.const_get(object_type)\n\n single_roles, multiple_roles = klass.all_role.\n partition do |n, r|\n r.unique && # Show only single-valued roles\n !r.is_identifying && # Unless identifying\n (r.unary? || !r.counterpart.is_identifying) # Or identifies a counterpart\n end.\n map do |rs|\n rs.map{|n, r| n}.\n sort_by(&:to_s)\n end\n\n instances = send(object_type.to_sym)\n next nil unless instances.size > 0\n \"\\tEvery #{object_type}:\\n\" +\n instances.map do |key, instance|\n s = \"\\t\\t\" + instance.verbalise\n if (single_roles.size > 0)\n role_values = \n single_roles.map do |role_name|\n #p klass, klass.all_role.keys; exit\n next nil if klass.all_role(role_name).fact_type.is_a?(TypeInheritanceFactType)\n value =\n if instance.respond_to?(role_name)\n value = instance.send(role_name)\n else\n instance.class.all_role(role_name) # This role has not yet been realised\n end\n [ role_name.to_s.camelcase, value ]\n end.compact.select do |role_name, value|\n value\n end.map do |role_name, value|\n \"#{role_name} = #{value ? value.verbalise : \"nil\"}\"\n end\n s += \" where \" + role_values*\", \" if role_values.size > 0\n end\n s\n end * \"\\n\"\n end.compact*\"\\n\"\n end",
"def paquete\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 2 )\n\n\n return_value = PaqueteReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n\n root_0 = nil\n\n __K_PACKAGE4__ = nil\n __EOL6__ = nil\n qualified_name5 = nil\n\n\n tree_for_K_PACKAGE4 = nil\n tree_for_EOL6 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 14:4: K_PACKAGE qualified_name EOL\n __K_PACKAGE4__ = match( K_PACKAGE, TOKENS_FOLLOWING_K_PACKAGE_IN_paquete_57 )\n if @state.backtracking == 0\n tree_for_K_PACKAGE4 = @adaptor.create_with_payload( __K_PACKAGE4__ )\n @adaptor.add_child( root_0, tree_for_K_PACKAGE4 )\n\n end\n\n @state.following.push( TOKENS_FOLLOWING_qualified_name_IN_paquete_59 )\n qualified_name5 = qualified_name\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, qualified_name5.tree )\n end\n\n __EOL6__ = match( EOL, TOKENS_FOLLOWING_EOL_IN_paquete_61 )\n if @state.backtracking == 0\n tree_for_EOL6 = @adaptor.create_with_payload( __EOL6__ )\n @adaptor.add_child( root_0, tree_for_EOL6 )\n\n end\n\n\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n\n if @state.backtracking == 0\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 2 )\n\n\n end\n\n return return_value\n end",
"def make_cnf_formula(encoding)\r\n cnf_formula = []\r\n \r\n # First create a generic formula which isn't specific to our board\r\n #\r\n case encoding\r\n when :minimal\r\n cnf_formula = SudokuSolver.minimal_encoding_formula\r\n when :extended\r\n cnf_formula = SudokuSolver.extended_encoding_formula\r\n else\r\n fail \"Unknown encoding #{encoding}\"\r\n end\r\n \r\n # Now add the unit clauses that result from the assigned cells in our board\r\n #\r\n (0 .. 8).each do |row|\r\n (0 .. 8).each do |col|\r\n if board[row][col] > 0\r\n cnf_formula.unshift([SudokuSolver.cell2variable(row, col, board[row][col])])\r\n end\r\n end\r\n end\r\n \r\n cnf_formula \r\n end",
"def parametros\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 28 )\n\n\n return_value = ParametrosReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n\n root_0 = nil\n\n __COMA135__ = nil\n valor134 = nil\n valor136 = nil\n\n\n tree_for_COMA135 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 143:4: valor ( COMA valor )*\n @state.following.push( TOKENS_FOLLOWING_valor_IN_parametros_634 )\n valor134 = valor\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, valor134.tree )\n end\n\n # at line 143:10: ( COMA valor )*\n while true # decision 17\n alt_17 = 2\n look_17_0 = @input.peek( 1 )\n\n if ( look_17_0 == COMA )\n alt_17 = 1\n\n end\n case alt_17\n when 1\n # at line 143:11: COMA valor\n __COMA135__ = match( COMA, TOKENS_FOLLOWING_COMA_IN_parametros_637 )\n if @state.backtracking == 0\n tree_for_COMA135 = @adaptor.create_with_payload( __COMA135__ )\n @adaptor.add_child( root_0, tree_for_COMA135 )\n\n end\n\n @state.following.push( TOKENS_FOLLOWING_valor_IN_parametros_639 )\n valor136 = valor\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, valor136.tree )\n end\n\n\n else\n break # out of loop for decision 17\n end\n end # loop for decision 17\n\n\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n\n if @state.backtracking == 0\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 28 )\n\n\n end\n\n return return_value\n end",
"def extract_bnf_grammar_from_yacc_spec(yaccFile)\r\n bnfg = \"\"\r\n File.open(yaccFile, \"r\") do |f|\r\n lines = f.readlines\r\n line = lines.shift while line !~ /^%%/\r\n paren_level = 0 # > 0 when in C code\r\n outside_string = true # false iff in a string\r\n while lines.first !~ /^%%/\r\n lines.shift.each_byte do |c|\r\n\toutside_string = !outside_string if paren_level == 0 && c == ?' #'\r\n\tparen_level += 1 if outside_string && c == ?{\r\n\tbnfg << c.chr if paren_level == 0\r\n\tparen_level -= 1 if outside_string && c == ?}\r\n\traise \"oops\" if paren_level < 0\r\n end\r\n end\r\n end\r\n bnfg\r\nend"
]
| [
"0.57956314",
"0.54493576",
"0.5425205",
"0.5412952",
"0.5344363",
"0.52897114",
"0.5277667",
"0.5216268",
"0.5154754",
"0.5138244",
"0.5109283",
"0.5085626",
"0.50761646",
"0.5060717",
"0.5031964",
"0.5017147",
"0.49444252",
"0.49179173",
"0.4911493",
"0.48964894",
"0.48754942",
"0.4860348",
"0.4847871",
"0.48474824",
"0.48320502",
"0.48202837",
"0.4816069",
"0.48128167",
"0.48060885",
"0.47791862"
]
| 0.60784334 | 0 |
the way this is designed, it short circuts. so sometimes when it should say false it will say indeterminant for the whole knowledgebase returns false, true, or indetermninant as 1,1,0 (in current encoding) alike with the assignment list and literal class assignment must be parallel array to id nums (may want to use hashes instead) | def satisfiable_assignment?(assignment)
sentence_eval = 1
index = 0
while(sentence_eval == 1 && index < @kb.size)
sentence_eval = 0
all_false = true
##############################################3
# puts "kb is: " + @kb.to_s
# puts "the assignments are : " + assignment.to_s
@kb[index].each do |id|
################################################33
# puts " the atom to check : " + id.to_s
temp_id = id
if(temp_id >0)
assign = assignment[temp_id - 1]
###################################################
# puts "the atom is : " + id.to_s
# puts "the variable is assigned to: " + assignment[temp_id-1].to_s
# puts "which evaluates to: " + assign.to_s
else
assign = assignment[temp_id*-1 -1].to_i * -1
###################################################
# puts "the atom is : " + id.to_s
# puts "the variable is assigned to: " + (assignment[temp_id*-1 - 1] - 1).to_s
# puts "which evaluates to: " + assign.to_s
end
if(assign==1)
sentence_eval = 1
all_false = false
break
elsif(assign == 0)
all_false = false
end
end
if(all_false)
sentence_eval = -1
end
index+=1
end
return sentence_eval
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assignment_intialize\n\t\tif(@puret and @puref)\n\t\t\treturn false\n\t\tend\n\t\tif(@num_negative == 0 or @puret)\n\t\t\t@assignments = [1]\n\t\telsif(@num_positive == 0 or @puref)\n\t\t\t@assignments = [-1]\n\t\telsif(@best_guess <0)\n\t\t\t@assignments = [-1,1]\n\t\telse\n\t\t\t@assignments = [1,-1]\n\t\tend\n\t\treturn true\n\tend",
"def determine_literalism(literalism_data)\n\tcase literalism_data\n\twhen 1\n\t\t:yes\n\twhen 2\n\t\t:no\n\telse\n\t\t:unknown\n\tend\nend",
"def exercise_1111 (bool_values)\n end",
"def ismn; end",
"def intensifier; end",
"def check_disjunctive_assignment(node); end",
"def primordial; end",
"def assignment?(node); end",
"def assignment?(node); end",
"def assignment?(node); end",
"def false_true\n alternatives false, true\n end",
"def prologify\n \"false\"\n end",
"def is_fixed?\n self.assignment_type_id == 2\n end",
"def is_primitive_sentence?\n index = 1\n if @classified[index].instance_of?(Proposition) || @classified[index].instance_of?(Constant)\n if @classified[index + 1].instance_of?(LogicalOperator)\n if @classified[index + 2].instance_of?(Proposition) || @classified[index + 2].instance_of?(Constant)\n return true\n end\n end\n end\n false\n end",
"def cardinal; end",
"def define_question_code(klass, position) \r\n \"is_a?(#{name}) && (!number || number==@value)\"\r\n end",
"def boolify(val)\n\nend",
"def test_compound_branch_w_3_terms_t_t_assign\n assert interpret('var=0; true && true || var=99; :var').zero?\n end",
"def abundant?(num)\n\nend",
"def abundant?(num)\n\nend",
"def first_assignment?(node); end",
"def _reduce_5(val, _values)\n AST::True.new true \nend",
"def is_amicable(n)\n a = d(n)\n a == n ? false : n == d(a)\nend",
"def calculate_truth_table\r\n false_s = @char_set[0]\r\n truth_s = @char_set[1]\r\n @table_array.each do |x|\r\n trues = x.count(truth_s)\r\n trues == @size ? x.push(truth_s) : x.push(false_s)\r\n trues > 0 ? x.push(truth_s) : x.push(false_s)\r\n trues.odd? ? x.push(truth_s) : x.push(false_s) \r\n end\r\n end",
"def initialize\n @set = BitSet.new\n @endOf = Sym::NoSym\n @ctx = false\n @correct = true\n end",
"def abundant?(num)\nend",
"def evalIdentifierINT_BOOL(expr)\n\tidentif = expr.get_value\n\t# evalua en la tabla que el identificador corresponda con entero o \n\t# booleano, o que simplemente no se encuentre en la tabla\n\ttype = $tables.lookup(identif)\n\tif type[0] == :INTEGER\n\t\tprint \"Introduzca un numero entero: \"\n\t\tinput = $stdin.readline\n\t\tcase input\n\t\twhen /^[0-9][0-9]*/ \n\t\t\tinput = input.to_i\n\t\t\tif input > 2147483647 || input < -2147483647\n\t\t\t\tputs \"ERROR: overflow entrada de numero de 32 bits erroneo\"\n\t\t\t\t$error = true\n\t\t\telsif input < 2147483647 && input > -2147483647\n\t\t\t\t$tables.update(type[0],identif,input)\n\t\t\tend\n\t\telse\n\t\t\tputs \"ERROR: entrada incorrecta se espera un INTEGER\"\n\t\t\t$error = true\n\t\tend\n\n\telsif type[0] == :BOOLEAN\n\t\tprint \"Introduzca un booleano true or false: \"\n\t\tinput = $stdin.readline\n\t\tif input.downcase == \"true\\n\"\n\t\t\t$tables.update(type[0],identif,true) \n\t\telsif input.downcase == \"false\\n\"\n\t\t\t$tables.update(type[0],identif,false)\n\t\telse\n\t\t\tputs \"ERROR: entrada incorrecta se espera un #{type[0]}\"\n\t\t\t$error = true\n\t\tend\n\tend\nend",
"def assignment?(node)\n [:lvasgn, :ivasgn, :gvasgn, :cvasgn, :casgn].include?(node.type)\n end",
"def assignment?(node)\n [:lvasgn, :ivasgn, :gvasgn, :cvasgn, :casgn].include?(node.type)\n end",
"def synpred8_Jejune\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 94 )\n\n # at line 556:7: member assignment_op\n @state.following.push( TOKENS_FOLLOWING_member_IN_synpred8_Jejune_3692 )\n member\n @state.following.pop\n @state.following.push( TOKENS_FOLLOWING_assignment_op_IN_synpred8_Jejune_3694 )\n assignment_op\n @state.following.pop\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 94 )\n\n end"
]
| [
"0.6625051",
"0.6095803",
"0.5790214",
"0.56934625",
"0.56818473",
"0.55996346",
"0.55899537",
"0.5428367",
"0.5428367",
"0.5428367",
"0.5427513",
"0.53843915",
"0.5354882",
"0.5267769",
"0.5261744",
"0.52563506",
"0.52499795",
"0.5246493",
"0.5193265",
"0.5193265",
"0.5179648",
"0.51507825",
"0.514845",
"0.51440495",
"0.51241696",
"0.51204103",
"0.5117597",
"0.51154333",
"0.51152456",
"0.5111607"
]
| 0.631583 | 1 |
Create a function with two arguments that will return a list of length (n) with multiples of (x). Assume both the given number and the number of times to count will be positive numbers greater than 0. Return the results as an array (or list in Python or Haskell.) Examples: count_by(1,10) should return [1,2,3,4,5,6,7,8,9,10] count_by(2,5) should return [2,4,6,8,10] | def count_by(x, n)
a=[]
y=0
n.times {y+=x; a<<y}
a
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count_by(x, n)\n (1..n).map{|i| i*x}\nend",
"def counts(n)\n divisors = Array.new\n (1..n).each do |n|\n single_divisors = count n\n divisors.push(single_divisors)\n end\n divisors\n end",
"def multiples_of( x, xmax )\n ct = x\n nums = []\n while ct <= xmax\n nums << ct\n ct += x\n end\n return nums\nend",
"def count_to (n)\n array = []\n count = 0\n while count <= n\n count += 1\n array.push(count.round)\n end\nend",
"def count_by_x (num1, num2)\n array = (num1..num1 * num2).to_a\n\n array.select do |num|\n num % num1 == 0\n end\nend",
"def factor_count(x)\n range = 2..Math.sqrt(x)\n count = range.count { |i| x % i == 0 }\n count * 2\nend",
"def monkey_count(n)\n [*1..n]\nend",
"def sum_of_multiples(x, n)\n multiples_count = n/x\n x * ((n/x) * ((n/x)+1)/2)\nend",
"def multiples(x)\n array = []\n while x > 0\n x = x - 1\n if (x % 3 == 0) || (x % 5 == 0)\n array << x\n end\n end\n return array.inject{|sum,x| sum + x }\nend",
"def count_to(n)\n arr = []\n if n>=0\n n = n.floor\n 0.upto(n) do |x|\n arr << x\n end\n else\n n = -(-n).floor\n 0.downto(n) do |x|\n arr << x\n end\n end\n arr\n end",
"def count(n,ar)\r\n result = Array.new(100){|x| x = 0}\r\n ar.each { |x| result[x] = result[x]+1 }\r\n return result\r\nend",
"def divisors(n)\n count = 0\n (1..n).each { |div| count += 1 if n % div == 0 }\n return count\nend",
"def counting(limit) # this method receives an integer argument and returns an array\n numbers = []\n if limit.is_a?(Integer)\n count = 0\n while count < limit\n numbers << count\n count += 1\n end\n end \n numbers\nend",
"def multiples_of(number, upTo)\n result = Array.new\n (0..upTo).step(number) do |n|\n result << n\n end\n puts result.inspect\n result\nend",
"def multiples_x(number, multiple)\n current_multiple = multiple\n multiples = []\n\n while current_multiple <= number\n multiples << current_multiple\n current_multiple += multiple\n end\n\n multiples\nend",
"def multisum(num)\n count = 0\n (1..num).each { |idx| count += idx if (idx % 3).zero? || (idx % 5).zero? }\n count\nend",
"def find_multiples(number)\n sum_of_multiples = (3...number).each_with_object([]) do |element, list|\n list << element if element % 3 == 0 || element % 5 == 0\n end.sum\nend",
"def simber_count(n)\n lower_range = 10**(n - 1)\n upper_range = (10**n) - 1\n count = 0\n (lower_range..upper_range).each do |i|\n count += 1 if simber_check(i)\n end\n count\nend",
"def factorialize(n)\n return 0 if n.zero?\n\n number_array = []\n\n n.times do |number|\n number_array << number + 1\n end\n\n number_array.reduce(:*)\nend",
"def collect_multiples(number)\n \n numbers = Array.new(number - 1, 0)\n count = 0\n while count < numbers.length \n numbers[count] = count + 1\n count += 1\n end\n\n numbers.select do |element|\n element % 3 == 0 || element % 5 == 0\n end\n\nend",
"def count(n)\n sum = 1\n n.prime_division.each do |x|\n sum *= (x[1] + 1)\n end\n sum\n end",
"def numDivisors(n)\n exponents = []\n remaining = n\n\n return 1 if n == 1\n\n for i in [email protected]\n\n if remaining == 1 then\n return exponents.inject(:*)\n end\n\n if remaining % @primes[i] == 0 then\n exponent_count = 0\n while remaining % @primes[i] == 0 do\n remaining /= @primes[i]\n\n exponent_count += 1\n end\n exponents.push(exponent_count + 1)\n end\n end\n return 1\nend",
"def multisum(num)\n counter = 1\n arr = []\n while counter <= num\n if counter % 3 == 0 || counter % 5 == 0\n arr << counter\n end\n counter += 1\n end\n arr.sum\nend",
"def at_least_n_factors(numbers, n)\n\n arr = []\n numbers.each do |x|\n arr << x if num_factors(x) >= n\n end\n\n arr\nend",
"def multisum(num)\n # 2. Next, since I know I have to store all multiples of 3 and 5, I want to create an empty array\n multiples = []\n # 3. Now I can run the each method on the range of 1 to num\n (1..num).each do |number|\n # 4. If the number is evenly divisible by 3 or 5 I want to store it in the multiples array\n if number % 3 == 0 || number % 5 == 0\n multiples << number\n end\n end\n # 5. Now I simply return the sum of the multiples array\n multiples.sum\nend",
"def monkey_count(n)\n Array.new(n) {|x| x + 1 }#your code here\nend",
"def get_sums(total, count)\n ([1]*total).group_by.with_index {|_, i| i % count}.values.map {|a| a.inject(0, &:+)}\nend",
"def series_up(n) # given n, return a list that goes [1,1,2,1,2,3... n]\n n_list = []\n (n+1).times do |m|\n m.times do |val|\n n_list.push(val+1)\n end\n end\n return n_list\nend",
"def multiples(number)\n number_array = Array(1..number)\n multiples_array = []\n\n number_array.each do |num|\n if num % 3 == 0 || num % 5 == 0\n multiples_array << num\n end\n end\n multiples_array.sum\nend",
"def count_them_while(n)\n count = 0 \n x = 1 \n while x <= n \n count += x \n x += 1 \n end \n count\nend"
]
| [
"0.8004699",
"0.70162845",
"0.6892011",
"0.68776846",
"0.6769908",
"0.67528325",
"0.6590494",
"0.6569084",
"0.65532243",
"0.6551252",
"0.65417355",
"0.64793026",
"0.6461403",
"0.64416224",
"0.6372089",
"0.6347995",
"0.6330729",
"0.63219327",
"0.6292802",
"0.6268252",
"0.62589306",
"0.6225369",
"0.62002367",
"0.6196773",
"0.61897844",
"0.6170912",
"0.6158201",
"0.6156859",
"0.61515623",
"0.61426324"
]
| 0.7754079 | 1 |
GET /tipocuenta GET /tipocuenta.json | def index
@tipocuenta = Tipocuentum.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @tipocliente = Tipocliente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n #format.json { render json: @tipocliente }\n end\n end",
"def show\n @tip_so = TipSo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tip_so }\n end\n end",
"def show\n @tipomedalla = Tipomedalla.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipomedalla }\n end\n end",
"def show\n @tecnico = Tecnico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tecnico }\n end\n end",
"def show\n @tecnico = Tecnico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tecnico }\n end\n end",
"def show\n @tecnico = Tecnico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @tecnico }\n end\n end",
"def show\n @articulo = Articulo.find(params[:id])\n @noticias = Articulo.where(\"tipo = 'noticia'\").order(\"created_at desc\")\n @title = @articulo.titulo\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @articulo }\n end\n end",
"def show\n @tipp = Tipp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipp }\n end\n end",
"def show\n @telefononegocio = Telefononegocio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @telefononegocio }\n end\n end",
"def index\n tips = Tip.all\n json_response(tips)\n end",
"def index\n @itemtipos = Itemtipo.all\n\n render json: @itemtipos\n end",
"def index\n @tiposervicos = Tiposervico.all\n end",
"def show\n @noto = Noto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @noto }\n end\n end",
"def index\n @tipovestuarios = Tipovestuario.all\n end",
"def show\n @tip = Tip.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tip }\n end\n end",
"def index\n @tipos_contatos = TiposContato.all\n end",
"def show\n @pto = Pto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pto }\n end\n end",
"def show\n json_response(@tip)\n end",
"def show\n @tarefa = Tarefa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tarefa }\n end\n end",
"def index\n @tipos = Tipo.all\n end",
"def index\n @tipos = Tipo.all\n end",
"def show\n @torso = Torso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @torso }\n end\n end",
"def show\n @tipo_atendimento = TipoAtendimento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_atendimento }\n end\n end",
"def index\n @tipoplatos = Tipoplato.all\n end",
"def show\n @torneo = Torneo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @torneo }\n end\n end",
"def show\n @trnodo = Trnodo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trnodo }\n end\n end",
"def show\n @etnia = Etnia.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @etnia }\n end\n end",
"def show\n @tipo_contrato = TipoContrato.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_contrato }\n end\n end",
"def show\n @territorio = Territorio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @territorio }\n end\n end",
"def index\n @tipoveiculos = Tipoveiculo.all\n end"
]
| [
"0.70758057",
"0.6861703",
"0.6858581",
"0.6765908",
"0.6765908",
"0.66960454",
"0.6654463",
"0.6627065",
"0.6605445",
"0.6594997",
"0.6522421",
"0.6487479",
"0.648541",
"0.64729357",
"0.64467347",
"0.6401073",
"0.63894105",
"0.63742113",
"0.6358471",
"0.63532233",
"0.63532233",
"0.632994",
"0.6316672",
"0.6313972",
"0.63037205",
"0.6290894",
"0.62833524",
"0.6265929",
"0.6264889",
"0.6256925"
]
| 0.6875919 | 1 |
Calls mattermost using the default Mattermost URL from the configuration data is a hash containing the data to send. Note that channel, username, and icon_url are reserved url is the Mattermost URL defined above. This can be overridden for debugging header is the default headers. This shouldn't need modified, but it's nice to have | def call_mattermost (data = {}, url = [Config['Mattermost']['url'], 'hooks', Config['Mattermost']['webhook_code']].join('/'), header = {content_type: :json, accept: :json})
if !data.has_key?(:login_id)
payload = data.merge(Config['DefaultPayload'])
else
payload = data
end
# Just in case, though we may not need text
unless payload.has_key?(:text) or payload.has_key?(:attachments)
payload['text'] = 'This was triggered on: ' + Time.now.strftime("%d/%m/%Y %H:%M") #Feel free to change this
end
response = RestClient.post url, payload.to_json, {content_type: :json, accept: :json}
return response
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def push_data(push_params)\n # Push URI\n push_uri = URI.parse(\"#{$tipboard_base_uri}/#{$apikey}/push\")\n\n # Post to API to set up tile\n push_response = Net::HTTP.post_form(push_uri, push_params)\nend",
"def send_message(mes,token,user_id)\n #Open a direct message\n options = {\n token: token,\n user: user_id\n }\n channel_id = post('https://slack.com/api/im.open', options).channel.id\n\n #Send the message\n options = {\n token: token,\n channel: channel_id,\n text: mes\n }\n post('https://slack.com/api/chat.postMessage', options)\nend",
"def send\n generate_url\n end",
"def send\n generate_url\n end",
"def send_post(post)\n title = CGI.unescapeHTML(post['title'])\n author = post['author']\n url = post['url']\n time = post['created']\n link = 'https://reddit.com' + post['permalink']\n preview = post['thumbnail']\n # Create an Embed\n Bot.channel(Config['channel']).send_embed do |emb|\n emb.color = '3498db'\n emb.author = { name: title, url: link}\n emb.image = { url: preview }\n emb.url = link\n emb.add_field name: 'Link:', value: url, inline: false\n emb.footer = { text: \"Posted by /u/#{author} @ #{Time.at(time).strftime('%a, %d %b %H:%M')}\", icon_url: Bot.profile.avatar_url }\n end\nend",
"def send(data: {}, headers: {})\n `#@native.open(#{method}, #{url})`\n @data = data\n self.headers = headers\n\n if method == :get || method == :delete\n `#@native.send()`\n elsif Hash === data\n `#@native.send(#{JSON.generate data})`\n elsif `!!data['native']`\n `#@native.send(data['native'])`\n else\n `#@native.send(data)`\n end\n\n self\n end",
"def setup_for_posting(extra = {})\n @params = { \n :destination => :tumblr, \n :post_url => 'http://www.domain.com/example/post/',\n :site_url => 'http://www.domain.com/',\n :email => '[email protected]',\n :password => 's3kr17'\n }\n @params = @params.merge(extra)\n @sender = BotSender.new(@params)\nend",
"def postMultipackAdminLogo( multipack_id, filedata)\n params = Hash.new\n params['multipack_id'] = multipack_id\n params['filedata'] = filedata\n return doCurl(\"post\",\"/multipack/adminLogo\",params)\n end",
"def http_send url, form_data, headers, &block\n if form_data['action'] == 'query'\n log.debug(\"GET: #{form_data.inspect}, #{@cookies.inspect}\")\n headers[:params] = form_data\n RestClient.get url, headers, &block\n else\n log.debug(\"POST: #{form_data.inspect}, #{@cookies.inspect}\")\n RestClient.post url, form_data, headers, &block\n end\n end",
"def postMultipackLogo( multipack_id, filedata)\n params = Hash.new\n params['multipack_id'] = multipack_id\n params['filedata'] = filedata\n return doCurl(\"post\",\"/multipack/logo\",params)\n end",
"def push_tileconfig(tile_name, tileconfig_params)\n # Tileconfig URI\n tileconfig_uri = URI.parse(\"#{$tipboard_base_uri}/#{$apikey}/tileconfig/\" + tile_name)\n\n # Post to API to set up tileconfig\n tileconfig_response = Net::HTTP.post_form(tileconfig_uri, tileconfig_params)\nend",
"def post(title, target, message, color)\n a_message_note = {\n 'color' => color,\n 'fields' => [\n {\n 'title' => 'Message',\n 'value' => message,\n 'short' => false\n },\n {\n 'title' => 'Archive Name',\n 'value' => target,\n 'short' => true\n },\n {\n 'title' => 'Status',\n 'value' => color,\n 'short' => false\n }\n ]\n }\n\n notify_user = ENV['SLACK_USER'] || 'notifier'\n notifier = Slack::Notifier.new ENV['SLACK_WEBHOOK'], :username => notify_user\n notifier.ping title, 'icon_emoji' => ENV['SLACK_ICON_EMOJI'], 'attachments' => [a_message_note]\nend",
"def uri\n sprintf(\"%s/%s?token=%s\", API_ENDPOINT, COMMAND, config.slack_bot_token)\n end",
"def http_post(curl, data, url)\n\n # Define the post data\n data2 = ''\n\n # Loop through the data[\"post_data\"] passed in to build up the post data string\n data[\"post_data\"].each do |key, value|\n if (data2 != '') then\n data2 = data2 + '&'\n end\n # If the value is null we don't just want it to look like: item=\n if (value.nil?) then\n data2 = data2 + CGI::escape(key.to_s) + '='\n else\n data2 = data2 + CGI::escape(key.to_s) + '=' + CGI::escape(value.to_s)\n end\n end\n\n # Define the url we want to hit\n curl.url = url\n # Specify the headers we want to hit\n curl.headers = data['header']\n\n # perform the call\n curl.post(data2)\n\n curl.headers = nil\n\n # Set headers to nil so none get reused elsewhere\n curl.headers = nil\n\n # return the curl object\n return curl\n\nend",
"def send_command(parms=nil)\n #logger.debug \"AQUIII ESTOOOY \"\n\n\n url = URI.parse(@control_url)\n #logger.debug \"URL #{@control_url}\"\n req = Net::HTTP::Get.new(url.path)\n\n\n #logger.debug \"URLpath #{url.path}\"\n if parms\n\t\t#logger.debug \"sent data #{parms.to_json}\"\n end\n \n\n req.basic_auth @username, @password if @username\n if parms\n\t\treq.set_form_data(parms)\n end\n \n \n res = Net::HTTP.new(url.host, url.port).start {|http| http.request(req) }\n res.use_ssl = true if @control_url =~ /^https/\n case res\n when Net::HTTPSuccess, Net::HTTPRedirection\n # OK\n #logger.debug \"REspuesta #{res}\"\n return res.body\n else\n res.error!\n end\n end",
"def httppost(url, corpNum, postData, action = '', userID = '', contentsType = '')\n\n headers = {\n \"x-lh-version\" => KAKAOCERT_APIVersion,\n \"Accept-Encoding\" => \"gzip,deflate\",\n }\n\n apiServerTime = @linkhub.getTime(@useStaticIP, @useGAIP)\n\n hmacTarget = \"POST\\n\"\n hmacTarget += Base64.strict_encode64(Digest::SHA256.digest(postData)) + \"\\n\"\n hmacTarget += apiServerTime + \"\\n\"\n\n hmacTarget += KAKAOCERT_APIVersion + \"\\n\"\n\n key = Base64.decode64(@linkhub._secretKey)\n\n data = hmacTarget\n digest = OpenSSL::Digest.new(\"sha256\")\n hmac = Base64.strict_encode64(OpenSSL::HMAC.digest(digest, key, data))\n\n headers[\"x-kc-auth\"] = @linkhub._linkID+' '+hmac\n headers[\"x-lh-date\"] = apiServerTime\n\n if contentsType == ''\n headers[\"Content-Type\"] = \"application/json; charset=utf8\"\n else\n headers[\"Content-Type\"] = contentsType\n end\n\n headers[\"Authorization\"] = \"Bearer \" + getSession_Token(corpNum)\n\n\n uri = URI(getServiceURL() + url)\n\n https = Net::HTTP.new(uri.host, 443)\n https.use_ssl = true\n Net::HTTP::Post.new(uri)\n\n res = https.post(uri.request_uri, postData, headers)\n\n if res.code == \"200\"\n if res.header['Content-Encoding'].eql?('gzip')\n JSON.parse(gzip_parse(res.body))\n else\n JSON.parse(res.body)\n end\n else\n raise KakaocertException.new(JSON.parse(res.body)[\"code\"],\n JSON.parse(res.body)[\"message\"])\n end\n end",
"def post_message(\n access_token:,\n channel_id:,\n attachments: nil,\n blocks: nil,\n text: nil,\n link_names: true,\n markdown: true,\n parse: 'full',\n reply_broadcast: false,\n thread_ts: nil,\n unfurl_links: true,\n unfurl_media: true\n )\n return if attachments.blank? && blocks.blank? && text.blank?\n params = {\n channel: channel_id,\n attachments: attachments,\n blocks: blocks,\n text: text,\n link_names: link_names,\n mrkdwn: markdown,\n parse: parse,\n reply_broadcast: reply_broadcast,\n thread_ts: thread_ts,\n unfurl_links: unfurl_links,\n unfurl_media: unfurl_media\n }.compact\n response = HTTParty.post(\"https://slack.com/api/chat.postMessage\",\n body: params.to_json,\n headers: { 'Authorization': \"Bearer #{access_token}\", 'Content-Type': 'application/json' })\n JSON.parse(response.body, symbolize_names: true)\n end",
"def pm(content = nil)\n if content\n # Recursively call pm to get the channel, then send a message to it\n channel = pm\n channel.send_message(content)\n else\n # If no message was specified, return the PM channel\n @bot.pm_channel(@id)\n end\n end",
"def uri\n \"mcp://#{@options[:url]}\"\n end",
"def push\n cfm.send_to_remote if do_push?\n end",
"def post_messages!(hash)\n Net::HTTP.post_form(URI.parse(@target), {'data'=>hash.to_json})\n end",
"def set_mst_url(mst, rmt_id)\n url=\"http://#{$settings['redmine_host']}:#{$settings['redmine_port']}/issues/#{rmt_id}\"\n mst.HyperlinkAddress = url\n return url\nend",
"def post_to_slack\n system(\"curl -X POST --data-urlencode 'payload={\\\"channel\\\": \\\"#hedgehogs\\\", \\\"username\\\": \\\"Toto, Min and Fumi\\\", \\\"text\\\": \\\"現在、小屋の気温は #{@temparature.round(1)}℃です\\\"}' https://hooks.slack.com/services/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\")\n end",
"def post(message, params = {})\n return if options[:quiet]\n ActiveResource::Base.logger = Logger.new(STDOUT) if options[:trace]\n Socialcast::CommandLine::Message.configure_from_credentials\n response = Socialcast::CommandLine::Message.create params.merge(:body => message)\n say \"Message has been posted: #{response.permalink_url}\"\n end",
"def set_whats_new_url(args = {}) \n put(\"/globalsettings.json/news/url\", args)\nend",
"def perform\n Kublog.facebook_client.link! :link => @url, :message => @message\n end",
"def curl_form_data(uri, form_data=[], options={})\n curl = Pkg::Util::Tool.find_tool(\"curl\") or fail \"Couldn't find curl. Curl is required for posting jenkins to trigger a build. Please install curl and try again.\"\n #\n # Begin constructing the post string.\n # First, assemble the form_data arguments\n #\n post_string = \"-i \"\n form_data.each do |param|\n post_string << \"#{param} \"\n end\n\n # Add the uri\n post_string << \"#{uri}\"\n\n # If this is quiet, we're going to silence all output\n if options[:quiet]\n post_string << \" >/dev/null 2>&1\"\n end\n\n %x{#{curl} #{post_string}}\n return $?.success?\nend",
"def dm(message)\n raise \"Could not send message because of invalid options #{options}\" unless NOTIFICARE_SETTINGS\n recipients = NOTIFICARE_SETTINGS[\"recipients\"].split(/\\s*,\\s*/)\n username = NOTIFICARE_SETTINGS[\"username\"]\n password = NOTIFICARE_SETTINGS[\"password\"]\n recipients.each do |recipient|\n uri = \"http://#{username}:#{password}@twitter.com/direct_messages/new.json\"\n yell \"Sending #{recipient}: #{message}\"\n Net::HTTP.post_form(URI.parse(uri), {'user' => recipient, 'text' => message})\n end \nend",
"def send_data\n request = Collector::Request.\n new(self.api_location,\n :user => config[:htpasswd_user],\n :pass => config[:htpasswd_pass])\n\n # convert the array of object to a hash\n server = {\n websites: @websites.map{ |w| w.to_hash(@version).merge({server: config[:client_name].underscore }) }.map{ |w| w[:website] },\n name: config[:client_name].underscore\n }\n\n request.send(server)\n\n end",
"def post_with_curl\n url = @settings.webhook_url\n `curl -is -X POST -H \"Content-Type:application/json\" -d '#{get_body}' '#{url}'`\n end"
]
| [
"0.5465588",
"0.542814",
"0.53797555",
"0.53797555",
"0.53348374",
"0.51957387",
"0.49491575",
"0.48877075",
"0.4883532",
"0.48634773",
"0.4846544",
"0.48428428",
"0.48361412",
"0.48356918",
"0.48224252",
"0.4820484",
"0.48077616",
"0.47950903",
"0.4787078",
"0.47738805",
"0.47655332",
"0.47643667",
"0.47575295",
"0.47519317",
"0.4742383",
"0.47423056",
"0.47212768",
"0.47177228",
"0.4717629",
"0.4694455"
]
| 0.72075117 | 0 |
upload_file moves the file to the webserver from the config file filename: The full path of the image file video_filename: Used to generate a unique MD5 hash for each image file | def upload_file (filename, video_filename)
# new filename is the md5 of the old filename, plus "jpg"
new_filename = Digest::MD5.hexdigest video_filename
new_filename += '.jpg'
FileUtils.mv(filename, [Config['WebServer']['webroot'], Config['WebServer']['preview_dir'], new_filename].join('/'))
return [Config['WebServer']['url'], Config['WebServer']['preview_dir'], new_filename].join('/')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def upload(file)\n logger.info 'Downloading video...'\n path = file.download.path\n movie = FFMPEG::Movie.new(path)\n @mp4_path = encode('mp4', movie, '-vcodec libx264 -strict -2')\n @webm_path = encode('webm', movie, '-vcodec libvpx -acodec libvorbis -f webm -deadline realtime -s 640x480')\n end",
"def file_upload\n tmp = params[:configfile]\n file = File.join(\"public\", \"uploads\", params[:configfile].original_filename)\n FileUtils.cp tmp.path, file\n puts \"File uploaded to: public/uploads\"\n # Put up file load success alert?\n redirect_to(\"/dashboard/manage\", :notice => \"File #{params[:configfile].original_filename} uploaded\")\n end",
"def img_upload(file)\n\t \t# puts \"++++ #{file.inspect} ++++\"\n\t \tpath=File.dirname(__FILE__) + '/public/uploads/' + file[:filename]\n\t \t# puts \"///////\"\n\t \t# puts path\n\t \tFile.open(path, \"w\") do |upload|\n\t \t\tupload.write(file[:tempfile].read)\n\t end\n\t return file[:filename]\n\t end",
"def create\n @video = Video.new(params[:video])\n video_file = params[:video_file]\n img_file = params[:img_file]\n\n if video_file != nil\n videoid = Utils.videoid\n @video.video_url = \"http://10.10.140.70:5000/files/\"+Utils.upload(video_file, videoid)\n @video.video_id = videoid\n end\n if img_file != nil\n @video.video_img =\"http://10.10.140.70:5000/files/\"+Utils.upload(img_file, nil)\n end\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to today_videos_path }\n else\n format.html { render action: \"new\" }\n end\n end\n end",
"def upload_video_at_s3(filename, filepath) \n\t\tbegin\n\t\t\ts3 = Aws::S3::Resource.new\n\t\t\tobj = s3.bucket(ENV['AWS_S3_BUCKET'] || 'tv-guide-s3-bucket').object(filename)\n\t\t\tif obj.upload_file(filepath)\n\t\t\t\tself.update(video_filename: filename) \n\n\t\t\t\tFile.delete(filepath) \n\t\t\tend\n\t\trescue StandardError => e\n\t \tRails.logger.info \"================================================upload_video_at_s3:69\"\n\t \tRails.logger.info e\n\t\tend\n\tend",
"def upload_file\n #TODO\n end",
"def update\n @video = Video.find(params[:id])\n video_file = params[:video_file]\n img_file = params[:img_file]\n\n if video_file != nil\n videoid = Utils.videoid\n @video.video_url = \"http://10.10.140.70:5000/files/\"+Utils.upload(video_file, videoid)\n end\n\n if img_file != nil\n @video.video_img =\"http://10.10.140.70:5000/files/\"+Utils.upload(img_file, nil)\n end\n respond_to do |format|\n if @video.update_attributes(params[:video])\n format.html { redirect_to today_videos_path }\n else\n format.html { render action: \"new\" }\n end\n end\n end",
"def savevid\n tmp = params[:vids][:video].tempfile\n #require 'ftools'\n file = File.join(\"app/assets/videos\", params[:vids][:video].original_filename) # use public if you want\n FileUtils.cp tmp.path, file\n\n redirect_to \"/admin\"\nend",
"def process_uploaded_video_file\n if @video_file.present?\n video_file_stream = if @video_file.respond_to?(:path, true)\n File.open(@video_file.path)\n else\n @video_file\n end\n @uploaded_video_token = local_or_global_kaltura_client.\n media_service.upload(video_file_stream)\n raise ActsAsKaltura::Video::NoUploadedTokenFound if @uploaded_video_token.nil?\n end\n end",
"def update\n @video = Video.find(params[:id])\n video_file = params[:video_file]\n img_file = params[:img_file]\n\n if video_file != nil\n videoid = Utils.videoid\n @video.video_url = \"http://#{Constants::UPLOAD_IP}/files/videos/\"+Utils.upload(video_file, videoid)\n end\n\n if img_file != nil\n @video.video_img =\"http://#{Constants::UPLOAD_IP}/files/images/\"+Utils.upload(img_file, nil)\n end\n\n respond_to do |format|\n if @video.update_attributes(params[:video])\n format.html { redirect_to channel_videos_path }\n else\n format.html { render action: \"new\" }\n end\n end\n end",
"def file_upload(file)\n file[\"//\"] = \"/\"\n file = ENV['RED5_HOME'] + \"/webapps/encrev1/#{file}\"\n request_url = \"#{@url}/file/demo\"\n request_url += \"?uid=#{@conf.uid}&sid=#{@conf.sid}\"\n $log.info \"Request filename : #{request_url}\"\n response = RestClient.put request_url, \"\"\n $log.info \"--> Got reponse : #{response}\"\n file_name = JSON.parse(response.to_str)['result']\n if file_name\n $log.info \"--> Got filename : #{file_name}\"\n request_url = \"#{@url}/file/demo/\"\n request_url += file_name\n request_url += \"?uid=#{@conf.uid}&sid=#{@conf.sid}\"\n $log.info \"Upload (#{file}) to Encre : #{request_url}\"\n response = RestClient.put request_url, File.read(file), :content_type => 'application/x-shockwave-flash'\n $log.info \"Delete #{file} ...\"\n file = File.delete(file)\n else\n file_name = nil\n end\n rescue\n file_name = nil\n $log.info \"... failed ! (check exception below)\"\n $log.info $!\n end",
"def upload_file\n full_path = file_path.join(file_name)\n File.open(full_path, 'wb') do |file|\n file.write(@file.read)\n end\n\n full_path.sub(Rails.root.to_s, '')\n end",
"def create\n @channel = params[:forminfo]\n @video = Video.new(params[:video])\n video_file = params[:video_file]\n img_file = params[:img_file]\n @video.video_type = params[:video_type]\n @video.video_id = Utils.videoid\n\n if video_file != nil\n @video.video_url = \"http://#{Constants::UPLOAD_IP}/files/videos/\"+Utils.upload(video_file, videoid)\n end\n\n if img_file != nil\n @video.video_img =\"http://#{Constants::UPLOAD_IP}/files/images/\"+Utils.upload(img_file, nil)\n end\n @video.cid = @channel\n respond_to do |format|\n if @video.save\n format.html { redirect_to channel_videos_path }\n else\n format.html { render action: \"new\" }\n end\n end\n end",
"def uploadFile(localFilePath, destFilePath, maxAge = 172800) # 2 Days = 1,72,800 seconds \n ext = File.extname(localFilePath).downcase\n msgContentType = \"\"\n cacheControl = \"max-age=#{maxAge}, must-revalidate\"\n if (ext == \"\")\n contentType = 'text/html'\n msgContentType = \"No file-ext: \"\n elsif (Fh5::Config.instance.contentTypes && Fh5::Config.instance.contentTypes.has_key?(ext))\n contentType = Fh5::Config.instance.contentTypes[ext]\n msgContentType = \"Override for '#{ext}':\"\n else \n contentType = MimeMagic.by_path(destFilePath).type\n end\n @log.info(@logPrefix) {\"Upload: '#{destFilePath}' (#{msgContentType}#{contentType}) (#{cacheControl})\"}\n begin\n File.open(localFilePath) do |f|\n content = f.read\n @bucketAdmin.defaultBucket.put(destFilePath, content, {}, 'public-read', \n {'Content-Type' => contentType, 'Cache-Control' => cacheControl})\n end\n rescue\n @log.errorException($!, @logPrefix) {\"Failed to upload to: '#{destFilePath}'\"}\n\n return nil\n end\n \n # comment out stuff related to public links which doesn't seem to work for website bucket.\n # publicLink = @bucketAdmin.endpointBucket.key(destFilePath).public_link\n # @log.debug(@logPrefix) {\"Public link: '#{publicLink}' for file: '#{destFilePath}'\"}\n # return publicLink \n end",
"def upload_file(file)\n file_path = file.path\n\n @size = File.size(file_path)\n @filename = File.basename(file_path)\n @io = File.open(file_path)\n io.binmode\n Rails.logger.debug \"filename of file to upload: #{filename} filepath: #{file_path}\"\n upload_io(io, size, filename).tap do\n io.close\n end\n end",
"def create\n\n @video_object = params[:video][:video_file] \n @video = Video.new(video_params)\n @video.competition = @competition \n @video.video_original_filename = @video_object.original_filename.to_s\n @video.video_content_type = @video_object.content_type.to_s\n\n respond_to do |format|\n if @video.save\n upload_file(@video.id, @video_object, \"original-videos\")\n send_msg_to_queue(@video.id.to_s)\n format.html { redirect_to @video.competition, success: 'Hemos recibido tu video y lo estamos procesando para que sea publicado. Tan pronto el video quede publicado en la página del concurso te notificaremos por email. Gracias.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def fileupload(filename)\n unless filename &&\n (tempfile = filename[:tempfile]) &&\n (name = filename[:filename])\n @error = \"No file selected\"\n return false\n end\n p filename\n fileextension = filename[\"filename\"]\n if File.extname(\"#{fileextension}\") == \".png\" or File.extname(\"#{fileextension}\") == \".jpg\" or File.extname(\"#{fileextension}\") == \".jpeg\" or File.extname(\"#{fileextension}\") == \".gif\"\n puts \"Uploading file, original name #{name.inspect}\"\n target = \"public/img/#{name}\"\n slimroute = \"img/#{name}\"\n files = {target: target, slimroute: slimroute, tempfile: tempfile}\n return files\n else\n return false\n end\nend",
"def create\n\n #動画基本情報\n @video = Video.new(video_params)\n @video.user_id = get_user_id\n\n upload_file = params[:file]\n\n # ファイル必須\n if upload_file.nil?\n @video.errors.add(:file, \"は最低1つアップしてください。\")\n end\n\n respond_to do |format|\n if !upload_file.nil? && @video.save\n UpfileManageService.save(upload_file, @video)\n format.html { redirect_to videos_url, notice: '動画情報を登録しました。' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def videos_upload\n\n file_extname = File.extname self.file_upload.original_filename\n new_file_name = \"#{Time.now.strftime(\"%Y%m%d%H%M%S\")}#{self[:employee_id]}#{file_extname}\"\n folder_path = \"/videos/#{Time.now.strftime(\"%Y\") }/#{Time.now.strftime(\"%m\") }/#{Time.now.strftime(\"%d\") }/\"\n url_path = folder_path + new_file_name\n full_folder_path = \"#{Rails.root.to_s}/public#{folder_path}\"\n new_file_path = \"#{Rails.root.to_s}/public#{url_path}\"\n unless File.exist? full_folder_path\n `mkdir -p #{full_folder_path}`\n end\n\n Dir.mkdir(full_folder_path) unless File.exists?(full_folder_path)\n\n if !self.file_upload.original_filename.empty?\n self.status = Document::ENCODE_PROCESS\n self.original = url_path\n #`touch #{new_file_path}`\n File.open(new_file_path, \"wb\") do |f|\n f.write(self.file_upload.read)\n f.close\n end\n self.save!\n # async encoding video files\n begin\n Backburner.enqueue Document, \"#{Rails.root.to_s}/public\", url_path, self.id\n rescue => ex\n puts 'async task fail'\n puts ex\n self.status = Document::ENCODE_FAILED\n self.save\n end\n end\n\n end",
"def upload_file(f)\n # grabs the compiled asset from public_path\n full_file_path = File.join(File.dirname(@manifest.dir), f)\n one_year = 31557600\n mime = Rack::Mime.mime_type(File.extname(f)) \n file = {\n :key => f,\n :public => true,\n :content_type => mime,\n :cache_control => \"public, max-age=#{one_year}\",\n :expires => CGI.rfc1123_date(Time.now + one_year) \n }\n\n gzipped = \"#{full_file_path}.gz\" \n\n if File.exists?(gzipped)\n original_size = File.size(full_file_path)\n gzipped_size = File.size(gzipped)\n\n if gzipped_size < original_size\n file.merge!({\n :body => File.open(gzipped),\n :content_encoding => 'gzip'\n })\n log \"Uploading #{gzipped} in place of #{f}\"\n else\n file.merge!({\n :body => File.open(full_file_path)\n })\n log \"Gzip exists but has larger file size, uploading #{f}\"\n end\n else\n file.merge!({\n :body => File.open(full_file_path)\n })\n log \"Uploading #{f}\"\n end\n # put in reduced redundancy option here later if desired\n\n file = bucket.files.create( file )\n end",
"def upload_file\n if !params['upload_file'].nil?\n file = params['upload_file']\n file_upload(file)\n else\n p \"filename is empty!!!\"\n end\n end",
"def upload_file(file, destination)\n body = IO.open(file).read\n image_cache_dir.create(key: destination, body: body, public: true)\n end",
"def path\n \"/#{UPLOAD_DIR}/#{filename}\"\n end",
"def upload\n if File.exists?(file_path = \"/home/redroid/motion_detection_images/#{params[:img]}.jpg\")\n send_403_forbidden\n else\n File.open(file_path, 'wb') { |file| file.write(request.raw_post)}\n send_200_ok\n end\nend",
"def upload\r\n \r\n end",
"def Upload file\n \n APICall(path: \"uploads.json?filename=#{file.split('/').last}\",method: 'POST',payload: File.read(file))\n \n end",
"def upload_file\n upload_thumb if Rails.configuration.thumbnails_enabled\n file_s3_obj.write(@file.tempfile.open, content_type: @file.content_type)\n end",
"def upload\n end",
"def upload\n end",
"def upload(config={})\n\n\t\tfile_name = config.delete(:file_name)\n\t\tpath_to_s3_folder = config.delete(:path_to_s3_folder)\n\n\t\tif file_name.nil? || file_name.empty?\n\t\t\traise ArgumentError, \"file_names is either empty or contains no values\"\n\t\telsif file_name==''\n\t\t\traise ArgumentError, \"File Names is passed as empty string. Pass appropriate values\"\n\t\tend\n\n\t\tfile_names = Array.new\n\t\tfile_names = file_name if file_name.is_a? Array\n\n\t\tfile_names.push(file_name) if file_name.is_a? String\n\t\tfile_names.each {|file|\n\t\t\t#raise ArgumentError, \"File name does not exist in the main directory\" if File.exists?(file)==false\n\t\t\tfinal_file_path = path_to_s3_folder + file\n\t\t\[email protected][@bucket_name].objects[final_file_path].write(:file => file)\n\t\t\tputs \"#{file} successfully uploaded\"\n\t\t} unless file_names.nil?\n\tend"
]
| [
"0.70270765",
"0.6648143",
"0.6634276",
"0.65686625",
"0.63425255",
"0.6336181",
"0.631758",
"0.62717307",
"0.6266716",
"0.61908865",
"0.61814225",
"0.61228365",
"0.6119716",
"0.6118708",
"0.6082119",
"0.60702676",
"0.60483265",
"0.60462517",
"0.60237974",
"0.59999603",
"0.598259",
"0.5972955",
"0.59452266",
"0.59430027",
"0.59214246",
"0.5912566",
"0.58796656",
"0.58680457",
"0.58680457",
"0.58568245"
]
| 0.8131492 | 0 |
Generates previews for each movie file in the transcode directory filename: The full path of the video file to output options: allows you to pass the following values for configuration. If not set they'll be pulled from your config framegrab_grid: (string) Something like '5x6' or '2x4' to specify the size of the grid framegrab_interval: (integer) The interval at which to grab frames in seconds. If set to zero it will determine it based on grid size and duration framegrab_height: (integer) The height of the generated frames in pixels. | def generate_previews(filename, options = {})
framegrab_grid = options['framegrab_grid'] || Config['PreviewSettings']['default_grid']
framegrab_interval = options['framegrab_interval'] || Config['PreviewSettings']['default_interval']
framegrab_height = options['framegrab_height'] || Config['PreviewSettings']['default_height']
base_filename = File.basename(filename)
filesize = File.size(filename)
file_info = Mediainfo.new filename
if framegrab_interval.to_i == 0
total_images = 1
framegrab_grid.split('x').each do |x|
total_images *= x.to_i
end
framegrab_interval = file_info.duration / total_images
end
count = 0
units = ['bytes', 'KB', 'MB', 'GB', 'TB']
loop do
break if filesize < 1024.0
count += 1
filesize /= 1024.0
end
pretty_filesize = filesize.round(2).to_s + ' ' + units[count]
duration = file_info.duration
remainder = 0
count = 0
units = ['sec','min','h']
loop do
break if duration < 60
count += 1
remainder = duration % 60
duration /= 60
end
pretty_duration = duration.round(0).to_s + ' ' + units[count]
if remainder > 0
pretty_duration += ' ' + remainder.round(0).to_s + ' ' + units[count-1]
end
command = "ffmpeg -loglevel panic -y -i \"#{filename}\" -frames 1 -q:v 1 -vf \"select='isnan(prev_selected_t)+gte(t-prev_selected_t\," + framegrab_interval.to_s + ")',scale=-1:" + framegrab_height.to_s + ",tile=" + framegrab_grid + "\" '/tmp/video_preview.jpg'"
# puts command
if system(command)
# # Now that the preview is generated, post it to Mattermost
if !(uploaded_file_url = upload_file('/tmp/video_preview.jpg', base_filename))
call_mattermost({:text => "We ran into a problem uploading the file. Have someone look at this!"})
else
message = "\n\n"
message+= "|#{base_filename}|[(preview)](#{uploaded_file_url})|\n"
message+= "|-|-:|\n"
message+= "|File Size| **#{pretty_filesize}**|\n"
message+= "|Duration| **#{pretty_duration}**|\n"
message+= "|Format| **#{file_info.format}**|"
actions = Config['FileOperations']
attachments_actions = []
actions.keys.each do |key|
action_hash = {
'name': key,
'integration': {
'url': [Config['Webhook']['url'], 'run-command'].join('/'),
'context': {
'command': key,
'filename': File.realpath(filename)
}
}
}
attachments_actions.push(action_hash)
end
attachments = [
{
"text": message,
"actions": attachments_actions
}]
payload = {:attachments => attachments}
call_mattermost(payload)
end
else
Log.error "There was an error running the command: #{command}"
call_mattermost({:text => "### DANGER WILL ROBINSON\nERROR"})
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_compilation\n puts \"Generating compilation\"\n get_selected_vines\n pathArray = [];\n @selected_vines.each do |vid|\n vine = Vine.find(vid)\n pathArray.push vine.path\n end\n if pathArray.count > 0\n return outputFile = execute_ffmpeg(pathArray)\n end\n end",
"def gen_highlights_for_multi_sessions(session_count, video_dir, txt_dir, dst_video)\n mpg_videos = []\n seg_filenames = []\n k = 1\n (1..session_count).each do |i|\n src_video = File.join(video_dir, \"session#{i}.mp4\")\n txt_file = File.join(txt_dir, \"session#{i}.txt\")\n pairs = get_time_pairs(txt_file)\n pairs.each do |pair|\n outmp4 = File.join($tmp_folder, \"#{k}.mp4\")\n outmpg = File.join($tmp_folder, \"#{k}.mpg\")\n seg_filenames << outmpg\n cmd_str = \"#{$ffmpeg} -ss #{pair[0]} -t #{pair[1] - pair[0] + 2} -i \\\"#{src_video}\\\" #{outmp4}\"\n p cmd_str\n system(cmd_str) unless File.exists? outmp4\n cmd_str = \"#{$ffmpeg} -i #{outmp4} -qscale:v 1 #{outmpg}\"\n p cmd_str\n system(cmd_str) unless File.exists? outmpg\n k = k + 1\n end\n end\n all_segs = seg_filenames.join('|')\n mpg_all = File.join($tmp_folder, 'all.mpg')\n cmd_str = \"#{$ffmpeg} -i \\\"concat:#{all_segs}\\\" -c copy #{mpg_all}\"\n p cmd_str\n system(cmd_str) unless File.exists? mpg_all\n cmd_str = \"#{$ffmpeg} -i #{mpg_all} -qscale:v 1 #{dst_video}\"\n p cmd_str\n system(cmd_str)\nend",
"def generate_black_video(movie, visual)\n #Render an image and create a video file from it\n @generated_videos += 1\n filename = movie.project.trimmed + \"/generated-#{@generated_videos}.avi\"\n cmd = @settings['still_video'].dup\n length = visual.end_point - visual.start_point\n cmd.sub!('<frames>', length.to_frames(25).to_s)\n cmd.sub!('<source>', VREConfig.instance.vre_root + \"resources/black_box.png\")\n cmd.sub!('<resolution>', movie.resolution)\n cmd.sub!('<target>', filename)\n system(cmd)\n filename\n end",
"def create_black_video(movie, visual)\n #Render an image and create a video file from it\n @generated_videos += 1\n filename = movie.project.trimmed + \"/generated-#{@generated_videos}.avi\"\n cmd = @settings['still_video'].dup\n length = visual.end_point - visual.start_point\n cmd.sub!('<frames>', length.to_frames(25).to_s)\n cmd.sub!('<source>', VREConfig.instance.vre_root + \"resources/black_box.png\")\n cmd.sub!('<resolution>', movie.resolution)\n cmd.sub!('<target>', filename)\n system(cmd)\n visual.file = filename\n visual.type = \"video\"\n visual.mute = true\n filename\n end",
"def screenshots(num_thumbnail_imgs)\n puts \"transcoded_movie thumbnail generation\"\n\t puts \"number of thumbnails #{num_thumbnail_imgs}\"\n\t \n\t \n\t #skipping some frames from begining and ending to take screenshots\n\t init_time = 15\n seek_t = ($transcoded_movie.duration - init_time*2) / num_thumbnail_imgs.to_i\n \t \n\t \n\t i = 0\n\t \n\t while i < num_thumbnail_imgs.to_i do\n filename = \"thumbnail_#{i}.jpg\"\n \n \t #, preserve_aspect_ratio: :width\n # keeping 160x90 to preserve aspect ratio 16:9 \n\t\t \n\t\t puts \"generating #{filename}\"\n \n\t\t $transcoded_movie.screenshot(filename, seek_time: (init_time + seek_t * i), resolution: '160x90')\n\t\t i += 1\n end #end while\t \n end",
"def run_loop(file_name)\n\n if @defaults[:ignore_files]\n MmMovieIgnoreList.shared_ignore_list.add(path: file_name)\n output(\"Note: added #{file_name} to the list of files to be ignored.\")\n elsif @defaults[:unignore_files]\n MmMovieIgnoreList.shared_ignore_list.remove(path: file_name)\n output(\"Note: removed #{file_name} to the list of files to be ignored.\")\n else\n @file_count[:processed] = @file_count[:processed] + 1\n movie = MmMovie.new(with_file: file_name)\n a = movie.interesting? # already interesting if low-quality, but separate quality check made for logic, below.\n b = MmMovieIgnoreList.shared_ignore_list.include?(file_name)\n c = movie.meets_minimum_quality?\n s = @defaults[:scan_type]&.to_sym\n\n if (s == :normal && a && !b && c) ||\n (s == :all && !b) ||\n (s == :flagged && b) ||\n (s == :quality && !c ) ||\n (s == :force)\n\n @file_count[:displayed] = @file_count[:displayed] + 1\n output(file_name)\n output(movie.format_table)\n output(movie.stream_table)\n if @defaults[:shell_commands]\n output(\"echo \\\"#{File.basename(file_name)}\\\" ; \\\\\", true)\n output(\"#{movie.command_rename} ; \\\\\", true)\n output(\"#{movie.command_transcode} ; \\\\\", true)\n output(movie.command_review_post, true)\n end\n output(\"\\n\\n\", true)\n end\n end # if\n end",
"def encode_movie(m)\r\n\tmovie_path = m[0..(m.length-2)].join('\\\\')\r\n\tmovie_folder = m[m.length-1]\r\n\r\n\tprint movie_folder + \", path:\" +movie_path+ \"\\n\"\r\n\r\n\tmovie_data_path = movie_path + \"\\\\\" + movie_folder + \"\\\\Pos0\\\\\"\r\n\tout_file = movie_data_path + \"..\\\\\" + movie_folder\r\n\tffmpeg_cmd = \"ffmpeg32 -framerate 30 -threads 2 -report -i \\\"#{movie_data_path}\\\\img_%09d_Default_000.tif\\\" -pix_fmt yuv420p \\\"#{out_file}.m4v\\\"\"\r\n\tprint \"#{ffmpeg_cmd}\\n=>\\n\"\r\n\t`#{ffmpeg_cmd}`\r\n\treturn [movie_path, \"#{out_file}.m4v\", movie_folder]\r\nend",
"def outputs\n VIDEO_PRESETS.map do |variant, preset_id|\n {\n key: \"#{name}-#{variant}\",\n thumbnail_pattern: \"#{name}-#{variant}-{count}\",\n preset_id: preset_id,\n segment_duration: SEGMENT_DURATION\n }\n end\n end",
"def mux(options={})\n if File.file?(options[:output])\n File.delete(options[:output])\n end\n\n create do |mp4creator|\n mp4creator.create = options[:audio]\n mp4creator.file = options[:output]\n end\n\n create do |mp4creator|\n mp4creator.create = options[:video]\n mp4creator.rate = options[:frame_rate].to_f\n mp4creator.file = options[:output]\n end\n\n if options[:hint]\n create do |mp4creator|\n mp4creator.hint = 1\n mp4creator.file = options[:output]\n end\n\n create do |mp4creator|\n mp4creator.hint = 2\n mp4creator.file = options[:output]\n end\n\n create do |mp4creator|\n mp4creator.optimize = true\n mp4creator.file = options[:output]\n end\n end\n end",
"def video(filename, opts = {})\n n = input(filename, opts)\n @videos << n\n n\n end",
"def generateVideos()\n #GENERATE AN INTERMEDIARY DIRECTORY WHERE WE'D STORE THE VIDEO FRAGMENTS\n pathToIntermediates=\"#{$PATHTOGENERATEINTERMEDIATES}/#{@meetingData.meetingId}\"\n puts \"generating intermediate videos in #{pathToIntermediates}\"\n createDirectoryIfNotExists(pathToIntermediates)\n \n dsPath=\"#{$PATHTOPUBLISHED}/#{@meetingData.meetingId}/deskshare\"\n presentationPath=\"#{$PATHTOPUBLISHED}/#{@meetingData.meetingId}/presentation\"\n \n #Scale to optimal resolution\n maxW=0\n maxH=0\n if Dir.exist?dsPath then\n maxW, maxH = getMaxResolution(dsPath)\n else \n maxW, maxH = getMaxResolution()\n end\n\n\n @objects.each_with_index{\n |val, index|\n puts \"Generating a #{val.class} video in interval [#{val.start_timestamp}, #{val.stop_timestamp}]\"\n val.generateVideo(pathToIntermediates, index, maxW, maxH)\n } \n end",
"def timelapse\n raise NoSnapshotError if Dir.glob(saving_path+'/*.jpg').count.zero?\n\n puts \"Generate video...\"\n MovieMaker.build\n puts \"Video is ready.\"\n end",
"def split_movie(file_path)\n OSX.require_framework(\"QTKit\")\n splitted_files = Array.new\n movie, error = OSX::QTMovie.movieWithFile_error(file_path) # Load in the original movie\n if(error != nil || movie == nil) # Check if we can load the movie\n $stderr.puts \"Could not open #{file_path}, #{error.localizedDescription}\"\n exit(-1)\n end\n \n # a QTTime structure has a timeValue and timeScale we need\n # to dived the timeValue by the timeScale to get the time\n # in seconds. If we devide that by 60 we get the time in\n # minutes\n time_scale = movie.duration.timeScale\n total_time = (movie.duration.timeValue / time_scale) / 60\n \n # If the total time is below 10 minutes we don't have to\n # split the movie\n if(total_time < 10)\n splitted_files.push(file_path)\n return splitted_files\n end\n \n # If the totol time is above 10 minutes we have to calculate\n # how many parts we need to make. No part can be over 10 minutes.\n parts = total_time.to_i / 10\n \n if(total_time.modulo(10) != 0)\n parts = parts + 1\n end\n \n # Parts are always 10 minutes long (or shorter)\n part_duration = OSX::QTMakeTime(600 * time_scale, time_scale)\n temp_dir = Dir.tmpdir()\n attributes = OSX::NSDictionary.dictionaryWithObjectsAndKeys(OSX::NSNumber.numberWithBool(true), \"QTMovieFlatten\", nil)\n movies = Array.new\n \n # For every part we extract the time selection out of the original movie\n # and write it out to a new, temporary file. We store the paths to the\n # temporary files\n parts.times do |i|\n begin_time = OSX::QTMakeTime(i * 600 * time_scale, time_scale)\n range = OSX::QTMakeTimeRange(begin_time, part_duration)\n movie_part, error = movie.movieWithTimeRange_error(range)\n \n if(error != nil || movie_part == nil)\n $stderr.puts \"Could not generate subclip, #{error.localizedDescription}\"\n exit(-1)\n end\n \n # Writing out the temporary file and storing the path in the movies array\n temp_file_path = temp_dir + \"/\" + File.basename(file_path, File.extname(file_path)) + \"-\" + i.to_s + \".mov\"\n movie_part.writeToFile_withAttributes(temp_file_path, attributes)\n movies.push(temp_file_path)\n end\n return movies \n end",
"def video_gen(slide)\n term = slide['term']\n kind = slide['kind']\n index = slide['index']\n audio = slide['audio']\n image = slide['image']\n raise \"audio is required fof #{term}\" unless audio\n raise \"image is required fof #{term}\" unless image\n file_name = file_name_gen(slide, \".mpg\")\n audio = command_arg(slide['audio'])\n image = command_arg(slide['image'])\n video = command_arg(file_name)\n `ffmpeg -loop 1 -y -i #{image} -i #{audio} -acodec libmp3lame -vcodec mpeg4 -shortest -qscale:v 1 #{video}`\n slide['video'] = file_name\nend",
"def run\n\n @options = @video.convert_options\n @output_file = \"#{generate_path @video.name}/#{@video.name}#{@options[:postfix]}.#{@options[:extension]}\"\n\n command = \"#{CONFIG[:ffmpeg_binary]} -y -i '#{@video.path}' #{@options} '#{@output_file}'\"\n output = \"\"\n convert_error = true\n\n # before convert callbacks\n Hook.exec :before_convert, @video, command\n\n # process video\n Open3.popen3(command) do |stdin, stdout, stderr|\n stderr.each \"r\" do |line|\n VTools.fix_encoding line\n output << line\n\n # we know, that all is not so bad, if \"time=\" at least once met\n if line.include? \"time=\"\n\n convert_error = false # that is why, we say \"generally it's OK\"\n\n if line =~ /time=(\\d+):(\\d+):(\\d+.\\d+)/ # ffmpeg 0.8 and above style\n time = ($1.to_i * 3600) + ($2.to_i * 60) + $3.to_f\n elsif line =~ /time=(\\d+.\\d+)/ # ffmpeg 0.7 and below style\n time = $1.to_f\n else # in case of unexpected output\n time = 0.0\n end\n progress = time / @video.duration\n Hook.exec :in_convert, @video, progress # callbacks\n end\n end\n end\n\n raise ProcessError, output.split(\"\\n\").last if convert_error # exit on error\n\n # callbacks\n unless error = encoding_invalid?\n Hook.exec :convert_success, @video, @output_file\n else\n Hook.exec :convert_error, @video, error, output\n raise ProcessError, error # raise exception in error\n end\n\n encoded\n end",
"def transcode_movie\n @command = \"#{FFMPEG.ffmpeg_binary} -y -i #{Shellwords.escape(@movie.path)} #{@raw_options} #{Shellwords.escape(@output_file)}\"\n FFMPEG.logger.info(\"Running transcoding...\\n#{@command}\\n\")\n @output = ''\n\n Open3.popen3(@command) do |_stdin, _stdout, stderr, wait_thr|\n begin\n yield(0.0) if block_given?\n\n next_line = proc do |line|\n fix_encoding(line)\n @output << line\n\n # frame= 1253 fps=249 q=0.0 size=N/A time=00:00:23.90 bitrate=N/A speed=4.75x\n if line.include?('time=')\n time = 0.0\n if line =~ /time=(?<hours>\\d+):(?<minutes>\\d+):(?<seconds>\\d+\\.\\d+)/ # ffmpeg 0.8 and above style\n time = (Regexp.last_match(:hours).to_i * 3600) + (Regexp.last_match(:minutes).to_i * 60) + Regexp.last_match(:seconds).to_f\n end\n progress = time / @movie.duration\n\n yield(progress) if block_given?\n end\n end\n\n if self.class.timeout\n stderr.each_with_timeout(wait_thr.pid, self.class.timeout, 'size=', &next_line)\n else\n stderr.each('size=', &next_line)\n end\n rescue Timeout::Error => e\n FFMPEG.logger.error \"Process hung... #{e.message}\\n@command\\n#{@command}\\nOutput\\n#{@output}\\n\"\n raise Error, \"Process hung. Full output: #{@output}\"\n end\n end\n end",
"def run\n @files.each do |file|\n generate_tracklist(file)\n end\n end",
"def ffmpeg_libvpx_cmd(input_path, output_path, bitrate, output_size, force=false)\n replace = force ? \"-y\" : \"\"\n return [\n \"ffmpeg -i '#{input_path}' -threads 8\",\n \"-c:v libvpx -pix_fmt yuv420p -crf 10 -b:v #{bitrate} -s #{output_size} -movflags +faststart -r 29.97 -c:a libvorbis -aq 5 #{replace} '#{output_path}'\"\n ]\nend",
"def process_previews!\n source = Magick::ImageList.new(preview_path).first\n\n previews.each do |name, blk|\n path = File.join(@dir, \"#{name}_preview.jpg\")\n\n copy = source.copy\n blk.call(copy)\n copy.write(path)\n\n @paths << path\n end\n\n @paths\n end",
"def ffmpeg_libx264_cmd(input_path, output_path, bitrate, output_size, force=false)\n crf = case bitrate\n when \"10M\" then 20\n when \"2M\" then 20\n when \"500k\" then 21\n else 21\n end\n replace = force ? \"-y\" : \"\"\n return [\n \"ffmpeg -i '#{input_path}' -threads 8\",\n \"-c:v libx264 -profile:v main -pix_fmt yuv420p -tune film -crf #{crf} -s #{output_size} -movflags +faststart -r 29.97 -c:a libfdk_aac -b:a 48k #{replace} '#{output_path}'\"\n ]\nend",
"def video(*sources)\n options = sources.extract_options!.symbolize_keys\n sources = sources.shift if sources.size == 1\n\n if options[:poster]\n options[:poster] = asset_path(options[:poster])\n end\n\n if size = options.delete(:size)\n options[:width], options[:height] = size =~ /^\\d+x\\d+$/ ? size.split('x') : size\n end\n\n if sources.is_a?(Array)\n content_tag(:video, options) do\n sources.collect { |source| tag(:source, src: asset_path(source)) }.join(\"\\n\")\n end\n else\n tag(:video, options.reverse_merge(src: asset_path(sources)))\n end\n end",
"def convert(file_info)\n input_name = Shellwords.escape(file_info[:filename])\n input_suffix = File.extname input_name\n output_name = File.basename input_name, input_suffix\n output_suffix = \"mp4\"\n command = [ \"ffmpeg\", \"-y\", \"-i #{input_name}\", \"-max_muxing_queue_size 9999\", \"-map_chapters -1\" ]\n\n if (file_info[:video].empty? && !file_info[:audio].empty?) || input_suffix == '.flac' || input_suffix == '.mp3' || input_suffix == '.aiff'\n #\n # Audio-only files are converted to either ALAC if the source was FLAC, or\n # AAC for all other formats.\n #\n stream = file_info[:audio][0]\n case stream[:codec]\n when \"alac\"\n command << \"-map 0:a:#{stream[:index]}\" << \"-codec:a copy\"\n when \"flac\"\n command << \"-map 0:a:#{stream[:index]}\" << \"-codec:a alac\"\n when \"mp3\"\n command << \"-map 0:a:#{stream[:index]}\" << \"-codec:a alac\"\n else\n command << \"-map 0:a:#{stream[:index]}\" << \"-codec:a aac\" << \"-ar:a:0 48k\" << \"-ab:a 256k\"\n end\n output_suffix = \"m4a\"\n elsif !file_info[:video].empty? && !file_info[:audio].empty?\n # Removes all of the default metadata that junks up the final file.\n command << \"-map_metadata -1\"\n \n # Maps the video track\n command << \"-map 0:v:0\" << \"-metadata:s:v:0 language=und\" << \"-metadata:s:v:0 title='Video Track'\"\n\n #\n # The video track is copied if the codec is h265 (hevc) and a video tag\n # is added so that Apple products understand the format. Otherwise, the\n # video track is copied if it's in h264 format and the frame size is\n # to remain the same, or it's converted to h264 using high-quality\n # settings.\n #\n if \"hevc\" == file_info[:video][:codec]\n command << \"-codec:v copy -vtag hvc1\"\n elsif \"h264\" == file_info[:video][:codec] && !Options.options[:P480] && !Options.options[:P720]\n command << \"-codec:v copy\"\n else\n # This converts the video using settings that provide nearly visual\n # lossless results.\n output_suffix = \"mp4\"\n command << \"-codec:v libx265\" << \"-vtag hvc1\" << \"-preset:v slow\" << \"-profile:v main\" << \"-crf:v 18\" << \"-threads:v 0\"\n\n # Converts HD video to wide-screen 720P if necessary.\n command << \"-vf:v scale=1280:-1\" if Options.options[:P720]\n\n # Converts HD video to wide-screen 480P if necessary.\n command << \"-vf:v scale=854:-1\" if Options.options[:P480]\n end\n\n # Convert all of the audio tracks to AAC (stereo) and AC3 (multi-channel)\n index = 0\n file_info[:audio].each do |stream|\n index, c = convert_audio(stream, index)\n command << c\n end\n\n if file_info.key?(:subtitle) && !file_info[:subtitle].nil? && !file_info[:subtitle].empty?\n command << \"-map 0:s:#{file_info[:subtitle][:index]}\" << \"-metadata:s:s:0 language=eng\" << \"-metadata:s:s:0 title='Subtitle Track'\"\n command << ('dvd_subtitle' == file_info[:subtitle][:codec] ? \"-codec:s:0 copy\" : \"-codec:s:0 mov_text\")\n end\n\n end\n\n command << \"#{output_name}.#{output_suffix}\"\n\n if Options.options[:dump]\n puts command.join(' ')\n exit\n end\n\n #\n # Starts the transcoding process.\n #\n puts file_info[:filename]\n progress = ProgressBar.create(:format => \"%t |%B| %e\",\n :total => file_info[:duration] + 1,\n :title => \"Encoding Progress\")\n execute(command, true) do |line|\n begin\n line.match /time=(\\d\\d):(\\d\\d):(\\d\\d)/ do |match|\n if match.length == 4\n time = match[1].to_i * 3600 + match[2].to_i * 60 + match[3].to_i\n progress.progress = time\n end\n end\n rescue\n # Some UTF-8 characters can cause match to throw, but these characters are not used by this script.\n end\n end\n progress.finish\nend",
"def run\n file = \"english.srt\"\n times = parse_times file\n build_ffmpeg times, file\nend",
"def test03()\n sourceMovie = File.join($directory, \"images/604_sd_clip.mov\") # 576x360\n width = 576\n height = 360\n movieLength = 300.0 # seconds.\n borderWidth = 32\n bitmapWidth = (3.0 * width.to_f * 0.5 + (3+1) * borderWidth).to_i\n bitmapHeight = (4.0 * height.to_f * 0.5 + (4+1) * borderWidth).to_i\n bitmapSize = MIShapes.make_size(bitmapWidth, bitmapHeight)\n baseFileName = \"coversheet\"\n begin\n # 1. Create the list of commands object, ready to have commands added to it.\n theCommands = SmigCommands.new\n theCommands.saveresultstype = :lastcommandresult\n\n # 2. Create movie importer and assign to list of commands.\n # Basically after the first block of commands is run, the movie importer\n # is closed automatically in the cleanup commands.\n movieImporterName = SecureRandom.uuid\n movieObject = theCommands.make_createmovieimporter(sourceMovie,\n name: movieImporterName)\n \n # 3. Create the process movie frames command and configure.\n imageIdentifier = SecureRandom.uuid\n\n processFramesCommand = ProcessFramesCommand.new(movieObject)\n processFramesCommand.create_localcontext = false\n processFramesCommand.imageidentifier = imageIdentifier\n\n track_id = MovieTrackIdentifier.make_movietrackid_from_mediatype(\n mediatype: :vide, trackindex: 0)\n \n processFramesCommand.videotracks = [ track_id ]\n\n # 4. Make a pre-process command list.\n preProcessCommands = []\n \n # 5. Make a create a bitmap context command.\n bitmapName = SecureRandom.uuid\n createBitmapCommand = CommandModule.make_createbitmapcontext(\n name: bitmapName, size: bitmapSize)\n\n bitmapObject = SmigIDHash.make_objectid(objecttype: :bitmapcontext,\n objectname: bitmapName)\n\n # 6. Add the create bitmap context object command to the pre-process list.\n preProcessCommands.push(createBitmapCommand.commandhash)\n\n # 7. Make a create exporter object command and add it to the pre-process list\n exporterName = SecureRandom.uuid\n createExporterCommand = CommandModule.make_createexporter(\n \"~/placeholder.jpg\", export_type: 'public.jpeg', name: exporterName)\n preProcessCommands.push(createExporterCommand.commandhash)\n exporterObject = SmigIDHash.make_objectid(objecttype: :imageexporter,\n objectname: exporterName)\n\n # 8. Assign the pre-process commands to the process movie frames command.\n processFramesCommand.preprocesscommands = preProcessCommands\n \n # 9. Add a close bitmap object command to cleanup commands.\n processFramesCommand.add_tocleanupcommands_closeobject(bitmapObject)\n \n # 10. Add a close exporter object command to cleanup commands.\n processFramesCommand.add_tocleanupcommands_closeobject(exporterObject)\n\n # 11. Add a remove image from collection command to cleanup commands.\n processFramesCommand.add_tocleanupcommands_removeimage(imageIdentifier)\n\n # 12. Prepare and start looping for creating process frame instrutions.\n numFrames = 24\n framesPerPage = 12 # 3 x 4\n frameDuration = movieLength / (numFrames - 1)\n pageNumber = 0\n x = 0\n y = 0\n halfWidth = width / 2\n halfHeight = height / 2\n drawnFrameSize = MIShapes.make_size(halfWidth, halfHeight)\n textBoxSize = MIShapes.make_size(halfWidth, borderWidth * 3 / 4)\n filesToCompare = []\n numFrames.times do |i|\n # 13. Create a ProcessMovieFrameInstruction object\n frameInstructions = ProcessMovieFrameInstructions.new\n \n # 14. Calculate the frame time and assign it.\n time = i.to_f * frameDuration\n frameTime = MovieTime.make_movietime_fromseconds(time)\n frameInstructions.frametime = frameTime\n \n # 15. Determine the frame number on the page & destination rectangle.\n frameNumber = i % framesPerPage\n x = frameNumber % 3\n y = 3 - (frameNumber / 3)\n xloc = x * halfWidth + (x + 1) * borderWidth\n yloc = y * halfHeight + (y + 1) * borderWidth\n origin = MIShapes.make_point(xloc, yloc)\n drawnFrameRect = MIShapes.make_rectangle(size: drawnFrameSize,\n origin: origin)\n \n # 16. Create the draw image element to draw the frame onto the bitmap.\n drawImageElement = MIDrawImageElement.new()\n drawImageElement.destinationrectangle = drawnFrameRect\n drawImageElement.set_imagecollection_imagesource(identifier: imageIdentifier)\n \n # 17. Create the draw image command and add it to the frame instructions.\n drawImageCommand = CommandModule.make_drawelement(bitmapObject,\n drawinstructions: drawImageElement, createimage: false)\n frameInstructions.add_command(drawImageCommand)\n \n # 18. Prepare drawing the text with the time.\n timeString = \"Frame time: %.3f secs\" % time\n drawStringElement = MIDrawBasicStringElement.new()\n drawStringElement.stringtext = timeString\n drawStringElement.userinterfacefont = \"kCTFontUIFontLabel\"\n drawStringElement.textalignment = \"kCTTextAlignmentCenter\"\n drawStringElement.fillcolor = MIColor.make_rgbacolor(0.0, 0.0, 0.0)\n boxOrigin = MIShapes.make_point(xloc, yloc - borderWidth)\n boundingBox = MIShapes.make_rectangle(size: textBoxSize, origin: boxOrigin)\n drawStringElement.boundingbox = boundingBox\n drawTextCommand = CommandModule.make_drawelement(bitmapObject,\n drawinstructions: drawStringElement, createimage: false)\n frameInstructions.add_command(drawTextCommand)\n\n # 19. If this was the last frame to be drawn then export the page.\n if (frameNumber == framesPerPage - 1) || i == numFrames - 1\n addImageCommand = CommandModule.make_addimage(exporterObject, bitmapObject)\n frameInstructions.add_command(addImageCommand)\n pageNum = (i / 12).to_s.rjust(3, '0')\n fileName = baseFileName + pageNum + \".jpg\"\n filesToCompare.push(fileName)\n# filePath = File.join($compareImageDir, fileName)\n filePath = File.join(Dir.tmpdir(), fileName)\n setExportPathCommand = CommandModule.make_set_objectproperty(\n exporterObject,\n propertykey: :file,\n propertyvalue: filePath)\n frameInstructions.add_command(setExportPathCommand)\n exportCommand = CommandModule.make_export(exporterObject)\n frameInstructions.add_command(exportCommand)\n # 20. Now redraw the bitmap context with a white rectangle.\n redrawBitmapElement = MIDrawElement.new(:fillrectangle)\n redrawBitmapElement.fillcolor = MIColor.make_rgbacolor(1.0, 1.0, 1.0)\n redrawBitmapElement.rectangle = MIShapes.make_rectangle(size: bitmapSize)\n redrawCommand = CommandModule.make_drawelement(bitmapObject,\n drawinstructions: redrawBitmapElement)\n frameInstructions.add_command(redrawCommand)\n end\n # 21. Set the frame processing intructions to the process frames command.\n processFramesCommand.add_processinstruction(frameInstructions)\n end\n \n # 22. Add the process frames command to the list of commands.\n theCommands.add_command(processFramesCommand)\n Smig.perform_commands(theCommands)\n\n filesToCompare.each do |fileName|\n origFile = File.join($compareImageDir, fileName)\n tempFile = File.join(Dir.tmpdir(), fileName)\n# tempFile = File.join($compareImageDir, fileName)\n compareResult = AreImageFilesSame(origFile, tempFile, 0)\n FileUtils.rm_f(tempFile)\n # FileUtils.mv(tempFile, origFile)\n unless compareResult\n # 2. Report if different.\n raise \"Different image files: \" + origFile + \" and \" + tempFile\n end\n end\n\n rescue RuntimeError => e\n $errorcode = Smig.exitvalue\n unless $errorcode.zero?\n puts \"Exit string: \" + Smig.exitstring\n puts \" Exit status: \" + $errorcode.to_s\n end\n puts e.message\n puts e.backtrace.to_s\n end\nend",
"def build(filename, frames)\n frames = normalize_depth frames, to: 3 # frames are rows of pixels\n pixel_args = frames.flat_map.with_index do |rows, z|\n width, height = frames.first.first.length, frames.first.length\n [ '(',\n '-size', \"#{width}x#{height}\", 'xc:none',\n '-frame', z.to_s,\n *rows.flat_map.with_index { |pixels, y|\n pixels.flat_map.with_index do |pixel, x|\n color = if pixel[:transparent]\n ['-alpha', 'Transparent']\n else\n [\"-fill\", \"RGB(#{pixel.fetch :red},#{pixel.fetch :green},#{pixel.fetch :blue})\",\n \"-draw\", \"point #{x},#{y}\"\n ]\n end\n end\n },\n ')',\n ]\n end\n\n if File.exist? filename\n puts \"skipping #{filename}\"\n else\n program = 'convert', '-coalesce', *pixel_args, filename\n puts program.join ' '\n system *program\n end\nend",
"def callback\n base_dir = \"#{RAILS_ROOT}/../../../source/\"\n\n a = Asset.find_by_zencoder_output_id(params['output']['id'])\n\n file_extension = \"mp4\"\n\n case a.description\n when \"1280x720\"\n size = \"-large\"\n when \"640x360\"\n size = \"-small\"\n else\n size = \"\"\n file_extension=\"mp3\"\n end\n\n file = \"#{a.video.to_param}#{size}.#{file_extension}\"\n # pick a random thumbnail as the preview image\n image_file = \"#{a.video.to_param}-thumb_#{rand(5).to_s.rjust(4,\"0\")}.png\"\n\n a.data = File.new(\"#{base_dir}zencoder/#{file}\")\n a.save\n\n a.populate_metadata\n a.zencoder_job_complete = true\n a.save\n\n if size == \"-small\"\n v = a.video\n v.streaming_asset_id = a.id\n v.available = true\n v.post_date = Date.today\n v.image = File.new(\"#{base_dir}zencoder/#{image_file}\")\n v.save\n end\n\n # TODO add code to set the primary asset to complete if all assets\n # generated by that one are complete.\n all_done = true\n a.video.assets.each do |as|\n unless as.generated_by_asset_id == 0 && as.generated_by_asset_id.nil?\n unless as.zencoder_job_complete == true\n all_done = false\n end\n end\n end\n\n if all_done\n generated_by_asset = Asset.find(a.generated_by_asset_id)\n generated_by_asset.zencoder_job_complete = true\n generated_by_asset.save\n end\n\n respond_to do |format|\n format.js {\n render :text => \"ok\".to_json\n }\n end\n end",
"def checkForTranscode(path, filename)\n pathToFile = File.join(path, filename)\n outputPathToFile = File.join(TMP_PATH, pathToFile)\n\n if ($doNotConvertVideosAgain && File.exists?(outputPathToFile))\n BigBlueButton.logger.info( \"Converted video for #{pathToFile} already exists, skipping...\")\n return path\n end\n\n # Gather possible commands\n transcodeCommands = []\n movie = FFMPEG::Movie.new(pathToFile)\n unless (movie.width % 2 == 0 && movie.height % 2 == 0)\n BigBlueButton.logger.info( \"Video #{pathToFile} requires cropping to be DivBy2\")\n transcodeCommands.push(%w(-y -r 30 -vf crop=trunc(iw/2)*2:trunc(ih/2)*2))\n end\n if (movie.duration <= 0)\n BigBlueButton.logger.info( \"Video #{pathToFile} requires transcoding due to missing duration\")\n transcodeCommands.push(%w(-y -c copy))\n end\n\n # Run gathered commands\n if(transcodeCommands.length == 0)\n BigBlueButton.logger.info( \"Video #{pathToFile} is fine\")\n return path\n else\n # Create path to save conversion to\n outputPath = File.join(TMP_PATH, path)\n unless File.directory?(outputPath)\n FileUtils.mkdir_p(outputPath)\n end\n\n BigBlueButton.logger.info( \"Start converting #{pathToFile} ...\")\n transcodeCommands.each do | command |\n BigBlueButton.logger.info( \"Running ffmpeg with options: #{command}\")\n movie.transcode(outputPath + 'tmp' + filename, command)\n FileUtils.mv(outputPath + 'tmp' + filename, outputPathToFile)\n movie = FFMPEG::Movie.new(outputPathToFile) # Further transcoding should happen on the new file\n end\n\n BigBlueButton.logger.info( \"Done converting #{pathToFile}\")\n return outputPath\n end\nend",
"def run\n begin\n prepare_for_conversion\n\n Queue.run *FORMATS.map{ |format| proc{ convert_to(format) } }, close_connection_before_execution: true\n \n mp4_file_info = Info.new output_path(:mp4)\n webm_file_info = Info.new output_path(:webm)\n \n unless similar_durations?(mp4_file_info.duration, webm_file_info.duration) \n raise Error.new( 'output videos have different duration', \n model_id: model_id, mp4_duration: mp4_file_info.duration, webm_duration: webm_file_info.duration )\n end\n \n cover_path = File.join output_folder, COVER_FORMAT % output_filename_without_extension\n extract_cover output_path(:mp4), cover_path, mp4_file_info.duration\n \n thumb_path = File.join output_folder, THUMB_FORMAT % output_filename_without_extension\n extract_thumb cover_path, thumb_path, *THUMB_SIZES\n \n rescue StandardError => e\n FileUtils.rm_rf output_folder\n \n input_path = \n if File.exists? temp_path\n temp_path\n elsif File.exists? uploaded_path\n uploaded_path\n end\n FileUtils.cp input_path, create_log_folder if input_path\n\n if model.present? and model.user_id.present?\n Notification.send_to(\n model.user_id,\n I18n.t('notifications.video.upload.failed.title'),\n I18n.t('notifications.video.upload.failed.message', :item => model.title),\n ''\n )\n model.destroyable_even_if_not_converted = true\n model.destroy\n end\n\n raise e\n end\n \n model.converted = true\n model.rename_media = true\n model.mp4_duration = mp4_file_info.duration\n model.webm_duration = webm_file_info.duration\n model.media = output_filename_without_extension\n model[:media] = output_filename_without_extension\n model.save!\n\n #FileUtils.rm temp_path\n FileUtils.rm_r temp_folder\n\n Notification.send_to(\n model.user_id,\n I18n.t('notifications.video.upload.ok.title'),\n I18n.t('notifications.video.upload.ok.message', :item => model.title),\n ''\n )\n end",
"def each &block\n if block_given?\n Tempfile.open('temp', binmode: true) do |newmovi|\n @avi.process_movi do |indices, movi|\n newindices = indices.select do |m|\n movi.pos = m[:offset] + 8 # 8 for id and size\n frame = Frame.new(movi.read(m[:size]), m[:id], m[:flag])\n block.call frame\n unless frame.data.nil?\n m[:offset] = newmovi.pos\n m[:size] = frame.data.size\n m[:flag] = frame.flag\n m[:id] = frame.id\n newmovi.print m[:id]\n newmovi.print [frame.data.size].pack('V')\n newmovi.print frame.data\n newmovi.print \"\\0\" if frame.data.size % 2 == 1\n true\n else\n false\n end\n end\n [newindices, newmovi]\n end\n end\n else\n self.enum_for :each\n end\n end",
"def videostab(path_to_video, width, height, crop, tracking_mode)\n\t# from true/false to 1/0\n\ttracking_mode = tracking_mode && 1 || 0\n\tpython_output = `python #{PYNAME} #{path_to_video} #{width} #{height} #{crop} #{tracking_mode}`\n\tputs \"The output from #{PYNAME} is: #{python_output}\"\nend"
]
| [
"0.60002273",
"0.58840054",
"0.58810204",
"0.57090247",
"0.5693331",
"0.5655191",
"0.5628516",
"0.56282556",
"0.5576697",
"0.5517942",
"0.54917055",
"0.5438951",
"0.54197395",
"0.54037774",
"0.5365946",
"0.5324334",
"0.52558136",
"0.52532005",
"0.5248448",
"0.5240166",
"0.52176946",
"0.5175818",
"0.5145332",
"0.51349515",
"0.5126838",
"0.50947404",
"0.5089553",
"0.50661373",
"0.5047335",
"0.50470924"
]
| 0.80225223 | 0 |
Runs the command defined in the config file input_filename: The full path of the file you want to run the command on file_operation: One of the defined file operations in the config file | def run_command(input_filename, file_operation)
Log.info "Inside run_command"
if !Config['FileOperations'].key?(file_operation)
return "#{file_operation} isn't a valid preset"
end
transcode_settings = Config['FileOperations'][file_operation]
Log.info transcode_settings.to_s
begin
if !transcode_settings.key?('command')
return "#{file_operation} doesn't have a command"
end
command_template = transcode_settings['command']
filename = File.basename(input_filename)
base_filename = File.basename(input_filename, File.extname(input_filename))
if transcode_settings.key?('location')
output_filename = [transcode_settings['location'], base_filename].join('/')
else
output_filename = [Config['WebServer']['webroot'], Config['WebServer']['transcode_dir'], base_filename].join('/')
end
command = command_template % {input_filename:input_filename, output_filename: output_filename}
Log.info command
# Update the channel to let them know what's happening
call_mattermost({:text => "Running command #{file_operation} on file #{filename}"})
if system(command)
if transcode_settings.key?('text')
output_text = transcode_settings['text'] % {input_filename:input_filename, output_filename: output_filename}
else
output_text = "Finished running command #{file_operation} on file #{filename}"
end
call_mattermost({:text => output_text})
else
call_mattermost({:text => "ERROR: Could not run command #{file_operation} on file #{filename}"})
end
rescue Exception => e
Log.error e.to_s
return 'There was an error'
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def execute_file( filename )\n text = File.read(filename)\n execute(text)\n end",
"def run(filename, options) end",
"def run(config_file)\n load_options_from_file(config_file)\n check_options\n output = %x[ #{@binary} #{config_file} ]\n output\n end",
"def run_file(filename, preloading = false)\n begin\n result = RSpec::Core::CommandLine.new([\"-f\", \"p\", filename]).run(io, io)\n rescue LoadError => e\n io << \"\\nCould not load file #{filename}: #{e.message}\\n\\n\"\n result = 1\n rescue Exception => e\n io << \"Exception when running #{filename}: #{e.message}\"\n io << e.backtrace[0..7].join(\"\\n\")\n result = 1\n end\n\n if preloading\n puts io.string\n else\n channel.write(\"command\" => \"result\", \"filename\" => filename, \"return_code\" => result.to_i, \"text\" => io.string, \"worker_number\" => worker_number)\n end\n end",
"def process_command_file\n gather_command\n create_command_structure\n end",
"def run_rules(input_file)\n\t\tcommand = \"#{@base_command} \\\"#{input_file}\\\"\"\n\t\t#output = Helpers.run_command(command,true,File.dirname(@rule_directory))\n\t\toutput = Helpers.run_command(command,true,@rule_directory)\n\t\treturn output\n\tend",
"def perform(filepath)\n\n end",
"def runner_command input_path, output_path\n # run as either local or hadoop\n case run_mode\n when 'local'\n $stderr.puts \" Reading STDIN / Writing STDOUT\"\n command = local_command input_path, output_path\n when 'hadoop', 'mapred'\n $stderr.puts \" Launching hadoop as\"\n command = hadoop_command input_path, output_path\n else\n raise \"Need to use --run=local or --run=hadoop; or to use the :default_run_mode in config.yaml just say --run \"\n end\n end",
"def file filename, options = {}\n if options[:as] and Dir.glob(File.join(Builder.config.base_path, filename)).length > 1\n raise NSIS::BadParameterError.new(\"NSIS::Script::file() may only accept a single source if :as is specified.\")\n end\n \n command = [\"File\"]\n \n # non-fatal, if no match is found, a warning rather than error will be issued.\n command << \"/nonfatal\" if options[:nonfatal]\n \n # recursive\n command << \"/r\" if options[:recurse]\n \n # preserve attributes\n command << \"/a\" if options[:with_attributes]\n\n # excluded files\n command << [options[:not]].flatten.collect{|n| \"/x #{n}\"}.join(' ') if options[:not]\n \n # rename or straight\n command << (options[:as] ? \"/oname=\\\"#{options[:as]}\\\" #{filename}\" : filename)\n \n append_instruction command\n end",
"def add_std_file_opt(inkey)\n @oparse.on(\"-f\", \"--file FILENAME\", \"Input from FILENAME\") do |f|\n @opts[inkey] = do_file_read(f)\n end\n return @oparse\n end",
"def parse_file(file)\n\n\n File.readlines(file).each do |line|\n command = parse_command(line)\n end\n # File.readlines(file).each do |line|\n # command = parse_command(line)\n # apply_command(command)\n end",
"def execute\n run_command current_or_selected_files\nend",
"def dc_op input='input.cir', output=self.dc_file_name\n puts \"Execute DCOP analysis: #{ltspice_path()} -b #{input}\"\n execute '-ascii -b', input # note: execute is a defined method\n\n check_log(log_name())\n\n rawfile = input.sub(File.extname(input),'') +'.raw'\n File.rename rawfile, 'op.raw' if File.exist? rawfile\n dc_op_conv 'op.raw', output\n end",
"def run(file, line)\n system *command_for(file, line)\n end",
"def run\n handle_options()\n execute_operation()\n end",
"def test_run_file_input\n workflow = File.open(WKF_PASS, \"r\")\n\n T2Server::Run.create($uri, WKF_PASS, $creds, $conn_params) do |run|\n\n assert_nothing_raised(T2Server::AttributeNotFoundError) do\n run.input_port(\"IN\").file = FILE_INPUT\n run.generate_provenance\n run.generate_provenance(false)\n end\n refute run.generate_provenance?\n\n run.start\n assert(run.running?)\n assert_nothing_raised(T2Server::RunStateError) { run.wait }\n assert_equal(run.output_port(\"OUT\").value, \"Hello, World!\")\n\n assert_raise(T2Server::AccessForbiddenError) do\n run.provenance\n end\n\n assert(run.delete)\n end\n\n workflow.close\n end",
"def build filetask,system_config,platform\n cmd_file=command_file(filetask.name,system_config,platform)\n if File.exists?(cmd_file)\n config=system_config.platform_config(platform)\n if cmd_file.end_with?('.library')\n cmdline = librarian(cmd_file,config)\n else\n cmdline = linker(cmd_file,config)\n end\n sh(cmdline.join(' '))\n else\n raise GaudiError, \"Missing command file for #{filetask.name}\"\n end\n end",
"def run_file(filename, preloading = false)\n @cuke_runtime ||= ::Cucumber::ResetableRuntime.new # This runtime gets reused, this is important as it's the part that loads the steps...\n begin\n result = 1\n cuke_config = ::Cucumber::Cli::Configuration.new(io, io)\n cuke_config.parse!([\"--no-color\", \"--require\", \"features\", filename])\n @cuke_runtime.configure(cuke_config)\n @cuke_runtime.run!\n result = 0 unless @cuke_runtime.results.failure?\n rescue LoadError => e\n io << \"\\nCould not load file #{filename}: #{e.message}\\n\\n\"\n rescue Exception => e\n io << \"Exception when running #{filename}: #{e.message}\"\n io << e.backtrace[0..7].join(\"\\n\")\n end\n\n if preloading\n puts(io.string)\n else\n channel.write(\"command\" => \"result\", \"filename\" => filename, \"return_code\" => result.to_i, \"text\" => io.string, \"worker_number\" => worker_number)\n end\n end",
"def execute\n Tools.public_send(command, options.configuration_path)\n end",
"def run(config, content = nil)\n # init content as default table if available\n if content != nil\n settable_cmd(\"default\", content)\n end\n\n return if config == \"---\\n\"\n\n # process each command in order\n read_config(config) do | cmd, args |\n if cmd == \"read\" or cmd == \"create\"\n self.send(\"#{cmd}_cmd\", *args)\n else\n # dynamically call method based on command name\n args = set_table_refs(cmd, args)\n if args.class == DataFile # only one arg\n args.send(\"#{cmd}_cmd\", *args[1..-1])\n elsif args[0].class == DataFile # single datafile\n args[0].send(\"#{cmd}_cmd\", *args[1..-1])\n else # mult datafiles\n args[0][0].send(\"#{cmd}_cmd\", *args)\n end\n end\n end\n end",
"def process_command_line(test, mediainfo, src_file, filename)\n\n command = test.command\n\n needs_scaling = mediainfo[:needs_scaling]\n scaling_option = needs_scaling ? test.scaling_option : ''\n\n interlaced = mediainfo[:interlaced]\n interlaced_option = interlaced ? test.interlaced_option : ''\n\n params = {'INPUT_FILE' => src_file.to_s, 'OUTPUT_FILE' => filename, 'INTERLACED_OPTION' => interlaced_option, 'SCALING_OPTION' => scaling_option}\n\n params.each do |key, value|\n command = command.gsub(key, value)\n end\n\n command\nend",
"def run\n if @options['file']\n execute_script @options['file']\n elsif @options['command']\n execute @options['command']\n else\n interactive_shell\n puts \n end\n end",
"def main\n\n if ARGV[0].nil?\n STDOUT.write(\"\\nERROR! Missing input file!\\nUsage: create_HHpred_job.rb A3M-FILE\\n\")\n return\n end\n \n infilename = ARGV[0]\n # chec\n if !File.exist?(File.join(infilename))\n STDOUT.write(\"\\nERROR! No inputfile #{infilename}!\\n\") \n return\n end\n\n create_toolkit_job( infilename )\n\nend",
"def dataflow\n arg = args.first\n basename = File.basename(arg.to_s, '.rb')\n\n case\n when settings[:run] then settings[:run]\n when arg && File.exist?(arg) then basename\n else arg\n end\n end",
"def run_command f\n files=nil\n case f\n when Array\n # escape the contents and create a string\n files = Shellwords.join(f)\n when String\n files = Shellwords.escape(f)\n end\n begin\n # TODO put all this get_line stuff into field history\n command = get_line \"Run a command on #{files}: \"\n return if command.size == 0\n command2 = get_line \"Second part of command: \"\n # FIXME we may need to go into cooked mode and all that for this\n # cat and most mess with the output using system\n c_system \"#{command} #{files} #{command2}\"\n rescue Exception => ex\n perror \"Canceled command, (#{ex}) press a key\"\n return\n end\n\n c_refresh\n push_used_dirs Dir.pwd\nend",
"def run_cmd(input); end",
"def run_from_file_command(command)\n if logger.debug?\n debug(\"Creating exec script for #{instance_name} (#{exec_script_file})\")\n debug(\"Executing #{exec_script_file}\")\n end\n File.open(exec_script_file, \"wb\") { |file| file.write(command) }\n %{powershell -file \"#{exec_script_file}\"}\n end",
"def file(context: nil, ignore_deletions: false)\n differ = \"git diff#{cmd}\"\n differ << \" --unified=#{context}\" if context\n differ << \" --diff-filter=d\" if ignore_deletions\n run(differ)\n end",
"def exec(cmd, options = {})\n Git.invoke :before_read\n\n options = {\n '-f' => @file\n }.merge(options)\n\n params = ''\n options.each do |key, val|\n params << \" #{key} #{Escape.shell_single_word(val)}\"\n end\n\n command = \"#{bin} #{params} #{cmd}\"\n\n `#{command}`.rstrip\n end",
"def initialize filename, options = {}\n @files = []\n @options = CommandLineOptions.new.merge options\n @filename = filename\n end"
]
| [
"0.6529169",
"0.6030414",
"0.5856169",
"0.5741992",
"0.5705901",
"0.5705548",
"0.56950265",
"0.55987614",
"0.558795",
"0.5523257",
"0.54516935",
"0.5441318",
"0.53969586",
"0.5386397",
"0.53860337",
"0.5376245",
"0.53733194",
"0.53602606",
"0.5351467",
"0.5345632",
"0.5338001",
"0.53312737",
"0.5313932",
"0.53078854",
"0.5281579",
"0.5236375",
"0.52308345",
"0.5185359",
"0.5175441",
"0.51737946"
]
| 0.73074967 | 0 |
The position of the data dictionary header within the page. | def pos_data_dictionary_header
pos_page_body
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pos_header\n @position - 2\n end",
"def header_position\n C.archive_read_header_position archive\n end",
"def pos_index_header\n pos_page_body\n end",
"def offset\n fil_header[:offset]\n end",
"def local_header_offset; end",
"def pos_partial_page_header\n pos_fil_header + 4\n end",
"def pos_fil_header\n 0\n end",
"def pos_fseg_header\n pos_index_header + size_index_header\n end",
"def page_header\n @page_header ||= cursor(pos_index_header).name(\"index\") do |c|\n index = PageHeader.new(\n n_dir_slots: c.name(\"n_dir_slots\") { c.read_uint16 },\n heap_top: c.name(\"heap_top\") { c.read_uint16 },\n n_heap_format: c.name(\"n_heap_format\") { c.read_uint16 },\n garbage_offset: c.name(\"garbage_offset\") { c.read_uint16 },\n garbage_size: c.name(\"garbage_size\") { c.read_uint16 },\n last_insert_offset: c.name(\"last_insert_offset\") { c.read_uint16 },\n direction: c.name(\"direction\") { PAGE_DIRECTION[c.read_uint16] },\n n_direction: c.name(\"n_direction\") { c.read_uint16 },\n n_recs: c.name(\"n_recs\") { c.read_uint16 },\n max_trx_id: c.name(\"max_trx_id\") { c.read_uint64 },\n level: c.name(\"level\") { c.read_uint16 },\n index_id: c.name(\"index_id\") { c.read_uint64 }\n )\n\n index.n_heap = index.n_heap_format & ((2**15) - 1)\n index.format = (index.n_heap_format & (1 << 15)).zero? ? :redundant : :compact\n\n index\n end\n end",
"def position\n _response_word.fetch(\"position\", nil)\n end",
"def data_dictionary_header\n cursor(pos_data_dictionary_header).name(\"data_dictionary_header\") do |c|\n Header.new(\n max_row_id: c.name(\"max_row_id\") { c.read_uint64 },\n max_table_id: c.name(\"max_table_id\") { c.read_uint64 },\n max_index_id: c.name(\"max_index_id\") { c.read_uint64 },\n max_space_id: c.name(\"max_space_id\") { c.read_uint32 },\n unused_mix_id_low: c.name(\"unused_mix_id_low\") { c.read_uint32 },\n indexes: c.name(\"indexes\") do\n {\n SYS_TABLES: c.name(\"SYS_TABLES\") do\n {\n PRIMARY: c.name(\"PRIMARY\") { c.read_uint32 },\n ID: c.name(\"ID\") { c.read_uint32 },\n }\n end,\n SYS_COLUMNS: c.name(\"SYS_COLUMNS\") do\n {\n PRIMARY: c.name(\"PRIMARY\") { c.read_uint32 },\n }\n end,\n SYS_INDEXES: c.name(\"SYS_INDEXES\") do\n {\n PRIMARY: c.name(\"PRIMARY\") { c.read_uint32 },\n }\n end,\n SYS_FIELDS: c.name(\"SYS_FIELDS\") do\n {\n PRIMARY: c.name(\"PRIMARY\") { c.read_uint32 },\n }\n end,\n }\n end,\n unused_space: c.name(\"unused_space\") { c.read_bytes(4) },\n fseg: c.name(\"fseg\") { Innodb::FsegEntry.get_inode(@space, c) }\n )\n end\n end",
"def get_header_info\n @data.rewind\n \n #column_count_offset = 33, record_count_offset = 24, record_length_offset = 36\n @record_count, @data_offset, @record_length = data.read(HEADER_LENGTH).unpack(\"@24 I x4 I I\")\n @column_count = (@data_offset-400)/200\n end",
"def local_header_offset=(_arg0); end",
"def page_fsp_hdr\n 0\n end",
"def position\n return @position\n end",
"def position\n return @position\n end",
"def fil_header\n @fil_header ||= cursor(pos_fil_header).name(\"fil_header\") do |c|\n {\n :checksum => c.name(\"checksum\") { c.get_uint32 },\n :offset => c.name(\"offset\") { c.get_uint32 },\n :prev => c.name(\"prev\") {\n Innodb::Page.maybe_undefined(c.get_uint32)\n },\n :next => c.name(\"next\") {\n Innodb::Page.maybe_undefined(c.get_uint32)\n },\n :lsn => c.name(\"lsn\") { c.get_uint64 },\n :type => c.name(\"type\") { PAGE_TYPE_BY_VALUE[c.get_uint16] },\n :flush_lsn => c.name(\"flush_lsn\") { c.get_uint64 },\n :space_id => c.name(\"space_id\") { c.get_uint32 },\n }\n end\n end",
"def position\n @entry.position\n end",
"def offset\n Array.new(headers.length, '')\n end",
"def pos\n @layout[@pos - 1]\n end",
"def position\n @position\n end",
"def first\n header_data\n end",
"def size_data_dictionary_header\n ((8 * 3) + (4 * 7) + 4 + Innodb::FsegEntry::SIZE)\n end",
"def pos_rseg_header\n pos_page_body\n end",
"def position\n @position ||= begin\n row, column = filename_with_position.split(':').slice(1..2)\n Parsing::Location.new(row: row.to_i, column: column.to_i)\n end\n end",
"def show_section_h_offset\n\t\t\tputs \" Start of section headers: #{@elf_section_h_offset} (bytes into file)\"\n\t\tend",
"def size_index_header\n 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 8 + 2 + 8\n end",
"def offset\n @offset ||= raw_response['response']['start']\n end",
"def position; end",
"def position; end"
]
| [
"0.77962977",
"0.7534069",
"0.71625656",
"0.69582975",
"0.69355947",
"0.6839482",
"0.659235",
"0.6557365",
"0.6500078",
"0.64648426",
"0.6379584",
"0.6372833",
"0.6348647",
"0.6330062",
"0.62297636",
"0.62297636",
"0.61918914",
"0.61702305",
"0.61660814",
"0.6159254",
"0.6136642",
"0.61319226",
"0.61213577",
"0.61179847",
"0.60851556",
"0.6080514",
"0.60672873",
"0.60529965",
"0.6047397",
"0.6047397"
]
| 0.80084866 | 0 |
The size of the data dictionary header. | def size_data_dictionary_header
((8 * 3) + (4 * 7) + 4 + Innodb::FsegEntry::SIZE)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def header_size\n TYPE_SIZE\n end",
"def d_size\n uint64(header, 'size') / @blockSize\n end",
"def size\n @data ? @data.size : header.sh_size\n end",
"def header_size\n 12\n end",
"def size\n self.data.keys.size\n end",
"def size\n @data.bytesize\n end",
"def size\n self.data.length + 4\n end",
"def header_size\n FFI::Type::ULONG.size + FFI::Type::USHORT.size + FFI::Type::USHORT.size\n end",
"def header_length size\n size.to_s(16).length +\n CHUNK_SIGNATURE_HEADER.length +\n SIGNATURE_LENGTH +\n CLRF.length +\n size +\n CLRF.length\n end",
"def uncompressed_size\n @header.size\n end",
"def size\n stats[:dataSize]\n end",
"def size\n stats[:dataSize]\n end",
"def header_size(header)\n header.unpack(\"N\").first\n end",
"def byte_size(); @data.byte_size + 4; end",
"def size ; data['size'] ; end",
"def size\n @data.size\n end",
"def size\n @data.size\n end",
"def size\n @data.size\n end",
"def header_size\n 0\n end",
"def size\n return @data.size\n end",
"def size\n headers[:content_length].to_i\n end",
"def size\n headers[\"content-length\"].to_i\n end",
"def size\r\n self.data.length\r\n end",
"def size\n data.values.inject(0){|m,v| m+=v.size}\n end",
"def size\n @data.size\n end",
"def size\n @data.size\n end",
"def size\n return @data.size\n end",
"def size_fil_header\n 4 + 4 + 4 + 4 + 8 + 2 + 8 + 4\n end",
"def size\n\n self.to_h.size\n end",
"def header_len\n (@binhdr[12, 1].unpack(\"C\").pop >> 4) << 2\n end"
]
| [
"0.8326364",
"0.8231278",
"0.821332",
"0.7950296",
"0.7906167",
"0.7841435",
"0.77830505",
"0.77472657",
"0.7738898",
"0.77322656",
"0.772482",
"0.772482",
"0.7649034",
"0.7637968",
"0.7603028",
"0.7592744",
"0.7592744",
"0.7592744",
"0.75760883",
"0.7490768",
"0.7485302",
"0.746882",
"0.7463521",
"0.74046946",
"0.7357788",
"0.7357788",
"0.7346511",
"0.7327596",
"0.7322446",
"0.7313257"
]
| 0.87241167 | 0 |
GET /krishes GET /krishes.json | def index
@krishes = Krish.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @konyu_rireki = KonyuRireki.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @konyu_rireki }\n end\n end",
"def show\n @heli_kit = HeliKit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @heli_kit }\n end\n end",
"def index\n @kids = Kid.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @kids }\n end\n end",
"def index\n @khs = Kh.all\n end",
"def index\n @kraje = Kraj.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @kraje }\n end\n end",
"def show\n @koti = Koti.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @koti }\n end\n end",
"def show\n @kisalli = Kisalli.find_by_key(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kisalli }\n end\n end",
"def index # public\n if params[:shelter_id]\n set_shelter\n render json: @shelter.animals\n else\n @animals = Animal.includes(:shelter).all\n render 'index.json.jbuilder'\n end\n end",
"def index\n @kifus = Kifu.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @kifus }\n end\n end",
"def show\n @cheer = Cheer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cheer }\n end\n end",
"def show\n render json: @shelter\n end",
"def show\n @kitten = Kitten.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kitten }\n end\n end",
"def route\n hitch = Hitch.find(params[:hitch_id])\n render json: hitch.geojson\n end",
"def show\n @kitty = Kitty.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kitty }\n end\n end",
"def index\n @harvestings = Harvesting.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @harvestings }\n end\n end",
"def show\n @squawk = Squawk.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @squawk }\n end\n end",
"def show\n @kolegij = Kolegij.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kolegij }\n end\n end",
"def show\n @kit = Kit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kit }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dish }\n end\n end",
"def show\n @scratcher = Scratcher.find(params[:id])\n\n render json: @scratcher\n end",
"def show\n @kid = Kid.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kid }\n end\n end",
"def index\n @wks = Wk.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @wks }\n end\n end",
"def show\n @sleuths = HTTParty.get('https://webservice.wikipathways.org/findPathwaysByText?query=' + @sleuth.ext_gene + '&species=homo+sapiens&format=json',\n :headers =>{'Content-Type' => 'application/json'} )\n @pubs = HTTParty.get('https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmed&retmode=json&term='+ @sleuth.ext_gene,\n :headers =>{'Content-Type' => 'application/json'} )\n end",
"def index\n @karyalay_caterers = KaryalayCaterer.all\n render json: @karyalay_caterers\n end",
"def show\n render json: @rock\n end",
"def index\n skickers = Skicker.order(power: :asc)\n render json: { status: 'SUCCESS', message: 'Loaded skickers', value: skickers }\n end",
"def show\n @kolegiji = Kolegiji.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kolegiji }\n end\n end",
"def index\n # @rushes = Rush.find_by_sql \"select * from rushes as r \n # left join (select rush_id, avg(chill) as avg_chill from cpratings group by rush_id) as c \n # on c.rush_id = r.id \n # order by c.avg_chill DESC\"\n @rushes = Rush.all\n render :json => @rushes\n end",
"def index\n @hikers = Hiker.all\n end",
"def index\n @frais_hebergements = FraisHebergement.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @frais_hebergements }\n end\n end"
]
| [
"0.64235795",
"0.6413217",
"0.63505614",
"0.63149554",
"0.6259184",
"0.61902434",
"0.6148827",
"0.61450493",
"0.613017",
"0.61261714",
"0.6111282",
"0.61100954",
"0.602197",
"0.59770715",
"0.5976871",
"0.5969935",
"0.5937085",
"0.5936833",
"0.5933155",
"0.5927539",
"0.5918369",
"0.59108937",
"0.59066445",
"0.59057254",
"0.5905105",
"0.5889064",
"0.5882202",
"0.58775616",
"0.583814",
"0.5837051"
]
| 0.72551185 | 0 |
POST /krishes POST /krishes.json | def create
@krish = Krish.new(krish_params)
respond_to do |format|
if @krish.save
format.html { redirect_to @krish, notice: 'Krish was successfully created.' }
format.json { render action: 'show', status: :created, location: @krish }
else
format.html { render action: 'new' }
format.json { render json: @krish.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @kraj = Kraj.new(params[:kraj])\n\n respond_to do |format|\n if @kraj.save\n format.html { redirect_to @kraj, notice: 'Kraj was successfully created.' }\n format.json { render json: @kraj, status: :created, location: @kraj }\n else\n format.html { render action: \"new\" }\n format.json { render json: @kraj.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @krishes = Krish.all\n end",
"def create\n @heli_kit = HeliKit.new(params[:heli_kit])\n\n respond_to do |format|\n if @heli_kit.save\n format.html { redirect_to @heli_kit, notice: 'Heli kit was successfully created.' }\n format.json { render json: @heli_kit, status: :created, location: @heli_kit }\n else\n format.html { render action: \"new\" }\n format.json { render json: @heli_kit.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @hk = Hk.new(hk_params)\n\n respond_to do |format|\n if @hk.save\n format.html { redirect_to @hk, notice: 'Hk was successfully created.' }\n format.json { render action: 'show', status: :created, location: @hk }\n else\n format.html { render action: 'new' }\n format.json { render json: @hk.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @keihi = Keihi.new(keihi_params)\n\n respond_to do |format|\n if @keihi.save\n format.html { redirect_to @keihi, notice: 'Keihi was successfully created.' }\n format.json { render :show, status: :created, location: @keihi }\n else\n format.html { render :new }\n format.json { render json: @keihi.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @kh = Kh.new(kh_params)\n\n respond_to do |format|\n if @kh.save\n format.html { redirect_to @kh, notice: 'Kh was successfully created.' }\n format.json { render :show, status: :created, location: @kh }\n else\n format.html { render :new }\n format.json { render json: @kh.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @scratcher = Scratcher.new(permitted_params)\n\n if @scratcher.save\n render json: @scratcher, status: :created, location: @scratcher\n else\n render json: @scratcher.errors, status: :unprocessable_entity\n end\n end",
"def create\n @hiker = Hiker.new(hiker_params)\n\n respond_to do |format|\n if @hiker.save\n format.html { redirect_to @hiker, notice: 'Hiker was successfully created.' }\n format.json { render :show, status: :created, location: @hiker }\n else\n format.html { render :new }\n format.json { render json: @hiker.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @keiyaku = Keiyaku.new(keiyaku_params)\n\n respond_to do |format|\n if @keiyaku.save\n format.html { redirect_to @keiyaku, notice: 'Keiyaku was successfully created.' }\n format.json { render :show, status: :created, location: @keiyaku }\n else\n format.html { render :new }\n format.json { render json: @keiyaku.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @shelter = Shelter.new(shelter_params)\n\n if @shelter.save\n render json: @shelter, status: :created, location: @shelter\n else\n render json: @shelter.errors, status: :unprocessable_entity\n end\n end",
"def create\n @koti = Koti.new(params[:koti])\n\n respond_to do |format|\n if @koti.save\n format.html { redirect_to @koti, notice: 'Koti was successfully created.' }\n format.json { render json: @koti, status: :created, location: @koti }\n else\n format.html { render action: \"new\" }\n format.json { render json: @koti.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @kniha = Kniha.new(kniha_params)\n\n respond_to do |format|\n if @kniha.save\n format.html { redirect_to @kniha, notice: 'Kniha was successfully created.' }\n format.json { render :show, status: :created, location: @kniha }\n else\n format.html { render :new }\n format.json { render json: @kniha.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cheer = Cheer.new(params[:cheer])\n\n respond_to do |format|\n if @cheer.save\n format.html { redirect_to @cheer, notice: 'Cheer was successfully created.' }\n format.json { render json: @cheer, status: :created, location: @cheer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @cheer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @inchicken_dish = InchickenDish.new(inchicken_dish_params)\n\n respond_to do |format|\n if @inchicken_dish.save\n format.html { redirect_to @inchicken_dish, notice: 'Inchicken dish was successfully created.' }\n format.json { render :show, status: :created, location: @inchicken_dish }\n else\n format.html { render :new }\n format.json { render json: @inchicken_dish.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @rishabh = Rishabh.new(rishabh_params)\n\n respond_to do |format|\n if @rishabh.save\n format.html { redirect_to @rishabh, notice: 'Rishabh was successfully created.' }\n format.json { render action: 'show', status: :created, location: @rishabh }\n else\n format.html { render action: 'new' }\n format.json { render json: @rishabh.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @dish = @cafeteria.dishes.new(dish_params)\n\n respond_to do |format|\n if @dish.save\n format.html { redirect_to @cafeteria, notice: 'El plato se ha creado.' }\n format.json { render :show, status: :created, location: @dish }\n else\n format.html { redirect_to @cafeteria, alert: 'No se pudo crear el plato.' }\n format.json { render json: @dish.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @koszyk = Koszyk.new(koszyk_params)\n\n respond_to do |format|\n if @koszyk.save\n format.html { redirect_to @koszyk, notice: 'Koszyk was successfully created.' }\n format.json { render :show, status: :created, location: @koszyk }\n else\n format.html { render :new }\n format.json { render json: @koszyk.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @jyanken = Jyanken.new(jyanken_params)\n\n respond_to do |format|\n if @jyanken.save\n format.html { redirect_to @jyanken, notice: 'Jyanken was successfully created.' }\n format.json { render :show, status: :created, location: @jyanken }\n else\n format.html { render :new }\n format.json { render json: @jyanken.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @knol = Knol.new(knol_params)\n\n respond_to do |format|\n if @knol.save\n format.html { redirect_to @knol, notice: 'Knol was successfully created.' }\n format.json { render action: 'show', status: :created, location: @knol }\n else\n format.html { render action: 'new' }\n format.json { render json: @knol.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post\n Typhoeus.post(@url,\n body: @results_hash.to_json,\n headers: { 'Content-Type' => 'application/json' })\n end",
"def create\n @kindergarten = Kindergarten.new(kindergarten_params)\n\n respond_to do |format|\n if @kindergarten.save\n format.html { redirect_to @kindergarten, notice: 'Kindergarten was successfully created.' }\n format.json { render :show, status: :created, location: @kindergarten }\n else\n format.html { render :new }\n format.json { render json: @kindergarten.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @squawk = Squawk.new(params[:squawk])\n\n respond_to do |format|\n if @squawk.save\n format.html { redirect_to @squawk, notice: 'Squawk was successfully created.' }\n format.json { render json: @squawk, status: :created, location: @squawk }\n else\n format.html { render action: \"new\" }\n format.json { render json: @squawk.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n title = params[:title]\n room_key = params[:rtok]\n room_id = params[:rid]\n room = Room.find_by_id(room_id.to_i) if room_id\n\n raise \"Access Denied\" unless room && room_key && room.key == room_key\n\n sgfdata = \"\"\n sgfdata = params[:sgffile].read if params[:sgffile]\n sgfdata = CGI.unescapeHTML(params[:sgfdata]) if params[:sgfdata]\n\n code_name = {\n Kconv::EUC => Encoding::EUC_JP,\n Kconv::SJIS => Encoding::Shift_JIS,\n Kconv::UTF8 => Encoding::UTF_8\n }\n sgfdata.encode!(\"UTF-8\", code_name[Kconv.guess(sgfdata)], invalid: :replace, undef: :replace, replace: \"?\")\n\n node = nil\n begin\n node = SgfReader.new.read_sgf(sgfdata)\n rescue SgfParseError => e\n session[:sgfdata] = sgfdata\n redirect_to controller: :rooms, action: :show, id: room_id, rtok: room_key, error_message: e.message\n return\n end\n\n facade = SgfNodeFacade.new(node)\n facade.set_helper(\"GM\", \"1\")\n facade.set_helper(\"FF\", \"4\")\n facade.set_helper(\"SZ\", \"19\")\n\n @kifu = Kifu.new(title: title, room_id: room_id, key: SecureRandom.urlsafe_base64(64), sgfdata: facade.to_sgf)\n @kifu.player_black = facade.player_black\n @kifu.player_white = facade.player_white\n @kifu.play_date = facade.date\n\n respond_to do |format|\n if @kifu.save\n format.html { redirect_to view_context.sec_kifu_path(@kifu), notice: 'Kifu was successfully created.' }\n format.json { render :show, status: :created, location: @kifu }\n else\n format.html { render :new }\n format.json { render json: @kifu.errors, status: :unprocessable_entity }\n end\n end\n end",
"def krish_params\n params.require(:krish).permit(:name, :location, :is_succes, :user_count, :employe_id, :user_id)\n end",
"def create\n @onske = Onske.new(params[:onske])\n\n respond_to do |format|\n if @onske.save\n format.html { redirect_to @onske, notice: 'Onske was successfully created.' }\n format.json { render json: @onske, status: :created, location: @onske }\n else\n format.html { render action: \"new\" }\n format.json { render json: @onske.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n render json: Dish.create(dish_params)\n end",
"def destroy\n @krish.destroy\n respond_to do |format|\n format.html { redirect_to krishes_url }\n format.json { head :no_content }\n end\n end",
"def create\n @kontum = Kontum.new(kontum_params)\n\n respond_to do |format|\n if @kontum.save\n format.html { redirect_to @kontum, notice: 'Kontum was successfully created.' }\n format.json { render :show, status: :created, location: @kontum }\n else\n format.html { render :new }\n format.json { render json: @kontum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @kwasny = Kwasny.new(kwasny_params)\n\n respond_to do |format|\n if @kwasny.save\n format.html { redirect_to @kwasny, notice: 'Kwasny was successfully created.' }\n format.json { render action: 'show', status: :created, location: @kwasny }\n else\n format.html { render action: 'new' }\n format.json { render json: @kwasny.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @kisting = Kisting.new(kisting_params)\n\n respond_to do |format|\n if @kisting.save\n format.html { redirect_to @kisting, notice: 'Kisting was successfully created.' }\n format.json { render :show, status: :created, location: @kisting }\n else\n format.html { render :new }\n format.json { render json: @kisting.errors, status: :unprocessable_entity }\n end\n end\n end"
]
| [
"0.5828118",
"0.58169323",
"0.57454354",
"0.57131404",
"0.5639105",
"0.56224394",
"0.56178004",
"0.56003463",
"0.5546556",
"0.5528062",
"0.550135",
"0.5460965",
"0.54601884",
"0.54574925",
"0.545331",
"0.5448933",
"0.54423964",
"0.54073685",
"0.53977144",
"0.53930813",
"0.539173",
"0.5389076",
"0.5387916",
"0.5369308",
"0.53676826",
"0.53573126",
"0.533782",
"0.5326271",
"0.53235877",
"0.5312053"
]
| 0.61175925 | 0 |
DELETE /krishes/1 DELETE /krishes/1.json | def destroy
@krish.destroy
respond_to do |format|
format.html { redirect_to krishes_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @kisalli = Kisalli.find_by_key(params[:id])\n @kisalli.destroy\n\n respond_to do |format|\n format.html { redirect_to kisallis_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @kid.destroy\n respond_to do |format|\n format.html { redirect_to kids_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @kota_stone.destroy\n respond_to do |format|\n format.html { redirect_to kota_stones_url }\n format.json { head :no_content }\n end\n end",
"def delete(path)\n RestClient.delete request_base+path\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def destroy\n @koti = Koti.find(params[:id])\n @koti.destroy\n\n respond_to do |format|\n format.html { redirect_to kotis_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @hk.destroy\n respond_to do |format|\n format.html { redirect_to hks_url }\n format.json { head :no_content }\n end\n end",
"def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end",
"def delete\n render json: Alien.delete(params[\"id\"])\n end",
"def destroy\n @kraj = Kraj.find(params[:id])\n @kraj.destroy\n\n respond_to do |format|\n format.html { redirect_to kraje_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @knol.destroy\n respond_to do |format|\n format.html { redirect_to knols_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @squawk = Squawk.find(params[:id])\n @squawk.destroy\n\n respond_to do |format|\n format.html { redirect_to squawks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @kumo.destroy\n respond_to do |format|\n format.html { redirect_to kumos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rishabh.destroy\n respond_to do |format|\n format.html { redirect_to rishabhs_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(url)\n @deleted = true\nend",
"def destroy\n @kit.destroy\n respond_to do |format|\n format.html { redirect_to kits_url }\n format.json { head :no_content }\n end\n end",
"def delete\n request(:delete)\n end",
"def destroy\n @kit = Kit.find(params[:id])\n @kit.destroy\n\n respond_to do |format|\n format.html { redirect_to kits_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @strosek.destroy\n respond_to do |format|\n format.html { redirect_to stroseks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shelf.destroy\n\n respond_to do |format|\n format.html { redirect_to shelves_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @kh.destroy\n respond_to do |format|\n format.html { redirect_to khs_url, notice: 'Kh was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @kata.destroy\n respond_to do |format|\n format.html { redirect_to katas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shelf.destroy\n respond_to do |format|\n format.html { redirect_to shelves_url }\n format.json { head :no_content }\n end\n end",
"def api_delete(path, data = {})\n api_request(:delete, path, :data => data)\n end",
"def delete!\n request! :delete\n end",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end",
"def destroy\n @kai2_ji7.destroy\n respond_to do |format|\n format.html { redirect_to kai2_ji7s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @kid.destroy\n respond_to do |format|\n format.html { redirect_to kids_url, notice: t('kid_destroyed') }\n format.json { head :no_content }\n end\n end"
]
| [
"0.71626604",
"0.6889966",
"0.6877485",
"0.68562984",
"0.68514127",
"0.68434036",
"0.6829869",
"0.68237877",
"0.6818874",
"0.67722005",
"0.673912",
"0.6737086",
"0.67237496",
"0.67152166",
"0.670024",
"0.66985",
"0.6692994",
"0.66918",
"0.66726756",
"0.6667808",
"0.6665582",
"0.66619897",
"0.66457766",
"0.6645611",
"0.6635007",
"0.66340214",
"0.6632685",
"0.6623089",
"0.66212374",
"0.66207016"
]
| 0.7293339 | 0 |
Toggle guest access on or off | def toggle_guest_access
raise NotImplementedError
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def guest_access?\n guest_access == :can_join\n end",
"def toggle_admin\n do_toggle_role :admin\n end",
"def guest?\n false\n end",
"def guest_access=(guest_access)\n client.api.set_room_guest_access(id, guest_access)\n tinycache_adapter.write(:guest_access, guest_access)\n guest_access\n end",
"def set_admin_flag\n @adminFlag = false\n end",
"def toggle_admin\n self.is_admin = !self.is_admin\n save!(:validate => false)\n end",
"def allow_guests=(allow_guests)\n self.guest_access = (allow_guests ? :can_join : :forbidden)\n allow_guests\n end",
"def toggle_auth(status, source_text)\n status_string = status == :enable ? 'true' : 'false'\n %w(dbms.security.authorization_enabled dbms.security.auth_enabled).each do |key|\n source_text = set_property(source_text, key, status_string)\n end\n source_text\n end",
"def guest\n can :read, ActiveAdmin::Page, name: \"Dashboard\"\n can [:read, :update], User, id: user.id\n end",
"def toggle_member\n do_toggle_role :member\n end",
"def guest\n allow [:show]\n end",
"def set_admin\n \t@is_admin = session[:is_admin]\n end",
"def guest_user(_user)\n if RuntimeConfig.vote_signin_active?\n can :access, :sessions\n end\n end",
"def check_guest_in\n\n end",
"def toggle\n @user.toggle\n redirect_to :back\n end",
"def is_guest?\n return @is_guest\n end",
"def guests_disabled?\n !AppConfig.check(:enable_guests)\n end",
"def guest_access\n client.api.get_room_guest_access(id)[:guest_access].to_sym\n end",
"def toggle_access\n @questionnaire = Questionnaire.find(params[:id])\n @questionnaire.private = [email protected]\n @questionnaire.save\n @access = @questionnaire.private == true ? 'private' : 'public'\n undo_link(\"The questionnaire \\\"#{@questionnaire.name}\\\" has been successfully made #{@access}. \")\n redirect_to controller: 'tree_display', action: 'list'\n end",
"def guest\n\tend",
"def toggle_officer\n do_toggle_role :officer\n end",
"def toggle!\n if status\n off!\n return false\n else\n on!\n return true\n end\n end",
"def expire_guest?\r\n admin? or own? or invited?\r\n end",
"def toggle_availability\n if @chef.availability == true\n @chef.availability = false\n else\n @chef.availability = true\n end\n end",
"def make_admin\n puts \"Creating Admin\"\n user = User.create!(:name => \"Admin\",\n :email => \"[email protected]\",\n :password => \"adminpw\",\n :password_confirmation => \"adminpw\")\n user.toggle!(:admin)\n user.toggle!(:staff)\nend",
"def kvm_disable(handle:, server_id: 1)\n kvm_mo = CommKvm.new(parent_mo_or_dn: _get_comm_mo_dn(handle, server_id))\n kvm_mo.set_prop(:admin_state, \"disabled\")\n handle.set_mo(mo: kvm_mo)\nend",
"def eds_guest?\n current_or_guest_user.guest\n end",
"def create_guest?\r\n admin? or streamer?\r\n end",
"def toggle_host_status\n if !self.host.listings.empty?\n self.host.update(host: true)\n else\n self.host.update(host: false)\n end\n end",
"def toggle\n if on?\n off\n else\n on\n end\n end"
]
| [
"0.6607076",
"0.6488401",
"0.6369919",
"0.6237322",
"0.62227607",
"0.6190604",
"0.61766887",
"0.61213094",
"0.61032784",
"0.60904926",
"0.6074536",
"0.60504216",
"0.60217774",
"0.60018927",
"0.59932137",
"0.59780246",
"0.5976769",
"0.5957458",
"0.59057647",
"0.5886336",
"0.58831894",
"0.58386284",
"0.5809851",
"0.5805317",
"0.57603806",
"0.5746105",
"0.57413876",
"0.56693566",
"0.56630105",
"0.56571317"
]
| 0.835637 | 0 |
Get the url for guest access | def guest_url
if guest_access_enabled?
"http://#{@campfire.subdomain}.campfirenow.com/#{guest_invite_code}"
else
nil
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def guest_link\n return guest_hearing_link if guest_hearing_link.present?\n\n \"#{VirtualHearing.base_url}?join=1&media=&escalate=1&\" \\\n \"conference=#{formatted_alias_or_alias_with_host}&\" \\\n \"pin=#{guest_pin}&role=guest\"\n end",
"def guest\n allow [:show]\n end",
"def redirect_guest\n redirect_to explore_comparisons_path if @context.guest?\n end",
"def bookkeeper_invitation_url(access)\n \"#{::AppConfig.mail.host}/access/#{access}\"\n end",
"def guest\n\tend",
"def seller_url\r\n ['http:', user.user_url].join('//') rescue nil\r\n end",
"def get_path\n if self.presentation.user.role==\"guest\"\n \"#{Rails.root}/public/guestdata/\"+self.presentation.user_id.to_s+\"/\"+self.presentation.id.to_s+\"/images/:filename\"\n else\n \"#{Rails.root}/public/userdata/\"+self.presentation.user.name.downcase.gsub(\" \", \"_\")+\"/\"+self.presentation.name.downcase.gsub(\" \", \"_\")+\"/images/:filename\"\n #\"#{Rails.root}/public/userdata/\"+self.presentation.user.name.downcase.gsub(\" \", \"_\")+\"/\"+self.presentation.name.downcase.gsub(\" \", \"_\")+\"/images/:attachment/:id_:style.:extension\"\n end\n end",
"def host(inv, options = {}) \n link_to(inv.inviter.user_name, member_profile_url(:id => inv.inviter.user_name), :target => options[:target]) if inv.inviter\n end",
"def p_url\n Rails.application.routes.url_helpers.rent_url(id, host: PUBLIC_URL)\n end",
"def url\n env[:url]\n end",
"def guest_access\n client.api.get_room_guest_access(id)[:guest_access].to_sym\n end",
"def viewer_url_s\n dip_field(:viewer_path)\n end",
"def get_meeting_url(id, password)\n prepare\n @api.join_meeting_url(id, 'Guest', password)\n end",
"def url\n send(\"url_#{page.env}\")\n end",
"def identity_url(hsh)\n if APP_CONFIG[:restricted_names].include?(hsh[:username].split('.').last)\n hsh[:username]\n else\n \"#{hsh[:username]}.#{AppConfig.host(request.host)}\"\n end\n end",
"def link\n BASE_URL + (private? ? \"/private/#{@key}\" : \"/#{@id}\")\n end",
"def repel_usr_guest\n redirect_to(\"/\") if session[:usr_id].nil?\n end",
"def url\n '/users/show/' + login\n end",
"def url_for_user_show(user)\n if logged_in?\n return url_for user_path(user)\n else\n return url_for login_path\n end\n end",
"def url() \n\t #'http://' << ENV['DOMAIN'] << \n\t '/' << self.author.username.to_s << '/' << self.name.to_s\n end",
"def current_url; end",
"def current_user_url\n view_context.user_url(current_user)\n end",
"def login_url\n DOMAINS[username_domain] || DOMAINS['hotmail.com']\n end",
"def users_url\n view_context.users_url\n end",
"def request_url(requirelogin=false, requireuserinfo=false, expirationdays=30, notifyonupload=false)\n end",
"def current_url\n return Knj::Web.url\n end",
"def gardener_url\n (ENV['SUT_SCHEME'] || 'https') + \"://\" + gardener_fqhn()\n end",
"def request_url(requirelogin=false, requireuserinfo=false, expirationdays=30, notifyonupload=false)\n end",
"def login_guest()\n login(:guest)\n end",
"def redirect_url; end"
]
| [
"0.79203606",
"0.63214844",
"0.63024205",
"0.61987704",
"0.6108481",
"0.6091542",
"0.6039268",
"0.603794",
"0.6015924",
"0.600454",
"0.5999916",
"0.5993426",
"0.5954002",
"0.5941162",
"0.59177375",
"0.5915073",
"0.59030753",
"0.58932114",
"0.5879106",
"0.58500963",
"0.5849586",
"0.58303106",
"0.58127624",
"0.57978064",
"0.5780067",
"0.57772",
"0.57746166",
"0.577366",
"0.5768387",
"0.57680774"
]
| 0.7852773 | 1 |
The invite code use for guest | def guest_invite_code
load
@active_token_value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_invite_code\n self.invite_code = generate_token\n end",
"def invitee_string\n\t\n\tend",
"def ensure_invite_code!\n self.invite_code ||= \"thiscord.gg/\"+SecureRandom.uuid[0..5]\n end",
"def invite\n \n end",
"def invite_code\n\t\tres = {}\n\t\tuser = User.find_by_token(params[:token])\n\t\tif user\n\t\t\tres[:status] = \"0\"\n\t\t\tres[:invite_code] = user.invite_code\n\t\telse\n\t\t\tres[:status] = \"1\"\n\t\tend\n\t\trender json: res\n\tend",
"def create_invite_code_for(identifier)\n #if email has been invited before, just update with new code.\n invite = Invite.find_by_identifier(identifier) || Invite.new(identifier:identifier)\n #code is only valid for the identifier provided and can only be used once.\n invite.is_used=false\n invite.code=SecureRandom.urlsafe_base64\n invite.save! #no need to validate\n return invite.code\n end",
"def accept_invitation\n \n end",
"def set_invitecode\n @invitecode = Invitecode.find(params[:id])\n end",
"def invite_subject\n \"Your invitation to #{org_name.possessive} Creative Difference Dashboard\"\n end",
"def join\n @invite_code = params[:invite_code]\n end",
"def accept_invite(_token)\n # stub\n end",
"def new_invitation_code\n if self.invitation_code.nil?\n write_attribute(:invitation_code, self.class.name.hashed(Time.now.to_i.to_s + rand.to_s))\n update_without_callbacks\n end\n return self.invitation_code\n end",
"def invite\n @data['invite']\n end",
"def create_invite_token\n\n # local cipher encrypt token\n invite_token_d = LocalCipher.get_sha_hashed_text(\n \"#{@client_id}::#{@email}::#{current_timestamp}::invite::#{rand}\"\n )\n\n db_row = ManagerValidationHash.create!(\n manager_id: @invitee_manager[:id],\n client_id: @client_id,\n kind: GlobalConstant::ManagerValidationHash.manager_invite_kind,\n validation_hash: invite_token_d,\n status: GlobalConstant::ManagerValidationHash.active_status,\n extra_data: {\n inviter_manager_id: @inviter_manager_id,\n is_super_admin: @admin_invite_privilege\n }\n )\n\n # create a custom key using db id and local cipher encrypt token\n invite_token_str = \"#{db_row.id}#{ManagerValidationHash.token_delimitter}#{invite_token_d}\"\n\n # encrypt it again to send it over in email\n encryptor_obj = EmailTokenEncryptor.new(GlobalConstant::SecretEncryptor.email_tokens_key)\n r = encryptor_obj.encrypt(invite_token_str, GlobalConstant::ManagerValidationHash::manager_invite_kind)\n return r unless r.success?\n\n @invite_token = r.data[:ciphertext_blob]\n\n success\n\n end",
"def guest_url\n if guest_access_enabled?\n \"http://#{@campfire.subdomain}.campfirenow.com/#{guest_invite_code}\"\n else\n nil\n end\n end",
"def accept_invitation(invite)\n self.invitation= invite\n self.validation_level = invite.validation_level\n self.invitation_code = invite.code\n end",
"def generate_invitation_key\n self.invitation_key ||= 'I'.freeze + SecureRandom.base64(8)\n end",
"def invite\n @obj['invite']\n end",
"def invitation_token\n \tinvitation.token if invitation\n end",
"def encrypt_code(e=nil)\n\t\tUser.encrypt((e || self.email), self.activation_code)\n\tend",
"def handle_incoming_invite(*args); false; end",
"def invite(invitee, inviter)\n @invitee = invitee\n @inviter = inviter\n\n mail to: invitee.email,\n subject: \"Invitation from #{inviter.first_name} to join a kinstagram family\"\n end",
"def invitation_token\n invitation.token if invitation\n end",
"def invite(invite)\n @invite = invite\n mail(:to => invite.email, :subject => \"#{@invite.user.name} has invited you to the \\\"#{invite.idea.name}\\\" idea\", :tag => 'invite') \n end",
"def new_workplace_invite(sender, invite, recipient_email, recipient_name, workplace, token, workplace_id)\n @sender = sender\n @invite = invite\n @recipient_email = recipient_email\n @recipient_name = recipient_name\n @workplace = workplace \n @token = token\n @workplace_id = workplace_id\n mail(to: \"#{@recipient_email}\", subject: \"#{@sender.name} invited you to join Ossemble\")\n end",
"def create_confirm_code\r\n \t\tself.confirm_code = SecureRandom.urlsafe_base64\r\n \tend",
"def invite(invitation, www_host)\n @invitation = invitation\n @www_host = www_host\n \n mail :to => invitation.email_address\n end",
"def invite\n if current_user.active_oauth_account.blank?\n session[:inviting_friend] = true\n redirect_to zh? ? \"/auth/weibo\" : \"/auth/facebook\"\n else\n redirect_to current_user.fb_invite_link\n end\n end",
"def invitation_token\n invitation.token if invitation\n end",
"def send_invite(invite, password=nil)\n @invite = invite\n @event = @invite.event\n @password = password\n @email = @invite.invited_email\n @photographer = @event.photographer\n @subject = @invite.invite_subject\n link_slug = Link.create(event_id: @event.id)\n unique_key = Shortener::ShortenedUrl.generate(event_path(link_slug, invited: 'true')).unique_key\n @link = (ENV['END_CLIENT_URL'] || Rails.application.secrets[:env]['END_CLIENT_URL']) + '/' + unique_key\n mail(to: @email, subject: @subject )\n end"
]
| [
"0.76387304",
"0.754709",
"0.72436905",
"0.72416025",
"0.6952381",
"0.6828545",
"0.6672465",
"0.6549126",
"0.6514559",
"0.64977175",
"0.64647174",
"0.64445704",
"0.6424634",
"0.6411214",
"0.63947904",
"0.6377739",
"0.63747996",
"0.63674206",
"0.6337006",
"0.6308173",
"0.62807274",
"0.62696534",
"0.62660795",
"0.62348557",
"0.6205517",
"0.6204521",
"0.61975825",
"0.6193489",
"0.6184454",
"0.6182329"
]
| 0.82367903 | 0 |
Change the name of the room | def name=(name)
connection.post("/room/#{@id}.json", :body => { :room => { :name => name } })
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name=(name)\n tinycache_adapter.write(:name, name)\n client.api.set_room_name(id, name)\n name\n end",
"def set_room(room_name)\n @room = find_room_by_name(room_name)\n end",
"def new_name(new_name)\n @name = new_name\n end",
"def name\n name = \"Store Room\"\n end",
"def set_room\n @room = Room.find(params[:id])\n @page_title << @room.name\n end",
"def set_name\n self.update(name: \"Medium Washer ##{self.id}\") unless self.name\n end",
"def set_name\n self.update(name: \"Large Washer ##{self.id}\") unless self.name\n end",
"def name=(value)\n if @playing_girl\n @name_girl = value\n else\n @name_boy = value\n end\n $game_actors[1].name = value\n end",
"def room_change(room_name)\n indx = @channels.index(@channels.find { |room,_| room == room_name })\n unless indx\n indx = @channels.length\n new_tab(room_name)\n end\n @tabs.current = indx\n @switcher.current = indx\n @tab_names[indx].show\n (@tabs.create ; @tabs.show) if @skin[:show_tabs] and indx != 0\n tab_notify(indx, false)\n @tabs.recalc\n @channels[indx].last.type_focus rescue nil\n end",
"def name= new_name\n @gapi.update! name: String(new_name)\n end",
"def name=(name)\n\t\t@new_name = name\n\tend",
"def set_player_name(msg, name=nil)\n player = get_player msg\n unless name\n msg.reply player.name\n return\n end\n if player.name\n msg.reply \"The majestic #{player.name} refuses to change his name!\"\n return\n end\n player.name = name\n player.save\n msg.reply \"Welcome, #{player.name}!\"\n end",
"def set_name(player_name)\n @player_name = player_name\n end",
"def name=(new_name)\n\t\t@name = new_name\n\tend",
"def name= (new_name)\n @name = new_name\n end",
"def name=(new_name)\n @name = new_name\n end",
"def name=(new_name)\n @name = new_name\n end",
"def name= new_name\n @name = new_name\n end",
"def enter_name(name)\n return @player_name = 'Anonymus' if name.empty?\n\n @player_name = name[0...18]\n end",
"def change_name=(name)\n @name = name\n end",
"def name=(new_name)\n @name = new_name\n end",
"def name=(new_name)\n @name = new_name\n end",
"def name=(new_name)\n @name = new_name\n end",
"def name\n client.api.get_room_name(id)[:name]\n rescue MatrixNotFoundError\n # No room name has been specified\n nil\n end",
"def name_setter(new_name)\n @name = new_name\n end",
"def name=(new_name)\n @name = new_name\n $game_party.quests.add_to_sort_array(:alphabet, @id) if $game_party && \n $game_party.quests\n end",
"def local_names(body)\n body = @var[:room] if body.length < 1\n room_id = @connection.room_ids[body]\n raise \"Invalid room name: #{body}\" unless room_id\n @var[:names_requested] = true\n _server_control('names', room_id)\nend",
"def name=(new_name)\n @name=new_name\n end",
"def set_name(uuid, new_name)\n execute_prlctl('set', uuid, '--name', new_name)\n end",
"def set_name name\n\t\t\t@name = name.gsub \" (#{@addr})\", ''\n\t\tend"
]
| [
"0.74344593",
"0.7372264",
"0.6911815",
"0.6841977",
"0.68415135",
"0.6718905",
"0.66798884",
"0.6624731",
"0.659215",
"0.6544838",
"0.64946675",
"0.6442982",
"0.64412916",
"0.64101684",
"0.63888556",
"0.63838935",
"0.63838935",
"0.63493305",
"0.63428617",
"0.63157773",
"0.6304479",
"0.6304479",
"0.6303495",
"0.62922823",
"0.6286246",
"0.6282976",
"0.62817776",
"0.62713766",
"0.62417346",
"0.6226351"
]
| 0.7658218 | 0 |
GET /tuberculoses GET /tuberculoses.json | def index
@tuberculoses = Tuberculose.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @tacks = Tack.all\n\n render json: @tacks\n end",
"def retrieve_tubes\n show do\n title \"Retrieve tubes and spin down\"\n \n timer initial: { hours: 0, minutes: 15, seconds: 0}\n \n check \"After timer finishes, retrieve all #{operations.length} tubes from 42 C heat block.\"\n check \"Spin the tube down for 20 seconds on a small tabletop centrifuge.\"\n check \"Remove all the supernatant carefully with a 1000 µl pipettor (~400 L total)\"\n end\n end",
"def index\n @universes = Universe.all.page(params[:page]).per(25)\n respond_to do |format|\n format.html\n format.json { render json: @universes }\n end\n end",
"def index\n @tenures = Tenure.all.order(\"updated_at DESC\").order(\"created_at DESC\")\n\n render json: @tenures\n end",
"def index\n @tutorados = Tutorado.all\n\n render json: @tutorados, status: :ok\n end",
"def index\n @tuiters = Tuiter.all\n end",
"def index\n # @tossups = Tossup.all\n end",
"def index\n # @tossups = Tossup.all\n end",
"def index\n @timers = Timer.all\n\n render json: @timers\n end",
"def index\n @toyota = Toyotum.all\n end",
"def index\n @terceros = Tercero.all\n end",
"def index *_\n @trades = owned_trades_view\n\n render json: @trades\n end",
"def index\n @tunes = Tune.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tunes }\n end\n end",
"def index\n users = User.all\n # cheer_ups = CheerUp.all\n render json: users\n end",
"def index\n @territorios = Territorio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @territorios }\n end\n end",
"def index\n @uttrances = Uttrance.all\n end",
"def index\n @turkeys = Turkey.all\n end",
"def index\n @electors = Elector.all\n\n render json: @electors\n end",
"def index\n @tamires = Tamire.all\n end",
"def index\n response = HTTParty.get('http://okta-api:8080/pets/v1/cats', {headers: {\"X-Token\"=> session[:oktastate][:credentials][:token]}})\n if response.code == 200\n @cats = JSON.parse(response.body)\n else\n @cats = []\n end\n end",
"def tattoos\n render :nothing => true and return if params[:id].nil?\n\n @tattoo = Tattoo.find(params[:id])\n render :json => @tattoo.to_json(:include => [:artist, :assets])\n #render :json => @tattoo.to_json(:include => { :assets => { :only => [:id, :data_file_name] } })\n return\n end",
"def index\n @tailors = Tailor.all\n respond_to do |format|\n format.html\n format.json { render json: @tailors}\n end\n end",
"def index\n @utentes = Utente.all\n end",
"def index\n @teathers = Teather.all\n end",
"def taken\n @travels = Travels::Travel.taken.where(performer: current_user)\n\n respond_to do |format|\n format.html { render \"travels/index\" }\n format.json { as_json @travels }\n end\n end",
"def index\n @tutor = Tutor.all\n\n render json: @tutor, status: :ok\n end",
"def index\n @turmas = Turma.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @turmas }\n end\n end",
"def index\n @takeouts = Takeout.all\n end",
"def index_user\n @tickets = Ticket.all_for_user(current_user.id)\n render json: @tickets, status: 200\n end",
"def index\n @losts = Lost.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @losts }\n end\n end"
]
| [
"0.61899436",
"0.6043484",
"0.5980227",
"0.59198403",
"0.59156847",
"0.5898723",
"0.5896654",
"0.5896654",
"0.5885377",
"0.5875285",
"0.58730227",
"0.58651614",
"0.5865042",
"0.5772566",
"0.5762172",
"0.5761809",
"0.5741422",
"0.5711907",
"0.56627285",
"0.56610477",
"0.5659338",
"0.5657349",
"0.56459016",
"0.56433064",
"0.5630062",
"0.5629968",
"0.5627898",
"0.562207",
"0.56097823",
"0.5603889"
]
| 0.70785415 | 0 |
GET /pharmas GET /pharmas.json | def index
@pharmas = Pharma.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @phlog = Phlog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @phlog }\n end\n end",
"def show\n @pharm = Pharm.find(params[:id])\n end",
"def show\n\t\t@pharmacy = Pharmacy.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.json { render json: @pharmacy }\n\t\tend\n\tend",
"def show\n @presenza = Presenza.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @presenza }\n end\n end",
"def index\n @parishes = Parish.all\n\n render json: @parishes\n end",
"def show\n @amplicon = Amplicon.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @amplicon }\n end\n end",
"def index\n @lophs = Loph.all\n respond_to do |format|\n format.html\n format.json { render json: @lophs}\n end\n end",
"def show\n @premio = Premio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @premio }\n end\n end",
"def show\n @pichanga = Pichanga.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @pichanga }\n end\n end",
"def show\n @micorpost = Micorpost.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @micorpost }\n end\n end",
"def show\n render json: @parish\n end",
"def show\n @psa = Psa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @psa }\n end\n end",
"def index\n @pizzas = Pizza.all\n render json: @pizzas\n end",
"def show\n @aroma = Aroma.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @aroma }\n end\n end",
"def show\n @agronomiaquimica = Agronomiaquimica.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @agronomiaquimica }\n end\n end",
"def show\n @pessoa = Pessoa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pessoa }\n end\n end",
"def index\n @phones = Phone.all\n json_response(@phones)\n end",
"def show\n @patrocinio = Patrocinio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @patrocinio }\n end\n end",
"def index\n @heroes = Hero.all\n\n render json: @heroes\n end",
"def show\n @papel = Papel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @papel }\n end\n end",
"def show\n @pessoa = Pessoa.find(params[:id])\n\n respond_to do |format|\n # format.html # show.html.erb\n format.json { render json: @pessoa }\n end\n end",
"def show\n @promocion = Promocion.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n #format.json { render json: @promocion }\n end\n end",
"def show\n @ramal = Ramal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ramal }\n end\n end",
"def index\n @patrocinios = Patrocinio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @patrocinios }\n end\n end",
"def show\n @publicaciones = Publicacione.find(params[:id])\n render json: @publicaciones, status: :ok\n end",
"def index\n @pacientes = Pacientes.all\n render json: @pacientes\n end",
"def index\n @papels = Papel.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @papels }\n end\n end",
"def index\n @prueba_jsons = PruebaJson.all\n end",
"def show\n @motivobaja = MotivoBaja.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @motivobaja }\n end\n end",
"def show\n @shichoson = Shichoson.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shichoson }\n end\n end"
]
| [
"0.6479799",
"0.6422723",
"0.6421849",
"0.6397673",
"0.63839346",
"0.63242126",
"0.62848365",
"0.6218878",
"0.6213666",
"0.6208553",
"0.62017393",
"0.6198759",
"0.61778975",
"0.6164403",
"0.616128",
"0.6150613",
"0.61449045",
"0.6138376",
"0.61362934",
"0.6135968",
"0.61357605",
"0.6121112",
"0.6115152",
"0.61061907",
"0.6101381",
"0.608646",
"0.60592014",
"0.60572",
"0.60520005",
"0.60498273"
]
| 0.68925804 | 0 |
POST /pharmas POST /pharmas.json | def create
@pharma = Pharma.new(pharma_params)
respond_to do |format|
if @pharma.save
format.html { redirect_to @pharma, notice: 'Pharma was successfully created.' }
format.json { render :show, status: :created, location: @pharma }
else
format.html { render :new }
format.json { render json: @pharma.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @pharm = Pharm.new(pharm_params)\n @pharm.user_id = current_user.id\n\n respond_to do |format|\n if @pharm.save\n format.html { redirect_to @pharm, notice: 'Pharm was successfully created.' }\n format.json { render :show, status: :created, location: @pharm }\n else\n format.html { render :new }\n format.json { render json: @pharm.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pharmacy = Pharmacy.new(pharmacy_params)\n respond_to do |format|\n if @pharmacy.save\n format.json { render :show, status: :created, location: @pharmacy }\n else\n format.json { render json: @pharmacy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n megam_rest.post_promos(to_hash) #WONT BE USED AS OF NOW\n end",
"def create\n @parish = Parish.new(parish_params)\n\n if @parish.save\n render json: @parish, status: :created, location: @parish\n else\n render json: @parish.errors, status: :unprocessable_entity\n end\n end",
"def create\n\t\t@pharmacy = Pharmacy.new(params[:pharmacy])\n\n\t\trespond_to do |format|\n\t\t\tif @pharmacy.save\n\t\t\t\tformat.html { redirect_to @pharmacy, notice: 'Pharmacy was successfully created.' }\n\t\t\t\tformat.json { render json: @pharmacy, status: :created, location: @pharmacy }\n\t\t\telse\n\t\t\t\tformat.html { render action: \"new\" }\n\t\t\t\tformat.json { render json: @pharmacy.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def post\n Typhoeus.post(@url,\n body: @results_hash.to_json,\n headers: { 'Content-Type' => 'application/json' })\n end",
"def create\n @phonenumber = Phonenumber.new(params[:phonenumber])\n\n if @phonenumber.save\n render json: @phonenumber, status: :created, location: @phonenumber\n else\n render json: @phonenumber.errors, status: :unprocessable_entity\n end\n end",
"def create\n @tipo_pregunta = TipoPregunta.new(params[:tipo_pregunta])\n\n if @tipo_pregunta.save\n render json: @tipo_pregunta, status: :created, location: @tipo_pregunta\n else\n render json: @tipo_pregunta.errors, status: :unprocessable_entity\n end\n end",
"def create\n @presenza = Presenza.new(params[:presenza])\n\n respond_to do |format|\n if @presenza.save\n format.html { redirect_to @presenza, notice: 'Presenza was successfully created.' }\n format.json { render json: @presenza, status: :created, location: @presenza }\n else\n format.html { render action: \"new\" }\n format.json { render json: @presenza.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @manga = Manga.new(manga_params)\n\n respond_to do |format|\n if @manga.save\n format.html { redirect_to @manga, notice: 'Manga was successfully created.' }\n format.json { render :show, status: :created, location: @manga }\n else\n format.html { render :new }\n format.json { render json: @manga.errors, status: :unprocessable_entity }\n end\n end\n end",
"def pharma_params\n params.require(:pharma).permit(:name, :hsopitalname)\n end",
"def create\n @pharmaceuticalform = Pharmaceuticalform.new(pharmaceuticalform_params)\n\n respond_to do |format|\n if @pharmaceuticalform.save\n format.html { redirect_to @pharmaceuticalform, notice: 'Pharmaceuticalform was successfully created.' }\n format.json { render :show, status: :created, location: @pharmaceuticalform }\n else\n format.html { render :new }\n format.json { render json: @pharmaceuticalform.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @prueba_json = PruebaJson.new(prueba_json_params)\n\n respond_to do |format|\n if @prueba_json.save\n format.html { redirect_to @prueba_json, notice: 'Prueba json was successfully created.' }\n format.json { render action: 'show', status: :created, location: @prueba_json }\n else\n format.html { render action: 'new' }\n format.json { render json: @prueba_json.errors, status: :unprocessable_entity }\n end\n end\n end",
"def moip_post\n @nasp_rail = NaspRail.new(params[:nasp_rail])\n\n format.html { redirect_to @nasp_rail, :notice => 'Nova entrada criada com sucesso.' }\n format.json { render :json => @nasp_rail, :status => :created, :location => @nasp_rail }\n end",
"def create\n @respuesta = Respuesta.new(params[:respuesta])\n\n if @respuesta.save\n render json: @respuesta, status: :created, location: @respuesta\n else\n render json: @respuesta.errors, status: :unprocessable_entity\n end\n end",
"def create\n @pichanga = Pichanga.new(params[:pichanga])\n\n respond_to do |format|\n if @pichanga.save\n format.html { redirect_to @pichanga, :notice => 'Pichanga was successfully created.' }\n format.json { render :json => @pichanga, :status => :created, :location => @pichanga }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @pichanga.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @plate = Plate.new(params[:plate])\n\n if @plate.save\n render json: @plate, status: :created, location: @plate\n else\n render json: @plate.errors, status: :unprocessable_entity\n end\n end",
"def create\n @micorpost = Micorpost.new(params[:micorpost])\n\n respond_to do |format|\n if @micorpost.save\n format.html { redirect_to @micorpost, notice: 'Micorpost was successfully created.' }\n format.json { render json: @micorpost, status: :created, location: @micorpost }\n else\n format.html { render action: \"new\" }\n format.json { render json: @micorpost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @hero = Hero.new(hero_params)\n\n if @hero.save\n render json: @hero, status: :created, location: @hero\n else\n render json: @hero.errors, status: :unprocessable_entity\n end\n end",
"def create\n @prestamo = Prestamo.new(prestamo_params)\n\n respond_to do |format|\n if @prestamo.save\n format.html { redirect_to @prestamo, notice: \"Prestamo was successfully created.\" }\n format.json { render :show, status: :created, location: @prestamo }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @prestamo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @psa = Psa.new(params[:psa])\n\n respond_to do |format|\n if @psa.save\n format.html { redirect_to @psa, notice: 'Psa was successfully created.' }\n format.json { render json: @psa, status: :created, location: @psa }\n else\n format.html { render action: \"new\" }\n format.json { render json: @psa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pockemon = Pockemon.new(pockemon_params)\n\n respond_to do |format|\n if @pockemon.save\n format.html { redirect_to @pockemon, notice: 'Pockemon was successfully created.' }\n format.json { render :show, status: :created, location: @pockemon }\n else\n format.html { render :new }\n format.json { render json: @pockemon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pharmaceutical_master = PharmaceuticalMaster.new(pharmaceutical_master_params)\n\n respond_to do |format|\n if @pharmaceutical_master.save\n format.html { redirect_to @pharmaceutical_master, notice: CREATE_NOTICE }\n format.json { render :show, status: :created, location: @pharmaceutical_master }\n else\n format.html { render :new }\n format.json { render json: @pharmaceutical_master.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pharmacy = Pharmacy.new(params[:pharmacy])\n\n respond_to do |format|\n if @pharmacy.save\n flash[:notice] = 'Pharmacy was successfully created.'\n format.html { redirect_to(@pharmacy) }\n format.xml { render :xml => @pharmacy, :status => :created, :location => @pharmacy }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @pharmacy.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @promotion = Promotion.new(promotion_params)\n\n if @promotion.save\n render json: @promotion, status: :created, location: @promotion\n else\n render json: @promotion.errors, status: :unprocessable_entity\n end\n end",
"def create\n @homeroom = Homeroom.new(homeroom_params)\n\n respond_to do |format|\n if @homeroom.save\n format.html { redirect_to @homeroom, notice: 'Homeroom was successfully created.' }\n format.json { render :show, status: :created, location: @homeroom }\n else\n format.html { render :new }\n format.json { render json: @homeroom.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @testmonial = Testmonial.new(testmonial_params)\n\n if @testmonial.save\n render json: @testmonial, status: :created\n else\n render json: @testmonial.errors, status: :unprocessable_entity\n end\n end",
"def create\n @premio = Premio.new(params[:premio])\n\n respond_to do |format|\n if @premio.save\n format.html { redirect_to @premio, :notice => 'Premio was successfully created.' }\n format.json { render :json => @premio, :status => :created, :location => @premio }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @premio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @pinjam = Pinjam.new(pinjam_params)\n\n respond_to do |format|\n if @pinjam.save\n format.html { redirect_to @pinjam, notice: 'Pinjam was successfully created.' }\n format.json { render :show, status: :created, location: @pinjam }\n else\n format.html { render :new }\n format.json { render json: @pinjam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def process_post\n service.sign_up_fisherman(\n JSON.parse(request.body.to_s).symbolize_keys\n ).on(\n fishing_application_succeeded: ->(result) {\n response.headers['Content-Type'] = \"application/json\"\n response.body = result.to_json\n true\n },\n fishing_application_conflicts: ->(result) {\n render_json_error_response(\n error: \"command_failed_validation\", message: result.fetch(:message)\n )\n 409\n },\n fishing_application_invalid: ->(result) {\n render_json_error_response(\n error: \"command_failed_validation\", message: result.fetch(:message)\n )\n 422\n }\n )\n end"
]
| [
"0.66720706",
"0.66034615",
"0.6332219",
"0.61596787",
"0.61153233",
"0.5994991",
"0.59933317",
"0.5993134",
"0.595828",
"0.5924629",
"0.5921499",
"0.5913209",
"0.5893331",
"0.5881247",
"0.58505136",
"0.5849291",
"0.5835567",
"0.5826907",
"0.5820701",
"0.5779027",
"0.577251",
"0.5770727",
"0.57693434",
"0.57672906",
"0.57646275",
"0.575245",
"0.5722463",
"0.57177657",
"0.57137793",
"0.5710011"
]
| 0.6895389 | 0 |
PATCH/PUT /pharmas/1 PATCH/PUT /pharmas/1.json | def update
respond_to do |format|
if @pharma.update(pharma_params)
format.html { redirect_to @pharma, notice: 'Pharma was successfully updated.' }
format.json { render :show, status: :ok, location: @pharma }
else
format.html { render :edit }
format.json { render json: @pharma.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @pharm = Pharm.find(params[:id])\n respond_to do |format|\n if @pharm.update(pharm_params)\n format.html { redirect_to @pharm, notice: 'Pharm was successfully updated.' }\n format.json { render :show, status: :ok, location: @pharm }\n else\n format.html { render :edit }\n format.json { render json: @pharm.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @plato = Plato.find(params[:id])\n\n if @plato.update(plato_params)\n head :no_content\n else\n render json: @plato.errors, status: :unprocessable_entity\n end\n end",
"def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end",
"def update\n respond_to do |format|\n if @pharmacy.update(pharmacy_params)\n format.json { render :show, status: :ok, location: @pharmacy }\n else\n format.json { render json: @pharmacy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @prueba_json.update(prueba_json_params)\n format.html { redirect_to @prueba_json, notice: 'Prueba json was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @prueba_json.errors, status: :unprocessable_entity }\n end\n end\n end",
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"def update\n respond_to do |format|\n if @pharmaceutical_master.update(pharmaceutical_master_params)\n format.html { redirect_to @pharmaceutical_master, notice: UPDATE_NOTICE }\n format.json { render :show, status: :ok, location: @pharmaceutical_master }\n else\n format.html { render :edit }\n format.json { render json: @pharmaceutical_master.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def put!\n request! :put\n end",
"def update\n @persona = Persona.find(params[:id])\n \n respond_to do |format|\n if @persona.update_attributes(params[:persona])\n format.json { head :ok }\n else\n format.json { render :json => @persona.errors,\n :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @plate = Plate.find(params[:id])\n\n if @plate.update(params[:plate])\n head :no_content\n else\n render json: @plate.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @platoon.update(platoon_params)\n format.html { redirect_to @platoon, notice: 'Platoon was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @platoon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def http_put(path, data, content_type = 'application/json')\n http_methods(path, :put, data, content_type)\n end",
"def patch!\n request! :patch\n end",
"def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end",
"def update_by_body\n @person = Person.find(person_update_params[:id])\n\n if @person.update_attributes(person_update_params)\n render json: { status: 'PUT Success' }, status: :ok\n else\n render json: { status: 'Error', message:'Error updating person', person: @person.errors }, status: :unprocessable_entity\n end\n end",
"def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end",
"def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end",
"def update_aos_version(args = {}) \n id = args['id']\n temp_path = \"/aosversions.json/{aosVersionId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"aosversionId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend",
"def update\n respond_to do |format|\n if @pharmaceuticalform.update(pharmaceuticalform_params)\n format.html { redirect_to @pharmaceuticalform, notice: 'Pharmaceuticalform was successfully updated.' }\n format.json { render :show, status: :ok, location: @pharmaceuticalform }\n else\n format.html { render :edit }\n format.json { render json: @pharmaceuticalform.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @placa.update(placa_params)\n format.html { redirect_to @placa, notice: 'Placa was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @placa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @homeroom.update(homeroom_params)\n format.html { redirect_to @homeroom, notice: 'Homeroom was successfully updated.' }\n format.json { render :show, status: :ok, location: @homeroom }\n else\n format.html { render :edit }\n format.json { render json: @homeroom.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @phonenumber = Phonenumber.find(params[:id])\n\n if @phonenumber.update(params[:phonenumber])\n head :no_content\n else\n render json: @phonenumber.errors, status: :unprocessable_entity\n end\n end",
"def update\n @premio = Premio.find(params[:id])\n\n respond_to do |format|\n if @premio.update_attributes(params[:premio])\n format.html { redirect_to @premio, :notice => 'Premio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @premio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @manifesto_promise.update(manifesto_promise_params)\n format.html { redirect_to @manifesto_promise, notice: 'Manifesto promise was successfully updated.' }\n format.json { render :show, status: :ok, location: @manifesto_promise }\n else\n format.html { render :edit }\n format.json { render json: @manifesto_promise.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @prospecto_meta_largo_plazo.update(prospecto_meta_largo_plazo_params)\n format.html { redirect_to @prospecto_meta_largo_plazo, notice: 'Prospecto meta largo plazo was successfully updated.' }\n format.json { render :show, status: :ok, location: @prospecto_meta_largo_plazo }\n else\n format.html { render :edit }\n format.json { render json: @prospecto_meta_largo_plazo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @phonetic.update(phonetic_params)\n format.html { redirect_to @phonetic, notice: 'Phonetic was successfully updated.' }\n format.json { render :show, status: :ok, location: @phonetic }\n else\n format.html { render :edit }\n format.json { render json: @phonetic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @spoofer = Spoofer.find(params[:id])\n\n respond_to do |format|\n if @spoofer.update_attributes(params[:spoofer])\n format.html { redirect_to @spoofer, notice: 'Spoofer was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @spoofer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @manga = Manga.find(params[:id])\n\n respond_to do |format|\n if @manga.update_attributes(params[:manga])\n format.html { redirect_to @manga, notice: 'Manga was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @manga.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @parish = Parish.find(params[:id])\n\n if @parish.update(parish_params)\n head :no_content\n else\n render json: @parish.errors, status: :unprocessable_entity\n end\n end"
]
| [
"0.6336532",
"0.6231755",
"0.6189727",
"0.61738074",
"0.61282563",
"0.60966814",
"0.6094203",
"0.6090823",
"0.6073731",
"0.6050702",
"0.60389566",
"0.60285115",
"0.6013566",
"0.5987759",
"0.594626",
"0.5922043",
"0.5915093",
"0.5915093",
"0.59119517",
"0.59048057",
"0.58823335",
"0.58804405",
"0.5866278",
"0.5848483",
"0.58473164",
"0.5840135",
"0.58295393",
"0.58137685",
"0.5807163",
"0.58060384"
]
| 0.62516516 | 1 |
GET /message_outs GET /message_outs.json | def index
@message_outs = MessageOut.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @outmessages = Outmessage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @outmessages }\n end\n end",
"def index\n if params[:workpoint_id]\n @outs = Workpoint.find(params[:workpoint_id]).outs\n else\n @outs = Out.all\n end\n respond_to do |format|\n format.json {\n render :json => @outs, :layout => false\n }\n end\n end",
"def smssend\n http = get_http_connection() \n post_args = { 'number' => params[:number], 'text' => params[:text],'replyto' => params[:replyto], 'name' => @pysmsd_config.app_name, 'password' => @pysmsd_config.app_password }\n \n request = Net::HTTP::Post.new('/messages/out.json')\n request.set_form_data(post_args)\n resp = http.request(request)\n json = JSON.parse(resp.body)\n render_json :entry => json\n end",
"def new\n @outmessage = Outmessage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @outmessage }\n end\n end",
"def messages\n get_json('messages.json')\n end",
"def outgoings\n @patient=User.find_by_wedgetail(params[:wedgetail],:order =>\"created_at DESC\")\n authorize_only (:patient) {@patient.wedgetail == @user.wedgetail}\n authorize :user\n @narrative = Narrative.find(params[:id])\n @outgoings = @narrative.outgoing_messages\n end",
"def show\n @outmessage = Outmessage.find(params[:id])\n respond_to do |format|\n format.html {\n render :layout => false\n }# show.html.erb\n format.json { \n render :json => @outmessage\n\n message = Message.new\n message.origin = \"DEVICE\"\n message.message = @outmessage.message\n message.timestamp = (Time.now.to_i)*1000\n message.user = @outmessage.user\n message.destination = @outmessage.destination\n message.save\n\n @outmessage.destroy }\n end\n end",
"def index\n @messages = current_user.received_messages\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @messages }\n end\n end",
"def index\n @messages = current_user.received_messages\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @messages }\n end\n end",
"def set_message_out\n @message_out = MessageOut.find(params[:id])\n end",
"def destroy\n @message_out.destroy\n respond_to do |format|\n format.html { redirect_to message_outs_url, notice: 'Message out was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def index\n messages = Message.all\n render json: messages\n end",
"def create\n @message_out = MessageOut.new(message_out_params)\n\n respond_to do |format|\n if @message_out.save\n format.html { redirect_to @message_out, notice: 'Message out was successfully created.' }\n format.json { render :show, status: :created, location: @message_out }\n else\n format.html { render :new }\n format.json { render json: @message_out.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @outmessage = Outmessage.find(params[:id])\n @outmessage.destroy\n\n respond_to do |format|\n format.html { redirect_to outmessages_url }\n format.json { head :ok }\n end\n end",
"def index\n @outs = Out.all\n end",
"def index\n @messages = Message.all\n\n render json: @messages\n end",
"def index\n @messages = Message.all\n render json: @messages\n end",
"def index\n @messages = Message.all\n render json: @messages\n end",
"def outbox\n cur_emp = get_logged_employee\n @messages = Message.where(\"sent_by = ?\", cur_emp).where(:is_deleted => nil) \n render \"resumes/message_show\"\n end",
"def index\n @messages = Message.find_all_by_user_id(session[:user_id], :order => \"timestamp DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @messages }\n end\n end",
"def outbox\n\n #handle new signatures\n @general_signature = params[:general_signature]\n @gw_signature = params[:gw_signature]\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @unsent_messages }\n end\n end",
"def index\n @messages = Room.find(params['room_id']).messages\n end",
"def sent_messages\n get('/direct_messages/sent.json')\n end",
"def visit_inbox\n get '/messages'\n end",
"def outbox\r\n @messages = current_user.outbox_messages\r\n session[:mail_box] = \"outbox\"\r\n render :action => \"messages\"\r\n end",
"def index\n @messages = message.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @messages }\n end\n end",
"def read_all_messages\n post(\"/api/read_all_messages\")\n end",
"def shouts(event)\n get(:standard, {:method => \"event.getShouts\", :event => event})\n end",
"def index\n @response_messages = @request_message.response_messages\n respond_to do |format|\n format.html { raise ActionController::RoutingError.new('Not Found') }\n format.json {}\n end\n end",
"def inbox\n @messages = current_user.received_messages\n respond_with @messages\n end"
]
| [
"0.70113707",
"0.63836396",
"0.62472916",
"0.6224572",
"0.6138406",
"0.6136233",
"0.61274123",
"0.6113622",
"0.6110786",
"0.60970414",
"0.60852665",
"0.60795325",
"0.60603845",
"0.60270935",
"0.6025916",
"0.60208464",
"0.6019969",
"0.6019969",
"0.60160685",
"0.6008911",
"0.60076755",
"0.59977806",
"0.5943561",
"0.59358704",
"0.591892",
"0.58896744",
"0.5882455",
"0.5879614",
"0.5879469",
"0.58405477"
]
| 0.7497711 | 0 |
POST /message_outs POST /message_outs.json | def create
@message_out = MessageOut.new(message_out_params)
respond_to do |format|
if @message_out.save
format.html { redirect_to @message_out, notice: 'Message out was successfully created.' }
format.json { render :show, status: :created, location: @message_out }
else
format.html { render :new }
format.json { render json: @message_out.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def smssend\n http = get_http_connection() \n post_args = { 'number' => params[:number], 'text' => params[:text],'replyto' => params[:replyto], 'name' => @pysmsd_config.app_name, 'password' => @pysmsd_config.app_password }\n \n request = Net::HTTP::Post.new('/messages/out.json')\n request.set_form_data(post_args)\n resp = http.request(request)\n json = JSON.parse(resp.body)\n render_json :entry => json\n end",
"def create\n @outmessage = Outmessage.new\n @outmessage.destination = params[:outmessage][:destination]\n @outmessage.message = params[:outmessage][:message]\n @outmessage.user = User.find_by_username(session[:user_id].username)\n\n if @outmessage.save\n if (params[:ajax_request])\n render :layout => false\n end\n notify_push_user(@outmessage)\n end\n end",
"def index\n @message_outs = MessageOut.all\n end",
"def post(message)\n puts message\n end",
"def post(message)\n puts message\n end",
"def message_out_params\n params.require(:message_out).permit(:content)\n end",
"def new\n @outmessage = Outmessage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @outmessage }\n end\n end",
"def create\n @out = Out.new(out_params)\n\n respond_to do |format|\n if @out.save\n format.json { render :json => @out, status: :created, :layout => false }\n else\n format.json { render json: @out.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post(content)\n post_to(\"/api/v1/messages/\", {:body => content})\n end",
"def create\n @messaging_outbox = Messaging::Outbox.new(params[:messaging_outbox])\n\n respond_to do |format|\n if @messaging_outbox.save\n format.html { redirect_to @messaging_outbox, notice: 'Outbox was successfully created.' }\n format.json { render json: @messaging_outbox, status: :created, location: @messaging_outbox }\n else\n format.html { render action: \"new\" }\n format.json { render json: @messaging_outbox.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_message_out\n @message_out = MessageOut.find(params[:id])\n end",
"def create\n @shout = Shout.new(params[:shout])\n\n sendPush (@shout.name + ' just shouted ' + @shout.shout_message)\n \n respond_to do |format|\n if @shout.save\n format.html { redirect_to(@shout, :notice => 'Shout was successfully created.') }\n format.xml { render :xml => @shout, :status => :created, :location => @shout }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @shout.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def destroy\n @message_out.destroy\n respond_to do |format|\n format.html { redirect_to message_outs_url, notice: 'Message out was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def create\n @out = Out.new(out_params)\n\n respond_to do |format|\n if @out.save\n format.html { redirect_to @out, notice: 'Out was successfully created.' }\n format.json { render action: 'show', status: :created, location: @out }\n else\n format.html { render action: 'new' }\n format.json { render json: @out.errors, status: :unprocessable_entity }\n end\n end\n end",
"def outbox\n\n #handle new signatures\n @general_signature = params[:general_signature]\n @gw_signature = params[:gw_signature]\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @unsent_messages }\n end\n end",
"def post_message\n\t\tdata = {\n\t\t\t:name => \"test_name_#{rand(256)}\",\n\t\t\t:message => \"test_name_#{rand(256)}\"\n\t\t}\n\t\tpost '/', data\n\t\t# Refering to the data variable in the last line of the code block\n\t\t# will cause data to be the return value.\n\t\tdata\n\tend",
"def create\n @message = Message.new(params[:message])\n\n respond_to do |format|\n if @message.save\n\n format.html { redirect_to outbox_path, notice: 'Message was successfully created.' }\n format.json { render json: @message, status: :created, location: @message }\n else\n format.html { render action: \"new\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def typer(session, message, options={})\n json_request \"message\", {:session => session,\n :message => message}, options\n end",
"def update\n respond_to do |format|\n if @message_out.update(message_out_params)\n format.html { redirect_to @message_out, notice: 'Message out was successfully updated.' }\n format.json { render :show, status: :ok, location: @message_out }\n else\n format.html { render :edit }\n format.json { render json: @message_out.errors, status: :unprocessable_entity }\n end\n end\n end",
"def smsmark\n http = get_http_connection() \n post_args = { 'ids' => params[:ids], 'name' => @pysmsd_config.app_name, 'password' => @pysmsd_config.app_password }\n request = Net::HTTP::Post.new('/messages/in.json')\n request.set_form_data(post_args)\n resp = http.request(request)\n json = JSON.parse(resp.body)\n render_json :entry => json\n end",
"def post_messages!(hash)\n Net::HTTP.post_form(URI.parse(@target), {'data'=>hash.to_json})\n end",
"def shout(event, message)\n post(:session, {:method => \"event.shout\", :event => event, :message => message})\n end",
"def create\n @shoutout = Shoutout.new(create_params)\n if @shoutout.save\n render json: @shoutout, status: 201, location: api_v1_shoutout_path(@shoutout.id)\n else\n render json: { error: \"Application error\", status: 400 }, status: 400\n end\n end",
"def outgoing_params\n params.require(:outgoing).permit(:id, :user_id, :outtype, :value, :description)\n end",
"def create\n inbound_messages.each(&:save)\n render :nothing => true, :status => 200\n end",
"def destroy\n @outmessage = Outmessage.find(params[:id])\n @outmessage.destroy\n\n respond_to do |format|\n format.html { redirect_to outmessages_url }\n format.json { head :ok }\n end\n end",
"def index\n @outmessages = Outmessage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @outmessages }\n end\n end",
"def _send_message data\n response << data\n end",
"def create\n message = params.require(:message).permit(:recipient_id, :content)\n\n message[:sender_id] = message[:owner_id] = current_user.id\n @out_message = Message.new(message)\n @out_message.read = true\n message[:owner_id] = message[:recipient_id].to_i\n @message = @in_message = Message.new(message)\n @in_message.read = false\n @out_message.save!\n\n @in_message.save!\n respond_to do |format|\n format.any(:html, :wml) {\n redirect_to messages_path\n }\n format.js { @message = @out_message }\n end\n end",
"def write(chunk)\n body = ''\n chunk.msgpack_each {|(tag,time,record)|\n\n # define index and sourcetype dynamically\n begin\n index = expand_param(@index, tag, time, record)\n sourcetype = expand_param(@sourcetype, tag, time, record)\n event_host = expand_param(@event_host, tag, time, record)\n token = expand_param(@token, tag, time, record)\n rescue => e\n # handle dynamic parameters misconfigurations\n router.emit_error_event(tag, time, record, e)\n next\n end\n log.debug \"routing event from #{event_host} to #{index} index\"\n log.debug \"expanded token #{token}\"\n\n # Parse record to Splunk event format\n case record\n when Integer\n event = record.to_s\n when Hash\n if @send_event_as_json\n event = Yajl::Encoder.encode(record)\n else\n event = Yajl::Encoder.encode(record).gsub(\"\\\"\", %q(\\\\\\\"))\n end\n else\n event = record\n end\n\n sourcetype = @sourcetype == 'tag' ? tag : @sourcetype\n\n # Build body for the POST request\n if !@usejson\n event = record[\"time\"]+ \" \" + Yajl::Encoder.encode(record[\"message\"]).gsub(/^\"|\"$/,\"\")\n body << '{\"time\":\"'+ DateTime.parse(record[\"time\"]).strftime(\"%Q\") +'\", \"event\":\"' + event + '\", \"sourcetype\" :\"' + sourcetype + '\", \"source\" :\"' + @source + '\", \"index\" :\"' + index + '\", \"host\" : \"' + event_host + '\"}'\n elsif @send_event_as_json\n body << '{\"time\" :' + time.to_s + ', \"event\" :' + event + ', \"sourcetype\" :\"' + sourcetype + '\", \"source\" :\"' + source + '\", \"index\" :\"' + index + '\", \"host\" : \"' + event_host + '\"}'\n else\n body << '{\"time\" :' + time.to_s + ', \"event\" :\"' + event + '\", \"sourcetype\" :\"' + sourcetype + '\", \"source\" :\"' + source + '\", \"index\" :\"' + index + '\", \"host\" : \"' + event_host + '\"}'\n end\n\n if @send_batched_events\n body << \"\\n\"\n else\n send_to_splunk(body, token)\n body = ''\n end\n }\n\n if @send_batched_events\n send_to_splunk(body, token)\n end\n end"
]
| [
"0.6903816",
"0.62890893",
"0.6182434",
"0.61759156",
"0.61600614",
"0.60449153",
"0.59814",
"0.5951197",
"0.59417355",
"0.5921014",
"0.5870418",
"0.58613354",
"0.58505166",
"0.5814998",
"0.58123255",
"0.5808695",
"0.5763554",
"0.57243544",
"0.56838673",
"0.565115",
"0.5645817",
"0.5629005",
"0.5606608",
"0.5595497",
"0.558773",
"0.55670416",
"0.55659974",
"0.55645174",
"0.5543525",
"0.5532647"
]
| 0.69519955 | 0 |
PATCH/PUT /message_outs/1 PATCH/PUT /message_outs/1.json | def update
respond_to do |format|
if @message_out.update(message_out_params)
format.html { redirect_to @message_out, notice: 'Message out was successfully updated.' }
format.json { render :show, status: :ok, location: @message_out }
else
format.html { render :edit }
format.json { render json: @message_out.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @outmessage = Outmessage.find(params[:id])\n\n respond_to do |format|\n if @outmessage.update_attributes(params[:outmessage])\n format.html { redirect_to @outmessage, :notice => 'Outmessage was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @outmessage.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n @private_message.user_from_id = current_user.id\n if @private_message.update(private_message_params)\n format.html { redirect_to \"/pm/#{request.fullpath.include?('outbox')?'out':'in'}box/#{@private_message.id}.html\", notice: I18n.t('Private message was successfully updated') }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @private_message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @message = Message.find(params[:id])\n\n respond_to do |format|\n if @message.update_attributes(params[:message])\n format.html { redirect_to outbox_path, notice: 'Message was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n params.require(:id)\n msg = Message.find(params[:id])\n msg.read = true\n msg.save\n render :json => msg.as_json, status: :ok\n end",
"def update\n @messaging_outbox = Messaging::Outbox.find(params[:id])\n\n respond_to do |format|\n if @messaging_outbox.update_attributes(params[:messaging_outbox])\n format.html { redirect_to @messaging_outbox, notice: 'Outbox was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @messaging_outbox.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n message = Message.find(params[:id])\n message.update(message_params)\n render json: message\n end",
"def update\n if @message.update(message_params) \n render json: @message, status: :ok, location: @message\n else\n render json: @message.errors, status: :unprocessable_entity\n end\n end",
"def update\n if @message.update(message_params)\n render json: @message\n else\n render json: @message.errors, status: :unprocessable_entity\n end\n end",
"def update\n @v1_message = V1::Message.find(params[:id])\n\n if @v1_message.update(message_params)\n render json: @v1_message, status: :ok\n else\n render json: @v1_message.errors, status: :unprocessable_entity\n end\n end",
"def update\n if @message.update(message_params)\n render json: @message, status: :ok\n else\n render json: @message.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_back_to messages_path, flash: { success: 'Message was successfully updated.' } }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @message.update(message_params)\n format.json {render json: :created}\n else\n format.json {render json: \"not created\"}\n end\n end\n end",
"def update\n respond_to do |format|\n if @msg.update(msg_params)\n format.html { redirect_to @msg, notice: 'Msg was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @msg.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @message = Message.find(params[:id])\n @message.update(text: params[\"_json\"])\n render json: @message\n end",
"def update\n # find and update a specific message\n end",
"def update\n respond_to do |format|\n if @out.update(out_params)\n format.html { redirect_to @out, notice: 'Out was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @out.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @message.update_attributes(params[:message])\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @msg.update(msg_params)\n format.html { redirect_to @msg, notice: 'Msg was successfully updated.' }\n format.json { render :show, status: :ok, location: @msg }\n else\n format.html { render :edit }\n format.json { render json: @msg.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { redirect :back }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @out.update(out_params)\n format.json { render :show, status: :ok, location: @out }\n else\n format.json { render json: @out.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @hello_message.update(hello_message_params)\n format.html { redirect_to @hello_message, notice: 'Hello message was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @hello_message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @outgoing_message_log = OutgoingMessageLog.find(params[:id])\n\n respond_to do |format|\n if @outgoing_message_log.update_attributes(params[:outgoing_message_log])\n format.html { redirect_to @outgoing_message_log, notice: 'Outgoing message log was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @outgoing_message_log.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @received_messages = args[:received_messages] unless args[:received_messages].nil?\n end",
"def update\n respond_to do |format|\n if @lobby_message.update(lobby_message_params)\n format.html { redirect_to @lobby_message, notice: 'Lobby message was successfully updated.' }\n format.json { render :show, status: :ok, location: @lobby_message }\n else\n format.html { render :edit }\n format.json { render json: @lobby_message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # find and update a specific message\n end",
"def update\n # find and update a specific message\n end",
"def update\n @message = Message.find(params[:id])\n @message.update_attributes(params[:message])\n respond_with(@message)\n end",
"def update\n @message = Message.find(params[:id])\n\n respond_to do |format|\n if @message.update_attributes(params[:message])\n format.html { redirect_to @message, :notice => 'Message was successfully set.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @message.errors, :status => :unprocessable_entity }\n end\n end\n end"
]
| [
"0.67088276",
"0.6356212",
"0.6294603",
"0.6271096",
"0.6247161",
"0.6242197",
"0.62195915",
"0.6139679",
"0.6108608",
"0.60467696",
"0.60067254",
"0.60018533",
"0.59900767",
"0.59868795",
"0.5872337",
"0.5866814",
"0.5856719",
"0.5856719",
"0.585349",
"0.5833102",
"0.5822631",
"0.5817377",
"0.57914394",
"0.5774936",
"0.5765074",
"0.57368314",
"0.5723946",
"0.5723946",
"0.5722839",
"0.57225037"
]
| 0.6683412 | 1 |
DELETE /message_outs/1 DELETE /message_outs/1.json | def destroy
@message_out.destroy
respond_to do |format|
format.html { redirect_to message_outs_url, notice: 'Message out was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @outmessage = Outmessage.find(params[:id])\n @outmessage.destroy\n\n respond_to do |format|\n format.html { redirect_to outmessages_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @outgoing_message_log = OutgoingMessageLog.find(params[:id])\n @outgoing_message_log.destroy\n\n respond_to do |format|\n format.html { redirect_to outgoing_message_logs_url }\n format.json { head :no_content }\n end\n end",
"def delete\n @client.post('/api/del_msg', id: get_attribute(:name))\n end",
"def destroy\n # delete a specific message\n end",
"def destroy\n @v1_message = V1::Message.find(params[:id])\n @v1_message.destroy\n\n head :no_content\n end",
"def delete_message(id)\n record \"/msg/delete/#{id}\"\n end",
"def destroy\n # delete a specific message\n end",
"def destroy\n # delete a specific message\n end",
"def destroy\n @msg.destroy\n respond_to do |format|\n format.html { redirect_to msgs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message.destroy\n \n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to [@member, :messages] }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message = Message.find(params[:id])\n\n @message.destroy\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end",
"def delete_message(data); end",
"def delete_message(data); end",
"def destroy\n @message = Message.find(params[:id])\n @message.destroy\n render json: 'Message was successfully deleted', status: :ok\n end",
"def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to student_messages_url(@student) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @hello_message.destroy\n respond_to do |format|\n format.html { redirect_to hello_messages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message_log = MessageLog.find(params[:id])\n @message_log.destroy\n\n respond_to do |format|\n format.html { redirect_to message_logs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bless_message.destroy\n\n render json: {}\n end",
"def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Message was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @in_message = InMessage.find(params[:id])\n @in_message.destroy\n\n respond_to do |format|\n format.html { redirect_to(in_messages_url) }\n format.xml { head :ok }\n end\n end",
"def message_destroy(id)\n post(\"/direct_messages/destroy/#{id}.json\")\n end",
"def message_destroy(id)\n post(\"/direct_messages/destroy/#{id}.json\")\n end",
"def destroy\n @messaging_outbox = Messaging::Outbox.find(params[:id])\n @messaging_outbox.destroy\n\n respond_to do |format|\n format.html { redirect_to messaging_outboxes_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :ok }\n end\n end"
]
| [
"0.74307024",
"0.72257817",
"0.7157802",
"0.71205676",
"0.70943093",
"0.70638305",
"0.7058172",
"0.7005902",
"0.6969792",
"0.69227165",
"0.6911765",
"0.6890537",
"0.68778795",
"0.68778795",
"0.6865568",
"0.6826625",
"0.6826625",
"0.68194973",
"0.68002",
"0.6778614",
"0.6778274",
"0.6770797",
"0.6770355",
"0.67677903",
"0.6761963",
"0.6761963",
"0.67594385",
"0.67476314",
"0.67476314",
"0.67476314"
]
| 0.7323805 | 1 |
GET /submission/1 GET /submission/1.xml | def show
@submission = Submission.find(params[:id])
respond_to do |format|
format.html # show.haml
format.xml { render :xml => @submission }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @submission = Submission.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @submission }\n end\n end",
"def index\n @submissions = Submission.find(:all)\n\n respond_to do |format|\n format.html # index.haml\n format.xml { render :xml => @submission }\n end\n end",
"def show\n @submission = Submission.find(params[:id])\n \n #now lets get the nice xml to display!\n xml = Ruote::Parser.to_xml(@submission.process_definition)\n doc = REXML::Document.new xml\n @nice_xml = ''\n doc.write(@nice_xml,2)\n @task_outputs = ''\n @submission.tasks.each do|t|\n @task_outputs += \"\\n== #{t.rank} - #{t.name} =====================\\n\\n\"\n @task_outputs += \"#{t.exec_output}\\n\"\n end\n \n flash[:error] = \"Your submission appears to have an error and is probably stuck. Please contact your system administrator.\" if (! @submission.last_error.blank? && @submission.active?)\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @submission }\n end\n end",
"def new\n @submission = Submission.new\n\n respond_to do |format|\n format.html # new.haml\n format.xml { render :xml => @submission }\n end\n end",
"def show\n @submission_comment = SubmissionComment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @submission_comment }\n end\n end",
"def show\n @submission = Submission.find(params[:id])\n end",
"def show\n @submission = Submission.find(params[:submission_id])\n end",
"def index\n @submission_comments = SubmissionComment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @submission_comments }\n end\n end",
"def retrieve_submission\n template = tool_proxy_from_guid.submission_service_url\n template&.gsub!('{submission_id}', params[:tc_submission_id])\n template&.gsub!('{assignment_id}', 'assignment_id')\n response = HTTParty.get(template, headers: { 'Authorization' => \"Bearer #{access_token}\" })\n JSON.parse(response.body)\n end",
"def show\n @submission = Submission.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @submission }\n end\n end",
"def show\n @submission = Submission.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @submission }\n end\n end",
"def show\n @submission = Submission.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @submission }\n end\n end",
"def show\n \t@submission = @job.submissions.find(params[:id])\n end",
"def new\n @submission_comment = SubmissionComment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @submission_comment }\n end\n end",
"def getSyndication_submission( syndication_submission_id)\n params = Hash.new\n params['syndication_submission_id'] = syndication_submission_id\n return doCurl(\"get\",\"/syndication_submission\",params)\n end",
"def create\n @submission = Submission.new(params[:submission])\n\n respond_to do |format|\n if @submission.save\n flash[:notice] = 'Submission was successfully created.'\n format.html { redirect_to(submission_path(@submission)) }\n format.xml { render :xml => @submission, :status => :created, :location => @submission }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @submission.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def index\n submission = Submission.get_submission_by_group_id_and_assignment_id(\n params[:group_id], params[:assignment_id]\n )\n\n collection = submission.feedback_files\n\n feedback_files = get_collection(collection) || return\n\n respond_to do |format|\n format.xml do\n render xml: feedback_files.to_xml(only: DEFAULT_FIELDS, root: 'feedback_files', skip_types: 'true')\n end\n format.json { render json: feedback_files.to_json(only: DEFAULT_FIELDS) }\n end\n rescue ActiveRecord::RecordNotFound => e\n # Could not find submission\n render 'shared/http_status', locals: { code: '404', message:\n e }, status: :not_found\n end",
"def get_submission\n @submission = Submission.find_by_id(params[:id])\n return if check_nil_object(@submission)\n @problem = @submission.problem\n end",
"def get_submission\n @submission = Submission.find_by_id(params[:submission_id])\n return if check_nil_object(@submission)\n @problem = @submission.problem\n end",
"def show\n @submission = Submission.in_conference(current_conference).\n find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @submission }\n end\n end",
"def index\n @submissions = Submission.all\n end",
"def index\n @submissions = Submission.all\n end",
"def index\n @submissions = Submission.all\n end",
"def index\n @submissions = Submission.all\n end",
"def show\n @submission = Submission.new\n @submission.responses.build\n @response = Response.new\n\n end",
"def show\n @email_submission = EmailSubmission.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @email_submission }\n end\n end",
"def show\n @email_submission = EmailSubmission.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @email_submission }\n end\n end",
"def get_submission2\n @submission = Submission.find_by_id(params[:submission_id])\n return if check_nil_object(@submission)\n @problem = @submission.problem\n end",
"def show\n @research = Research.find(params[:id])\n @page_title = \"Hello Congress research request: \" + @research.name\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @research.to_xml(:except => [:email]) }\n end\n end",
"def show\n @test_submission = TestSubmission.find(params[:id])\n render :layout => \"homepage\"\n\n# respond_to do |format|\n# format.html # new.html.erb\n# format.xml { render :xml => @test_submission }\n# end\n end"
]
| [
"0.7128289",
"0.685183",
"0.66381526",
"0.65334976",
"0.6471589",
"0.63435775",
"0.6316685",
"0.6315651",
"0.6210698",
"0.61896497",
"0.61896497",
"0.61862713",
"0.61342084",
"0.60995966",
"0.6079903",
"0.60533637",
"0.5961079",
"0.5909505",
"0.58529884",
"0.5845093",
"0.58303726",
"0.58303726",
"0.58303726",
"0.58303726",
"0.58090305",
"0.577793",
"0.577793",
"0.57712805",
"0.5750586",
"0.57297146"
]
| 0.6941431 | 1 |
GET /submission/new GET /submission/new.xml | def new
@submission = Submission.new
respond_to do |format|
format.html # new.haml
format.xml { render :xml => @submission }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @submission_comment = SubmissionComment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @submission_comment }\n end\n end",
"def create\n @submission = Submission.new(params[:submission])\n\n respond_to do |format|\n if @submission.save\n flash[:notice] = 'Submission was successfully created.'\n format.html { redirect_to(submission_path(@submission)) }\n format.xml { render :xml => @submission, :status => :created, :location => @submission }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @submission.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @post149 = Post149.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post149 }\n end\n end",
"def new\n @post78 = Post78.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post78 }\n end\n end",
"def new\n @post197 = Post197.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post197 }\n end\n end",
"def new\n @submission = Submission.new\n end",
"def new\n @submission = Submission.new\n end",
"def new\n @press = Press.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @press }\n end\n end",
"def new_rest\n @entry_answer = EntryAnswer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @entry_answer }\n end\n end",
"def new\n @post257 = Post257.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post257 }\n end\n end",
"def new\n @email_submission = EmailSubmission.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @email_submission }\n end\n end",
"def new\n @post75 = Post75.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post75 }\n end\n end",
"def new\n @post57 = Post57.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post57 }\n end\n end",
"def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post }\n end\n make_rss\n end",
"def new\n @post227 = Post227.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post227 }\n end\n end",
"def new\n @post377 = Post377.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post377 }\n end\n end",
"def new\n @post246 = Post246.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post246 }\n end\n end",
"def new\n @post143 = Post143.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post143 }\n end\n end",
"def new\n @post55 = Post55.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post55 }\n end\n end",
"def new\n @entry = Entry.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @entry }\n end\n end",
"def new\n @entry = Entry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @entry }\n end\n end",
"def new\n @post253 = Post253.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post253 }\n end\n end",
"def new\n @post249 = Post249.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post249 }\n end\n end",
"def new\n @mailing = Mailing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @mailing }\n end\n end",
"def new\n @post297 = Post297.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post297 }\n end\n end",
"def new\n @post194 = Post194.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post194 }\n end\n end",
"def new\n @post59 = Post59.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post59 }\n end\n end",
"def new\n @post139 = Post139.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post139 }\n end\n end",
"def new\n @post248 = Post248.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post248 }\n end\n end",
"def new\n get_user\n @submission = Submission.new\n end"
]
| [
"0.74332213",
"0.7074458",
"0.7019172",
"0.69804245",
"0.69463885",
"0.69345796",
"0.69345796",
"0.6921083",
"0.69173825",
"0.69098866",
"0.6890191",
"0.68783003",
"0.687734",
"0.686037",
"0.68561286",
"0.68555546",
"0.6855061",
"0.68489915",
"0.684102",
"0.68381727",
"0.68351144",
"0.683199",
"0.683159",
"0.68300056",
"0.68069345",
"0.6806839",
"0.6805831",
"0.67992985",
"0.6797137",
"0.67966616"
]
| 0.7942215 | 0 |
POST /submission POST /submission.xml | def create
@submission = Submission.new(params[:submission])
respond_to do |format|
if @submission.save
flash[:notice] = 'Submission was successfully created.'
format.html { redirect_to(submission_path(@submission)) }
format.xml { render :xml => @submission, :status => :created, :location => @submission }
else
format.html { render :action => "new" }
format.xml { render :xml => @submission.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def do_submission(path, xml = nil)\n if xml.nil?\n form = create(:form, question_types: %w(integer integer))\n form.publish!\n xml = build_odk_submission(form)\n end\n\n # write xml to file\n require 'fileutils'\n FileUtils.mkpath('test/fixtures')\n fixture_file = Rails.root.join('test/fixtures/', ODK_XML_FILE)\n File.open(fixture_file.to_s, 'w') { |f| f.write(xml) }\n\n # Upload and do request.\n uploaded = fixture_file_upload(fixture_file, 'text/xml')\n post(path, {:xml_submission_file => uploaded, :format => 'xml'}, 'HTTP_AUTHORIZATION' => encode_credentials(@user.login, 'password'))\n assigns(:response)\n end",
"def create\n @submission = Submission.new(params[:submission])\n @submission.user_id = remember_token[0]\n respond_to do |format|\n if @submission.save\n format.html { redirect_to(@submission, :notice => 'Submission was successfully created.') }\n format.xml { render :xml => @submission, :status => :created, :location => @submission }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @submission.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def post\n resource.post(request, response)\n end",
"def create\n @test_submission = TestSubmission.new(params[:test_submission])\n\n respond_to do |format|\n if @test_submission.save\n format.html { redirect_to(@test_submission, :notice => 'If you would like to make changes use your back button.') }\n format.xml { render :xml => @test_submission, :status => :created, :location => @test_submission }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @test_submission.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def POST; end",
"def submit\n\t\tset_post_data\n get_response @url\n parse_response\n\tend",
"def create\n @submission = Submission.new(submission_params)\n\n respond_to do |format|\n if @submission.save\n SubmissionsMailer.submission_email(@submission).deliver_later\n format.html { redirect_to submissions_path, notice: 'Submission' }\n # format.json { render :new, status: :created, location: @submission }\n else\n format.html { render :new }\n # format.json { render json: @submission.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @submission = Submission.new(submission_params)\n\n respond_to do |format|\n if @submission.save\n format.html { redirect_to auditions_path, notice: 'Thanks for submitting!' }\n format.json { render action: 'show', status: :created, location: @submission }\n else\n format.html { render action: 'new' }\n format.json { render json: @submission.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post; end",
"def post\r\n end",
"def post(data = \"\")\n submit :Post, data\n end",
"def create\n @submission = Submission.new(submission_params)\n\n respond_to do |format|\n if @submission.save\n format.html do\n redirect_to [@activity.learning_unit.course, @activity.learning_unit, @activity],\n notice: 'Submission was successfully created.'\n end\n format.json { render :show, status: :created, location: @submission }\n else\n format.html { render :new }\n format.json { render json: @submission.errors, status: :unprocessable_entity }\n end\n end\n end",
"def postSyndication_submissionProcessed( syndication_submission_id)\n params = Hash.new\n params['syndication_submission_id'] = syndication_submission_id\n return doCurl(\"post\",\"/syndication_submission/processed\",params)\n end",
"def post(xmldoc)\n headers = {'Content-Type' => 'text/xml'}\n check_response( @httpcli.post(@endpoint, xmldoc, headers) )\n end",
"def post(uri, xml)\r\n req = Net::HTTP::Post.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end",
"def post\n end",
"def create\n params[:submission][:verdict] = 'pending'\n create_base(params[:submission]) \n end",
"def create\n @submission = Submission.new(submission_params)\n @submission.correctness = false\n @submission.reviewed = false\n\n respond_to do |format|\n if @submission.save\n format.html { redirect_to task_path(@submission.task), notice: 'Submission was successfully created.' }\n format.json { render :show, status: :created, location: @submission }\n else\n format.html { render :new }\n format.json { render json: @submission.errors, status: :unprocessable_entity }\n end\n end\n end",
"def submission_params\n params.require(:submission).permit(:raw_content, :person_id, :ip_addr, :entry_id, :form_structure, :field_structure, :form_id, :form_type)\n end",
"def submission_params\n params.require(:submission).permit(:raw_content, :person_id, :ip_addr, :entry_id, :form_structure, :field_structure, :form_id, :form_type)\n end",
"def create\n if params['HandshakeKey'].present?\n if Logan::Application.config.wufoo_handshake_key != params['HandshakeKey']\n Rails.logger.warn(\"[wufoo] received request with invalid handshake. Full request: #{request.inspect}\")\n head(403) && return\n end\n\n @submission = Submission.new(\n raw_content: params.to_json,\n ip_addr: params['IP'],\n entry_id: params['EntryId'],\n form_structure: params['FormStructure'],\n field_structure: params['FieldStructure']\n )\n\n # Parse the form type\n form_type = @submission.form_type_field\n begin\n # try to save with matching enum type\n @submission.form_type = form_type.downcase\n rescue\n # Otherwise set form type as unknown\n @submission.form_type = 'unknown'\n end\n\n # Parse the email, and add the associated person\n person_identifier = @submission.form_email_or_phone_number\n this_person = nil\n if person_identifier.present?\n this_person = Person.where('lower(email_address) = ?', person_identifier.downcase).last\n if this_person.blank?\n test_number = PhonyRails.normalize_number(person_identifier)\n this_person = Person.where('phone_number = ?', test_number).last\n end\n end\n @submission.person = this_person\n\n if @submission.save\n Rails.logger.info(\"SubmissionsController#create: recorded a new submission for #{person_identifier}\")\n head '201'\n else\n Rails.logger.warn(\"SubmissionsController#create: failed to save new submission for #{person_identifier}\")\n head '400'\n end\n\n else\n @submission = Submission.new(\n raw_content: '',\n entry_id: params['submission']['entry_id'],\n form_id: params['submission']['form_id'],\n person_id: params['submission']['person_id']\n )\n person_id = params['submission']['person_id']\n this_form_id = params['submission']['form_id']\n # Rails.logger.info \"[submissions_controller create] this_form_id = #{this_form_id}\"\n if this_form_id.present?\n this_form = Logan::Application.config.wufoo.form(this_form_id)\n @submission.field_structure = { 'Fields' => this_form.fields }.to_json\n @submission.form_structure = this_form.details.to_json\n raw_content = { 'FieldStructure' => @submission.field_structure }\n raw_content['FormStructure'] = @submission.form_structure\n this_entry_id = params['submission']['entry_id']\n # Rails.logger.info \"[submissions_controller create] this_entry_id = #{this_entry_id}\"\n if this_entry_id.present?\n this_entry = this_form.entries(filters: [['EntryId', 'Is_equal_to', this_entry_id]]).first\n # Rails.logger.info \"@submission.raw_content = #{@submission.raw_content}\"\n # Rails.logger.info \"this_entry = #{this_entry}\"\n raw_content = raw_content.merge(this_entry)\n @submission.raw_content = raw_content.to_json\n end\n end\n if @submission.save\n Rails.logger.info(\"SubmissionsController#create: recorded a new submission for #{person_id}\")\n format.html { redirect_to submission_path, notice: 'Submission was successfully created.' }\n else\n Rails.logger.warn(\"SubmissionsController#create: failed to save new submission for #{person_id}\")\n format.html { render action: 'new' }\n end\n end\n end",
"def create\n @email_submission = EmailSubmission.new(params[:email_submission])\n\n respond_to do |format|\n if @email_submission.save\n format.html { redirect_to @email_submission, notice: 'Email submission was successfully created.' }\n format.json { render json: @email_submission, status: :created, location: @email_submission }\n else\n format.html { render action: \"new\" }\n format.json { render json: @email_submission.errors, status: :unprocessable_entity }\n end\n end\n end",
"def submit\n obj = ActiveSupport::Inflector.constantize(self.class.to_s.gsub(/Builder/, ''))\n obj.new(Client.post_xml_request(to_s))\n end",
"def create\n @submission_comment = SubmissionComment.new(params[:submission_comment])\n @submission_comment.user = current_user\n\n respond_to do |format|\n if @submission_comment.save\n format.html { redirect_to @submission_comment.submission }\n #format.html { redirect_to(@submission_comment, :notice => 'Submission comment was successfully created.') }\n format.xml { render :xml => @submission_comment, :status => :created, :location => @submission_comment }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @submission_comment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def post\n Rentlinx.client.post(self)\n end",
"def create\n @submission = Submission.new(params[:submission])\n @items_list = current_user.build_items_list\n \n respond_to do |format|\n if @submission.save\n @submission.submit_job\n flash[:notice] = 'Submission was successfully created.'\n format.html { redirect_to(@submission) }\n format.xml { render :xml => @submission, :status => :created, :location => @submission }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @submission.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def submission(recipient, subject, name, project_id, field_code, date_submitted, shipping_date, sent_at = Time.now)\n @subject = subject\n @recipients = recipient\n @from = '[email protected]'\n @reply_to ='[email protected]'\n @sent_on = sent_at\n @body[\"name\"] = name\n @body[\"email\"] = recipient\n @body[\"project_id\"] = project_id\n @body[\"field_code\"] = field_code\n @body[\"date_submitted\"] = date_submitted\n @body[\"shipping_date\"] = shipping_date\n \n @headers = {content_type => 'text/html'}\n end",
"def post #:doc:\n end",
"def create\n @submission = current_user.submissions.create!(submission_params)\n flash[:notice] = \"submission created\"\n redirect_to @submission\n end",
"def post\n frm.button(:name=>\"post\").click\n AssignmentsList.new(@browser)\n end"
]
| [
"0.7185427",
"0.6769586",
"0.6536815",
"0.6521938",
"0.6394957",
"0.638802",
"0.63349056",
"0.63217914",
"0.626405",
"0.6262381",
"0.6243754",
"0.6222123",
"0.62183017",
"0.618068",
"0.61588675",
"0.6127506",
"0.6119407",
"0.6106426",
"0.6095596",
"0.6095596",
"0.60903686",
"0.6077256",
"0.6068312",
"0.60598004",
"0.6058592",
"0.60579735",
"0.6057195",
"0.6057124",
"0.60568106",
"0.6054754"
]
| 0.70729274 | 1 |
DELETE /submission/1 DELETE /submission/1.xml | def destroy
@submission = Submission.find(params[:id])
@submission.destroy
respond_to do |format|
format.html { redirect_to(submission_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @submission = Submission.find(params[:id])\n @submission.destroy\n\n respond_to do |format|\n format.html { redirect_to(submissions_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @submission = Submission.find(params[:id])\n @submission.destroy\n\n respond_to do |format|\n format.html { redirect_to(submissions_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @submission = Submission.find(params[:id])\n @submission.destroy\n\n respond_to do |format|\n format.html { redirect_to(submissions_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n Submission.find(params[:id]).destroy\n redirect_to '/submissions'\n end",
"def destroy\n @submission_detail.attachment = nil\n @submission_detail.destroy\n respond_to do |format|\n format.html { redirect_to submissions_url, notice: 'Document was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @submission_comment = SubmissionComment.find(params[:id])\n @submission_comment.destroy\n\n respond_to do |format|\n format.html { redirect_to @submission_comment.submission }\n #format.html { redirect_to(submission_comments_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @submission = Submission.find(params[:id])\n @submission.destroy\n\n redirect_to(submissions_url)\n end",
"def destroy\n @submission = Submission.find(params[:id])\n @submission.destroy\n\n respond_to do |format|\n format.html { redirect_to submissions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @submission = Submission.find(params[:id])\n @submission.destroy\n\n respond_to do |format|\n format.html { redirect_to submissions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @submission = Submission.find(params[:id])\n @submission.destroy\n\n respond_to do |format|\n format.html { redirect_to submissions_url }\n format.json { head :no_content }\n end\n end",
"def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end",
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def destroy\n @submission.destroy\n respond_to do |format|\n format.html { redirect_to submissions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @submission.destroy\n respond_to do |format|\n format.html { redirect_to submissions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @submission.destroy\n respond_to do |format|\n format.html { redirect_to submissions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @email_submission = EmailSubmission.find(params[:id])\n @email_submission.destroy\n\n respond_to do |format|\n format.html { redirect_to email_submissions_url }\n format.json { head :no_content }\n end\n end",
"def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end",
"def destroy\n @test_submission = TestSubmission.find(params[:id])\n @test_submission.destroy\n\n respond_to do |format|\n format.html { redirect_to test_submissions_url }\n format.json { head :ok }\n end\n end",
"def delete_form_submission(id)\n @client.raw('delete', \"/content/forms/submissions/#{id}\")\n end",
"def delete_questions\n response = Request.delete_request(URL_QUESTION)\n if response.success?\n redirect '/upload-csv'\n end\nend",
"def destroy\n @submission.destroy\n respond_to do |format|\n format.html { redirect_to submissions_url, notice: 'Submission was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @submission.destroy\n respond_to do |format|\n format.html { redirect_to submissions_url, notice: 'Submission was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @submission.destroy\n respond_to do |format|\n format.html { redirect_to submissions_url, notice: 'Submission was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @submission.destroy\n respond_to do |format|\n format.html { redirect_to submissions_url, notice: 'Submission was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @submission.destroy\n respond_to do |format|\n format.html { redirect_to submissions_url, notice: 'Submission was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @submission.destroy\n respond_to do |format|\n format.html { redirect_to submissions_url, notice: 'Submission was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @submission.destroy\n respond_to do |format|\n format.html { redirect_to submissions_url, notice: 'Submission was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post149 = Post149.find(params[:id])\n @post149.destroy\n\n respond_to do |format|\n format.html { redirect_to(post149s_url) }\n format.xml { head :ok }\n end\n end",
"def deletepublish\n @question = Publishquiz.find(:all, :conditions=>\"question_id=\"+params[:question]+\" and quiz_id=\"+session[:quizid])\n @question[0].destroy\n\n respond_to do |format|\n format.html { redirect_to(questions_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @subentry = Subentry.find(params[:id])\n @subentry.destroy\n\n respond_to do |format|\n format.html { redirect_to(subentries_url) }\n format.xml { head :ok }\n end\n end"
]
| [
"0.7380481",
"0.7380481",
"0.7380481",
"0.69005835",
"0.68519807",
"0.67469066",
"0.67363787",
"0.6726497",
"0.6726497",
"0.67259705",
"0.66746765",
"0.6673411",
"0.666435",
"0.666435",
"0.666435",
"0.6600906",
"0.6573058",
"0.654463",
"0.6509483",
"0.64563006",
"0.64297146",
"0.64297146",
"0.64297146",
"0.64297146",
"0.64297146",
"0.64297146",
"0.64297146",
"0.6422501",
"0.64204997",
"0.63927335"
]
| 0.74571323 | 0 |
The +MessageOptions+ defined for this message. | def options
message_descriptor_proto.options
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def options(args = nil)\r\n if args\r\n @_message.options.merge!(args)\r\n else\r\n @_message\r\n end\r\n end",
"def default_message_options\n @default_message_options ||= {type: 'message'}\n end",
"def generate_options(message)\n {\n raw_message: {\n data: message.to_s,\n },\n tags: [\n {\n name: message.delivery_handler.to_s,\n value: get_value_from(message[\"tag\"]),\n },\n ],\n configuration_set_name: get_value_from(message[\"configuration_set_name\"]),\n }\n end",
"def text_message_options\n # Get menu options\n menu_options = self.menu_options.where(:type => \"MenuOption\").all.order_by([:name, :desc])\n options = {}\n options[\"#0\"] = [\"menu\",\"\"]\n \n menu_options.each_with_index do |option, index|\n i = index+1\n options[\"#\" + i.to_s] = [option.option_name, option.option_format]\n end\n \n options\n end",
"def options\n self.class.instance_variable_get(:@__options) || []\n end",
"def messages(options = EMPTY_HASH)\n message_set(options)\n end",
"def options\n @options ||= {}\n end",
"def options\n @options ||= {}\n end",
"def options\n @options ||= {}\n end",
"def options\n Hash[ * VALID_OPTIONS_KEYS.map { |key| [key, send(key)] }.flatten ]\n end",
"def options\n Hash[VALID_OPTIONS.map { |key| [key, send(key)] }]\n end",
"def options\n Hash[VALID_OPTIONS_KEYS.map {|key| [key, send(key)] }]\n end",
"def options\n OPTIONS_KEYS.inject({}) do |options, key|\n options.merge!(key => send(key))\n end\n end",
"def options\n return @options\n end",
"def options\n VALID_OPTIONS_KEYS.reduce({}) do |option, key|\n option.merge!(key => send(key))\n end\n end",
"def options\n VALID_OPTIONS_KEYS.inject({}) do |option, key|\n option.merge!(key => send(key))\n end\n end",
"def options\n options = {}\n VALID_OPTIONS_KEYS.each { |k| options[k] = send(k) }\n options\n end",
"def options\n options = {}\n VALID_OPTIONS_KEYS.each { |k| options[k] = send(k) }\n options\n end",
"def options \n options = {}\n VALID_OPTIONS_KEYS.each {|k| options[k] = send(k)}\n options\n end",
"def options\n @@options\n end",
"def options\n @@options\n end",
"def options\n @@options\n end",
"def options\n @options ||= {}\n end",
"def options\n @options ||= {}\n end",
"def options\n VALID_OPTIONS_KEYS.inject({}) do |option, key|\n option.merge!(key => send(key))\n end\n end",
"def options\n VALID_OPTIONS_KEYS.inject({}) do |option, key|\n option.merge!(key => send(key))\n end\n end",
"def options\n VALID_OPTIONS_KEYS.inject({}) do |option, key|\n option.merge!(key => send(key))\n end\n end",
"def options\n VALID_OPTIONS_KEYS.inject({}) do |option, key|\n option.merge!(key => send(key))\n end\n end",
"def options\n VALID_OPTIONS_KEYS.inject({}) do |option, key|\n option.merge!(key => send(key))\n end\n end",
"def options\n VALID_OPTIONS_KEYS.inject({}) do |option, key|\n option.merge!(key => send(key))\n end\n end"
]
| [
"0.7453573",
"0.7247541",
"0.7049129",
"0.664804",
"0.6534514",
"0.6418044",
"0.6415079",
"0.6415079",
"0.6415079",
"0.640184",
"0.6399006",
"0.6393965",
"0.6392944",
"0.6391486",
"0.63879585",
"0.63874835",
"0.6385375",
"0.6385375",
"0.63793576",
"0.63530993",
"0.63530993",
"0.63530993",
"0.63484514",
"0.63484514",
"0.63454133",
"0.63454133",
"0.63454133",
"0.63454133",
"0.63454133",
"0.63454133"
]
| 0.7984034 | 0 |
The extension ranges defined for this message | def extension_range
message_descriptor_proto.extension_range
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extensions(range)\n extension_ranges << range\n end",
"def extensions(range)\n extension_ranges << range\n end",
"def extensions(range)\n extension_ranges << range\n end",
"def extensions(range)\n @extension_tag = range\n end",
"def range_extensions\n @range_extensions ||= \n class << self.range\n self.included_modules - [Kernel]\n end\n end",
"def extensions(range)\n @extension_fields = ExtensionFields.new(range)\n end",
"def ranges\n attributes.fetch(:ranges)\n end",
"def ip_ranges\n data.ip_ranges\n end",
"def limits\n @array_specs.collect {|spec| spec.range }\n end",
"def enterprise_i_p_ranges\n return @enterprise_i_p_ranges\n end",
"def utf8_ranges( range )\n ranges = []\n UTF8_BOUNDARIES.each do |max|\n if range.begin <= max\n return ranges << range if range.end <= max\n\n ranges << range.begin .. max\n range = (max + 1) .. range.end\n end\n end\n ranges\nend",
"def from_ranges\n attributes.fetch(:fromRanges)\n end",
"def m_range\r\n end",
"def extensions\n data.extensions\n end",
"def offset_range\n return nil unless original_tag\n if original_end_tag\n end_offset = end_pos.offset + original_end_tag.bytesize\n else\n end_offset = start_pos.offset + original_tag.bytesize\n end\n\n start_pos.offset...end_offset\n end",
"def get_bounds\n [ @min, @max ]\n end",
"def ranges\n pairs.map { |b, e| (b...e) }\n end",
"def extensions\n @extensions.to_a\n end",
"def extensions\n return @extensions\n end",
"def extensions\n return @extensions\n end",
"def extensions\n return @extensions\n end",
"def ranges\n x_start, y_start = absolute(0, 0)\n x_end, y_end = absolute(@diameter - 1, @diameter - 1)\n\n [x_start..x_end, y_start..y_end]\n end",
"def extensions\n @@extensions\n end",
"def extensions\n @@extensions\n end",
"def to_range\n min .. max\n end",
"def get_range_parts(range)\n if range =~ /([' a-zA-Z]+!)?([A-Z]+\\d+):([A-Z]+\\d+)/\n sheet = $1\n range1 = $2\n range2 = $3\n if sheet\n sheet = sheet[0..sheet.size-2]\n if sheet =~ /'(.+)'/\n sheet = $1\n end\n end\n return [sheet, range1, range2]\n end\n nil\n end",
"def content_range\n return nil unless original_tag && original_end_tag\n\n (start_pos.offset + original_tag.bytesize)...end_pos.offset\n end",
"def range_all\n [ range(:upper_alphas), \n range(:lower_alphas), \n range(:numerals), \n range(:symbols_1), \n range(:symbols_2), \n range(:symbols_3), \n range(:symbols_4), \n range(:symbols_5), \n range(:symbols_6),\n range(:single_quotes),\n range(:double_quotes),\n range(:backtick) ]\n end",
"def boundaries\n [intervals.first[0], intervals.last[1]]\n end",
"def extension_allowlist\n end"
]
| [
"0.72202086",
"0.72202086",
"0.7183523",
"0.6975689",
"0.67840195",
"0.6592586",
"0.6405685",
"0.6001918",
"0.5968311",
"0.59562844",
"0.594816",
"0.59000134",
"0.5830478",
"0.58039474",
"0.5792925",
"0.57710093",
"0.5681345",
"0.56523645",
"0.56175786",
"0.56175786",
"0.56175786",
"0.5615939",
"0.56079155",
"0.56079155",
"0.56078666",
"0.5581658",
"0.557916",
"0.55757916",
"0.55692494",
"0.5553283"
]
| 0.82498056 | 0 |
returns a Reputation::Threshold instance and validates based on self action and sender | def threshold
@threshold ||= Reputation::Threshold.lookup(self.action, self.sender, :tier => self.tier)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reputation_threshold_action\n :offer_reward\n end",
"def find_tier_threshold_points\n @tier_threshold_points_cache ||= if tp = self.tier.reputation_thresholds.find(:first, \n :conditions => [\"reward_rates.action = ?\", self.action.to_s])\n tp\n elsif self.tier.parent && (ptp = self.tier.parent.reputation_thresholds.find(:first, \n :conditions => [\"reward_rates.action = ?\", self.action.to_s]))\n ptp\n end\n end",
"def action_points\n @threshold_action_points_cache ||= ReputationThreshold.action_points(self.action, self.tier)\n end",
"def action_points(action, tier=nil)\n if tier \n if rate = tier.find_reputation_threshold_action_points(action)\n return rate.points\n end\n return if !tier.accept_default_reputation_threshold\n end\n send(action.to_sym) if action_defined?(action)\n end",
"def set_threshold\n @threshold = Threshold.find(params[:id])\n end",
"def threshold\n @threshold || 95\n end",
"def alert_threshold\n return @alert_threshold\n end",
"def check_threshold\n rate = lines.length.to_f / expiry\n if rate > threshold\n alert_status\n elsif rate < threshold\n normal_status\n end\n end",
"def create\n @threshold = Threshold.new(threshold_params)\n\n respond_to do |format|\n if @threshold.save\n format.html { redirect_to thresholds_path, notice: 'Threshold was successfully created.' }\n format.json { render :show, status: :created, location: @threshold }\n else\n format.html { render :new }\n format.json { render json: @threshold.errors, status: :unprocessable_entity }\n end\n end\n end",
"def threshold_params\n params.require(:threshold).permit(:sensor_id, :comparing_string, :comparing_value, :status, :action)\n end",
"def action_defined?(action, tier=nil)\n if tier && !tier.accept_default_reputation_threshold\n if rate = tier.find_reputation_threshold_action_points(action)\n return !!rate.points\n end\n end\n respond_to?(action.to_sym)\n end",
"def alert_threshold=(value)\n @alert_threshold = value\n end",
"def create\n @threshold = Threshold.new(params[:threshold])\n\n respond_to do |format|\n if @threshold.save\n format.html { redirect_to @threshold, notice: 'Threshold was successfully created.' }\n format.json { render json: @threshold, status: :created, location: @threshold }\n else\n format.html { render action: \"new\" }\n format.json { render json: @threshold.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patient_score\n @@thresholds.keys.inject(0) do |accu, attribute|\n accu + self.send(\"#{attribute}_score\")\n end\n end",
"def threshold_reached_value_type_value_xxx(value_type, threshold_type)\n # Used to prefix sender email to change it\n new_email_prefix = \"new_\"\n # This is ripped from email_bill_entry value_type_value\n sum_thus_far_curr_val = 0\n sum_thus_far_curr_code = nil\n sum_thus_far_str = nil\n email_elem = inbound_emails(:nick_n_xxx_y_yyy_n_tags_y_currency_sender_idable_inbound_email)\n # Set the path so that the \"from:\" email is used\n # otherwise sender is anonymous\n @request.path = Constants::SENDGRID_PARSE_URL\n post :create, :inbound_email => email_elem.attributes\n # Get the new pii\n input_str = email_elem.subject\n input_str ||= email_elem.body_text\n meantItRel_hash = ControllerHelper.parse_meant_it_input(input_str)\n pii_value = meantItRel_hash[ControllerHelper::MEANT_IT_INPUT_RECEIVER_PII]\n hk_pii = Pii.find_by_pii_value(pii_value)\n assert_equal(false, ControllerHelper.sellable_pii(hk_pii), \"newly created pii is not sellable since no pii_property_set\")\n # Now create pii_propery_set and fill in the \n # necessary properties to make pii sellable\n hk_pii.pii_property_set = PiiPropertySet.create\n hk_pii.pii_property_set.currency = \"SGD\"\n # NOTE: We submit inbound_emails(:nick_n_xxx_y_yyy_n_tags_y_currency_sender_idable_inbound_email_buy) \n # twice with the second time we increase by 1 unit currency\n # so we adjust threshold to the sum so that \n # threshold is exceeded after the 2nd buy\n email_elem = inbound_emails(:nick_n_xxx_y_yyy_n_tags_y_currency_sender_idable_inbound_email_buy)\n input_str = email_elem.subject\n input_str ||= email_elem.body_text\n threshold = ControllerHelper.sum_currency_in_str(input_str)\n threshold_curr_code, threshold_curr_val = ControllerHelper.get_currency_code_and_val(threshold)\n one_unit_currency = \"#{threshold_curr_code}1\"\n threshold = ControllerHelper.sum_currency_in_str(\"#{threshold} #{threshold} #{one_unit_currency}\")\n threshold_curr_code, threshold_curr_val = ControllerHelper.get_currency_code_and_val(threshold)\n hk_pii.pii_property_set.threshold = threshold_curr_val\n hk_pii.pii_property_set.currency = threshold_curr_code\n hk_pii.pii_property_set.status = StatusTypeValidator::STATUS_ACTIVE\n hk_pii.pii_property_set.value_type = value_type\n hk_pii.pii_property_set.threshold_type = threshold_type\n hk_pii.pii_property_set.save\n assert_equal(true, ControllerHelper.sellable_pii(hk_pii), \"pii with appropriate fields filled in is sellable\")\n # Create a new mir by sending another mail\n assert_differences([\n ['InboundEmailLog.count', 0],\n ['InboundEmail.count', 1],\n ['EndPoint.count', 2], # for new sender and the nick for destination\n ['Pii.count', 1], # for new sender\n ['Tag.count', 1], # New tag, i.e., each price is a new tag\n ['EndPointTagRel.count', 1], # New tag to endpoint\n ['MeantItRel.count', 1],\n ['MeantItMoodTagRel.count', 1], # We create a link from MeantItRel to Tag\n ['EmailBillEntry.count', 1]\n ]) do\n # Set the path so that the \"from:\" email is used\n # otherwise sender is anonymous\n @request.path = Constants::SENDGRID_PARSE_URL\n post :create, :inbound_email => email_elem.attributes\n end # end assert_differences\n hk_pii.reload\n # Check the value of email_bill_entry.qty\n hk_pii_email_bill_entries = hk_pii.pii_property_set.email_bill_entries\n assert_equal(1, hk_pii_email_bill_entries.size)\n assert_equal(1, hk_pii_email_bill_entries[0].meant_it_rels.size)\n input_str = email_elem.subject\n input_str ||= email_elem.body_text\n#AAAAA sum_thus_far_str = ControllerHelper.sum_currency_in_str(input_str)\n first_email_curr_str = ControllerHelper.sum_currency_in_str(input_str)\n#AAAAA sum_thus_far_curr_code, sum_thus_far_curr_val = ControllerHelper.get_currency_code_and_val(sum_thus_far_str)\n first_email_curr_code, first_email_curr_val = ControllerHelper.get_currency_code_and_val(first_email_curr_str)\n#AAAAA assert_equal(sum_thus_far_curr_val.to_f, hk_pii_email_bill_entries[0].qty)\n assert_equal(first_email_curr_val.to_f, hk_pii_email_bill_entries[0].qty)\n#AAAAA assert_equal(sum_thus_far_curr_code, hk_pii_email_bill_entries[0].currency)\n assert_equal(first_email_curr_code, hk_pii_email_bill_entries[0].currency)\n # Check threshold\n#AAAAA assert(sum_thus_far_curr_val.to_f < hk_pii_email_bill_entries[0].pii_property_set.threshold)\n assert(first_email_curr_val.to_f < hk_pii_email_bill_entries[0].pii_property_set.threshold)\n assert_nil(hk_pii_email_bill_entries[0].ready_date)\n # If a same email is resubmitted, but with different value!\n body_text = email_elem.body_text\n # Get pii and currency\n email_body_hash = ControllerHelper.parse_meant_it_input(body_text)\n pii_str = email_body_hash[ControllerHelper::MEANT_IT_INPUT_RECEIVER_PII]\n curr_arr = ControllerHelper.get_currency_arr_from_str(body_text)\n # Just take one value\n#AAAAA new_curr_curr_code, new_curr_curr_val = ControllerHelper.get_currency_code_and_val(curr_arr[0])\n prev_curr_curr_code, prev_curr_curr_val = ControllerHelper.get_currency_code_and_val(curr_arr[0])\n second_email_curr_code = prev_curr_curr_code\n#AAAAA new_curr_f = new_curr_curr_val.to_f + 1.0\n second_email_curr_val = prev_curr_curr_val.to_f + 1.0\n#AAAAA new_curr_str = \"#{new_curr_curr_code}#{new_curr_f}\"\n second_email_curr_str = \"#{second_email_curr_code}#{second_email_curr_val}\"\n#AAAAA email_elem.body_text = \":#{pii_str} #{new_curr_str}\"\n email_elem.body_text = \":#{pii_str} #{second_email_curr_str}\"\n p \"new email_elem.body_text:#{email_elem.body_text}\"\n assert_differences([\n ['InboundEmailLog.count', 0],\n ['InboundEmail.count', 1],\n ['EndPoint.count', 0], # no new sender and the nick for destination\n ['Pii.count', 0], # no new sender\n ['Tag.count', 1], # One more tag, i.e., the new curr value\n ['EndPointTagRel.count', 1], # One more tag => one more EndPointTagRel\n ['MeantItRel.count', 1],\n ['MeantItMoodTagRel.count', 1], # We create a link from MeantItRel to Tag\n ['EmailBillEntry.count', 0] # No new bill\n ]) do\n # Set the path so that the \"from:\" email is used\n # otherwise sender is anonymous\n @request.path = Constants::SENDGRID_PARSE_URL\n post :create, :inbound_email => email_elem.attributes\n end # end assert_differences\n hk_pii.reload\n hk_pii_email_bill_entries = hk_pii.pii_property_set.email_bill_entries\n assert_equal(1, hk_pii_email_bill_entries.size)\n if value_type == ValueTypeValidator::VALUE_TYPE_VALUE\n # Add one entry even tho' the sender is same \n # since value_type is VALUE_TYPE_VALUE\n assert_equal(2, hk_pii_email_bill_entries[0].meant_it_rels.size)\n src_ep_hash = ControllerHelper.parse_email(email_elem.from)\n src_ep_1 = src_ep_hash[ControllerHelper::EMAIL_STR]\n # The qty should be sum of 1st+2nd email if VALUE_TYPE_VALUE,\n sum_thus_far_curr_val = first_email_curr_val + second_email_curr_val\n else\n # No entry is added\n # since value_type is VALUE_TYPE_VALUE_UNIQ\n assert_equal(1, hk_pii_email_bill_entries[0].meant_it_rels.size)\n # Send another email\n email_addy_hash = ControllerHelper.parse_email(email_elem.from)\n email_addy = email_addy_hash[ControllerHelper::EMAIL_STR]\n email_elem.from = \"#{new_email_prefix}#{email_addy}\"\n src_ep_1 = email_elem.from\np \"!!!!!!!!!!!!!email_elem.attributes.inspect:#{email_elem.attributes.inspect}\"\n assert_differences([\n ['InboundEmailLog.count', 0],\n ['InboundEmail.count', 1],\n ['EndPoint.count', 2], # new sender and the nick for destination\n ['Pii.count', 1], # no new sender\n ['Tag.count', 0], # Zero new tag, since we're using same currency tag\n ['EndPointTagRel.count', 1], # One more tag => one more EndPointTagRel\n ['MeantItRel.count', 1],\n ['MeantItMoodTagRel.count', 1], # We create a link from MeantItRel to Tag\n ['EmailBillEntry.count', 0] # No new bill\n ]) do\n # Set the path so that the \"from:\" email is used\n # otherwise sender is anonymous\n @request.path = Constants::SENDGRID_PARSE_URL\n post :create, :inbound_email => email_elem.attributes\n end # end assert_differences\n hk_pii.reload\n hk_pii_email_bill_entries = hk_pii.pii_property_set.email_bill_entries\n # The qty should be sum of 2nd+3rd if VALUE_TYPE_VALUE_UNIQ\n # NOTE: 3rd email is just 2nd email with from changed\n sum_thus_far_curr_val = second_email_curr_val + second_email_curr_val\n end # end elsif value_type == ValueTypeValidator::VALUE_TYPE_VALUE_UNIQ\n hk_pii_mirs_id_desc = hk_pii_email_bill_entries[0].meant_it_rels.order(\"id desc\")\n#AAAAA mir_src_pii = hk_pii_email_bill_entries[0].meant_it_rels[0].src_endpoint.pii\n mir_src_pii = hk_pii_mirs_id_desc[0].src_endpoint.pii\n assert_equal(src_ep_1, mir_src_pii.pii_value)\n#AAAAA sum_thus_far_curr_val += new_curr_f\n assert_equal(sum_thus_far_curr_val, hk_pii_email_bill_entries[0].qty)\n # Increase in the number of mirs\n assert_equal(2, hk_pii_email_bill_entries[0].meant_it_rels.size)\n # The currency code of first email and second email value are the same\n#AAAAA assert_equal(sum_thus_far_curr_code, new_curr_curr_code)\n assert_equal(first_email_curr_code, second_email_curr_code)\n#AAAAA assert_equal(new_curr_curr_code, hk_pii_email_bill_entries[0].currency)\n assert_equal(second_email_curr_code, hk_pii_email_bill_entries[0].currency)\n # Check threshold\np \"!!!!!!sum_thus_far_curr_val:#{sum_thus_far_curr_val}\"\np \"!!!!!!hk_pii_email_bill_entries[0].pii_property_set.threshold:#{hk_pii_email_bill_entries[0].pii_property_set.threshold}\"\n assert(hk_pii_email_bill_entries[0].pii_property_set.threshold <= sum_thus_far_curr_val)\n assert_not_nil(hk_pii_email_bill_entries[0].ready_date)\n # Check price_final, threshold_final\n if (value_type == ValueTypeValidator::VALUE_TYPE_VALUE or value_type == ValueTypeValidator::VALUE_TYPE_VALUE_UNIQ)\n # For VALUE_TYPE_VALUE_xxx, there is no price_final\n assert_nil(hk_pii_email_bill_entries[0].price_final)\n else\n assert_equal(ControllerHelper.get_price_from_formula(hk_pii.pii_property_set.formula), hk_pii_email_bill_entries[0].price_final)\n end # end if (value_type == ValueTypeValidator::VALUE_TYPE_VALUE or value_type == ValueTypeValidator::VALUE_TYPE_UNIQ)\n assert_equal(hk_pii.pii_property_set.threshold, hk_pii_email_bill_entries[0].threshold_final)\n assert_equal(hk_pii.pii_property_set.currency, hk_pii_email_bill_entries[0].currency)\n if threshold_type == PiiPropertySetThresholdTypeValidator::THRESHOLD_TYPE_ONETIME\n # If threshold_type is onetime then pii becomes inactive\n assert_equal(StatusTypeValidator::STATUS_INACTIVE, hk_pii.pii_property_set.status)\n new_bill_ready_date = hk_pii.pii_property_set.email_bill_entries[0].ready_date\n assert_not_nil(new_bill_ready_date)\n # NOTE: For ONETIME, the active_date is <= ready_date since\n # active_date is set only when the pii is created when active state\n # is re-set\n new_active_date = ControllerHelper.get_bill_dates_by_pii(hk_pii)\n assert_not_nil(new_active_date)\n assert(new_bill_ready_date >= new_active_date)\n assert_in_delta(new_bill_ready_date, new_active_date, 2)\n else\n # If threshold_type is recur then check billing\n # Since this is recur, status should remain active\n assert_equal(StatusTypeValidator::STATUS_ACTIVE, hk_pii.pii_property_set.status)\n new_bill_ready_date = hk_pii.pii_property_set.email_bill_entries[0].ready_date\n assert_not_nil(new_bill_ready_date)\n new_start_bill_date = ControllerHelper.get_bill_dates_by_pii(hk_pii)\n # NOTE: For now new bill dates are created only when billed_date is\n # set, i.e., user contacts their customers through emails\n assert(new_bill_ready_date >= new_start_bill_date)\n assert_in_delta(new_bill_ready_date, new_start_bill_date, 2)\n end # end if threshold_type == PiiPropertySetThresholdTypeValidator::THRESHOLD_TYPE_ONETIME\n end",
"def classify_instance( instance )\n return score(instance) > threshold ? true : false\n end",
"def vote_threshold\n vote_count = self.votes_for.count # Sets variable for tracking petition's vote count\n if vote_count >= 500 && self.filed == false && self.stage == 0 # Petition hit the goal threshold and hasn't already been filed\n self.update_attributes(pending: false, filed_at: Time.now, filed: true, stage: 1) # Updates petition to filed and the time it was filed and sets the stage to 1, setting the timer for days left\n return true\n elsif vote_count < 500\n return false \n else # Vote count is above 100\n return false\n end \n end",
"def create(match:, threshold:, period:, action:, id: nil, disabled: nil, description: nil, bypass: nil)\n common_checks(match, action, threshold, period)\n\n data = {match: match, threshold: threshold, period: period, action: action}\n data[:id] = id unless id.nil?\n\n unless disabled.nil?\n valid_value_check(:disabled, disabled, [true, false])\n data[:disabled] = disabled\n end\n\n cf_post(path: \"/zones/#{zone_id}/rate_limits\", data: data)\n end",
"def initialize(threshold: 0.0)\n super()\n @params = { threshold: threshold }\n end",
"def check_threshold\n max_threshold = @assignment.review_topic_threshold\n # Assignment.find_by_sql([\"SELECT review_topic_threshold FROM pg_development.assignments WHERE assignments.id =?\",assign.id])\n num_reviews = ResponseMap.find_by_sql([\"SELECT * FROM response_maps rm where rm.reviewed_object_id =? AND rm.reviewee_id=?\", @assignment.id, @map.reviewee_id]).count\n max_threshold = 5 if max_threshold == 0 || max_threshold.nil?\n\n if num_reviews < (max_threshold / REARRANGING_FACTOR)\n return true\n else\n return false\n end\n end",
"def threshold_reached_value_type_count_xxx(value_type, threshold_type)\n # Used to prefix sender email to change it\n new_email_prefix = \"new_\"\n # This is ripped from email_bill_entry value_type_value\n sum_thus_far_curr_val = 0\n sum_thus_far_curr_code = nil\n sum_thus_far_str = nil\n email_elem = inbound_emails(:nick_n_xxx_y_yyy_n_tags_y_currency_sender_idable_inbound_email)\n # Set the path so that the \"from:\" email is used\n # otherwise sender is anonymous\n @request.path = Constants::SENDGRID_PARSE_URL\n post :create, :inbound_email => email_elem.attributes\n # Get the new pii\n input_str = email_elem.subject\n input_str ||= email_elem.body_text\n meantItRel_hash = ControllerHelper.parse_meant_it_input(input_str)\n pii_value = meantItRel_hash[ControllerHelper::MEANT_IT_INPUT_RECEIVER_PII]\n hk_pii = Pii.find_by_pii_value(pii_value)\n assert_equal(false, ControllerHelper.sellable_pii(hk_pii), \"newly created pii is not sellable since no pii_property_set\")\n # Now create pii_propery_set and fill in the \n # necessary properties to make pii sellable\n hk_pii.pii_property_set = PiiPropertySet.create\n hk_pii.pii_property_set.currency = nil\n # NOTE: We submit inbound_emails(:nick_n_xxx_y_yyy_n_tags_y_currency_sender_idable_inbound_email_buy) \n # twice with the second time we increase by 1 unit currency\n # so we adjust threshold to the sum so that \n # threshold is exceeded after the 2nd buy\n email_elem = inbound_emails(:nick_n_xxx_y_yyy_n_tags_y_currency_sender_idable_inbound_email_buy)\n input_str = email_elem.subject\n input_str ||= email_elem.body_text\n threshold = ControllerHelper.sum_currency_in_str(input_str)\n threshold_curr_code, threshold_curr_val = ControllerHelper.get_currency_code_and_val(threshold)\n one_unit_currency = \"#{threshold_curr_code}1\"\n threshold = ControllerHelper.sum_currency_in_str(\"#{threshold} #{threshold} #{one_unit_currency}\")\n threshold_curr_code, threshold_curr_val = ControllerHelper.get_currency_code_and_val(threshold)\n hk_pii.pii_property_set.threshold = 2\n hk_pii.pii_property_set.currency = nil\n hk_pii.pii_property_set.status = StatusTypeValidator::STATUS_ACTIVE\n hk_pii.pii_property_set.value_type = value_type\n hk_pii.pii_property_set.threshold_type = threshold_type\n hk_pii.pii_property_set.save\n assert_equal(true, ControllerHelper.sellable_pii(hk_pii), \"pii with appropriate fields filled in is sellable\")\n # Create a new mir by sending another mail\n assert_differences([\n ['InboundEmailLog.count', 0],\n ['InboundEmail.count', 1],\n ['EndPoint.count', 2], # for new sender and the nick for destination\n ['Pii.count', 1], # for new sender\n ['Tag.count', 1], # New tag, i.e., each price is a new tag\n ['EndPointTagRel.count', 1], # New tag to endpoint\n ['MeantItRel.count', 1],\n ['MeantItMoodTagRel.count', 1], # We create a link from MeantItRel to Tag\n ['EmailBillEntry.count', 1]\n ]) do\n # Set the path so that the \"from:\" email is used\n # otherwise sender is anonymous\n @request.path = Constants::SENDGRID_PARSE_URL\n post :create, :inbound_email => email_elem.attributes\n end # end assert_differences\n hk_pii.reload\n # Check the value of email_bill_entry.qty\n hk_pii_email_bill_entries = hk_pii.pii_property_set.email_bill_entries\n assert_equal(1, hk_pii_email_bill_entries.size)\n assert_equal(1, hk_pii_email_bill_entries[0].meant_it_rels.size)\n input_str = email_elem.subject\n input_str ||= email_elem.body_text\n first_email_curr_str = ControllerHelper.sum_currency_in_str(input_str) #AAAAA\n first_email_curr_code, first_email_curr_val = ControllerHelper.get_currency_code_and_val(first_email_curr_str) #AAAAA\n # Assert that we have now one entry\n assert_equal(hk_pii_email_bill_entries.size, hk_pii_email_bill_entries[0].qty)\n assert_equal(nil, hk_pii_email_bill_entries[0].currency)\n # Check threshold\n assert(hk_pii_email_bill_entries[0].qty < hk_pii_email_bill_entries[0].pii_property_set.threshold)\n assert_nil(hk_pii_email_bill_entries[0].ready_date)\n # If a same email is resubmitted, but with different value!\n body_text = email_elem.body_text\n # Get pii and currency\n email_body_hash = ControllerHelper.parse_meant_it_input(body_text)\n pii_str = email_body_hash[ControllerHelper::MEANT_IT_INPUT_RECEIVER_PII]\n curr_arr = ControllerHelper.get_currency_arr_from_str(body_text)\n # Just take one value\n prev_curr_curr_code, prev_curr_curr_val = ControllerHelper.get_currency_code_and_val(curr_arr[0])\n second_email_curr_code = prev_curr_curr_code\n second_email_curr_val = prev_curr_curr_val.to_f + 1.0\n second_email_curr_str = \"#{second_email_curr_code}#{second_email_curr_val}\"\n email_elem.body_text = \":#{pii_str} #{second_email_curr_str}\"\n p \"new email_elem.body_text:#{email_elem.body_text}\"\n assert_differences([\n ['InboundEmailLog.count', 0],\n ['InboundEmail.count', 1],\n ['EndPoint.count', 0], # no new sender and the nick for destination\n ['Pii.count', 0], # no new sender\n ['Tag.count', 1], # One more tag, i.e., the new curr value\n ['EndPointTagRel.count', 1], # One more tag => one more EndPointTagRel\n ['MeantItRel.count', 1],\n ['MeantItMoodTagRel.count', 1], # We create a link from MeantItRel to Tag\n ['EmailBillEntry.count', 0] # No new bill\n ]) do\n # Set the path so that the \"from:\" email is used\n # otherwise sender is anonymous\n @request.path = Constants::SENDGRID_PARSE_URL\n post :create, :inbound_email => email_elem.attributes\n end # end assert_differences\n hk_pii.reload\n hk_pii_email_bill_entries = hk_pii.pii_property_set.email_bill_entries\n assert_equal(1, hk_pii_email_bill_entries.size)\n if value_type == ValueTypeValidator::VALUE_TYPE_COUNT\n # Add one entry even tho' the sender is same \n # since value_type is VALUE_TYPE_VALUE\n assert_equal(2, hk_pii_email_bill_entries[0].meant_it_rels.size)\n src_ep_hash = ControllerHelper.parse_email(email_elem.from)\n src_ep_1 = src_ep_hash[ControllerHelper::EMAIL_STR]\n # The qty should be sum of 1st+2nd email if VALUE_TYPE_VALUE,\n sum_thus_far_curr_val = first_email_curr_val + second_email_curr_val\n else\n # No entry is added\n # since value_type is VALUE_TYPE_VALUE_UNIQ\n assert_equal(1, hk_pii_email_bill_entries[0].meant_it_rels.size)\n # Send another email\n email_addy_hash = ControllerHelper.parse_email(email_elem.from)\n email_addy = email_addy_hash[ControllerHelper::EMAIL_STR]\n email_elem.from = \"#{new_email_prefix}#{email_addy}\"\n src_ep_1 = email_elem.from\np \"!!!!!!!!!!!!!email_elem.attributes.inspect:#{email_elem.attributes.inspect}\"\n assert_differences([\n ['InboundEmailLog.count', 0],\n ['InboundEmail.count', 1],\n ['EndPoint.count', 2], # new sender and the nick for destination\n ['Pii.count', 1], # no new sender\n ['Tag.count', 0], # Zero new tag, since we're using same currency tag\n ['EndPointTagRel.count', 1], # One more tag => one more EndPointTagRel\n ['MeantItRel.count', 1],\n ['MeantItMoodTagRel.count', 1], # We create a link from MeantItRel to Tag\n ['EmailBillEntry.count', 0] # No new bill\n ]) do\n # Set the path so that the \"from:\" email is used\n # otherwise sender is anonymous\n @request.path = Constants::SENDGRID_PARSE_URL\n post :create, :inbound_email => email_elem.attributes\n end # end assert_differences\n hk_pii.reload\n hk_pii_email_bill_entries = hk_pii.pii_property_set.email_bill_entries\n # The qty should be sum of 2nd+3rd if VALUE_TYPE_VALUE_UNIQ\n # NOTE: 3rd email is just 2nd email with from changed\n sum_thus_far_curr_val = second_email_curr_val + second_email_curr_val\n end # end elsif value_type == ValueTypeValidator::VALUE_TYPE_VALUE_UNIQ\n hk_pii_mirs_id_desc = hk_pii_email_bill_entries[0].meant_it_rels.order(\"id desc\")\n mir_src_pii = hk_pii_mirs_id_desc[0].src_endpoint.pii\n assert_equal(src_ep_1, mir_src_pii.pii_value)\n assert_equal(2, hk_pii_email_bill_entries[0].qty)\n # Increase in the number of mirs\n assert_equal(2, hk_pii_email_bill_entries[0].meant_it_rels.size)\n assert_equal(nil, hk_pii_email_bill_entries[0].currency)\n # Check threshold\np \"!!!!!!sum_thus_far_curr_val:#{sum_thus_far_curr_val}\"\np \"!!!!!!hk_pii_email_bill_entries[0].pii_property_set.threshold:#{hk_pii_email_bill_entries[0].pii_property_set.threshold}\"\n assert_equal(hk_pii_email_bill_entries[0].pii_property_set.threshold, hk_pii_email_bill_entries[0].qty)\n assert_not_nil(hk_pii_email_bill_entries[0].ready_date)\n # Check price_final, threshold_final\n if (value_type == ValueTypeValidator::VALUE_TYPE_VALUE or value_type == ValueTypeValidator::VALUE_TYPE_COUNT_UNIQ)\n # For VALUE_TYPE_VALUE_xxx, there is no price_final\n assert_nil(hk_pii_email_bill_entries[0].price_final)\n else\n assert_equal(ControllerHelper.get_price_from_formula(hk_pii.pii_property_set.formula), hk_pii_email_bill_entries[0].price_final)\n end # end if (value_type == ValueTypeValidator::VALUE_TYPE_VALUE or value_type == ValueTypeValidator::VALUE_TYPE_UNIQ)\n assert_equal(hk_pii.pii_property_set.threshold, hk_pii_email_bill_entries[0].threshold_final)\n assert_equal(hk_pii.pii_property_set.currency, hk_pii_email_bill_entries[0].currency)\n if threshold_type == PiiPropertySetThresholdTypeValidator::THRESHOLD_TYPE_ONETIME\n # If threshold_type is onetime then pii becomes inactive\n assert_equal(StatusTypeValidator::STATUS_INACTIVE, hk_pii.pii_property_set.status)\n new_bill_ready_date = hk_pii.pii_property_set.email_bill_entries[0].ready_date\n assert_not_nil(new_bill_ready_date)\n # NOTE: For ONETIME, the active_date is <= ready_date since\n # active_date is set only when the pii is created when active state\n # is re-set\n new_active_date = ControllerHelper.get_bill_dates_by_pii(hk_pii)\n assert_not_nil(new_active_date)\n assert(new_bill_ready_date >= new_active_date)\n assert_in_delta(new_bill_ready_date, new_active_date, 2)\n else\n # If threshold_type is recur then check billing\n # Since this is recur, status should remain active\n assert_equal(StatusTypeValidator::STATUS_ACTIVE, hk_pii.pii_property_set.status)\n new_bill_ready_date = hk_pii.pii_property_set.email_bill_entries[0].ready_date\n assert_not_nil(new_bill_ready_date)\n new_start_bill_date = ControllerHelper.get_bill_dates_by_pii(hk_pii)\n # NOTE: For now new bill dates are created only when billed_date is\n # set, i.e., user contacts their customers through emails\n assert(new_bill_ready_date >= new_start_bill_date)\n assert_in_delta(new_bill_ready_date, new_start_bill_date, 2)\n end # end if threshold_type == PiiPropertySetThresholdTypeValidator::THRESHOLD_TYPE_ONETIME\n end",
"def gather_threshold_totals\n rules.each{|field_to_validate, field_options|\n field_threshold = return_threshold(field_to_validate, field_options)\n if field_threshold\n gather_field_threshold_totals(field_to_validate, field_options)\n else\n gather_specific_validation_totals(field_to_validate, field_options)\n end\n }\n end",
"def set_Threshold(value)\n set_input(\"Threshold\", value)\n end",
"def pick\n r = rand(@upper_threshold)\n @thresholds.find { |value, x| r < x }.first\n end",
"def check_thresholds(data:)\n if data > @options[:critical].to_i\n @critical << @message\n elsif data > @options[:warning].to_i\n @warning << @message\n else\n @okays << @message\n end\n # make the final step\n build_final_output\n end",
"def get_threshold\n d = self.vspecs.select(:value).where(name: 'threshold').first\n return d != nil ? d.value : d\n end",
"def restriction_params\n params.require(:restriction).permit(:threshold)\n end",
"def validate\n raise \"Can only validate request messages\" unless type == :request\n\n raise(NotTargettedAtUs, \"Received message is not targetted to us\") unless PluginManager[\"security_plugin\"].validate_filter?(payload[:filter])\n end",
"def action_defined?\n # ReputationThreshold.action_defined?(self.action, self.tier)\n !self.action_points.nil?\n end",
"def threshold_spy\n return (user_science_level(defender, spy_id) - user_science_level(attacker, spy_id))*0.05+0.5 \n end"
]
| [
"0.69859254",
"0.64288294",
"0.6358009",
"0.58064383",
"0.5729089",
"0.5695526",
"0.5599671",
"0.5571309",
"0.5392161",
"0.53439987",
"0.5334644",
"0.5311986",
"0.5274186",
"0.5268406",
"0.5155847",
"0.51414645",
"0.5139207",
"0.5122872",
"0.5109536",
"0.5108959",
"0.5102317",
"0.5079074",
"0.5053766",
"0.5048954",
"0.50120836",
"0.5007233",
"0.49818707",
"0.49750042",
"0.49737424",
"0.49636564"
]
| 0.8527558 | 0 |
is this action defined as a reputation action | def action_defined?
# ReputationThreshold.action_defined?(self.action, self.tier)
!self.action_points.nil?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reputation_threshold_action\n :offer_reward\n end",
"def action_defined?(action, tier=nil)\n if tier && !tier.accept_default_reputation_threshold\n if rate = tier.find_reputation_threshold_action_points(action)\n return !!rate.points\n end\n end\n respond_to?(action.to_sym)\n end",
"def allows_reward?\n true\n end",
"def allows_reward?\n self.class.allows_reward?\n end",
"def can_be_retagged_by?(editor, tier=nil)\n self.alive? && (editor == self.person || Reputation::Threshold.valid?(:retag_kase, editor, :tier => tier))\n end",
"def action_points\n @threshold_action_points_cache ||= ReputationThreshold.action_points(self.action, self.tier)\n end",
"def set_reputation\n @reputation = Reputation.find(params[:id])\n end",
"def has_access?( action )\n unless( action_name == :show && @sir_item.sir_log.permitted_to_access?( current_user.id )) ||\n @sir_item.sir_log.permitted_to_update?( current_user.id )\n render_no_access \n return false\n end\n g = [ :new, :create ].include?( action_name ) ? @sir_item.resp_next_entry : @sir_entry.resp_this_entry\n unless current_user.permission_to_access( feature_identifier, action, g.id )\n render_no_permission \n return false\n end\n true\n end",
"def quest_rewarded?(quest_id)\n quest_revealed?(quest_id) && quest(quest_id).status?(:reward)\n end",
"def allows_reward?\n false\n end",
"def find_reputation_points(reputable, destination, action, tier=nil)\n ReputationReward.action_points(reputable, destination, action, tier=nil)\n end",
"def action_points(action, tier=nil)\n if tier \n if rate = tier.find_reputation_threshold_action_points(action)\n return rate.points\n end\n return if !tier.accept_default_reputation_threshold\n end\n send(action.to_sym) if action_defined?(action)\n end",
"def threshold\n @threshold ||= Reputation::Threshold.lookup(self.action, self.sender, :tier => self.tier)\n end",
"def repostable_by_user?(user)\n user.is_a?(Admin) || ( user.parent_of?(offender) && pending_parent_action? )\n end",
"def has_access?( action )\n unless @sir_log.permitted_to_access?( current_user.id )\n render_no_access\n return false\n end\n return true if [ 'index', 'new', 'create', 'show_stats' ].include?( action_name )\n unless current_user.permission_to_access( feature_identifier, action, @sir_item.group_id )\n render_no_permission \n return false \n end\n return true\n end",
"def action_allowed?\n current_user_has_ta_privileges?\n end",
"def action_allowed?\n current_user_has_ta_privileges?\n end",
"def can?(user, action)\n return false unless @actions.key? action\n user.power_in(@room) >= @actions[action]\n end",
"def action_allowed?(action_name, user)\n return false\n end",
"def action_allowed?\n if %w[edit update list_submissions].include? params[:action]\n current_user_has_admin_privileges? || current_user_teaching_staff_of_assignment?(params[:id])\n else\n current_user_has_ta_privileges?\n end\n end",
"def action_allowed?\n case params[:action]\n when 'edit'\n @questionnaire = Questionnaire.find(params[:id])\n current_user_has_admin_privileges? ||\n (current_user_is_a?('Instructor') && current_user_id?(@questionnaire.try(:instructor_id))) ||\n (current_user_is_a?('Teaching Assistant') && session[:user].instructor_id == @questionnaire.try(:instructor_id))\n else\n current_user_has_student_privileges?\n end\n end",
"def reputation_params\n params.require(:reputation).permit(:user_id, :contract_id, :category, :subcategory, :item, :params, :status)\n end",
"def is_authorized_to_perform(action)\n permission = role.shift_management_permissions_table.read_attribute(:\"#{action}\")\n return permission != :nobody\n end",
"def authorized?(user, action)\n\t\ttrue\n\tend",
"def index\n @reputations = Reputation.where(user: current_user, status: 'Active')\n end",
"def is_valid_action?(aid)\n return aid > 0 && aid <= @total_actions\n end",
"def available_action?(action_name); end",
"def requires_photographer_action\n self.requests.each do |r|\n if r.state == \"action_needed\"\n return true\n end\n end\n false\n end",
"def set_reward_action\n @reward_action = RewardAction.find(params[:id])\n end",
"def can_reward_user?(reward)\n return false if reward.required_value.nil? || user.reload.nil?\n\n case reward_type\n when 'collected_coins'\n !user.rewards.include?(reward) && user.total_coins >= reward.required_value\n when 'deaths'\n !user.rewards.include?(reward) && user.deaths_count >= reward.required_value\n when 'killed_turtles'\n !user.rewards.include?(reward) && user.killed_turtles_count >= reward.required_value\n when 'killed_bowsers'\n !user.rewards.include?(reward) && user.killed_bowsers_count >= reward.required_value\n else\n false\n end\n end"
]
| [
"0.73953027",
"0.70862067",
"0.6136532",
"0.61103255",
"0.6049808",
"0.60334575",
"0.600791",
"0.5976963",
"0.5958899",
"0.59512293",
"0.5941366",
"0.59375584",
"0.5880065",
"0.584357",
"0.58298135",
"0.58221287",
"0.58221287",
"0.58019215",
"0.5797781",
"0.5728047",
"0.56945986",
"0.5660896",
"0.5639843",
"0.56373435",
"0.5633835",
"0.5616006",
"0.5611383",
"0.5591009",
"0.5558825",
"0.55493104"
]
| 0.7302406 | 1 |
returns the threshold points that are defined for certain action either in database or globally | def action_points
@threshold_action_points_cache ||= ReputationThreshold.action_points(self.action, self.tier)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_tier_threshold_points\n @tier_threshold_points_cache ||= if tp = self.tier.reputation_thresholds.find(:first, \n :conditions => [\"reward_rates.action = ?\", self.action.to_s])\n tp\n elsif self.tier.parent && (ptp = self.tier.parent.reputation_thresholds.find(:first, \n :conditions => [\"reward_rates.action = ?\", self.action.to_s]))\n ptp\n end\n end",
"def threshold\n @threshold ||= Reputation::Threshold.lookup(self.action, self.sender, :tier => self.tier)\n end",
"def action_points(action, tier=nil)\n if tier \n if rate = tier.find_reputation_threshold_action_points(action)\n return rate.points\n end\n return if !tier.accept_default_reputation_threshold\n end\n send(action.to_sym) if action_defined?(action)\n end",
"def threshold\n @threshold || 95\n end",
"def threshold_spy\n return (user_science_level(defender, spy_id) - user_science_level(attacker, spy_id))*0.05+0.5 \n end",
"def threshold_emp\n return (1-(1/(1+0.5*@number_of_emp_ships)))\n end",
"def subsample_thresholds_required\n SUBSAMPLE_THRESHOLDS.select {|sample| sample < self.points}\n end",
"def get_threshold\n d = self.vspecs.select(:value).where(name: 'threshold').first\n return d != nil ? d.value : d\n end",
"def threshold_x\n @zab\n end",
"def threshold_emp(user)\n return (1-(1/(1+0.5*number_ships_ships(user,emp_ship_id))))\n end",
"def reputation_threshold_action\n :offer_reward\n end",
"def patient_score\n @@thresholds.keys.inject(0) do |accu, attribute|\n accu + self.send(\"#{attribute}_score\")\n end\n end",
"def check_threshold\n max_threshold = @assignment.review_topic_threshold\n # Assignment.find_by_sql([\"SELECT review_topic_threshold FROM pg_development.assignments WHERE assignments.id =?\",assign.id])\n num_reviews = ResponseMap.find_by_sql([\"SELECT * FROM response_maps rm where rm.reviewed_object_id =? AND rm.reviewee_id=?\", @assignment.id, @map.reviewee_id]).count\n max_threshold = 5 if max_threshold == 0 || max_threshold.nil?\n\n if num_reviews < (max_threshold / REARRANGING_FACTOR)\n return true\n else\n return false\n end\n end",
"def threshold_spy\n puts \"Ergebnis:\"\n puts (@spy_level_defender - @spy_level_attacker)*0.05+0.5 \n return (@spy_level_defender - @spy_level_attacker)*0.05+0.5 \n end",
"def choice_threshold\n @choice_threshold ||= (cal_cell_mean - darkest_cell_mean) * 0.75 + darkest_cell_mean\n end",
"def hit_points\n @hit_points\n end",
"def threshold_params\n params.require(:threshold).permit(:sensor_id, :comparing_string, :comparing_value, :status, :action)\n end",
"def next_level_threshold\n self.next ? self.next.experience_points_threshold : experience_points_threshold\n end",
"def analyze!\n if nova_score_above_threshold?\n APPROVE_VALUE\n else\n DENIAL_VALUE\n end\n end",
"def check_threshold\n rate = lines.length.to_f / expiry\n if rate > threshold\n alert_status\n elsif rate < threshold\n normal_status\n end\n end",
"def success_threshold; end",
"def gather_threshold_totals\n rules.each{|field_to_validate, field_options|\n field_threshold = return_threshold(field_to_validate, field_options)\n if field_threshold\n gather_field_threshold_totals(field_to_validate, field_options)\n else\n gather_specific_validation_totals(field_to_validate, field_options)\n end\n }\n end",
"def alert_threshold\n return @alert_threshold\n end",
"def maximum_points\n criteria.reduce(0) { |sum, criterion| sum + (criterion.award? ? criterion.point : 0) }\n end",
"def index\n @thresholds = Threshold.all\n end",
"def compute_level(experience_points)\n i = numbered_levels.rindex do |l|\n l.experience_points_threshold <= experience_points\n end\n i ? numbered_levels[i] : nil\n end",
"def captured_points(range = $capture_distance)\n\t\tchecked_set = []\n\t\tcurrent_set = [@hunter.coords]\n\n\t\tdistance = 0\n\t\t# This collects every nonblocked point next to the current set of points (including diagonals) up to a certain number of moves\n\t\tuntil distance > range || current_set.empty?\n\t\t\tfound_set = ((current_set.map{|c| collect_adjacent_points(c)}.flatten - checked_set) - current_set)\n\t\t\tchecked_set += current_set\n\t\t\tcurrent_set = found_set\n\t\t\tdistance += 1\n\t\tend\n\t\t#\tTake out any points that are outside the CAPTURE DISTANCE in euclidean distance from the hunter, and return the remaining set\n\t\tfinal_set = (checked_set + current_set).reject{|p| distance(@hunter.coords,p) > range}\n\tend",
"def threshold(x)\n\t\tx > 0 ? 1.0 : 0.0\n\tend",
"def inactive_threshold_days\n return @inactive_threshold_days\n end",
"def threshold_alert(actual, threshold)\n\t\t\tif actual > threshold\n\t\t\t\tputs \"#{actual - threshold}% above threshold set @ #{threshold}%\".color(:red)\n\t\t\t\tputs \"pixels changed (%): \t\t#{@compare.percentage_changed}%\"\n\t\t\t\tputs \"pixels changed/total:\t#{@compare.changed_px}/#{@compare.total_px}\"\n\t\t\telse\n\t\t\t\tputs \"pixels changed/total:\t#{@compare.changed_px}/#{@compare.total_px}\"\n\t\t\tend\n\t\tend"
]
| [
"0.71479875",
"0.6933815",
"0.6827573",
"0.63600874",
"0.6338986",
"0.6283388",
"0.62192",
"0.61403847",
"0.59998006",
"0.5992386",
"0.5949395",
"0.5902614",
"0.58541006",
"0.5770324",
"0.57589537",
"0.56442285",
"0.5610904",
"0.5608768",
"0.5544826",
"0.5541749",
"0.5540912",
"0.5521972",
"0.55155474",
"0.55015576",
"0.54510695",
"0.5436747",
"0.5426658",
"0.54264736",
"0.54190284",
"0.5407997"
]
| 0.7490711 | 0 |
is a sender assigned? | def sender?
!!self.sender
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sender?\n !!self.sender\n end",
"def receive_sender sender\n true\n end",
"def receive_sender sender\n true\n end",
"def receive_sender sender\n true\n end",
"def sender? usr\n usr.id == user_id\n end",
"def sent?\n sender_id.present?\n end",
"def sender\n @sender ||= User.find( @sender_id )\n end",
"def recipient_is_sender?\n event = Event.where(id: \"#{params[:id]}\")[0]\n user = User.where(username: \"#{invite_params[:username]}\")[0]\n if event.creator.id == user.id\n flash[:notice] = \"You cannot invite yourself.\"\n redirect_to event_path(event)\n end\n end",
"def copy_sender?(subscriber)\n false\n end",
"def sender_contains\n return @sender_contains\n end",
"def from_admin?\n if self.sender == self.receiver\n true\n else\n false\n end\n end",
"def same_sender?(next_line)\n @sender == next_line.sender\n end",
"def sender=(value)\n @sender = value\n end",
"def sender=(value)\n @sender = value\n end",
"def sent_by?(user)\n from_user_id == user&.id\n end",
"def sender_email?\n !self.sender_email.blank?\n end",
"def sender_email?\n !self.sender_email.blank?\n end",
"def isSelfMessage?\n if(@fromNick==@selfNick)\n return true\n else\n return false\n end\n end",
"def sender\n begin\n User.cached_find(self.sender_id)\n rescue\n nil\n end\n end",
"def can_activate?\n self.sender && self.email_match?\n end",
"def sender\n return @sender\n end",
"def sender\n return @sender\n end",
"def sender=(sender)\n @sender = ensure_type(Sender, sender)\n end",
"def sender=(sender)\n @sender = ensure_type(Sender, sender)\n end",
"def with(current_user)\n \tsender == current_user ? recipient : sender\n\tend",
"def update_sender\n if !@from_name.blank? and from_email_address and !@from_email_address.empty? and !(@from_name.to_s == @from_email_address.to_s )\n self.sender = \"#{@from_name} <#{@from_email_address}>\"\n else\n self.sender = @from_email_address.to_s\n end\n end",
"def reject?(sender)\r\n false\r\n end",
"def email_match?\n (!self.sender_email && self.sender?) || (self.sender_email && self.sender && self.sender_email == self.sender.email)\n end",
"def bound?\n @receiver ? true : false\n end",
"def sender\n sender = User.where(:uid => sender_uid)\n sender.first\n end"
]
| [
"0.76944166",
"0.76186776",
"0.76186776",
"0.76186776",
"0.761215",
"0.7483794",
"0.70083576",
"0.6990902",
"0.6962058",
"0.6909903",
"0.6815898",
"0.67791086",
"0.6705199",
"0.6705199",
"0.6694272",
"0.653331",
"0.653331",
"0.65278137",
"0.64955354",
"0.64868957",
"0.64597535",
"0.64597535",
"0.64199847",
"0.64199847",
"0.63670516",
"0.63173366",
"0.6316753",
"0.63128924",
"0.6264567",
"0.6254297"
]
| 0.79234743 | 0 |
produces an html href to the faq pages | def link_to_faq(text, options={})
html = "<a"
html += " class=\"#{options[:class]}\"" if options[:class]
html += " href=\"/faq\""
html += ">"
html += text
html += "</a>"
html
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def faq_url\n WALLSOME_SITE_BASE_URL + \"/faq.html\"\n end",
"def faqs\n end",
"def faqs\n end",
"def faq\n end",
"def faq\n end",
"def render\n <<-HTML\n <div class=\"relative\">\n <a href=\"#{url}\"class=\"#{position_classes}f6 link dim br2 ph3 pv2 dib white bg-blue\" data-help-link=\"Y\" target=\"cbf-help\">#{Icon.new(:question).render} #{text}</a>\n </div>\n HTML\n end",
"def faq\n\n end",
"def href; end",
"def link_to_help(help_entry, link = '<span class=\"symbol question\"><span>?</span></span>'.html_safe)\n help_file = \"\"\n #if Locale.active && Locale.active.language\n # help_file = \"#{ArchiveConfig.HELP_DIRECTORY}/#{Locale.active.language.code}/#{help_entry}.html\"\n #end\n \n unless !help_file.blank? && File.exists?(\"#{Rails.root}/public/#{help_file}\")\n help_file = \"#{ArchiveConfig.HELP_DIRECTORY}/#{help_entry}.html\"\n end\n \n \" \".html_safe + link_to_ibox(link, :for => help_file, :title => help_entry.split('-').join(' ').capitalize, :class => \"symbol question\").html_safe\n end",
"def link_to_help(help_entry, link = '<span class=\"symbol question\"><span>?</span></span>')\n help_file = \"\"\n #if Locale.active && Locale.active.language\n # help_file = \"#{ArchiveConfig.HELP_DIRECTORY}/#{Locale.active.language.code}/#{help_entry}.html\"\n #end\n \n unless !help_file.blank? && File.exists?(\"#{RAILS_ROOT}/public/#{help_file}\")\n help_file = \"#{ArchiveConfig.HELP_DIRECTORY}/#{help_entry}.html\"\n end\n \n link_to_ibox link, :for => help_file, :title => help_entry.split('-').join(' ').capitalize, :class => \"symbol question\"\n end",
"def faq\n respond_to do |format|\n format.html # faq.html.erb\n format.xml { render :xml => nil }\n end\n end",
"def aref\n title = @title || '[untitled]'\n\n CGI.escape(title).gsub('%', '-').sub(/^-/, '')\n end",
"def emit_link(cur_mtg_dir, f, desc)\n _a desc, href: f.include?('/') ? f : File.join(cur_mtg_dir, f)\nend",
"def content_htm\n link_to @options[:url], link_html_options do\n concat glyph_and_content_html\n concat badge_html if @options[:badge]\n end\n end",
"def create_ref_link(index)\n %Q([<a href=\"##{NOTE}-#{index}\">#{index}</a>])\n end",
"def link(href: nil, issue: nil)\n return \"<a href='#{href}#{issue}'>#{issue}</a>\"\n end",
"def link_markup(descr = nil)\n descr = \"View resource.\" if descr == nil\n\n link = @reference_action_def.doi\n link = @reference_action_def.link if link.empty?\n return \"<a href=\\\"#{link}\\\" target=\\\"_blank\\\">#{descr}</a>\"\n end",
"def fb_help(name, url)\n \"<fb:help href=\\\"#{url_for(url)}\\\">#{name}</fb:help>\"\n end",
"def fb_help(name, url)\n \"<fb:help href=\\\"#{url_for(url)}\\\">#{name}</fb:help>\"\n end",
"def generate_link(failure_file_details, file_path)\n \"<strong><a href='xdoclet/#{failure_file_details[0].gsub(/\\//, \"_\").gsub(/\\.rb/, \".rb.html\")}' target='_blank'>#{file_path}</a></strong><br/>\"\n end",
"def list_hyperlink_submission(response_map_id, question_id)\n assignment = Assignment.find(@id)\n curr_round = assignment.try(:num_review_rounds)\n curr_response = Response.where(map_id: response_map_id, round: curr_round).first\n answer_with_link = Answer.where(response_id: curr_response.id, question_id: question_id).first if curr_response\n comments = answer_with_link.try(:comments)\n html = ''\n html += display_hyperlink_in_peer_review_question(comments) if comments.present? and comments.start_with?('http')\n html.html_safe\n end",
"def allfaqs\n @faqs = Faq.getActiveFaqs.order(created_at: :ASC).all()\n @role = user_signed_in? ? (current_user.interface.nil? ? 'admin' : 'user') : 'user'\n\n render :template => 'faqs/all', :locals => {:faqs => @faqs, :role => @role}\n end",
"def url(href)\n a href, :href => href\n end",
"def html(args = nil)\n if args and args[:edit]\n url = self.url_edit\n else\n url = self.url\n end\n\n return \"<a href=\\\"#{Knj::Web.ahref_parse(url)}\\\">#{self.name_html}</a>\"\n end",
"def event_href(title)\n truncated = title[0..5]\n return frm.link(:text=>/#{Regexp.escape(truncated)}/).href\n end",
"def help_link(wiki_entry_name=nil)\n wiki_url = \"https://github.com/indykish/identityprov/wiki\"\n if wiki_entry_name\n wiki_url += \"/#{wiki_entry_name}\"\n link_text = \"Help for #{wiki_entry_name.underscore_humanize}\" \n else\n link_text =\"Help\" \n end\n link_to_ link_text, wiki_url, { :target => '_blank'}\n end",
"def link(link, title, content)\n\t \"<u><link href='#{link}'>#{content}</link></u>\"\n\t end",
"def link\n Html::Link.new(:href => url) << display_name\n end",
"def link_to(body, url)\n \"[#{body}](#{url})\" if !AIPP.options.check_links || url_exists?(url)\n end",
"def search_ah_link(atk, health, content)\n string = \"<a href='#{@search_url}type=troop&atk=#{atk}&health=#{health}'>#{content}</a>\"\nend"
]
| [
"0.7262702",
"0.6984959",
"0.6984959",
"0.63352615",
"0.63352615",
"0.6328134",
"0.6242769",
"0.6170071",
"0.6164575",
"0.6066346",
"0.6018735",
"0.59769714",
"0.59391046",
"0.5923673",
"0.59150124",
"0.58892757",
"0.5856246",
"0.57082224",
"0.57082224",
"0.57062006",
"0.56927943",
"0.5664335",
"0.5634797",
"0.5612076",
"0.5611874",
"0.5609216",
"0.5600365",
"0.5600284",
"0.5594065",
"0.5593905"
]
| 0.7102768 | 1 |
Defines a singleton_method in the receiver. The method parameter can be a Proc or Method object. If a block is specified, it is used as the method body. This block is evaluated using instance_eval. | def define_singleton_method(symbol, method)
# TODO
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def define_singleton_method name, &body\r\n singleton_class = class << self; self; end\r\n singleton_class.send(:define_method, name, &body)\r\n end",
"def define_and_call_method(method, &block)\n self.class.send(:define_method, method, block)\n send method\n end",
"def ensure_method(name, &block)\n define_singleton_method(name, &block) unless respond_to?(name)\n end",
"def helper(name, &block)\n delegation_obj = subject.__getobj__\n subject.define_singleton_method(name.to_sym) do\n instance_exec(delegation_obj, &block)\n end\n end",
"def define_class_method(name, &code)\n singleton_class.instance_eval { define_method(name, &code) }\n end",
"def define method_name, &block\n machine.named_procs[method_name] = block\n end",
"def remove_possible_singleton_method(method)\n singleton_class.instance_eval do\n remove_possible_method(method)\n end\n end",
"def method_missing(symbol,*args,&block)\n singleton_method(symbol,*args,&block) ||\n singleton_method(:body).send(symbol, *args, &block)\n end",
"def add_method(instance, method_name)\n\t define_singleton_method(method_name) do |*args|\n\t instance.public_send(method_name, *args)\n\t end\n\t\tend",
"def add_method(instance, method_name)\n define_singleton_method(method_name) do |*args|\n instance.public_send(method_name, *args)\n end\n end",
"def create_method(name, &block)\n eigen = class << self; self; end\n eigen.send(:define_method, name, &block)\n end",
"def override_singleton_method(instance, klass_name, meth)\n saved_meth_name = get_saved_method_name(meth, 'singleton')\n if instance.respond_to?(saved_meth_name, true)\n Sqreen.log.debug { \"#{saved_meth_name} found #{instance.class}##{instance.object_id} already instrumented\" }\n return nil\n elsif instance.frozen?\n Sqreen.log.debug { \"#{instance.class}##{instance.object_id} is frozen, not reinstrumenting\" }\n return nil\n end\n raise Sqreen::NotImplementedYet, \"#{instance.inspect} doesn't respond to define_singleton_method\" unless instance.respond_to?(:define_singleton_method)\n p = Instrumentation.define_callback_method(meth, saved_meth_name,\n klass_name)\n instance.define_singleton_method(saved_meth_name, instance.method(meth))\n instance.define_singleton_method(meth, p)\n # Hide saved method (its only available in this syntax)\n eval <<-RUBY, binding, __FILE__, __LINE__ + 1\n class << instance\n private :#{saved_meth_name}\n end\n saved_meth_name\n RUBY\n end",
"def initialize(klass, &block)\n @original_block = block\n\n klass.__send__ :define_method, method_name, &block\n @instance_method = klass.instance_method method_name\n klass.__send__ :remove_method, method_name\n end",
"def create_method( name, &block )\n self.class.send( :define_method, name, &block )\n end",
"def singleton_instance_eval(&block)\n singleton_class.instance_eval(&block)\n end",
"def meta_eval(&block)\n singleton_class.instance_eval(&block)\n end",
"def mk_method(proc)\n @klass.send(:define_method, @method_name, proc)\n end",
"def def(name, &block)\n @runtime_methods[name.to_s] = block\n end",
"def generate_method(method_name, &block)\n define_method(method_name, &block)\n method = instance_method method_name\n remove_method method_name\n method\n end",
"def my_method(&block)\n block.call # .call to invoke the block\nend",
"def create_method(name, &block)\n\t\t\tself.class.send(:define_method, name, &block)\n\t\tend",
"def define_class_method(name, &block)\n (class << self; self; end).instance_eval do\n define_method name, &block\n end\n end",
"def redefine_method(method, &block)\n visibility = method_visibility(method)\n remove_possible_method(method)\n define_method(method, &block)\n send(visibility, method)\n end",
"def register_method(method, &block)\n self.class.register_method(method, &block)\n end",
"def bound_method(block); end",
"def singleton_class_eval &block\n self.singleton_class.class_eval &block\n end",
"def singleton_class(&block)\n\t\tif block_given?\n\t\t(class << self; self; end).class_eval(&block)\n\t\tself\n\t\telse\n\t\t(class << self; self; end)\n\t\tend\n\tend",
"def send_bypass_singleton meth, *args, &block\n self.class.instance_method(meth).bind(self).call *args, &block\n end",
"def call(method, params = [], &blk)\n id = self.next_id()\n self.send(msg: 'method', id: id, method: method, params: params)\n @callbacks[id] = blk\n end",
"def redefine_method(method, &block)\n remove_possible_method(method)\n define_method(method, &block)\n end"
]
| [
"0.65705115",
"0.6448794",
"0.59842664",
"0.5925674",
"0.5833038",
"0.5671119",
"0.56663966",
"0.56383723",
"0.56275105",
"0.5615008",
"0.56046265",
"0.55882794",
"0.55846226",
"0.5533319",
"0.55091405",
"0.5500842",
"0.5488578",
"0.5486694",
"0.54477465",
"0.54208934",
"0.541625",
"0.54129136",
"0.5403428",
"0.5380933",
"0.5369697",
"0.5365385",
"0.5357115",
"0.5328795",
"0.53253394",
"0.5322627"
]
| 0.6649878 | 0 |
Edit a particular Address in the database | def edit_address(edited_address)
address = Address.find(edited_address.uid)
address.attributes = edited_address.attributes
address.save!
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edit\n\t\t@address = current_user.addresses.find(params[:id])\n\tend",
"def edit\n\t@address=Address.new\n\t@address=Address.find(params[:id])\nend",
"def update\n @address = @addressable.addresses.find_by_id(params[:id])\n\n respond_to do |format|\n if @address.update_attributes(params[:address])\n format.html { redirect_to current_user, notice: 'address was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @address.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_address\n @address = Address.find params[:id]\n end",
"def set_address\n @address = Address.find params[:id]\n end",
"def update\n begin\n saved = @address.update!(address_params)\n save_redirector saved, @address, \"Address was successfully updated.\"\n rescue ActiveRecord::RecordInvalid => e\n redirect_to edit_address_path(@address), notice: e.message\n end\n end",
"def set_address\n @address = Address.find(params[:id])\n end",
"def set_address\n @address = Address.find(params[:id])\n end",
"def set_address\n @address = Address.find(params[:id])\n end",
"def set_address\n @address = Address.find(params[:id])\n end",
"def set_address\n @address = Address.find(params[:id])\n end",
"def set_address\n @address = Address.find(params[:id])\n end",
"def set_address\n @address = Address.find(params[:id])\n end",
"def set_address\n @address = Address.find(params[:id])\n end",
"def set_address\n @address = Address.find(params[:id])\n end",
"def set_address\n @address = Address.find(params[:id])\n end",
"def set_address\n @address = Address.find(params[:id])\n end",
"def set_address\n @address = Address.find(params[:id])\n end",
"def edit_address(order_or_user, address_id, expect_success, values, type=nil)\n visit_edit_address(order_or_user, address_id)\n fill_in_address(values, type)\n click_button Spree.t('actions.update')\n\n if expect_success\n expect_address_collection_path(order_or_user)\n expect(page).to have_content(Spree.t(:successfully_updated, resource: Spree::Address.model_name.human))\n else\n expect(page).to have_no_content(Spree.t(:successfully_updated, resource: Spree::Address.model_name.human))\n expect(path_with_query).to eq(spree.admin_address_path(address_id, user_id: @user_id, order_id: @order_id))\n end\n end",
"def edit_address\n traveller = Traveller.find(params[:pk])\n address = params[:value]\n\n coordinates = GoogleAPIGeocoder.do_geocode(address)\n\n if coordinates.nil?\n render json: {success: false, msg: 'Unable to find the location of the given address. Please check that it is correct.'}\n else\n traveller.update(address: address, latitude: coordinates[0], longitude: coordinates[1])\n\n if current_user.nil?\n if session[:trip] != nil\n travellers = session[:trip].travellers\n travellers[travellers.index(traveller)].address = params[:value]\n end\n\n if session[:travellers] != nil\n session[:travellers][session[:travellers].index(traveller)].address = params[:value]\n end\n end\n\n render json: {success: true}\n end\n end",
"def set_address\n @address = Address.find(params[:id])\n end",
"def update\n if current_user\n @address = Address.find(params[:id])\n if current_user == @address.user\n address = Address.new(params[:address])\n address.user = current_user\n if address.save\n @address.update_attributes(:status => 'deleted')\n flash[:notice] = I18n.t(\"stizun.address.address_changed\")\n redirect_to user_addresses_path(current_user)\n else\n flash[:error] = I18n.t(\"stizun.address.address_couldnt_be_saved\")\n render :action => 'edit'\n end\n else\n flash[:error] = I18n.t(\"stizun.address.you_have_no_permission_to_edit\")\n redirect_to root_path\n end\n end\n end",
"def set_address\n @address = Address.find(params[:id])\n end",
"def set_address\n @address = Address.find(params[:id])\n end",
"def set_address\n @address = Address.find(params[:id])\n end",
"def set_address\n @address = Address.find(params[:id])\n end",
"def update\n @address = current_user.addresses.find(params[:id])\n\n respond_to do |format|\n if @address.update_attributes(params[:address])\n format.html { redirect_to user_address_path(current_user, @address), notice: 'Address was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @address.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @address = Address.find(params[:id])\n\n respond_to do |format|\n if @address.update_attributes(params[:address])\n format.html { redirect_to @address, notice: 'Address was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @address.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @address = Address.find(params[:id])\n\n respond_to do |format|\n if @address.update_attributes(params[:address])\n format.html { redirect_to @address, notice: 'Address was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @address.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @address = Address.find(params[:id])\n\n respond_to do |format|\n if @address.update_attributes(params[:address])\n format.html { redirect_to @address, notice: 'Address was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @address.errors, status: :unprocessable_entity }\n end\n end\n end"
]
| [
"0.7819367",
"0.77717304",
"0.7608921",
"0.75805825",
"0.75805825",
"0.75251263",
"0.75176305",
"0.75176305",
"0.75176305",
"0.75176305",
"0.75176305",
"0.75176305",
"0.75176305",
"0.75176305",
"0.75176305",
"0.75176305",
"0.75176305",
"0.75176305",
"0.74903965",
"0.7477694",
"0.7463883",
"0.74340034",
"0.73954314",
"0.73954314",
"0.73954314",
"0.73954314",
"0.7375167",
"0.7350678",
"0.7350678",
"0.7350678"
]
| 0.8174226 | 0 |
Delete a particular Address from the database | def delete_address(address)
address.delete!
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n @address = Address.find(params[:address_id])\n end",
"def delete_address(id)\n delete(\"addresses/#{id}\")\n end",
"def delete\n @carddav_backend.delete_address_book(@address_book_info['id'])\n end",
"def delete_address\n @mailing_list_address.destroy if @ok\n render 'update_addresses'\n end",
"def delete_address_book(address_book_id)\n end",
"def destroy\n @addresses = Address.paginate(:page => params[:page], :per_page => 5).order('updated_at DESC')\n @address = Address.find(params[:id])\n @error = nil\n\n begin\n @address.destroy\n rescue ActiveRecord::DeleteRestrictionError => e\n @error = e.message\n end\n end",
"def destroy\n @address = Address.find(params[:id])\n @address.destroy\n\n respond_to do |format|\n format.html { redirect_to(:action=>'index') }\n format.xml { head :ok }\n end\n end",
"def destroy\n @address = Address.find(params[:id])\n @address.destroy\n\n respond_to do |format|\n format.html { redirect_to addresses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @address = Address.find(params[:id])\n @address.destroy\n\n respond_to do |format|\n format.html { redirect_to addresses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @address = Address.find(params[:id])\n @address.destroy\n\n respond_to do |format|\n format.html { redirect_to addresses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @address = Address.find(params[:id])\n @address.destroy\n\n respond_to do |format|\n format.html { redirect_to addresses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @address.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'Address was successfully destroyed.' }\n end\n end",
"def delete_address(order_or_user, address_id, expect_success)\n address_id = address_id.id if address_id.is_a?(Spree::Address)\n\n visit_addresses(order_or_user)\n\n click_link \"delete-address-#{address_id}\"\n\n if expect_success\n expect(page).to have_content(Spree.t(:successfully_removed, resource: Spree::Address.model_name.human))\n else\n expect(page).to have_no_content(Spree.t(:successfully_removed, resource: Spree::Address.model_name.human))\n end\n end",
"def destroy\n @taddress = Taddress.find(params[:id])\n @taddress.destroy\n \n respond_to do |format|\n format.html { redirect_to taddresses_url }\n format.json { head :ok }\n end\n end",
"def destroy\n\t\t@address = Address.find(params[:id])\n\t\[email protected] do |c|\n\t\t\tc.destroy\n\t\tend\n\t\tredirect_to address_url(@address)\n\tend",
"def destroy\n @address.destroy\n respond_to do |format|\n format.html { redirect_to url_back, notice: 'Address was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user_address = UserAddress.find(params[:id])\n @user_address.destroy\n\n respond_to do |format|\n format.html { redirect_to(user_addresses_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @address = current_user.addresses.find(params[:id])\n @address.destroy\n\n respond_to do |format|\n format.html { redirect_to user_addresses_path(current_user) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @address.destroy\n\n render :nothing => true\n end",
"def delete\n @addresses = Address.where(person_id: params[:id])\n @addresses.each do |c|\n Address.find(c.id).destroy\n end\n Person.find(params[:id]).destroy\n redirect_to :action => 'list'\n end",
"def destroy\n # @address = Address.find(params[:id])\n @address = Address.find_by_permalink!(params[:id])\n @address.destroy\n\n respond_to do |format|\n format.html { redirect_to(addresses_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @address.destroy\n respond_to do |format|\n format.html { redirect_to admin_path(current_user), notice: 'Address was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user_address = UserAddress.find(params[:id])\n @user_address.destroy\n\n respond_to do |format|\n format.html { redirect_to user_addresses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n address = Address.find(params[:id])\n status = address.delivery_address # stores whether it is delivery address or not\n address.destroy\n current_user_address = @current_user.addresses\n # if the address deleted is the current delivery address and the user should have atleast one address to mark the first address as delivery address.\n if (status && !(current_user_address.empty?))\n addrs = Address.first\n addrs.delivery_address = true\n addrs.save!\n end\n redirect_to cart_items_path\n end",
"def destroy\n @ag_address.destroy\n respond_to do |format|\n format.html { redirect_to ag_addresses_url, notice: 'Address was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @address.destroy\n respond_to do |format|\n format.html { redirect_to edit_company_path(@company), notice: 'Address was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @address.destroy\n respond_to do |format|\n format.html { redirect_to addresses_url, notice: 'Address was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @address.destroy\n respond_to do |format|\n format.html { redirect_to addresses_url, notice: \"Address was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @address.destroy\n respond_to do |format|\n format.html { redirect_to addresses_url, notice: \"Address was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @address = Address.find(params[:id])\n @address.destroy\n\n respond_to do |format|\n format.html { render :partial => 'addresses/list' }\n end\n end"
]
| [
"0.8295874",
"0.8109702",
"0.76348406",
"0.756122",
"0.7521462",
"0.73788595",
"0.73546976",
"0.7353126",
"0.7353126",
"0.7353126",
"0.7353126",
"0.7342045",
"0.73061633",
"0.7299389",
"0.7290487",
"0.72902477",
"0.72712773",
"0.7260513",
"0.724764",
"0.7227744",
"0.72251207",
"0.7206896",
"0.71714866",
"0.71179986",
"0.7062416",
"0.70439726",
"0.70303905",
"0.7014396",
"0.7014396",
"0.7008799"
]
| 0.84705895 | 0 |
Cleanse Address through third party service using SOA pattern (psuedocode) | def cleanse_address(address)
cleansed_address = SOAAddressCleanser.cleanse_address(address)
cleansed_address.save!
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getToolsParseAddress( address, postcode, country, normalise)\n params = Hash.new\n params['address'] = address\n params['postcode'] = postcode\n params['country'] = country\n params['normalise'] = normalise\n return doCurl(\"get\",\"/tools/parse/address\",params)\n end",
"def clean_for_comp( address = '' )\n address.upcase.gsub /[^0-9A-Z]/, ''\nend",
"def cleanup_address(address)\n rules = [\n {\n # Remove \" Block \" just use the specified address\n pattern: '[[:space:]](Block)[[:space:]]',\n replacement: ' '\n },\n {\n # Replace \\sAv (where Ave is cut off at the end of the string)\n pattern: '\\s(AV)$',\n replacement: ' Ave'\n },\n {\n # Replace mid sentence \" AV \" with \" Ave \" (aka: Avenue)\n pattern: '\\s(AV)\\s',\n replacement: ' Ave '\n }\n ]\n\n rules.each do |regex|\n address.gsub!(/#{regex[:pattern]}/i, regex[:replacement])\n end\n\n address\nend",
"def normalize_address(address)\n wallet.blockchain_api&.supports_cash_addr_format? ? CashAddr::Converter.to_legacy_address(super) : super\n end",
"def fix(address)\n @address = address\n end",
"def fix(address)\n @address = address\n end",
"def normalized\n @address.downcase.gsub(/[^A-Fa-f0-9]/, '')\n end",
"def normalize_address(address)\n normalize(address).split(' ').map { |word| StreetAbbrevs[word] || word }.join(' ')\n end",
"def validate_and_sanitize\n r = validate\n return r unless r.success?\n\n @ethereum_address = @ethereum_address.to_s\n\n @ethereum_address = Util::CommonValidator.sanitize_ethereum_address(@ethereum_address)\n\n return error_with_identifier('invalid_api_params',\n 'um_cea_1',\n ['invalid_ethereum_address']\n ) unless Util::CommonValidator.is_ethereum_address?(@ethereum_address)\n\n success\n end",
"def validateaddress(coinaddress)\n coind.validateaddress\n end",
"def fake_address\n {\n first_name: 'Jack',\n last_name: 'Macdowall',\n company_name: 'Macdowalls',\n line_1: '1225 Invention Avenue',\n line_2: 'Birmingham',\n postcode: 'B21 9AF',\n county: 'West Midlands',\n country: 'UK'\n }\n end",
"def remove_original_address(opts)\n opts = check_params(opts,[:addresses])\n super(opts)\n end",
"def post_address\n postcode = params['value'].delete('- ')\n address = CoreService.get_address(postcode)\n\n respond_to do |format|\n format.json { render json: { success: true, address: address } }\n end\n end",
"def try_to_fix address\n parts = address.split(\",\")\n if parts.shift\n parts.join(',')\n else\n address\n end\n end",
"def make_address(street, city, state, zip)\nend",
"def validate_address(street,sid,house_nr) \n\n url = 'http://ags2.lojic.org/ArcGIS/rest/services/External/Address/MapServer/exts/AddressRestSoe/ValidateAddress?' +\n \"token=XByufiRcTeZJOARKuu3jJV2mNkBRSCD--D1YqeBZDCuEij4BnbkuzNL3QcE-l3mwAnR7Rs9CoaKo-Xp8j4Tsuw..\" +\n '&Houseno='+ house_nr.to_s + \n '&SifID='+sid.to_s + \n '&Apt='+\n '&f=json'+\n 'callback=dojo.io.script.jsonp_dojoIoScript52._jsonpCallback'\n\n html = cache \"house\" + sid + \"_house\" + house_nr ,url\n\n json = JSON.parse(html)\n\n if json \n if json.include?('Candidates')\n json['Candidates'].each{ |house|\n\n # creat the source point in meters\n srcPoint = Proj4::Point.new( house[\"X\" ] * 0.3048006 , house[\"Y\" ] * 0.3048006 , )\n\n # transform it \n point = @srcPrj.transform(@destPrj, srcPoint)\n\n # covert to degrees\n lat = point.x * Proj4::RAD_TO_DEG\n lon= point.y * Proj4::RAD_TO_DEG\n\n p = Node.new(lon,lat)\n p.kv 'addr:housenumber', house[\"Houseno\"].to_s\n#<tag k=\"addr:housenumber\" v=\"{\"Houseno\"=>4305, \"Hafhouse\"=>\"\", \"Apt\"=>\"\", \"Roadname\"=>\"W MUHAMMAD ALI BLVD\", \"FullAddress\"=>\"4305 W MUHAMMAD ALI BLVD\", \"ZIPCode\"=>\"40212\", \"Sitecad\"=>1110234909, \"X\"=>1188974.2500012815, \"Y\"=>280104.8749201}\"/>\n# p.kv 'addr:full', house[\"FullAddress\"]\n p.kv 'addr:suite', house[\"Apt\"]\n p.kv 'addr:Hafhouse', house[\"Hafhouse\"]\n p.kv 'addr:street', street\n p.kv 'addr:postcode', house[\"ZIPCode\"]\n p.kv 'building', \"yes\"\n\n @properties.push(p)\n }\n end \n end\n\n end",
"def full_street_address\n postcode_only_address\n end",
"def set_for_postcode_search\n @show_manual_address = false\n @address_read_only = false\n @address_summary.postcode = ''\n @address_detail = Address.new(default_country: params[:address][:default_country])\n end",
"def createAddress\n value = posting_address_params\n @posting=Posting.find(params[:id])\n\n if(value[:id].nil? && @posting[params[:id]].nil?)\n @address = Address.new\n if @posting[:enable_sharing]==1\n value[:hiacode]=Loolcode.create('AF','SN',20) #af for afrikelist sn for senegal... how to pull the country code?\n end\n @address.update_attributes(value)\n\n @address.save\n else\n @address = Address.find(params[:id])\n @address.update_attributes(value )\n end\n @posting.update(address_id: @address.id)\n end",
"def address_from_spree_address(address)\n ::ShipCompliant::Address.new(\n first_name: address.first_name,\n last_name: address.last_name,\n country: address.country.iso,\n city: address.city,\n state: address.try(:state).try(:abbr),\n street1: address.address1,\n street2: address.address2,\n zip1: address.zipcode.try(:[], 0...5)).address\n end",
"def address\n '310 S Harrington'\n end",
"def secondary_address; end",
"def original_address\n super\n end",
"def full_address; end",
"def delete_address(address)\n address.delete!\n end",
"def set_address\n end",
"def get_common_address\n service = EVSS::PCIUAddress::Service.new(user)\n response = service.get_address\n case response.address\n when EVSS::PCIUAddress::DomesticAddress\n prefill_domestic_address(response.address)\n when EVSS::PCIUAddress::InternationalAddress\n prefill_international_address(response.address)\n when EVSS::PCIUAddress::MilitaryAddress\n prefill_military_address(response.address)\n else\n {}\n end\n rescue\n {}\n end",
"def sanitize_postcode\n if attribute_present?('business_postcode')\n self.business_postcode = business_postcode.gsub(' ', '').upcase\n end\n end",
"def extract_postcode(address)\n postcode = \"\"\n if /[[:alpha:]]+\\d+\\s\\d+[[:alpha:]][[:alpha:]]/.match(address)\n postcode = /[[:alpha:]]+\\d+\\s\\d+[[:alpha:]][[:alpha:]]/.match(address)[0]\n end\nend",
"def preprocess(raw_street_address, raw_city, raw_state, raw_zip_code)\n zip5 = normalize_zip_code(raw_zip_code)[:zip5]\n lat_lng = geocode_by_zip_code(zip5)\n\n {\n street_address: raw_street_address,\n city: raw_city,\n state: raw_state&.upcase,\n zip_code: zip5,\n lat: lat_lng[:lat],\n lng: lat_lng[:lng],\n }\n end"
]
| [
"0.6242082",
"0.60627574",
"0.5978242",
"0.5943953",
"0.59070307",
"0.59070307",
"0.5906608",
"0.5845295",
"0.57819074",
"0.5777708",
"0.5678787",
"0.5667282",
"0.56634676",
"0.5639671",
"0.5619848",
"0.56121933",
"0.5599824",
"0.5592019",
"0.55840635",
"0.5571092",
"0.5569788",
"0.5567111",
"0.5537053",
"0.55301774",
"0.55283266",
"0.5519048",
"0.5509963",
"0.550905",
"0.5506747",
"0.549858"
]
| 0.7425036 | 0 |
Validate zipcode through third party service using SOA pattern (psuedocode) | def validate_zip(address)
return SOAZipValidator(address.city, address.zipcode)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zipvalidate(postcode)\n !!postcode.match(/\\A[1-46][\\d]{5}\\z/)\nend",
"def zip_code\n @zip_code || (@address_line3 if @address_line3 =~ /(?i)^[a-z0-9][a-z0-9\\- ]{0,10}[a-z0-9]$/)\n end",
"def check_zipcode_validity\n\t\tif (zip_code =~ /\\d{5}/) == 0\n\t\t\t#zip_code.length == 5 and \n\t\t\t# !zip_code.include? \"abcdefghijklmnopqrstuvwxyz!@#$%^&*()\"\n\t\t\tputs 'Thanks for a valid zip code!'\n\t\t\tself.call_api\n\t\t\tself.parse_api\n\t\telse\n\t\t\tputs 'Sorry friend, that zipcode is not valid. Please try again!'\n\t\tend\n\tend",
"def validate_zipcode(province_id, zipcode)\n zipcode = zipcode.to_i\n url = \"/provincia/#{province_id}/validar-codigo-postal\"\n query = \"codigo_postal=#{zipcode}\"\n get_response(url, query)\n end",
"def validation_of_zip_code(code)\n\n # check type\n for str in code.chars\n if !/\\A\\d+\\z/.match(code)\n return false\n end \n end\n\n # check length\n if code.length == 5\n return true\n else\n return false\n end\nend",
"def check_zip_code\n zip_string = @zipcode.to_s\n raise InvalidParameterException if zip_string.size != 5\n # raise InvalidParameterException if (@zipcode.to_s =~ pattern)\n check_patterns(zip_string)\n end",
"def zipcode_isValid?(zipcode)\n if(zipcode.length != 8 || !zipcode.numeric?)\n false\n else\n true\n end\nend",
"def validation_of_zip_code(code) # arr.select { |e| e.even? || e == odd }\n if !/\\A\\d+\\z/.match(code)\n return false\n elsif code.length == 5\n return true\n else\n return false\n end\nend",
"def is_zipcode?(address_or_zipcode)\n\t\t/\\d{5}(-| )\\d{4}$|^\\d{5}$/.match(address_or_zipcode) != nil\n\tend",
"def enter_zip_and_search(code)\n fill_in 'tZip', :with => code\n click_button 'Find'\n \n # checks if it found a valid zip code.\n # 2 conditions to fail a search.\n # 1. if zip is in a valid format and no city is found.\n # 2. if zip is not in a valid format.\n # pages contains those strings.\n strs = ['Sorry', 'You did not enter a valid ZIP Code']\n if ScrapeUtil.has_content_or?(page, strs)\n false\n else\n # found a valid zip.\n # the first p tag contains the city.\n result = first(:xpath, '//div[@id=\"result-cities\"]/p')\n #result.text\n hash_result = self.city_state_as_hash(code, result.text)\n \n # save to db.\n self.save_to_db(hash_result)\n \n hash_result\n end\n end",
"def validates_zip_code_according_to_publisher(*config)\n validates_each(:zip_code, *config) do |model, attr, zip|\n if zip.present?\n valid = false\n if model.publisher\n model.publisher.country_codes.each do |country_code|\n regex = postal_code_regex(country_code)\n if regex.present?\n valid = true if regex =~ zip\n else\n # valid if there's no validation regex\n valid = true\n end\n end\n else\n valid = true\n end\n unless valid\n model.errors.add(attr, I18n.t(\"activerecord.errors.messages.invalid\"))\n end\n end\n end\n end",
"def match_postal_code(postal_code)\n /\\A\\s*(?<fsa>[a-zA-Z]\\d[a-zA-Z])\\s*(?<ldu>\\d[a-zA-Z]\\d)\\s*\\z/\n .match(postal_code)\n end",
"def validates_zip_code(*config)\n validates_each(:zip_code, *config) do |model, attr, zip|\n if zip.present?\n regex = postal_code_regex(model.country_code)\n if regex.present?\n unless regex =~ zip\n model.errors.add(attr, I18n.t(\"activerecord.errors.messages.invalid\"))\n end\n end\n end\n end\n end",
"def is_zip_code?(user_zip)\n if user_zip.nil?\n false\n else\n user_zip.size == 5 && user_zip.to_i.to_s == user_zip && !user_zip.nil?\n end\n end",
"def fix_up_zip_code(zip)\n return nil unless zip.present?\n return nil if (zip =~ /\\A(\\d{5})/).nil?\n $1\n end",
"def zip_code_grabber\n\n puts ''\n puts \"Please enter your 5-digit zip code:\"\n puts ''\n\n @zip_code = nil\n\n # checks for zip code validation utilzing is_zip_code? method\n while !self.is_zip_code?(self.zip_code)\n\n self.zip_code = gets.chomp\n\n if !self.is_zip_code?(self.zip_code)\n puts \"\"\n puts \"I'm sorry. That entry was invalid. Please enter a valid 5 digit zip code.\"\n puts \"\"\n end\n end\n\n #return zip_code\n self.zip_code.to_i\n end",
"def zipcode\n return poi.zip unless poi.nil?\n return place.zip unless place.nil?\n return get_zipcode\n end",
"def validate_zip_or_state\n # check format of zip and state\n enough = false\n if zip.present? && ::Geocode::ZipCode.is_valid_usa_zip_code?(zip)\n #\n enough = true\n elsif state.present?\n if ::Geocode::State::USA_STATE_CODES_TO_NAMES_MAP.include?(state.strip.upcase)\n enough = true\n else\n self.errors.add(:state, \"Invalid State\")\n end\n end\n unless enough\n self.errors.add(:zip, \"Required to set either State or Zip Code\")\n end\n end",
"def call_from_zip_code\n\n #grab user's zip code,\n self.zip_code_grabber\n\n #call scraper class method to access html of page based on zip code\n @doc = AirQualityIndex::Scraper.new.local_aqi_scraper(self.zip_code)\n\n #return aqi information, unless unavailable for that zip code\n self.aqi_info_validation_return(self.doc)\n end",
"def has_valid_postal_code_pattern\n return unless format.is_a?(LocalPostal::Format)\n\n matches = Regexp.new(format.postal_code_pattern).match(postal_code)\n\n errors.add(:postal_code, 'is invalid') unless matches.to_a.length > 0\n end",
"def postal_code_search(_zip, _city, _country, or_search)\n unless or_search\n Rails.logger.debug \"\\t1) Determine longitude/latitude using exact search (AND)\" \n else\n Rails.logger.debug \"\\t\\t1.1) Determine longitude/latitude using matched search (OR)\"\n end\n \n geo_query = Geonames::PostalCodeSearchCriteria.new\n geo_query.place_name = [zip, city, correct(country)].compact.reject { |s| s.strip.empty? }.join(\" \")\n geo_query.max_rows = or_search ? '10' : '1'\n geo_query.is_or_operator = or_search\n \n results = Geonames::WebService.postal_code_search(geo_query)\n ensure_it_fits(results, _country)\n end",
"def clean_zipcodes(original)\n zipcode = \"#{INVALID_ZIPCODE}#{original}\"\n zipcode = zipcode[-5..-1]\n return zipcode\n end",
"def parisian?\n return self.zip_code.starts_with? '75','77','78','91','92','93','94','95'\n end",
"def zipcode_matches_state?\n zipArray = Array.new\n zipArray[0] = /CT|MA|ME|NH|NJ|RI|VT/\n zipArray[1] = /DE|NY|PA/\n zipArray[2] = /DC|MD|NC|SC|VA|WV/\n zipArray[3] = /AL|FL|GA|MS|TN/\n zipArray[4] = /IN|KY|MI|OH/\n zipArray[5] = /IA|MN|MT|ND|SD|WI/\n zipArray[6] = /IL|KY|MO|NE/\n zipArray[7] = /AR|LA|OK|TX/\n zipArray[8] = /AZ|CO|ID|NM|NV|UT|WY/\n zipArray[9] = /AK|CA|HI|OR|WA/\n (zipArray[postalcode.chars.first.to_i] =~ province) != nil\n end",
"def valid_address?( delta = 1.0 )\n @required = [:ups_account, :ups_user, :ups_password]\n \n state = STATES.has_value?(@state.downcase) ? STATES.index(@state.downcase) : @state\n \n @data = String.new\n b = Builder::XmlMarkup.new :target => @data\n \n b.instruct!\n b.AccessRequest {|b|\n b.AccessLicenseNumber @ups_account\n b.UserId @ups_user\n b.Password @ups_password\n }\n b.instruct!\n b.AddressValidationRequest {|b|\n b.Request {|b|\n b.RequestAction \"AV\"\n b.TransactionReference {|b|\n b.CustomerContext \"#{@city}, #{state} #{@zip}\"\n b.XpciVersion API_VERSION\n }\n }\n b.Address {|b|\n b.City @city\n b.StateProvinceCode state\n b.PostalCode @zip\n }\n }\n \n \t get_response \"https://wwwcie.ups.com/ups.app/xml/AV\"\n \n \t\tif REXML::XPath.first(@response, \"//AddressValidationResponse/Response/ResponseStatusCode\").text == \"1\" && REXML::XPath.first(@response, \"//AddressValidationResponse/AddressValidationResult/Quality\").text.to_f >= delta\n \t\t return true\n \t\telse\n \t\t return false\n \t\tend\n end",
"def get_zipcode\n return zip\n end",
"def scotland_postcode_format_valid?(postcode)\n postcode.match?(SCOTLAND_POSTCODE_REGEX)\n end",
"def zip\n puts \"Welcome to the disc golf course finder. This tool will help you choose the best course around for you to go play! Start by entering your five digit zip code:\" \n ui = gets.strip.to_i\n if ui.match(/([0-9] *){5}\\b/)\n puts \"Great!\"\n @zip = ui\n else\n puts \"Please enter a five digit zip code:\"\n zip\n end\n end",
"def validate_pin(pin)\n (pin.length == 4 || pin.length == 6) && pin.count(\"0-9\") == pin.length\nend",
"def getCode \n\t#Message prompting user to input a postal code to continue\n\tputs \"Please enter a valid zip code containing 5 digits\"\n\tuserInput = gets.chomp\n\treturn userInput\nend"
]
| [
"0.7463366",
"0.7298691",
"0.72607654",
"0.72205293",
"0.7136198",
"0.7124995",
"0.68900555",
"0.68285197",
"0.67880523",
"0.6695647",
"0.6690848",
"0.6675632",
"0.65642965",
"0.64860547",
"0.6445737",
"0.63939327",
"0.6359967",
"0.63279116",
"0.6292299",
"0.6266898",
"0.62175596",
"0.61774665",
"0.6092972",
"0.607807",
"0.60525703",
"0.60458815",
"0.6020343",
"0.60192925",
"0.5994063",
"0.5986836"
]
| 0.7341014 | 1 |
Nathan Tests def run_tests root = BinaryTreeNode.new(50) left = root.insert_left(30) right = root.insert_right(80) left_left = left.insert_left(20) left_right = left.insert_right(40) right_left = right.insert_left(70) right_right = right.insert_right(90) assert_true(root) root = BinaryTreeNode.new(50) left = root.insert_left(30) right = root.insert_right(80) left_left = left.insert_left(20) left_right = left.insert_right(60) right_left = right.insert_left(70) right_right = right.insert_right(90) assert_false(root) end def assert_true(value) p binary_search_tree?(value) ? "Pass" : "Fail" end def assert_false(value) p binary_search_tree?(value) ? "Fail" : "Pass" end run_tests Interview Cake Tests | def run_tests
desc = 'valid full tree'
tree = BinaryTreeNode.new(50)
left = tree.insert_left(30)
right = tree.insert_right(70)
left.insert_left(10)
left.insert_right(40)
right.insert_left(60)
right.insert_right(80)
result = binary_search_tree?(tree)
assert_true(result, desc)
desc = 'both subtrees valid'
tree = BinaryTreeNode.new(50)
left = tree.insert_left(30)
right = tree.insert_right(80)
left.insert_left(20)
left.insert_right(60)
right.insert_left(70)
right.insert_right(90)
result = binary_search_tree?(tree)
assert_false(result, desc)
desc = 'descending linked list'
tree = BinaryTreeNode.new(50)
left = tree.insert_left(40)
left_left = left.insert_left(30)
left_left_left = left_left.insert_left(20)
left_left_left.insert_left(10)
result = binary_search_tree?(tree)
assert_true(result, desc)
desc = 'out of order linked list'
tree = BinaryTreeNode.new(50)
right = tree.insert_right(70)
right_right = right.insert_right(60)
right_right.insert_right(80)
result = binary_search_tree?(tree)
assert_false(result, desc)
desc = 'one node tree'
tree = BinaryTreeNode.new(50)
result = binary_search_tree?(tree)
assert_true(result, desc)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unit_test_binary_tree\n node_a = Node.new('A', nil, nil, nil)\n node_b = Node.new('B', nil, nil, nil)\n node_c = Node.new('C', nil, nil, nil)\n node_d = Node.new('D', nil, nil, nil)\n node_e = Node.new('E', nil, nil, nil)\n node_f = Node.new('F', nil, nil, nil)\n node_g = Node.new('G', nil, nil, nil)\n node_h = Node.new('H', nil, nil, nil)\n node_i = Node.new('I', nil, nil, nil)\n node_j = Node.new('J', nil, nil, nil)\n\n tree = Tree.new(nil)\n\n p \"-------------------- BEGIN CONSTRUCTING TREE -------------------- \"\n p \" F \"\n p \" // \\\\ \"\n p \" B G \"\n p \" // \\\\ \\\\ \"\n p \" A D I \"\n p \" // \\\\ // \"\n p \" C E H \"\n\n p \"-------------------- END CONSTRUCTING TREE -------------------- \"\n\n print \"\\n\"\n\n p \"-------------------- BEGIN INRODER TREE WALK -------------------- \"\n p inorder_tree_walk(tree.root)\n p \"-------------------- END INRODER TREE WALK -------------------- \"\n\n print \"\\n\"\n\n p \"-------------------- BEGIN PREORDER TREE WALK -------------------- \"\n p preoder_tree_walk(tree.root)\n p \"-------------------- END PREORDER TREE WALK -------------------- \"\n\n print \"\\n\"\n\n p \"-------------------- BEGIN POSTORDER TREE WALK -------------------- \"\n p postorder_tree_walk(tree.root)\n p \"-------------------- END PREORDER TREE WALK -------------------- \"\n\n print \"\\n\"\n\n p \"-------------------- BEGIN RECURSIVE TREE SEARCH -------------------- \"\n p tree_search(tree.root, 'I')\n p \"-------------------- END RECURSIVE TREE SEARCH -------------------- \"\n\n print \"\\n\"\n\n p \"-------------------- BEGIN ITERATIVE TREE SEARCH -------------------- \"\n p iterative_tree_search(tree.root, 'I')\n p \"-------------------- END ITERATIVETREE SEARCH -------------------- \"\n\n print \"\\n\"\n\n p \"-------------------- BEGIN SEARCHING FOR TREE MIN -------------------- \"\n p tree_minimum(tree.root)\n p \"-------------------- END SEARCHING FOR TREE MIN -------------------- \"\n\n print \"\\n\"\n\n p \"-------------------- BEGIN SEARCHING TREE MAX -------------------- \"\n p tree_maximum(tree.root)\n p \"-------------------- END SEARCHING TREE MAX -------------------- \"\n\n print \"\\n\"\n\n p \"-------------------- BEGIN SEARCHING FOR SUCCESSOR -------------------- \"\n p tree_successor(node_g)\n p \"-------------------- END SEARCHING FOR SUCCESSOR -------------------- \"\n\n print \"\\n\"\n\n p \"-------------------- BEGIN SEARCHING FOR PREDECESSOR -------------------- \"\n p tree_predecessor(node_g)\n p \"-------------------- END SEARCHING FOR PREDECESSOR -------------------- \"\n\n print \"\\n\"\n\n p \"-------------------- BEGIN NODE INSERTION -------------------- \"\n tree_insert(tree, node_j)\n p \" F \"\n p \" // \\\\ \"\n p \" B G \"\n p \" // \\\\ \\\\ \"\n p \" A D I \"\n p \" // \\\\ // \\\\ \"\n p \" C E H J \"\n p \"-------------------- END NODE INSERTION -------------------- \"\n\n print \"\\n\"\n\n p \"-------------------- BEGIN NODE DELETION (SUCCESSOR) -------------------- \"\n tree_delete(tree, node_d)\n p \" F \"\n p \" // \\\\ \"\n p \" B G \"\n p \" // \\\\ \\\\ \"\n p \" A E I \"\n p \" // // \\\\ \"\n p \" C H J \"\n p \"-------------------- END NODE DELETION (SUCCESSOR) -------------------- \"\n preoder_tree_walk(tree.root)\n\n print \"\\n\"\n\n p \"-------------------- BEGIN NODE DELETION (PREDECESSOR) -------------------- \"\n tree_delete_predecessor(tree, node_b)\n p \" F \"\n p \" // \\\\ \"\n p \" A G \"\n p \" \\\\ \\\\ \"\n p \" E I \"\n p \" // // \\\\ \"\n p \" C H J \"\n p \"-------------------- END NODE DELETION (PREDECESSOR) -------------------- \"\n preoder_tree_walk(tree.root)\n end",
"def test_add\n tree = BinTree.new\n #test empty\n assert tree.root == nil\n\n test_node = TreeNode.new(6)\n tree.add(test_node)\n #test one node added\n assert_equal(tree.root, test_node)\n\n test_node = TreeNode.new(4)\n tree.add(test_node)\n #test 2 nodes added\n assert_equal(test_node, tree.root.left)\n\n test_node = TreeNode.new(9)\n tree.add(test_node)\n #test 3 nodes added\n assert_equal(test_node, tree.root.right)\n\n test_node = TreeNode.new(-1)\n tree.add(test_node)\n #test 4 nodes added\n assert_equal(test_node, tree.root.left.left)\n end",
"def test_first_node_is_root_node\n tree = BinarySearchTree.new\n tree.insert(50, \"movie a\")\n assert_equal \"movie a\", tree.root.title\n end",
"def test_add_second_node_to_left\n tree = BinarySearchTree.new\n tree.insert(50, \"movie a\")\n movie_b = tree.insert(40, \"movie b\")\n assert tree.root.left_node\n end",
"def test_that_include_can_search\n tree = BinarySearchTree.new\n tree.insert(50, \"movie a\")\n movie_b = tree.insert(40, \"movie b\")\n assert tree.include?(40)\n end",
"def test_can_insert_node\n tree = BinarySearchTree.new\n tree.insert(61, \"Bill & Ted's Excellent Adventure\")\n\n assert_equal 61, tree.root.score\n assert_equal \"Bill & Ted's Excellent Adventure\", tree.root.title\n end",
"def test_add_second_node_to_right\n tree = BinarySearchTree.new\n tree.insert(50, \"movie a\")\n movie_b = tree.insert(60, \"movie b\")\n assert tree.root.right_node\n end",
"def test_tree_starts_empty\n tree = BinarySearchTree.new\n assert_nil tree.root\n end",
"def test_insert_root_node_returns_depth\n tree = BinarySearchTree.new\n tree.insert(50, \"movie a\")\n assert_equal 0, tree.root.depth\n end",
"def test_load_works\n tree = BinarySearchTree.new\n tree.load\n assert tree.root.left_node != nil\n assert tree.root.right_node != nil\n end",
"def test_that_include_can_search_more_cases\n tree = BinarySearchTree.new\n tree.insert(50, \"movie a\")\n tree.insert(24, \"movie b\")\n tree.insert(75, \"movie c\")\n tree.insert(34, \"movie d\")\n tree.insert(46, \"movie e\")\n tree.insert(68, \"movie f\")\n tree.insert(52, \"movie g\")\n tree.insert(65, \"movie h\")\n tree.insert(43, \"movie i\")\n assert tree.include?(52)\n end",
"def test_that_include_method_works\n tree = BinarySearchTree.new\n tree.insert(60, \"movie a\")\n assert tree.include?(60)\n end",
"def test_depth_of_root\n tree = BinarySearchTree.new\n tree.insert(13, \"Test1\")\n assert_equal tree.depth_of(13), 0\n end",
"def test_save_tree\n end",
"def test_root\n setup_test_tree\n\n # TODO: Should probably change this logic. Root's root should\n # return nil so that the possibility of a recursive error does not exist\n # at all.\n assert_same(@root , @root.root, \"Root's root is self\")\n assert_same(@root , @child1.root, \"Root should be ROOT\")\n assert_same(@root , @child4.root, \"Root should be ROOT\")\n assert_equal(2 , @root.node_height, \"Root's height after adding the children should be 2\")\n end",
"def test_add_third_node_to_left\n tree = BinarySearchTree.new\n tree.insert(50, \"movie a\")\n movie_b = tree.insert(40, \"movie b\")\n movie_c = tree.insert(30, \"movie c\")\n assert_equal 2, tree.root.left_node.left_node.depth\n end",
"def test_insert_adds_node_at_root\n @tree.insert(\"a\")\n assert_equal \"a\", @tree.root.value\n end",
"def test_lt2 # Test the << method\n @root << @child1\n @root << @child2\n @root << @child3 << @child4\n assert_not_nil(@root['Child1'], \"Child 1 should have been added to Root\")\n assert_not_nil(@root['Child2'], \"Child 2 should have been added to Root\")\n assert_not_nil(@root['Child3'], \"Child 3 should have been added to Root\")\n assert_not_nil(@child3['Child4'], \"Child 4 should have been added to Child3\")\n end",
"def test_return_method_truthy\n @tree.insert(\"a\")\n @tree.insert(\"c\")\n assert_equal true, @tree.includes?(\"c\")\n end",
"def test_return_sorted_array_two_nodes\n @tree.insert(\"b\")\n @tree.insert(\"a\")\n assert_equal [\"ab\"], @tree.sort\n end",
"def test_left_child\n @root << @left_child1\n @root << @right_child1\n assert_same(@left_child1, @root.left_child, \"The left child should be 'left_child1\")\n assert_not_same(@right_child1, @root.left_child, \"The right_child1 is not the left child\")\n end",
"def test_add_third_node_to_right\n tree = BinarySearchTree.new\n tree.insert(50, \"movie a\")\n movie_b = tree.insert(60, \"movie b\")\n movie_c = tree.insert(70, \"movie c\")\n assert_equal 2, tree.root.right_node.right_node.depth\n end",
"def test_root_setup\n assert_not_nil(@root , \"Root cannot be nil\")\n assert_nil(@root.parent , \"Parent of root node should be nil\")\n assert_not_nil(@root.name , \"Name should not be nil\")\n assert_equal(\"ROOT\" , @root.name, \"Name should be 'ROOT'\")\n assert_equal(\"Root Node\" , @root.content, \"Content should be 'Root Node'\")\n assert(@root.is_root? , \"Should identify as root\")\n assert([email protected]_children? , \"Cannot have any children\")\n assert(@root.has_content? , \"This root should have content\")\n assert_equal(1 , @root.size, \"Number of nodes should be one\")\n assert_equal(0, @root.siblings.length, \"This root does not have any children\")\n assert_equal(0, @root.in_degree, \"Root should have an in-degree of 0\")\n assert_equal(0, @root.node_height, \"Root's height before adding any children is 0\")\n assert_raise(ArgumentError) { Tree::TreeNode.new(nil) }\n end",
"def test_new_tree_empty_root\n assert_equal nil, @tree.root\n end",
"def test_initialize\n assert_not_nil(@root, \"Binary tree's Root should have been created\")\n assert_nil(@root.left_child, \"The initial left child of root should be nil\")\n assert_nil(@root.right_child, \"The initial right child of root should be nil\")\n assert_equal(@root.children.size, 0, \"Initially no children should be present\")\n end",
"def test_insert_second_node_returns_depth\n tree = BinarySearchTree.new\n tree.insert(50, \"movie a\")\n movie_b = tree.insert(40, \"movie b\")\n assert_equal 1, tree.root.left_node.depth\n end",
"def test_return_array_root_node\n @tree.insert(\"f\")\n assert_equal [\"f\"], @tree.sort\n end",
"def test_each_leaf\n setup_test_tree\n\n nodes = []\n @root.each_leaf { |node| nodes << node }\n\n assert_equal(3, nodes.length, \"Should have THREE LEAF NODES\")\n assert(!nodes.include?(@root), \"Should not have root\")\n assert(nodes.include?(@child1), \"Should have child 1\")\n assert(nodes.include?(@child2), \"Should have child 2\")\n assert(!nodes.include?(@child3), \"Should not have child 3\")\n assert(nodes.include?(@child4), \"Should have child 4\")\n end",
"def test_find\n setup_test_tree\n found_node = @root.find { |node| node == @child2}\n assert_same(@child2, found_node, \"The node should be Child 2\")\n\n found_node = @root.find { |node| node == @child4}\n assert_same(@child4, found_node, \"The node should be Child 4\")\n\n found_node = @root.find { |node| node.name == \"Child4\" }\n assert_same(@child4, found_node, \"The node should be Child 4\")\n found_node = @root.find { |node| node.name == \"NOT PRESENT\" }\n assert_nil(found_node, \"The node should not be found\")\n end",
"def test_is_leaf_eh\n setup_test_tree\n assert([email protected]_leaf?, \"Child 3 is not a leaf node\")\n assert(@child4.is_leaf?, \"Child 4 is a leaf node\")\n end"
]
| [
"0.7259953",
"0.70194036",
"0.68536365",
"0.68166846",
"0.6759323",
"0.6732959",
"0.67094165",
"0.6514451",
"0.65119976",
"0.65034074",
"0.6474655",
"0.64682364",
"0.6380666",
"0.6340369",
"0.63395727",
"0.6327768",
"0.6322519",
"0.6321463",
"0.62482226",
"0.6245848",
"0.62429816",
"0.6236956",
"0.62057704",
"0.6201678",
"0.6181197",
"0.61779803",
"0.6177973",
"0.61779237",
"0.617241",
"0.6144425"
]
| 0.83192563 | 0 |
=> Delete customer from db | def delete()
sql = "DELETE from customers WHERE id = $1"
values = [@id]
SqlRunner.run(sql, values)
# => Deleting customer record, nothing to return
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @customer.destroy\n end",
"def destroy\n @customer.destroy\n redirect_to customers_url\n end",
"def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n redirect_to(action: \"index\")\n end",
"def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n head :no_content\n end",
"def destroy\n begin\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: t('messages.deleted', model:Customer.model_name.human) }\n format.json { head :no_content }\n end\n rescue ActiveRecord::InvalidForeignKey => e\n flash[:error] = t 'errors.messages.delete_fail.being_used', model:@customer.name\n flash[:error_details] = e\n redirect_to [:admin, @customer]\n rescue ActiveRecord::StatementInvalid => e\n flash[:error] = t 'errors.messages.ops'\n flash[:error_details] = e\n redirect_to [:admin, @customer]\n end\n end",
"def destroy\n \n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to user_customers_url(current_user) }\n format.json do\n render json: {\n customer: @customer,\n status: :deleted\n }.to_json\n end\n end\n end",
"def destroy\n Customer.destroy params #[not sure what to put in the params]\n redirect_to customers_path\n end",
"def delete(params = {})\n req = WebPay::CustomerIdRequest.create(params)\n raw_response = @client._request(:delete, 'customers' + '/' + req.id.to_s, req)\n WebPay::CustomerResponse.new(raw_response)\n end",
"def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'Cliente eliminado exitosamente.' }\n end\n end",
"def customer_destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'データが削除されました。' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'データが削除されました。' }\n format.json { head :no_content }\n end\n end",
"def destroy\n if @customer.delete\n redirect_to customers_path, notice: \"O Clinte #{@customer.name} foi apagado!\"\n else\n render :index\n end\n\n end",
"def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to admin_customers_url, notice: 'Customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @customer = Customer.where(:id => params[:id], :company_id => current_user.company.id).first\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end",
"def delete\n authenticated('/account') do\n enforce_method! :POST\n assert_params :confirm, :custid\n if req.params[:confirm] && cust.custid == req.params[:custid]\n cust.destroy!\n res.delete_cookie :sess\n sess.destroy! :all\n @cust = Stella::Customer.anonymous\n @sess = Stella::Session.new\n Stella::Analytics.event \"Delete account\"\n res.redirect '/'\n else\n sess.add_info_message! \"Account was not deleted. You must click confirm.\"\n res.redirect '/account'\n end\n end\n end",
"def destroy\r\n @customer = Customer.find(params[:id])\r\n @customer.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to customers_url }\r\n format.json { head :ok }\r\n end\r\n end",
"def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @customer = @order.customer\n @order.destroy\n redirect_to @customer, notice: \"The order was successfully deleted.\"\n end",
"def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n find_customer\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to('/customers/overview') }\n format.xml { head :ok }\n end\n end",
"def destroy\n @customer = customer_scope.find(params[:id])\n\n redirect = current_company && company_customers_path(current_company) || customers_url\n begin\n @customer.destroy\n redirect_to redirect, notice: I18n.t('commons.successfully_deleted')\n rescue ActiveRecord::DeleteRestrictionError => e\n redirect_to redirect, notice: e.message\n rescue\n redirect_to redirect, alert: I18n.t('commons.cannot_delete')\n end\n\n end",
"def delete\n CONNECTION.execute(\"DELETE FROM users WHERE id = #{self.id};\")\n end",
"def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end"
]
| [
"0.8091326",
"0.7685374",
"0.7660621",
"0.7566509",
"0.7473403",
"0.7435382",
"0.73416096",
"0.73031926",
"0.72650564",
"0.72642577",
"0.7258824",
"0.7249436",
"0.7246636",
"0.71850663",
"0.7167352",
"0.7138773",
"0.7124898",
"0.7124898",
"0.71205467",
"0.7119648",
"0.71099895",
"0.7096365",
"0.7084933",
"0.7084862",
"0.7084862",
"0.7084862",
"0.7084862",
"0.7084862",
"0.7084862",
"0.7084862"
]
| 0.79741013 | 1 |
=> Display all the films a particular customer has bought ticket for | def films()
sql = "SELECT films.* FROM films INNER JOIN tickets ON tickets.film_id = films.id WHERE customer_id = $1"
values = [@id]
film_data = SqlRunner.run(sql, values)
return Film.map_items(film_data)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def customers_for_film()\n sql = \"SELECT name FROM customers\n INNER JOIN tickets ON customers.id = tickets.customer_id\n WHERE film_id = $1 ORDER BY name\"\n values = [@id]\n customer_data = SqlRunner.run(sql, values)\n return Customer.map_items(customer_data)\n end",
"def films()\n sql = \"SELECT films.* FROM films INNER JOIN tickets ON films.id = tickets.film_id WHERE tickets.cust_id = $1\"\n values = [@id]\n films = SqlRunner.run(sql, values)\n return films.map{|film| Film.new(film)}\n end",
"def find_films_for_each_customer()\n sql = \"SELECT films.*\n FROM films\n INNER JOIN tickets\n ON tickets.film_id = films.id\n WHERE customer_id = $1\"\n values = [@id]\n films = SqlRunner.run(sql, values)\n result = films.map {|film| Film.new(film)}\n return result\n end",
"def films()\n sql = \"SELECT films.* FROM films INNER JOIN tickets ON films.id = tickets.film_id WHERE tickets.customer_id = $1\"\n values = [@id]\n films = SqlRunner.run(sql, values)\n return films.map {|film| Film.new(film)}\n end",
"def booked_films()\n # sql\n sql = \"SELECT films.* FROM films INNER JOIN tickets ON films.id = tickets.film_id WHERE customer_id = $1;\"\n # values\n values = [@id]\n # sql runner\n results = SqlRunner.run(sql, \"get_all_booked_films\", values)\n # return\n return results.map {|film| Film.new(film)}\n end",
"def films()\n sql = \"SELECT films.* FROM films INNER JOIN tickets ON\n films.id = tickets.film_id WHERE tickets.customer_id = $1;\"\n values = [@id]\n films = SqlRunner.run(sql, values)\n result = Film.map_films(films)\n end",
"def films()\n sql = \"SELECT films.* FROM films INNER JOIN tickets ON films.id = tickets.film_id WHERE tickets.customer_id = $1;\"\n values = [@id]\n films = SqlRunner.run(sql, values)\n return films.map{|film| Film.new(film)}\n end",
"def films()\n sql = \"SELECT films.* FROM films\n INNER JOIN tickets ON tickets.film_id = films.id\n WHERE tickets.customer_id = $1\"\n values = [@id]\n film_array = SqlRunner.run(sql, values)\n result = film_array.map { |film| Film.new( film ) }\n return result\n end",
"def films()\n sql = \"SELECT films.* FROM films INNER JOIN tickets ON films.id = tickets.film_id WHERE tickets.customer_id = $1\"\n values = [@id]\n films_array = SqlRunner.run(sql, values)\n films = films_array.map { |film_hash| Film.new(film_hash)}\n return films\n end",
"def films\n sql = \"SELECT films.*\n FROM films\n INNER JOIN tickets\n ON films.id = tickets.film_id\n WHERE tickets.customer_id = $1\"\n values = [@id]\n SqlRunner.run(sql, values).map { |film_hash| Film.new(film_hash) }\n end",
"def show_customers\n sql = \"SELECT customers.* FROM films INNER JOIN screenings ON films.id = screenings.film_id INNER JOIN tickets ON screenings.id = tickets.screening_id INNER JOIN customers on tickets.customer_id = customers.id WHERE films.id = $1\"\n values = [@id]\n result = SqlRunner.run(sql, values)\n return result.map {|customer| Customer.new(customer)}\n end",
"def films()\n sql = \"SELECT DISTINCT films.* FROM films\n INNER JOIN screenings ON films.id = screenings.film_id\n INNER JOIN tickets ON screenings.id = tickets.screening_id\n WHERE tickets.customer_id = $1;\"\n values = [@id]\n films_array = SqlRunner.run(sql, values)\n return Film.map_to_objects(films_array)\n end",
"def show_films\n sql = \"SELECT films.* FROM films INNER JOIN screenings ON screenings.film_id = films.id INNER JOIN tickets on screenings.id = tickets.screening_id INNER JOIN customers on customers.id = tickets.customer_id WHERE customers.id = $1\"\n values = [@id]\n result = SqlRunner.run(sql, values)\n return result.map {|film| Film.new(film)}\n end",
"def customers\n sql = \"SELECT customers.* FROM customers INNER JOIN tickets ON tickets.customer_id = customers.id WHERE tickets.film_id = #{@id};\"\n return Customer.map_items(sql) \n end",
"def films()\n sql = \"\n SELECT films.* FROM films\n INNER JOIN tickets ON tickets.film_id =\n films.id WHERE customer_id = $1\n \"\n values = [@id]\n result = SqlRunner.run(sql, values)\n\n return nil if result.count == 0\n return result.map {|film| Film.new(film)}\n end",
"def films_customer_sees()\n sql = \"SELECT * FROM films INNER JOIN tickets\n ON films.id = tickets.film_id WHERE customer_id = $1\"\n values = [@id]\n films = SqlRunner.run(sql, values)\n result = films.map {|film_hash| Film.new(film_hash)}\n return result\nend",
"def customers()\n sql = \"SELECT customers.* FROM customers INNER JOIN tickets ON customers.id = tickets.customer_id WHERE film_id = $1\"\n values = [@id]\n customer_data = SqlRunner.run(sql, values)\n return Customer.map_items(customer_data)\n end",
"def tickets()\n return films().count()\n end",
"def customers()\n sql = \"SELECT customers.*\n FROM customers\n INNER JOIN tickets\n ON customers.id = tickets.customer_id\n WHERE film_id = $1\"\n values = [@id]\n star_data = SqlRunner.run(sql, values)\n return Star.map_items(star_data)\n end",
"def all_customers() # RETURN film1.all_customers (returns all customers attending that film)\n sql = \"SELECT customers.* FROM customers INNER JOIN tickets ON customers.id = tickets.customer_id\n WHERE tickets.film_id = $1\"\n values = [@id]\n customers = SqlRunner.run(sql, values)\n result = customers.map { |customer| Customer.new(customer) }\n return result\n end",
"def booked_films()\n sql = \"SELECT films.* FROM films\n INNER JOIN screenings\n\t ON films.id = screenings.film_id\n INNER JOIN tickets\n ON screenings.id = tickets.screening_id\n WHERE tickets.customer_id = $1\n ORDER BY films.id;\"\n values = [@id]\n result = SqlRunner.run(sql, values) # array of hashes.\n booked_films = result.map { |film| Film.new(film) }\n return booked_films.uniq # no duplicates.\n end",
"def customers()\n sql = \"SELECT customers.* FROM customers INNER JOIN tickets ON customers.id = tickets.cust_id WHERE tickets.film_id = $1\"\n values = [@id]\n customers = SqlRunner.run(sql, values)\n return customers.map{|cust| Customer.new(cust)}\n end",
"def tickets_bought()\n tickets_array = films()\n number_of_tickets = tickets_array.count\n return \"#{@name} has bought #{number_of_tickets} tickets.\"\n end",
"def customers()\n sql = \"SELECT customers.* FROM customers INNER JOIN tickets ON customers.id = tickets.customer_id INNER JOIN screenings ON screenings.id = tickets.screening_id INNER JOIN films ON films.id = screenings.film_id WHERE tickets.customer_id = $1\"\n values = [@id]\n customers = SqlRunner.run(sql, values)\n return Customer.map_customers(customers)\n end",
"def buy()\n #films the customer has tickets to\n all_films = films()\n #sum the films (as there can be more than one) and from each film add the price up and assign it to price\n price = all_films.sum{|film| film.price}\n remaining_funds = @funds - price\n @funds = remaining_funds\n update() #update the customer's funds!\n end",
"def films\n sql = \"SELECT films.* FROM films\n INNER JOIN tickets\n ON tickets.film_id = films.id\n WHERE tickets.customer_id = $1\"\n values = [@id]\n films = SqlRunner.run(sql, values)\n return films.map{|film| Film.new(film)}\nend",
"def how_many_films()\n sql = \"SELECT films.* FROM films INNER JOIN tickets ON\n films.id = tickets.film_id WHERE tickets.customer_id = $1;\"\n values = [@id]\n films = SqlRunner.run(sql, values)\n result = Film.map_films(films).count\n end",
"def count_tickets()\n sql = \"SELECT films.* FROM films\n INNER JOIN tickets ON\n tickets.film_id = films.id\n WHERE customer_id = $1\"\n values = [@id]\n films = SqlRunner.run(sql, values)\n result = films.map{|film| Film.new(film)}\n return result.count\n end",
"def customer()\n sql = \"SELECT customers.* from customers INNER JOIN tickets on\n customers.id = tickets.customer_id WHERE film_id = $1 \"\n values = [@id]\n results = SqlRunner.run(sql, values)\n results.map {|result| Customer.new(result)}\n end",
"def all_tickets()\n sql = \"SELECT customers.name, films.title, tickets.id\n FROM tickets\n INNER JOIN customers\n ON tickets.customer_id = customers.id\n INNER JOIN screenings\n ON tickets.screening_id = screenings.id\n INNER JOIN films\n ON screenings.film_id = films.id\n WHERE customers.id = $1\"\n values = [@id]\n result = Sqlrunner.run(sql, values)\n return result.each {|info| p info}\n end"
]
| [
"0.70514375",
"0.69678015",
"0.69102687",
"0.68326306",
"0.6825748",
"0.68093425",
"0.67934924",
"0.6775241",
"0.66688496",
"0.6593604",
"0.65885574",
"0.6540881",
"0.6534333",
"0.65192235",
"0.649704",
"0.6430018",
"0.6391056",
"0.6298964",
"0.62578",
"0.62064695",
"0.6146085",
"0.6084062",
"0.60599726",
"0.6045989",
"0.60372484",
"0.599021",
"0.59807324",
"0.5968374",
"0.5961908",
"0.5945128"
]
| 0.71264905 | 0 |
Given an account type, set the account_params_key. | def account_params_key
@account_params_key ||= Account.config.account_type_to_param(account_type)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_account_type\n @account_type = AccountType.find(params[:id])\n end",
"def accounttype_params\n params.require(:accounttype).permit(:name, :description, :key)\n end",
"def register_account_type_params\n if params[:account][:account_type]\n params.require(:account).require(:account_type).permit(AccountType.attribute_list)\n else\n {}\n end\n end",
"def set_accounttype\n @accounttype = Accounttype.find(params[:id])\n end",
"def set_account_type(account_type = nil, reset = false)\n self.roles = nil if reset\n unless account_type.blank?\n self.roles << account_type.to_sym\n self.setup << :account_type\n end\n end",
"def set_account_type\n @account_type = account.class.to_s\n end",
"def update!(**args)\n @account_type = args[:account_type] if args.key?(:account_type)\n end",
"def account_type_params\n params.require(:account_type).permit(:name, :description, :max_expiry)\n end",
"def set_account_id\n params[:account_id] = params[:id]\n end",
"def set_params\n params[:user] = params[:account]\n end",
"def register_account_params\n account_type_params = register_account_type_params\n\n # Allow for taxes\n permitted = Account.attribute_list.map { |attr| (attr == :taxes ? { taxes: [] } : attr) }\n\n parameter_types = %w[current_user account_type company]\n # current user is processed separately so reject it\n account_params = params.require(:account).reject do |param|\n parameter_types.include?(param)\n end.permit(permitted)\n account_params.merge(account_type_params)\n end",
"def account_params\n params.require(:account).permit(:name, :account_type)\n end",
"def set_platform_account_type\n @platform_account_type = PlatformAccountType.find(params[:id])\n end",
"def account_type_to_param(account_type)\n account_type.to_s.underscore.tr(\"/\", \"_\")\n end",
"def set_address type, key, params={}\n opts = {:single_quoted => false}\n params = {\n :query => {\n \"ClientToken\" => self.token,\n \"AddressType\" => Type::String.safe_value(type, opts),\n \"VoterKey\" => Type::String.safe_value(key, opts),\n \"AddressLine1\" => Type::String.safe_value(params[:address_1], opts),\n \"AddressLine2\" => Type::String.safe_value(params[:address_2], opts),\n \"AddressCity\" => Type::String.safe_value(params[:city], opts),\n \"AddressState\" => Type::String.safe_value(params[:state], opts),\n \"AddressZip5\" => Type::String.safe_value(params[:zip5], opts),\n \"AddressZip4\" => Type::String.safe_value(params[:zip4], opts)\n }\n }\n\n put 'set_address.php', params\n end",
"def account_type=(account_type)\n validator = EnumAttributeValidator.new('String', [\"C\", \"S\"])\n unless validator.valid?(account_type)\n fail ArgumentError, \"invalid value for \\\"account_type\\\", must be one of #{validator.allowable_values}.\"\n end\n @account_type = account_type\n end",
"def set_account_data(type, account_data)\n client.api.set_room_account_data(client.mxid, id, type, account_data)\n true\n end",
"def platform_account_type_params\n params.require(:platform_account_type).permit(:name, :platform_id, :endpoint, :schema, :field_mapping)\n end",
"def set_acct_type\n @acct_type = AcctType.find(params[:id])\n end",
"def account_type=(type)\n case type\n when TEMP_DUPLICATE\n @account_type = 'duplicate'\n when NORMAL\n @account_type = 'normal'\n when INTERDOMAIN_TRUST\n @account_type = 'interdomain_trust'\n when WORKSTATION_TRUST\n @account_type = 'workstation_trust'\n when SERVER_TRUST\n @account_type = 'server_trust'\n else\n @account_type = 'unknown'\n end\n end",
"def account_type=(account_type)\n validator = EnumAttributeValidator.new('String', [\"company\", \"individual\"])\n unless validator.valid?(account_type)\n fail ArgumentError, \"invalid value for \\\"account_type\\\", must be one of #{validator.allowable_values}.\"\n end\n @account_type = account_type\n end",
"def acct_type_params\n params[:acct_type]\n end",
"def account_params\n params.require(:account).permit(:acctNumber, :balance, :acctType)\n end",
"def account_params\n params.require(:account).permit(:user_id, :name, :account_type, :amount)\n end",
"def admin_account_type_params\n params.require(:admin_account_type).permit(:name, :space, :price)\n end",
"def ledger_account_params\n params.require(:ledger_account).permit(:account_type, :ledger_id, :account_id)\n end",
"def account_params\n params.require(:account).permit(:account_number, :user_id, :type_account, :tenure_in_years, :tenure_in_months, :tenure_in_days, :maturity_proceeds)\n end",
"def account_params\n params.require(:account).permit( :accountnumber, :user_id, :balance, :account_type )\n end",
"def set_account\n @account = Account.find(params[:account_id])\n end",
"def set_admin_account_type\n @admin_account_type = AccountType.find(params[:id])\n end"
]
| [
"0.7022764",
"0.69546366",
"0.6658146",
"0.66553295",
"0.66403574",
"0.6585411",
"0.65810865",
"0.6462391",
"0.64344263",
"0.6424918",
"0.64217556",
"0.6405559",
"0.6390779",
"0.6322264",
"0.6296023",
"0.6167764",
"0.615584",
"0.6148411",
"0.6143317",
"0.6137606",
"0.6114785",
"0.6099509",
"0.60803175",
"0.6067513",
"0.60613257",
"0.6050938",
"0.601245",
"0.6002713",
"0.5985997",
"0.5937516"
]
| 0.76216143 | 0 |
Applies strong_param rules to the passed in params based on the current `action`. Assumes params are guarenteed to be an instantiated `ActionController::Parameters` object. Silently returns an empty params hash if the `account_params_key` is missing. | def account_params
return ActionController::Parameters.new unless params.key?(account_params_key)
permitted = send("account_params_for_#{action}")
params.require(account_params_key).permit(*permitted)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def account_params\n @account_params ||= params.require(:account).except(:user)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def ensure_redirected_params_are_safe!(passed_params)\n unless passed_params.is_a?(ActionController::Parameters) && passed_params.permitted?\n error_message = if passed_params.is_a?(ActionController::Parameters)\n unsafe_parameters = passed_params.send(:unpermitted_keys, params)\n \"[Rails::Prg] Error - Must use permitted strong parameters. Unsafe: #{unsafe_parameters.join(', ')}\"\n else\n \"[Rails::Prg] Error - Must pass strong parameters.\"\n end\n raise error_message\n end\n end",
"def account_params\n params.fetch(:account, {})\n end",
"def account_params_for_update\n self.class.common_permitted_account_params.dup\n end",
"def strengthen_params!(method_name)\n permitting_model_name = self.class.instance_variable_defined?(:@permitting_model_name) && self.class.instance_variable_get(:@permitting_model_name)\n target_model_name = (permitting_model_name || self.class.name.sub(/.+::/, '').sub(/Controller$/, '')).singularize.underscore.tr('/', '_').to_sym\n permitted_attributes = self.class.instance_variable_defined?(:@permitted_attributes) && self.class.instance_variable_get(:@permitted_attributes)\n\n method_parameters = method(method_name).parameters\n method_parameters.each do |type, key|\n trimmed_key = key.to_s.sub(/_params\\z/, '').to_sym\n if (trimmed_key == target_model_name) && permitted_attributes\n params.require(trimmed_key) if %i[req keyreq].include?(type)\n params[trimmed_key] = params[trimmed_key].try :permit, *permitted_attributes if params.key? trimmed_key\n end\n end\n end",
"def account_params\n params.require(:account).permit!\n end",
"def allow_params(action, keys: nil, except: nil, &blk)\n keys &&= Array.wrap(keys)\n keys ||= User.field_names\n except &&= Array.wrap(except)\n except ||= %i[id email]\n devise_parameter_sanitizer.permit(action, keys: keys, except: except, &blk)\n end",
"def permitted_params_for(action)\n send(\"permitted_#{action}_params\")\n end",
"def kakao_account_params\n params.fetch(:kakao_account, {})\n end",
"def sanitize_params(params = params)\n params = walk_hash(params) if params\n end",
"def account_params\n params.require(:account).permit!\n end",
"def sanitize_params(params = params)\n params = walk_hash(params) if params\n end",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def permit_all_params options = {}\n prepend_before_filter do\n self.params.deep_permit!\n end\n end",
"def account_params\n account = if request.format.ref === :json\n ActionController::Parameters.new(JSON.parse(request.body.read))\n else\n params.require(:account)\n end\n account.permit(:type, :sub_type, :merchant, :change, :currency, :comments, :datetime)\n end",
"def configure_update_params\n allow_params(:account_update)\n end",
"def permit_params_on_update *keys\n filter_strong_params :permit, [:update], keys\n end",
"def user_account_params\n params.fetch(:user_account, {})\n end",
"def update_params!(params)\n @params.update(_deep_dup(params))\n @inherited_params.update(@params.delete(:inherited) || {})\n\n # Note: self.class.default_params is NOT to be merged in @child_params\n @child_params = @inherited_params.merge(@params)\n self.class.special_params.each { |name| @child_params.delete(name) }\n\n self.class.required_params.each do |rp|\n raise \"Required param is missing: #{rp}\" unless @pmerger.param?(rp)\n end\n end",
"def account_params\n params_syms = %I[\n id\n first_name\n last_name email\n phone_number\n address1\n address2\n city\n state\n zip\n ]\n\n params.require(:account).permit(*params_syms).reject{ |_, v| v.blank? }\n end",
"def campaign_banner_params(action=:update)\n required = params.require(:campaign_banner)\n permitted = (action == :create ? [:banner_id, :weight] : [:weight])\n required.permit(permitted).merge(campaign_id: @campaign.id)\n end",
"def apply_params\n if current_user.rol == \"company\"\n params.require(:apply).permit(:status, :highlight)\n elsif current_user.rol == \"candidate\"\n params.require(:apply).permit(:job_advert_id)\n end\n end",
"def blacklight_params\n params = super\n\n # This method needs to be idempotent.\n if params[\"processed\"]\n params\n else\n process_params!(params, params_process_chain)\n end\n end",
"def secure_params\n return @secure_params if @secure_params\n\n @implementation_class = implementation_class\n resname = @implementation_class.name.ns_underscore.gsub('__', '_').singularize.to_sym\n @secure_params = params.require(resname).permit(*permitted_params)\n end",
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def validate_and_coerce_params(action, params)\n actions[action].validate_and_coerce(params)\n end",
"def account_params\n params[:account]\n end",
"def wallet_action_params\n params.require(:wallet_action).permit(:wallet_id, :action_type, :amount)\n end",
"def require_params *keys\n filter_strong_params :require, [:create, :update], keys\n end"
]
| [
"0.6255454",
"0.6014911",
"0.5959547",
"0.5919349",
"0.59032226",
"0.5898747",
"0.58598787",
"0.57777226",
"0.5776317",
"0.57508504",
"0.57365084",
"0.5727238",
"0.57134247",
"0.5712519",
"0.56805354",
"0.5678277",
"0.56631446",
"0.56222606",
"0.5593027",
"0.5592583",
"0.55910254",
"0.55900156",
"0.55828017",
"0.55828017",
"0.5573229",
"0.5572944",
"0.5571351",
"0.5557735",
"0.5556945",
"0.5521292"
]
| 0.74400306 | 0 |
Simply assigns the strong_params to the account new/persisted account object. | def assign_params
account.assign_attributes(account_params)
account
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def account_params\n params.fetch(:account, {}).permit(:current_password, :password, :password_confirmation)\n end",
"def create( params )\n params.delete( :id ) # Prevent overwriting ID\n Account.new( params ).save\n end",
"def account_params\n params.require(:account).permit!\n end",
"def account_params\n params.require(:account).permit(:account_id, :name, :available_balance, :current_balance, :account_type, :account_subtype, :user_id)\n end",
"def account_params\n params.require(:account).permit!\n end",
"def account_new_params\n params.require(:account).permit(:id, :givenname, :tech, :admin, :email)\n end",
"def new_account_params\n params.require(:account).permit(:mg_account_name,:description,:is_deleted,:mg_school_id,:created_by,:updated_by,:mg_school_id)\n end",
"def account_params\n params.require(:account).permit(:acctNumber, :balance, :acctType)\n end",
"def account_params\n params.require(:account).permit(:balance, :account_number,\n :cvv, :expiry_date, :currency, :user_id)\n end",
"def account_params\n params.require(:account).permit(:kind, :name, :initial_balance, :current_balance, :description, :user_id)\n end",
"def account_params\n params.require(:account).permit(:email, :password, :current_password)\n end",
"def account_params\n params.require(:account).permit(:user_id, :useable_balance, :balance, :frozen_balance, :total_estate)\n end",
"def account_params\n params.require(:account).permit(:name, :note, :balance, :account_type_id)\n end",
"def account_params\n # params.fetch(:account, {})\n params.require(:account).permit(:first_name, :last_name, :address, :phone,:email)\n end",
"def account_params\n params.require(:account).permit(:acc_no, :balance, :state)\n end",
"def assign_account(account_id)\n self.account_id = account_id\n end",
"def account_params\n params.require(:account).permit( :accountnumber, :user_id, :balance, :account_type )\n end",
"def account_params\n params.require(:account).permit(:bank_id, :account_number, :account_type,:email, :user_created_id, :user_updated_id, :status )\n end",
"def account_params\n params.fetch(:account, {}).permit(:email, :first_name, :last_name, :business_name, :phone, :gatorlink_id, :ufid, :chartfield, :affiliation, :account_type, :expires_at, :uf_college, :credit)\n end",
"def account_params\n params.require(:account).permit(:user_id, :name, :account_type, :amount)\n end",
"def account_params\n params.require(:account).permit(:name, :city, :country, :postal_code, :state, :telephone, :brewery_type, :has_pub, :user_id)\n end",
"def set_params\n params[:user] = params[:account]\n end",
"def account_params\n params.require(:account).permit(:name, :initial_value, :active)\n end",
"def account_params\n params.require(:account).permit(:app_id, :customer_id, :account_no)\n end",
"def account_params\n params.require(:account).permit(:balance, :user_id)\n end",
"def account_params\n params.require(:account).permit(:acc_number, :user_id, :is_closed, :balance)\n end",
"def account_params\n params.require(:account).permit(:account_name, :account_number, :sru, :company_id)\n end",
"def user_account_params\n merged_params = { user_id: @user.id }\n params.require(:user_account).permit(:country_id, :account_id, :currency_id, :category, :name,\n :active).merge(merged_params)\n end",
"def account_params\n params.permit(:account_id)\n end",
"def account_params\n params.require(:account).permit(:email, :encrypted_password, :salt, :last_sync_at)\n end"
]
| [
"0.6963002",
"0.6961664",
"0.69106436",
"0.6848165",
"0.6837659",
"0.67944485",
"0.6761268",
"0.6687412",
"0.6679951",
"0.6677307",
"0.667075",
"0.6654123",
"0.6640671",
"0.6635405",
"0.66181237",
"0.6611523",
"0.6599604",
"0.65879446",
"0.65874106",
"0.65801793",
"0.6571076",
"0.6558488",
"0.655509",
"0.6553025",
"0.65520346",
"0.6548431",
"0.6522311",
"0.65201205",
"0.6474818",
"0.64725834"
]
| 0.7993425 | 0 |
Sets the `action` which is used to load the proper set of account_params. The action should always get set before `account_params` is called. | def set_action(action)
@action = action
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def action=(action)\n validator = EnumAttributeValidator.new('String', [\"None\", \"GeneratePreSignedUploadUrl\", \"GeneratePreSignedDownloadUrl\", \"CompleteImportProcess\", \"MarkImportFailed\", \"PreCache\", \"Cancel\", \"Extract\", \"Evict\"])\n unless validator.valid?(action)\n fail ArgumentError, \"invalid value for \\\"action\\\", must be one of #{validator.allowable_values}.\"\n end\n @action = action\n end",
"def action=(action)\n allowed_values = [\"Create\", \"View\", \"Update\", \"Delete\", \"Download\", \"MemberAdd\", \"MemberUpdate\", \"MemberRemove\", \"Read\", \"ApplyProtection\", \"RevokeProtection\", \"UpdateRetention\", \"ReadAll\", \"Execute\", \"Publish\", \"Unpublish\", \"Enable\", \"Disable\", \"Authorize\", \"Deauthorize\", \"Authenticate\", \"ChangePassword\"]\n if action && !allowed_values.include?(action)\n fail ArgumentError, \"invalid value for 'action', must be one of #{allowed_values}.\"\n end\n @action = action\n end",
"def set_action(action)\n return unless action\n\n @action = action\n @ext.set_action(action)\n end",
"def setAction(action)\n @action = action\n end",
"def wallet_action_params\n params.require(:wallet_action).permit(:wallet_id, :action_type, :amount)\n end",
"def action=(action)\n allowed_values = [\"DELETE\", \"EXPORT\"]\n if action && !allowed_values.include?(action)\n fail ArgumentError, \"invalid value for 'action', must be one of #{allowed_values}.\"\n end\n @action = action\n end",
"def my_action_params\n params.require(:my_action).permit(:name, :url, :active, :provider_id)\n end",
"def action\n @params['action'] || @params[:action]\n end",
"def action=(action)\n validator = EnumAttributeValidator.new('String', [\"Accept\", \"Active\", \"AwaitingPayment\", \"AwaitingRefund\", \"Cancelled\", \"Completed\", \"Created\", \"Error\", \"Expiring\", \"Expired\", \"Failed\", \"Migrated\", \"NeedsAmendments\", \"Paid\", \"Pending\", \"Provisioned\", \"Refunded\", \"Reject\", \"Trial\", \"Unknown\", \"Unpaid\", \"Updated\", \"Voided\", \"PaymentFailed\"])\n unless validator.valid?(action)\n fail ArgumentError, \"invalid value for 'action', must be one of #{validator.allowable_values}.\"\n end\n @action = action\n end",
"def set_accounting_action\n @accounting_action = AccountingAction.find(params[:id])\n end",
"def account_params\n return ActionController::Parameters.new unless params.key?(account_params_key)\n permitted = send(\"account_params_for_#{action}\")\n params.require(account_params_key).permit(*permitted)\n end",
"def set_wallet_action\n @wallet_action = WalletAction.find(params[:id])\n end",
"def initialize(action:, action_params:)\n @action = action\n @action_params = action_params\n end",
"def setAction(action)\n unless /(?i)^(join|shuffle|extract|delete)$/.match(action)\n raise Error.new(Pdfcrowd.create_invalid_value_message(action, \"setAction\", \"pdf-to-pdf\", \"Allowed values are join, shuffle, extract, delete.\", \"set_action\"), 470);\n end\n \n @fields['action'] = action\n self\n end",
"def action=(action)\n if !VALID_ACTIONS.include?(action.to_s.upcase)\n raise ArgumentError, \"Action must be one of #{VALID_ACTIONS.join(', ')}\"\n end\n @action = action.downcase.to_sym\n end",
"def set_action\n @action = Action.find(params[:id])\n end",
"def set_action(action)\n return if !active? ||\n Appsignal::Transaction.current.nil? ||\n action.nil?\n Appsignal::Transaction.current.set_action(action)\n end",
"def set_failsafe_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def set_action_if_nil(action)\n return if @action\n\n set_action(action)\n end",
"def get(action)\n PARAMS.fetch(action, [])\n end",
"def _init_action(action_hash)\n obj = _load_asset(ASSET_TYPE_ACTION, action_hash[:name])\n obj.parameters = action_hash[:parameters]\n obj\n end",
"def action_params\n params.require(:action).permit(:name, :status, :user_id)\n end",
"def action\n self.params[:action]\n end",
"def send_action(action, params={})\n set_params Hash[action: action].merge params\n @response = http_send_action\n end",
"def set_params\n params[:user] = params[:account]\n end",
"def fill_controller_action_attributes\n return if controller_action.blank?\n route = controller_action.split('#')\n self.controller, self.action = route.first, route.last\n end",
"def reward_action_params\n params.fetch(:reward_action, {})\n end",
"def user_action_params\n Rails.logger.info(\"params: #{params}\")\n params.require(:user_action).permit([:description,:action_type,:action_subtype,:flyer_id,:user_id,:data])\n end",
"def initialize(params_hash)\n super\n @type_name = 'action'\n end"
]
| [
"0.6679395",
"0.65982026",
"0.6566531",
"0.6449901",
"0.6434612",
"0.62735105",
"0.62001806",
"0.6197067",
"0.61663985",
"0.6137422",
"0.61278105",
"0.61094934",
"0.6081423",
"0.60546964",
"0.60503405",
"0.5999909",
"0.5964624",
"0.59615743",
"0.5939661",
"0.5900196",
"0.58879346",
"0.58141726",
"0.5791049",
"0.57497877",
"0.57472396",
"0.57262015",
"0.57225555",
"0.5687155",
"0.5687105",
"0.5678918"
]
| 0.66290647 | 1 |
Given an account, set the account_type. Only used for `update`. | def set_account_type
@account_type = account.class.to_s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def account_type=(account_type)\n validator = EnumAttributeValidator.new('String', [\"C\", \"S\"])\n unless validator.valid?(account_type)\n fail ArgumentError, \"invalid value for \\\"account_type\\\", must be one of #{validator.allowable_values}.\"\n end\n @account_type = account_type\n end",
"def set_account_type(account_type = nil, reset = false)\n self.roles = nil if reset\n unless account_type.blank?\n self.roles << account_type.to_sym\n self.setup << :account_type\n end\n end",
"def set_account_type\n @account_type = AccountType.find(params[:id])\n end",
"def account_type=(account_type)\n validator = EnumAttributeValidator.new('String', [\"company\", \"individual\"])\n unless validator.valid?(account_type)\n fail ArgumentError, \"invalid value for \\\"account_type\\\", must be one of #{validator.allowable_values}.\"\n end\n @account_type = account_type\n end",
"def update!(**args)\n @account_type = args[:account_type] if args.key?(:account_type)\n end",
"def account_type=(type)\n case type\n when TEMP_DUPLICATE\n @account_type = 'duplicate'\n when NORMAL\n @account_type = 'normal'\n when INTERDOMAIN_TRUST\n @account_type = 'interdomain_trust'\n when WORKSTATION_TRUST\n @account_type = 'workstation_trust'\n when SERVER_TRUST\n @account_type = 'server_trust'\n else\n @account_type = 'unknown'\n end\n end",
"def set_accounttype\n @accounttype = Accounttype.find(params[:id])\n end",
"def set_account_data(type, account_data)\n client.api.set_room_account_data(client.mxid, id, type, account_data)\n true\n end",
"def set_acct_type\n @acct_type = AcctType.find(params[:id])\n end",
"def account=(account)\n @account = account ? Struct::Account.new(account) : account\n end",
"def bank_account_type=(bank_account_type)\n validator = EnumAttributeValidator.new('String', ['Checking', 'Savings'])\n unless validator.valid?(bank_account_type)\n fail ArgumentError, 'invalid value for \"bank_account_type\", must be one of #{validator.allowable_values}.'\n end\n @bank_account_type = bank_account_type\n end",
"def set_platform_account_type\n @platform_account_type = PlatformAccountType.find(params[:id])\n end",
"def setaccount(bitcoinaddress, account)\n @api.request 'setaccount', bitcoinaddress, account\n end",
"def account_type(account_type_id)\n result = nil\n public_connection(HTTP_GET, \"/api/accounts/#{account_type_id}.xml\") do |xml|\n result = AccountType.new xml\n end\n result\n end",
"def account=(value)\n @account = value\n end",
"def set_admin_account_type\n @admin_account_type = AccountType.find(params[:id])\n end",
"def account_type_code\n self.class.account_types[account_type]\n end",
"def set_account\n @account = current_user.accounts.find(current_account.id)\n end",
"def set_account\n @account = current_user.accounts.find(current_account.id)\n end",
"def change_account(new_account)\n @current_account = new_account\n end",
"def setaccount(namecoin_address, account)\n request :setaccount, namecoin_address, account\n end",
"def set_account\n @account = Account.find(params[:account_id])\n end",
"def setaccount(coinaddress, account)\n coind.setaccount coinaddress, account\n end",
"def account_type\n self.class.account_type\n end",
"def account_type_code\n self.class.account_types[account_type]\n end",
"def account=(val)\n @account = val\n @base.accountRef = val.ref\n end",
"def set_account\n @account = current_user\n end",
"def update(organisation_id, account_number, name, classification, type, tax, currency, options = {})\n body = options.has_key?(:body) ? options[:body] : {}\n body[:organisation_id] = organisation_id\n body[:account_number] = account_number\n body[:name] = name\n body[:classification] = classification\n body[:type] = type\n body[:tax] = tax\n body[:currency] = currency\n\n response = @client.post \"/core.account/update/#{@account_id}\", body, options\n\n return response\n end",
"def set_bank_account_type_setting\n @bank_account_type_setting = BankAccountTypeSetting.find(params[:id])\n end",
"def assign_account(account_id)\n self.account_id = account_id\n end"
]
| [
"0.7769743",
"0.7734451",
"0.77227294",
"0.7722503",
"0.7311412",
"0.70600116",
"0.7044634",
"0.690822",
"0.6901016",
"0.6747927",
"0.66774553",
"0.6595702",
"0.65805143",
"0.64787865",
"0.6453682",
"0.6411728",
"0.6408398",
"0.6379682",
"0.6379682",
"0.63513744",
"0.62595695",
"0.6234089",
"0.6228081",
"0.61977965",
"0.61877805",
"0.61651975",
"0.60753566",
"0.60622704",
"0.606019",
"0.6028034"
]
| 0.8263673 | 0 |
Build the owner account_user. Only used for `build`. | def build_account_users
account.account_users.build(
user_id: owner_user.id,
user_role: "Owner",
created_by: current_user.id,
)
account
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_user(attributes = {}, options = {})\n @provider_user.build_record(attributes, options)\n end",
"def owner\n @owner ||= User.new(connection, :login => @attributes[:owner])\n end",
"def make_owner(user, org)\n associate_in_groups(user, org, [\"admins\", \"billing-admins\", \"users\"])\n end",
"def owner\n build_object attributes['owner'], default_class: Role\n end",
"def owner\n {owner_id: self.object.user.id, \n owner_account: self.object.user.email}\n end",
"def owner=(attributes)\n @owner = User.new(attributes)\n end",
"def owner=(attributes)\n @owner = User.new(attributes)\n end",
"def create\n @user = User.new(params[:user])\n owner = @user.build_owner(params[:managed_object_id]) \n\n respond_to do |format|\n if @user.save\n owner.user = @user\n owner.save\n @user.owner = owner\n @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def make_user(params = {})\n self.user= account.users.build_with_fields params.reverse_merge(:email => email, :invitation => self)\n end",
"def user\n build :user, :using => data_for(:user)\n end",
"def owner!(user, uuid)\n build_owner(user, uuid).save!\n end",
"def build\n set_action(:build)\n validate_account_type!\n new_account\n assign_params\n build_account_users\n set_affiliate\n set_created_by\n set_facility\n\n after_build\n account\n end",
"def create_admin_account\n account = Account.create!\n self.account = account\n self.account_owner = true\n end",
"def owner\n @owner ||= User.find(owner_user_id)\n end",
"def build_user\n User.new(first_name: 'John', \n last_name: 'Doe', \n email: '[email protected]') \n end",
"def user(*args)\n super(*args) || build_user\n end",
"def build_resource(*args)\n # Call the parent function to build the User model.\n super\n \n # If we have :omniauth in our session cookie we will build\n # an authentication for the new user from that and then \n # check to make sure the user is valid (i.e. get the password\n # from someone who created an account via LinkedIn or Facebook).\n if session[:omniauth]\n @user.build_authentication(session[:omniauth])\n @user.valid?\n end\n end",
"def autosets_owner_on_create\n has_owner # this will do nothing if the user has already set up has_owner :something\n # the hook runs before validation so we can validate_associated\n before_validation_on_create :autoset_owner\n end",
"def build_user\n FactoryBot.build(:user,\n email: Faker::Internet.email,\n password: Faker::Internet.password)\n end",
"def create_or_find_user\n User.find_or_create_by(provider: auth_hash['provider'], uid: auth_hash['uid']) do |user|\n user.email = auth_hash['info']['email']\n user.name = auth_hash['info']['name']\n user.username = auth_hash['extra']['raw_info']['login']\n user.public_repos = auth_hash['extra']['raw_info']['public_repos']\n end\n end",
"def project_owner\n user_id = project.namespace.owner.id\n access_level = Gitlab::Access::OWNER\n\n Member\n .from(generate_from_statement([[user_id, access_level]])) # rubocop: disable CodeReuse/ActiveRecord\n .limit(1)\n end",
"def create_organization_and_subscription_plan\n organization = Organization.create(\n name: \"My Organization\",\n subscription_plan_id: self.subscription_plan_id,\n time_zone: self.time_zone\n )\n\n organization_membership = organization.add_user(self)\n organization_membership.role = :owner\n organization_membership.save\n end",
"def set_owner(account)\n unless org = account.organization\n errors.add(:account, \"must have an organization\") and return false\n end\n update_attributes(:account_id => account.id, :organization_id => org.id)\n sql = \"account_id = #{account.id}, organization_id = #{org.id}\"\n self.pages.update_all( sql )\n self.entities.update_all( sql )\n self.entity_dates.update_all( sql )\n end",
"def set_owner(ownername)\n @result.owner = ownername\n end",
"def extract_owner_username(project_hash)\n new_owner = User.find_by_username(project_hash.delete(\"owner_username\"))\n return new_owner\n end",
"def build_user_details(xml, options)\n xml.User{\n xml.Name(@options[:user])\n xml.Password(@options[:password])\n xml.ClientId(@options[:clientId], :DataType => \"S32\")\n }\n end",
"def blank_user_for_create_action_form\n @blank_user ||= User.new(\n provider_credentials: [GitHubProviderCredential.new]\n )\n end",
"def build_resource(*args)\n super\n if session[\"devise.omni\"]\n @user.apply_omniauth(session[\"devise.omni\"])\n @user.valid?\n end\n end",
"def owner\n get_user owner_id\n end",
"def set_owner\n @owner = CacheUser.where(login: params[:login]).first\n if !@owner\n @owner = CacheUser.new(login: params[:login])\n @owner.save!\n end\n end"
]
| [
"0.67366105",
"0.6534766",
"0.6529248",
"0.63094616",
"0.62501216",
"0.62178934",
"0.62178934",
"0.6211486",
"0.6205372",
"0.6155081",
"0.6086903",
"0.60621643",
"0.60589343",
"0.60346043",
"0.59902084",
"0.5987126",
"0.5974206",
"0.5943992",
"0.5923644",
"0.5850913",
"0.57931656",
"0.5775581",
"0.57729137",
"0.5733857",
"0.57270545",
"0.57218695",
"0.5695396",
"0.56925446",
"0.5681068",
"0.5678177"
]
| 0.7838152 | 0 |
Set the affiliate_id if the account type supports affiliates, the affiliate param is present, and the affiliate exists. Also ensure affiliate_other gets wiped out if the affiliate_id does not point to `Other`. | def set_affiliate
if affiliate.present?
account.affiliate_id = affiliate.id
account.affiliate_other = affiliate.subaffiliates_enabled? ? account_params[:affiliate_other] : nil
else
account.affiliate_id = account.affiliate_other = nil
end
account
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def affiliate= affiliate\n if affiliate\n if affiliate.class != affiliate_class # self.class.to_s != \"#{affiliate.class.to_s}Reference\"\n raise \"Attempt to affiliate #{self.class.to_s} reference with #{affiliate.class} object.\"\n elsif affiliate_id && (affiliate_id != affiliate.id)\n raise \"Attempt to create ambiguous reference by asserting new affiliate\"\n else\n self.affiliate_id = affiliate.id\n end\n end\n end",
"def affiliate\n @affiliate || Affiliate.with_id(@data_object.user_affiliate)\n end",
"def set_affiliate\n @affiliate = Affiliate.find(params[:id])\n end",
"def affiliate\n self.affiliate_class && affiliate_id && self.affiliate_class.find(affiliate_id)\n end",
"def set_affiliate\n @affiliate = Affiliate.find(params[:id])\n end",
"def set_affiliate\n @affiliate = Affiliate.find(params[:id])\n end",
"def affiliation_id=(affil_id)\n self.affiliation_ids = affil_id\n end",
"def using_affiliate?(account_type)\n affiliate_account_types.include?(account_type.to_s.classify)\n end",
"def affiliation=(affil)\n affiliations.clear\n affiliations << affil\n end",
"def set_affiliation\n @affiliation = Affiliation.find(params[:id])\n end",
"def associated_with_affiliate?(aff_id)\n (aff_id == @data_object.user_affiliate) ||\n role_assoc_with_affiliate?(aff_id)\n end",
"def affiliates_enabled?\n affiliate_account_types.present?\n end",
"def affiliate_affiliations\n @affiliate_affiliations ||= Affiliation.find_by_uid(uid)\n end",
"def affiliate_params\n params.require(:affiliate).permit(:name, :affid)\n end",
"def new_affiliate\n resource = build_resource\n resource.role = 'affiliate'\n resource.build_affiliate\n respond_with resource\n end",
"def register_affiliate_role\n Role.set_user_role(@data_object.user_id, \n user_affiliate, \n nil,\n RoleNameTable::REGISTERED,\n TargetTable::AFFILIATE,\n user_affiliate)\n end",
"def set_cms_affiliation\n @cms_affiliation = Cms::Affiliation.find(params[:id])\n end",
"def update\n affiliations = current_company.company_affiliations.find(params[:id])\n affiliations.update_attributes(params[:company_affiliation])\n respond_with(affiliations)\n end",
"def maintain_affiliates\n values = {\n 'aff_opts' => Affiliate.options,\n 'aff_id' => -1,\n 'form_url' => url(:handle_maintain),\n }\n\n standard_page(\"Maintain Affiliates\", values, MAINTAIN_AFFILIATES)\n end",
"def set_po_affiliation_status\n @po_affiliation_status = PoAffiliationStatus.find(params[:id])\n end",
"def update\n @affiliate = Affiliate.find(params[:id])\n\n respond_to do |format|\n if @affiliate.update_attributes(params[:affiliate])\n flash[:notice] = 'Affiliate was successfully updated.'\n format.html { redirect_to(@affiliate) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @affiliate.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def modify_affiliations(affs)\n affs = [affs].flatten\n iq = connection.iq_stanza({'to'=>jid.bare,'type'=>'set'},\n x('pubsub',{:xmlns => EM::Xmpp::Namespaces::PubSubOwner},\n x('affiliations',{:node => node_id},\n affs.map do |s|\n x('affiliation',:jid => s.jid, :affiliation => s.affiliation)\n end\n )\n )\n )\n send_iq_stanza_fibered iq\n end",
"def mock_affiliate(stubs={})\n @mock_affiliate ||= mock_model(Affiliate, stubs)\n end",
"def affiliation\n @affiliation ||= auth_types_collection[attrs[:patron_status]] unless attrs[:patron_status].nil?\n end",
"def affiliate_account_types\n @affiliate_account_types ||= []\n end",
"def mandated_advocate_id=(value)\n if value\n if value.to_s =~ /^(none|unlisted)/i\n self.mandated_person_id = nil\n self.mandated = \"unlisted\"\n self.mandate_given_action = \"external\"\n @mandate_given = \"yes\"\n else \n self.mandated_person_id = value\n self.mandate_given_action = \"internal\"\n self.mandated = \"listed\"\n @mandate_given = \"yes\"\n end\n else\n self.mandated_person_id = nil\n self.mandated = nil\n self.mandate_given_action = nil\n end\n end",
"def become_an_advisor_for(company)\n advised_company_affiliations.create(company_id: company.id)\n end",
"def can_disable_affiliate_branding?\n !self.invitation.nil? && \n !self.affiliate.nil? && \n (!self.subscription.trial? || !self.invitation_subscription?)\n end",
"def update\n if params[:affiliate_credit]['amount'].blank? || params[:affiliate_credit]['comment'].blank?\n flash[:error] = t(\"affiliate_credit_add_error\")\n redirect_to :back\n else\n @user = Spree.user_class.find(params[:affiliate_credit]['user_id'])\n affiliate_credit = @user.affiliate_credits.new\n if affiliate_credit.update_attributes(params[:affiliate_credit])\n flash[:notice] = t(\"account_updated\")\n end\n redirect_to admin_user_url(@user)\n end\n end",
"def set_affiliation\n @affiliation = Affiliation.find(params[:id])\n add_breadcrumb @affiliation, @affiliation\n rescue ActiveRecord::RecordNotFound\n render_404\n end"
]
| [
"0.71535945",
"0.67755854",
"0.6702551",
"0.65431345",
"0.64234036",
"0.64234036",
"0.62347305",
"0.6205583",
"0.6086611",
"0.5946735",
"0.5888641",
"0.58612424",
"0.5811037",
"0.57084227",
"0.5680665",
"0.5662318",
"0.5533677",
"0.55099297",
"0.5326219",
"0.5311682",
"0.52836156",
"0.528083",
"0.5256479",
"0.5214065",
"0.51672405",
"0.51639223",
"0.51331955",
"0.5102949",
"0.5048904",
"0.5025491"
]
| 0.8225072 | 0 |
Set the facility if the account type is scoped to facility. | def set_facility
return unless account.per_facility? && facility&.id
account.account_facility_joins.build(facility: facility)
account
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_facility_type\n @facility_type = FacilityType.find(params[:id])\n end",
"def set_facility\n @facility = Facility.find(params[:id])\n end",
"def set_facility\n @facility = Facility.find(params[:id])\n end",
"def set_facility\n @facility = Facility.find(params[:id])\n end",
"def set_facility\n @facility = Facility.find(params[:id])\n end",
"def set_facility\n @facility = Facility.find(params[:id])\n end",
"def set_facility\n @facility = Facility.find(params[:id])\n end",
"def set_facility\n @facility = Facility.find(params[:id])\n end",
"def set_facility\n @facility = Facility.find(params[:id])\n end",
"def set_facility\n @facility = Facility.find(params[:id])\n end",
"def set_facility\n @facility = Facility.find(params[:facility_id])\n end",
"def set_facilities\n if user_signed_in?\n if current_user.role == \"site_admin\"\n @userfacilities = Facility.all\n else\n @userfacilities = current_user.facility_relationships.includes(:facility_roles).where.not(facility_roles: {name: 'climber'}).all\n end\n end\n end",
"def set_facility\n @facility = Facility.find(params[:id])\n end",
"def update_facility_id\n if @claim_information.billing_provider_npi && @facility_npi_hash[@claim_information.billing_provider_npi]\n @claim_information.facility_id = @facility_npi_hash[@claim_information.billing_provider_npi][:facility_id]\n @claim_information.active = @claim_information.facility_id?\n elsif @claim_information.facility_id.nil?\n @claim_information.active = false\n end\n end",
"def try_to_set_scope\n #this is a commodity method\n if self.featurable.is_a?(Account)\n self.scope = \"AccountPlan\"\n end\n end",
"def set_facility_item\n @facility_item = FacilityItem.find(params[:id])\n end",
"def per_facility?(account_type)\n facility_account_types.include?(account_type.to_s.classify)\n end",
"def set_place_facility\n @place_facility = PlaceFacility.find(params[:id])\n end",
"def set_room_facility\n @room_facility = RoomFacility.find(params[:id])\n end",
"def set_other_facility\n @other_facility = OtherFacility.find(params[:id])\n end",
"def set_faculty_type\n @faculty_type = FacultyType.find(params[:id])\n end",
"def set_insurance_facility\n @insurance_facility = InsuranceFacility.find(params[:id])\n end",
"def set_facility_space\n @facility_space = FacilitySpace.find(params[:id])\n end",
"def facility( *values )\n if values.empty?\n @facility\n else\n # deprecate, but should still work\n Yell.__deprecate__( \"0.6.0\", \"Use :facility= for setting the Syslog facility\" )\n\n self.facility = values\n end\n end",
"def set_facility_item\n @facility_item = FacilityItem.find(params[:id]) \n end",
"def current_facility\n @facility ||= load_facility\n end",
"def facility_account_types\n @facility_account_types ||= []\n end",
"def set_facility_cost_item\n @facility_cost_item = FacilityCostItem.find(params[:id])\n end",
"def set_home_facility\n @home_facility = HomeFacility.find(params[:id])\n end",
"def current_facility\n current_facility ||= (current_user.facilities.find_by(id: params[:facility_id]) || current_user.facilities.first)\n end"
]
| [
"0.6779261",
"0.65848863",
"0.65848863",
"0.65848863",
"0.65848863",
"0.65848863",
"0.65848863",
"0.65848863",
"0.65848863",
"0.65848863",
"0.6562685",
"0.6315417",
"0.63153106",
"0.6217873",
"0.6120958",
"0.60601026",
"0.60302186",
"0.60097283",
"0.5844239",
"0.58384955",
"0.5749381",
"0.5729035",
"0.56628656",
"0.56526357",
"0.56108326",
"0.56048924",
"0.54657835",
"0.54299676",
"0.53934777",
"0.53835964"
]
| 0.73396176 | 0 |
return the bank activity for the specified date | def activity(date)
main_ledger_account.activity(date)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def activity(date)\n ledger_entries.for_date(date).sum(:debit) - ledger_entries.for_date(date).sum(:credit)\n end",
"def get_account_activity(start_date, end_date, options = {})\n submit GetAccountActivity.new(options.merge(:start_date => start_date, :end_date => end_date))\n end",
"def activities_on_date(date)\n get(\"/user/#{@user_id}/activities/date/#{format_date(date)}.json\")\n end",
"def activities_on_date(date)\n get(\"/user/#{@user_id}/activities/date/#{format_date(date)}.json\")\n end",
"def activities_in_date_range(from_date, to_date)\n from_date = format_date from_date\n to_date = format_date to_date\n\n @dealing_platform.gather \"history/activity/#{from_date}/#{to_date}\", :activities, AccountActivity\n end",
"def calories_on_date(date)\n get_call(\"1/user/#{user_id}/activities/calories/date/#{format_date(date)}/1d.json\")\n end",
"def index\n @activities = @user.activities.where(\"date = ?\", requested_date(params[:date]))\n end",
"def activities(date)\n\n sql =<<-SQL\n select o_i.id, o_i.date, o_i.time, o_i.item_id, o_i.item_description, \n o_i.item_price_description,\n o_i.quantity, o_i.item_unit_cost, o_i.item_cost, o_i.item_price_type,\n o_i.comments, o_i.notes, o_i.customers_pickup_place,\n o.id as order_id, o.customer_name, o.customer_surname, o.customer_email,\n o.customer_phone, o.comments as order_comments,\n case o.status\n when 1 then 'pending_confirmation'\n when 2 then 'confirmed'\n when 3 then 'cancelled'\n end as status, \n a.capacity\n from orderds_order_items o_i\n join orderds_orders o on o.id = o_i.order_id\n join bookds_activities a on a.code = o_i.item_id\n where o.status NOT IN (3) and o_i.date = ? \n order by o_i.date, o_i.time, o_i.item_id, o.customer_surname, o.customer_name\n SQL\n\n orders = repository.adapter.select(sql, date)\n\n end",
"def balance(date = nil)\n return @starting_balance if @transactions.empty?\n\n update_balances\n date = end_date if date.nil?\n\n raise \"Transaction set begins later than this date\" if date < start_date\n raise \"Transaction set ends before this date\" if date > end_date\n\n @balances[date.to_date]\n end",
"def activity_on_date_range(activity, start, finish)\n get(\"/user/#{@user_id}/activities/#{activity}/date/#{format_date(start)}/#{format_date(finish)}.json\")\n end",
"def transactions_in_date_range(from_date, to_date, transaction_type = :all)\n validate_transaction_type transaction_type\n\n from_date = format_date from_date\n to_date = format_date to_date\n\n url = \"history/transactions/#{transaction_type.to_s.upcase}/#{from_date}/#{to_date}\"\n\n @dealing_platform.gather url, :transactions, AccountTransaction\n end",
"def balance(date = Time.now)\n total = 0\n\n transactions.sort_by(&:transaction_at).each do |transaction|\n break if transaction.transaction_at.end_of_day > date.end_of_day\n\n total += transaction.adjusted_amount\n end\n\n total\n end",
"def balance(date=Date.tomorrow)\n ledger_entries.before_date(date).sum(:debit) - ledger_entries.before_date(date).sum(:credit)\n end",
"def for(date)\n where(actual_date: date)\n end",
"def date(date_name)\r\n case date_name\r\n when :start\r\n return self.accommodation_histories.last.from\r\n when :end\r\n return self.accommodation_histories.last.to\r\n else\r\n return 0\r\n end\r\n end",
"def report(date = nil)\n date = end_date if date.nil?\n balance = @starting_balance\n data = []\n\n sorted_transactions.each do |t|\n balance += t.adjusted_amount\n\n row = {\n id: t.id,\n account: t.account.name,\n date: t.transaction_at.to_date,\n type: t.transaction_type,\n from: t.from.name,\n to: t.to.name,\n category: t.category.nil? ? 'Uncategorized' : t.category.name,\n amount: Mny.display_cents(t.amount),\n balance: Mny.display_cents(balance)\n }\n\n row[:status] = t.status || :unknown if t.is_a? Transaction\n data<< row\n end\n\n data\n end",
"def daily_balances(start_date, end_date)\n LedgerAccountHelper.daily_balances(main_ledger_account, start_date, end_date)\n end",
"def daily_activity\n\t\t@work_flows = WorkFlow.where(is_active: true)\n\t\t@workflows = WorkFlow.where(is_active: true, is_in_use: false)\n\t\tif request.post? or session[:daily_activity_report_date].present?\n\t\t\tif request.post?\n\t\t\t\t@daily_report_date = params[:daily_report_date]\n\t\t\t\tsession[:daily_activity_report_date] = @daily_report_date\n\t\t\telse\n\t\t\t\t@daily_report_date = session[:daily_activity_report_date]\n\t\t\tend\n\t\t\tdate = L1.set_db_date_format(@daily_report_date)\n\t\t\tq_string = \"STR_TO_DATE( '#{date}', '%Y-%m-%d') = STR_TO_DATE(timestamp_logs.created_at, '%Y-%m-%d')\"\n\t\t\tworkflow = params[:work_flow]\n\t\t\tif workflow.present? \n\t\t\t\t@searched_work_flow = workflow\n\t\t\t\tq_string += \"and timestamp_logs.work_flow_id = #{workflow}\"\n\t\t\telse\n\t\t\t\t@searched_work_flow = @workflow.id\n\t\t\t\tq_string += \"and timestamp_logs.work_flow_id = #{@workflow.id}\"\n\t\t\tend\n\t\t\t@report_serach_result = WorkFlow.daily_report_serach(q_string)\n\t\tend\n\tend",
"def daily_activity_aaa\n\t\t@work_flows = WorkFlow.where(is_active: true)\n\t\t@workflows = WorkFlow.where(is_active: true, is_in_use: false)\n\t\tif request.post? or session[:daily_activity_report_date].present?\n\t\t\tif request.post?\n\t\t\t\t@daily_report_date = params[:daily_report_date]\n\t\t\t\tsession[:daily_activity_report_date] = @daily_report_date\n\t\t\telse\n\t\t\t\t@daily_report_date = session[:daily_activity_report_date]\n\t\t\tend\n\t\t\tdate = L1.set_db_date_format(@daily_report_date)\n\t\t\tq_string = \"STR_TO_DATE( '#{date}', '%Y-%m-%d') = STR_TO_DATE(created_at, '%Y-%m-%d')\"\n\t\t\tworkflow = params[:work_flow]\n\t\t\tif workflow.present?\n\t\t\t\tq_string += \"and work_flow_id = #{workflow}\"\n\t\t\telse\n\t\t\t\tq_string += \"and work_flow_id = #{@workflow.id}\"\n\t\t\tend\n\t\t\t@logs = TimestampLog.where(q_string)\n\t\tend\n\tend",
"def getLeasesByDate(date)\n leases = getLeases()\n today_leases = []\n if leases.length !=0\n leases.each do |lease|\n if lease[\"status\"] == \"accepted\"\n #puts \"Gia na assssssssssssss\"\n #puts lease[\"valid_from\"].split('T')[0]\n #puts date\n #puts lease[\"valid_until\"].split('T')[0]\n if lease[\"valid_from\"].split(' ')[0] <= date && lease[\"valid_until\"].split(' ')[0]>=date\n #puts \"mpika\"\n today_leases << lease\n end\n end\n end\n end\n\n return today_leases\n end",
"def on(date)\n between(date, date).first\n end",
"def action_date\n case object.status\n when 'paid'\n object.created_at\n when 'canceled'\n object.closed_at\n when 'shipped'\n object.shipped_at\n when 'accepted'\n object.accepted_at\n end\n end",
"def public_programmed_activities(date_from)\n\n sql = <<-SQL\n select oi.date, oi.time, oi.date_to, oi.time_to, oi.item_id, \n oi.item_description, sum(oi.quantity) as occupation\n from orderds_orders o\n join orderds_order_items oi on oi.order_id = o.id\n join bookds_activities a on a.code = oi.item_id\n where o.status in (2) and oi.date > ? \n group by oi.date, oi.time, oi.date_to, oi.time_to, oi.item_id, \n oi.item_description\n order by oi.date asc, oi.time asc, oi.item_id\n SQL\n\n programmed_activities = repository.adapter.select(sql, date_from) \n\n\n end",
"def account_balance_as_of(date, include_news=false, include_rectify=true)\n running_total = 0.0\n\n charges.each do |charge|\n if (charge.created_at && charge.created_at.to_date <= date.to_date) || (include_news && charge.created_at.nil?)\n running_total = running_total - charge.amount\n end\n end\n\n # we want to manage both payments (failed and otherwise) as well as general credits\n payments = include_rectify ? non_failed_payment_transactions : successful_payment_transactions\n\n the_credits = payments.collect {|payment| payment.credit }\n the_credits = the_credits | credits.select {|credit| credit.payment_transaction.nil? }\n \n the_credits.compact! # removes nils\n \n the_credits.each do |credit|\n running_total = running_total + credit.amount.to_f if credit.created_at.to_date <= date.to_date\n end\n\n return running_total.round(2) # takes care of obnoxious adding errors\n end",
"def read_history_by_date(date)\n obj = self.send(self_class_name+'_histories').find_first_by_date(date)\n obj.value unless obj.nil?\n end",
"def index\n @date = params[:date].present? ? Date.parse(params[:date]) : Date.today\n beginning_of_day, end_of_day = @date.beginning_of_day, @date.end_of_day\n @feats = @person.feats.all(\n :include => :activity, \n :conditions => [\"activities.start_time > ? and activities.start_time < ?\", beginning_of_day, end_of_day])\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @feats }\n end\n end",
"def account\n\t\t@user = current_user\n\t\t@projects = Project.report_by_user(current_user.id, month_now)\n\t\t@new_daily = @user.dailies.build\n\tend",
"def index\n @entries = current_user.entries.for_month(@date)\n @budgets = current_user.budgets\n end",
"def programmed_activities(date_from, date_to)\n\n sql = <<-SQL\n select oi.date, oi.time, oi.date_to, oi.time_to, oi.item_id, \n oi.item_description, sum(oi.quantity) as occupation,\n a.schedule_color, a.duration_days, a.duration_hours\n from orderds_orders o\n join orderds_order_items oi on oi.order_id = o.id\n join bookds_activities a on a.code = oi.item_id\n where o.status in (2) and oi.date >= ? and oi.date <= ?\n group by oi.date, oi.time, oi.date_to, oi.time_to, oi.item_id, oi.item_description, a.schedule_color, a.duration_days, a.duration_hours\n order by oi.date asc, oi.time asc, oi.item_id\n SQL\n\n programmed_activities = repository.adapter.select(sql, date_from, date_to) \n\n end",
"def fat_on_date(date)\n get_call(\"/1/user/#{@user_id}/body/log/fat/date/#{format_date(date)}.json\")\n end"
]
| [
"0.69148326",
"0.6866681",
"0.6711",
"0.6711",
"0.6511803",
"0.6454644",
"0.64540946",
"0.62788147",
"0.62519133",
"0.6086539",
"0.6069161",
"0.6055967",
"0.5982076",
"0.5918181",
"0.5872746",
"0.5864139",
"0.58433294",
"0.5812383",
"0.5749635",
"0.5742037",
"0.56973827",
"0.56800085",
"0.56532645",
"0.56213766",
"0.56210154",
"0.5613227",
"0.55838245",
"0.5575392",
"0.55253005",
"0.55057013"
]
| 0.82403153 | 0 |
return daily balances for a date range... | def daily_balances(start_date, end_date)
LedgerAccountHelper.daily_balances(main_ledger_account, start_date, end_date)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def balance(date = Time.now)\n total = 0\n\n transactions.sort_by(&:transaction_at).each do |transaction|\n break if transaction.transaction_at.end_of_day > date.end_of_day\n\n total += transaction.adjusted_amount\n end\n\n total\n end",
"def balance(date=Date.tomorrow)\n ledger_entries.before_date(date).sum(:debit) - ledger_entries.before_date(date).sum(:credit)\n end",
"def balance(date = nil)\n return @starting_balance if @transactions.empty?\n\n update_balances\n date = end_date if date.nil?\n\n raise \"Transaction set begins later than this date\" if date < start_date\n raise \"Transaction set ends before this date\" if date > end_date\n\n @balances[date.to_date]\n end",
"def calculate_balance_forward\n invoices.each do |invoice|\n if date_range.is_active? && invoice.issue_date < date_range.start_date\n @balances[invoice.customer_id] += invoice.amount_due\n end\n end\n end",
"def debit(range = nil)\n debit = (range == nil ? self.transactions : self.transactions.all(:date => range)).all(:amount.lt => 0).sum(:amount)\n debit == nil ? 0.0 : debit\n end",
"def calc_daily_credit_debit\n credit = Transaction.sum(:amount, :conditions => \"date IS '#{Date.current}' AND sign IS 'c' \") # change this to transactiontype_id 1\n debit = Transaction.sum(:amount, :conditions => \"date IS '#{Date.current}' AND sign IS 'd' \") # change this to transactiontype_id 4 (2 + 5)\n @dailytotal = credit - debit\n return @dailytotal\n end",
"def negative_balances(date = nil)\n update_balances\n date = end_date if date.nil?\n\n raise \"Transaction set begins later than this date\" if date < start_date\n raise \"Transaction set ends before this date\" if date > end_date\n\n negatives = {}\n @balances.each do |d, b|\n negatives[d] = b if b < 0 && d <= date.to_date\n end\n\n negatives\n end",
"def dr(date)\n _, end_date = *roll_period_for_date(date)\n start_date = next_cboe_business_day(date)\n remaining_business_days_in_roll_period = date_series_inclusive(start_date, end_date).select {|date| cboe_business_day?(date) }\n remaining_business_days_in_roll_period.count.to_f\nend",
"def calc_business_days_for_range(start_date, end_date)\n total = 0\n return total if start_date.blank? or end_date.blank?\n (start_date..end_date).each do |date|\n total += 1 unless date.saturday? or date.sunday? or \n date.thanksgiving? or date.labor_day? or date.memorial_day? or\n date.christmas? or date.christmas_eve? or date.independence_day? or\n date.black_friday? or date.new_years_day?\n end\n return total\n end",
"def between(first_date, last_date)\n return [] if first_date > last_date\n current_date = first_date\n active_dates = []\n until current_date >= last_date\n active_dates << current_date if active?(current_date)\n current_date = current_date.next_day\n end\n\n active_dates\n rescue NoMethodError\n p 'provided date is not of valid type'\n nil\n end",
"def ranges(date)\n ranges =[]\n bra_doc = bra_per_day(date)\n bra_doc.each do |element|\n ranges << element[\"massif\"]\n end\n ranges\nend",
"def daily\n if dates_ok?\n @entries = Entry.where('user_id = ?\n AND \"time\"(date) BETWEEN ? AND ?\n AND CAST(date AS DATE) >= ? and CAST(date AS DATE) <= ?', current_user.id, params[:timeFrom], params[:timeTo], Date.parse(params[:dateFrom]), Date.parse(params[:dateTo])).\n select('CAST(date AS DATE), sum(calories) as calories').group('CAST(date AS DATE)')\n else\n @entries = Entry.where('user_id = ?', current_user.id).\n select('CAST(date AS DATE), sum(calories) as calories').group('CAST(date AS DATE)')\n end\n end",
"def calculate(from_date, to_date)\n calendar_days_between(from_date, to_date)\n end",
"def calcs_for_date_range(start_date, end_date, abandon_rate)\n puts \"\\tFrom #{start_date} to #{end_date} inclusive:\"\n\n total_registrations = WasteExemptionsEngine::Registration.where(\n created_at: start_date.beginning_of_day..end_date.end_of_day\n ).count\n total_registrations_s = number_with_delimiter(total_registrations)\n puts \"\\tTotal registrations: #{total_registrations}, of which:\"\n\n assisted_digital_registrations = WasteExemptionsEngine::Registration.where(\n created_at: start_date.beginning_of_day..end_date.end_of_day,\n assistance_mode: \"full\"\n ).count\n assisted_digital_registrations_s = number_with_delimiter(assisted_digital_registrations)\n puts \"\\t... assisted digital: #{assisted_digital_registrations_s}\"\n\n fully_digital_registrations = WasteExemptionsEngine::Registration.where(\n created_at: start_date.beginning_of_day..end_date.end_of_day,\n assistance_mode: nil\n ).count\n fully_digital_registrations_s = number_with_delimiter(fully_digital_registrations)\n puts \"\\t... fully digital: #{fully_digital_registrations}\"\n\n delta = total_registrations - assisted_digital_registrations - fully_digital_registrations\n puts \"\\t(delta of #{delta} is due to some registrations not having metaData.route set)\" unless delta.zero?\n\n abandon_rate_s = number_to_percentage(100.0 * abandon_rate, precision: 0)\n non_abandon_rate_s = number_to_percentage(100.0 * (1 - abandon_rate), precision: 0)\n\n total_registrations_started = (total_registrations / (1.0 - abandon_rate)).round(0)\n total_registrations_started_s = number_with_delimiter(total_registrations_started.to_i)\n\n total_registrations_completed = fully_digital_registrations + assisted_digital_registrations + delta\n total_registrations_completed_s = number_with_delimiter(total_registrations_completed)\n\n total_registrations_started_online = (fully_digital_registrations / (1.0 - abandon_rate)).round(0)\n total_registrations_started_online_s = number_with_delimiter(total_registrations_started_online)\n\n total_registrations_abandoned = total_registrations_started - total_registrations_completed\n total_registrations_abandoned_s = number_with_delimiter(total_registrations_abandoned)\n\n puts \"\\tSo including abandoned attempts, estimated orders started = \" \\\n \"#{total_registrations_s} / (1 - #{abandon_rate_s}) = #{total_registrations_started_s}, of which: \"\n puts \"\\t... completed: #{total_registrations_completed_s}\"\n puts \"\\t... abandoned: #{total_registrations_abandoned_s}\"\n\n puts \"\\nSummary:\"\n puts \"\\t1. Total number of transactions started and completed online only: #{fully_digital_registrations_s}\"\n puts \"\\t2. Total number of transactions started online: ESTIMATED: #{total_registrations_started_online_s}\"\n puts \"\\t\\t(Estimated dropoff rate for the last 30 days: #{abandon_rate_s}\"\n puts \"\\t\\t so estimated completion (non-abandoned) rate for the last 30 days: #{non_abandon_rate_s}\"\n puts \"\\t\\t so given #{fully_digital_registrations_s} fully digital orders, \" \\\n \"estimated total orders started online = \" \\\n \"(#{fully_digital_registrations_s}/#{non_abandon_rate_s}) = #{total_registrations_started_online_s})\"\n puts \"\\t3. Number of online claims: #{fully_digital_registrations_s}\"\n puts \"\\t4. Total number of claims (online + offline + unknown): \" \\\n \"#{fully_digital_registrations_s} + #{assisted_digital_registrations_s} + \" \\\n \"#{delta} = #{total_registrations_completed_s}\"\n\n puts \"====================================================================================================\"\n end",
"def activity(date)\n ledger_entries.for_date(date).sum(:debit) - ledger_entries.for_date(date).sum(:credit)\n end",
"def retrieve_date_range\n \t@all = false\n \tif params[:daily_summary][:from].nil? && params[:daily_summary][:to].nil?\n\t @free_period = false\n\t @from, @to = nil, nil\n\t if params[:daily_summary][:period_type] == '1' || (params[:daily_summary][:period_type].nil? && !params[:daily_summary][:period].nil?)\n\t case params[:daily_summary][:period].to_s\n\t when 'today'\n\t @from = @to = Date.today\n\t when 'yesterday'\n\t @from = @to = Date.yesterday\n\t when 'current_week'\n\t @from = Date.today.beginning_of_week(:sunday)\n\t @to = @from + 6\n\t when 'last_week'\n\t @from = Date.today - 7 - (Date.today.cwday - 1)%7\n\t @to = @from + 6\n\t when 'last_2_weeks'\n\t @from = Date.today - 14 - (Date.today.cwday - 1)%7\n\t @to = @from + 13\n\t when '7_days'\n\t @from = Date.today - 7\n\t @to = Date.today\n\t when 'current_month'\n\t @from = Date.civil(Date.today.year, Date.today.month, 1)\n\t @to = (@from >> 1) - 1\n\t when 'last_month'\n\t @from = Date.civil(Date.today.year, Date.today.month, 1) << 1\n\t @to = (@from >> 1) - 1\n\t when '30_days'\n\t @from = Date.today - 30\n\t @to = Date.today\n\t when 'current_year'\n\t @from = Date.civil(Date.today.year, 1, 1)\n\t @to = Date.civil(Date.today.year, 12, 31)\n\t when 'all'\n\t @all = true\n\t end\n\t elsif params[:free_period] || params[:daily_summary][:period_type] == '2' || (params[:daily_summary][:period_type].nil? && (!params[:daily_summary][:date_from].nil? || !params[:daily_summary][:date_to].nil?))\n\t begin; @from = params[:daily_summary][:date_from].to_s.to_date unless params[:daily_summary][:date_from].blank?; rescue; end\n\t begin; @to = params[:daily_summary][:date_to].to_s.to_date unless params[:daily_summary][:date_to].blank?; rescue; end\n\t @free_period = true\n\t else\n\t # default\n\t end\n\n\t @from, @to = @to, @from if @from && @to && @from > @to\n\telse\n \t @from = params[:daily_summary][:from]\n \t @to = params[:daily_summary][:to]\n end\n end",
"def balance_from_to(from_date, to_date, format_value=true)\n process(children_moves.where('date >= ? AND date <= ?', from_date, to_date).group(:dh).sum(:value))\n end",
"def update_balances\n @balances = {}\n balance = @starting_balance\n sorted_transactions.each do |t|\n key = t.transaction_at.to_date\n\n balance += t.adjusted_amount\n\n @balances[key] = balance\n end\n\n # fill in missing dates for easy lookup\n last_date = nil\n last_balance = nil\n @balances.keys.sort.each do |date|\n while last_date && last_date < (date - 1.day).to_date\n last_date = (last_date + 1.day).to_date\n @balances[last_date] = last_balance\n end\n\n last_date = date\n last_balance = @balances[date]\n end\n end",
"def ranges(date)\n ranges =[]\n bra_doc = bra_per_day(date)\n bra_doc.each do |element|\n ranges << element[\"massif\"]\n end\n p ranges\n end",
"def balances()\n request(\"#{@base_url}/account/getbalances\")\n end",
"def balance_from(from_date, format_value=true)\n process(children_moves.where('date >= ?', from_date).group(:dh).sum(:value))\n end",
"def list_daily_reservations(given_date)\n\n given_date = Date.parse(given_date)\n daily_reservations = []\n\n @reservations.find_all do |reservation|\n if ((reservation.checkin_date..reservation.checkout_date).to_a - [reservation.checkout_date]).include?(given_date)\n daily_reservations << reservation.confirmation_id\n end\n end\n\n return \"No reservations for #{given_date}.\" if daily_reservations.empty?\n return daily_reservations\n end",
"def generate_payments start_date, end_date\n \tdates = start_date.step( end_date ).\n \t select { |date| date.day == bill.due_on }.\n \t map { |date| Payment.from date, bill, self }\n end",
"def daily_budget\n country_code = Geocoder.search(self.address).first.country_code\n Country.find_by(country_code: country_code).daily_budget\n end",
"def render_daily_balance(balances)\n html = \"\"\n balances.each do |date,value|\n if block_given?\n yield(date,value)\n else\n html << \"<tr><td>#{date}</td><td>#{sprintf(\"%.2f\",value)}</td></tr>\\n\"\n end\n end\n html\nend",
"def getTotalValueOfAllFundInvestments(ind, date)\r\n\r\n\tend",
"def balance_dollars\n transactions = Transaction.where('contact_id = ?', id)\n .includes(:settled_by)\n\n totalPaid = Money.new(0)\n totalSettled = Money.new(0)\n\n transactions.each do |loan|\n totalPaid = totalPaid + loan.amount_dollars\n\n loan.settled_by.each do |payback|\n totalSettled = totalSettled + payback.amount_dollars\n end\n end\n\n return totalPaid + totalSettled\n end",
"def bra_all_ranges_per_date(date)\n bra_all_ranges = []\n ranges(date).each do |range|\n bra_all_ranges << bra_per_range(bra_key(range,date))\n end\n bra_all_ranges\nend",
"def amount_by_date_cumulative\n amounts_by_date = Installment.amount_by_date(self)\n amounts_by_date.each do |status, dates|\n sum = 0\n amounts_by_date[status].each do |date, amount|\n sum += amount\n amounts_by_date[status][date] = sum\n end\n end\n return amounts_by_date\n end",
"def daily_statistics start_on = Date.today, end_on = Date.today, local_time_zone = true\n self.get_statistics('ox.bannerDailyStatistics', start_on, end_on, local_time_zone)\n end"
]
| [
"0.7316175",
"0.7285797",
"0.6791438",
"0.6625377",
"0.6614883",
"0.65106344",
"0.62950295",
"0.6216034",
"0.6122384",
"0.6084558",
"0.6074286",
"0.6066016",
"0.60606134",
"0.603537",
"0.6014007",
"0.60114545",
"0.5963322",
"0.59528744",
"0.5940237",
"0.5928822",
"0.59189856",
"0.59024876",
"0.5898965",
"0.5890111",
"0.58819515",
"0.58693916",
"0.5867622",
"0.58360267",
"0.58163613",
"0.58149695"
]
| 0.85685986 | 0 |
Add errors if name_is_valid? returns false | def name_is_valid
errors.add(:name,'Invalid empty string for name.') unless name_is_valid?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name_is_valid\n errors.add(:name,\"Invalid string for name.\") unless name_is_valid?\n end",
"def name_invalid\n errors.add(:name, :unknown)\n end",
"def validate_name\n unless name.length > 0\n add_error :name, 'name of the price item shall be provided'\n end\n\n unless price.to_i > 0\n add_error :price, 'price should be a number'\n end\n end",
"def name_not_blank\n if self.name.blank?\n self.errors.add(:name, I18n.t('stage.errors.blank_name'))\n end\n end",
"def valid_name!\n return unless @name.blank?\n\n @success = false\n @error = 'Error: site name must be present'\n end",
"def names_valid?\n return nil unless AccountType.individual?(account_type)\n\n errors.add(:forename, :cant_be_blank) if forename.to_s.empty?\n errors.add(:surname, :cant_be_blank) if surname.to_s.empty?\n names_length_valid?\n end",
"def name_valid_format\n if name.present? and not name.match(/[\\w]+([\\s]+[\\w]+){1}+/)\n errors.add :name , \"must be seperated by space and should not contain any special characters.\"\n end\n end",
"def name_present\n if name.blank?\n errors.add(:name, \"Can't be empty\")\n end\n end",
"def your_name_is_not_dumb\n if name.include?(\"dumb\")\n errors.add(:name, \"is dumb\")\n end\n end",
"def empty_name_error(type, what)\n validation_error(type, what, 'name is empty')\n end",
"def name_can_not_be_greg\n if self && self.name.downcase == \"greg\"\n self.errors.add(:name, \"Can not be Greg\")\n end \n end",
"def last_name_is_valid\n errors.add(:last_name,'Invalid empty string for last name.') unless last_name_is_valid?\n end",
"def validate_name\n\t\t\tunless Nacreon::NameRX.match(name)\n\t\t\t\terrors.add(:name,\n\t\t\t\t\t'must contain only letters, numbers, and \"-\".')\n\t\t\tend\n\t\tend",
"def validate_name_and_url\n # check name and url_safe_name first and set validation error\n if self.name.blank? || self.name.nil?\n errors.add(:name, \" cannot be blank - please provide a name for your study.\")\n end\n if Study.where(name: self.name).any?\n errors.add(:name, \": #{self.name} has already been taken. Please choose another name.\")\n end\n if Study.where(url_safe_name: self.url_safe_name).any?\n errors.add(:url_safe_name, \": The name you provided (#{self.name}) tried to create a public URL (#{self.url_safe_name}) that is already assigned. Please rename your study to a different value.\")\n end\n end",
"def name_is_valid?\n return false unless not_nil_and_string(self.name)\n return self.name.length > 0\n end",
"def name_is_valid?\n return false unless not_nil_and_string(self.name)\n return self.name.length > 0\n end",
"def validate_name\n if third_party && name.blank?\n errors.add(\n :name,\n :blank,\n )\n end\n end",
"def first_name_is_valid\n errors.add(:first_name,'Invalid empty string for first name.') unless first_name_is_valid?\n end",
"def validate_name\n errors.add(:abstract, \"person_name or company_name must be present\") unless (person_name || company_name)\n end",
"def name_valid(name)\n if !name.empty?\n self.name = name\n return true\n end\n end",
"def name_valid(name)\n if !name.empty?\n self.name = name\n return true\n else\n return false\n end\n end",
"def _validate_name(name)\n if name =~ %r{/}\n results.add_error('name', 'The name of a spec should not contain ' \\\n 'a slash.')\n end\n\n if name =~ /\\s/\n results.add_error('name', 'The name of a spec should not contain ' \\\n 'whitespace.')\n end\n\n if name[0, 1] == '.'\n results.add_error('name', 'The name of a spec should not begin' \\\n ' with a period.')\n end\n end",
"def validate_display_name\nif ! validate_a_display_name( self.display_name )\nerrors.add( :display_name , \"Invalid display name (see RFC 3261).\" )\nend\nend",
"def check_create_user_name_is_valid\n return self.name != \"\" ? true : false\n end",
"def names_length_valid?\n errors.add(:forename, :too_long, count: 50) if forename.length > 50\n errors.add(:surname, :too_long, count: 100) if surname.length > 100\n end",
"def valid?\n !name.nil?\n end",
"def valid?\n !name.nil?\n end",
"def valid?\n !name.nil?\n end",
"def check_username_format\n errors.add(:username, \"is not a valid username\") unless username =~ Handle.validation_regex\n end",
"def name_legal?\n if @params\n if self.name.include?(\"\\\\\") or self.name.include?(\"/\")\n errors.add(\"Invalid name:\", \"Slashes not allowed in names.\")\n elsif self.name == \"\"\n errors.add(\"Invalid name:\", \"No name provided.\")\n end\n end\n end"
]
| [
"0.8849024",
"0.81621915",
"0.78472495",
"0.7818782",
"0.780932",
"0.76998484",
"0.76245207",
"0.76146877",
"0.7571461",
"0.7513229",
"0.7502683",
"0.7485334",
"0.7476541",
"0.74586964",
"0.7434845",
"0.7434845",
"0.738939",
"0.73345906",
"0.73150057",
"0.7263868",
"0.7228135",
"0.713607",
"0.7130203",
"0.7120261",
"0.7087566",
"0.7000877",
"0.7000877",
"0.7000877",
"0.6996761",
"0.698615"
]
| 0.8818862 | 1 |
Tests if the name of course is not nil and is a string and returns true or false. | def name_is_valid?
return false unless not_nil_and_string(self.name)
return self.name.length > 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name?\n @name.is_a?(String) && [email protected]?\n end",
"def valid?\n valid = true\n\n if self.name.nil? || self.name == \"\"\n valid = false\n end\n\n return valid\n end",
"def valid?\n !name.nil?\n end",
"def valid?\n !name.nil?\n end",
"def valid?\n !name.nil?\n end",
"def valid?\n return false if @name.nil?\n return true\n end",
"def name_present?\n name.present?\n end",
"def valid?\n title_or_description.to_s != ''\n end",
"def name_valid(name)\n if !name.empty?\n self.name = name\n return true\n else\n return false\n end\n end",
"def name_valid?(name)\n name.nil? || /^[A-Za-z]{2,}$/.match?(name)\n end",
"def name?\n [email protected]?\n end",
"def name_valid(name)\n if !name.empty?\n self.name = name\n return true\n end\n end",
"def valid?\n [:region, :security_group, :security_key].all? do |var|\n self.send(var).is_a? String\n end\n end",
"def valid_case_string?()\n LuckyCase.case(self) != nil\n end",
"def name?(name)\n name = name&.strip\n !(name.blank? || name.match?(%r{(N[/\\\\]+A|UNKNOWN)}i))\n end",
"def is_valid_name?(name)\n return name.class == String && name.match(/[a-zA-Z]+?/)\n end",
"def can_show? str\n \treturn not(str.nil? || str === \"\")\n end",
"def present?(string)\n return !blank?(string)\n end",
"def validateName(name)\n if (name == nil)\n return false\n end\n \n return true # TODO This is wrong. Finish this function.\nend",
"def string?\n type == \"STRING\"\n end",
"def valid?\n self.name.match(/^[a-zA-Z0-9_]+$/) ? true : false\n end",
"def not_nil_and_string(str)\n return true unless ((str == nil) or (not str.instance_of? String))\n return false\n end",
"def not_nil_and_string(str)\n return true unless ((str == nil) or (not str.instance_of? String))\n return false\n end",
"def not_nil_and_string(str)\n return true unless ((str == nil) or (not str.instance_of? String))\n return false\n end",
"def valid?(att)\n return false if att.nil?\n\n return !att.nil? && !att.empty? if att.is_a? String\n\n !att.nil?\n end",
"def valid?\n return false if @name.nil?\n return false if @schedule.nil?\n true\n end",
"def is_string?\n @name.is_a?(String) && @stack.empty?\n end",
"def unknown?\n\t\treturn name.to_s == \"\"\n\tend",
"def is_strname?(); @type == GRT_STRNAME; end",
"def is_valid_name(str)\n return str.include?(\" \") && format_name(str) == str\nend"
]
| [
"0.7013948",
"0.67589116",
"0.6693198",
"0.6693198",
"0.6693198",
"0.6618374",
"0.6543606",
"0.6467556",
"0.6462177",
"0.64107823",
"0.64037585",
"0.63744503",
"0.6357518",
"0.63415873",
"0.63144195",
"0.6290922",
"0.6275527",
"0.6272617",
"0.62617624",
"0.624366",
"0.62320787",
"0.62269914",
"0.62269914",
"0.62269914",
"0.6213639",
"0.6194685",
"0.6188798",
"0.61858946",
"0.6172428",
"0.61686635"
]
| 0.70330954 | 1 |
Add errors if start_time_is_valid? return false | def start_time_is_valid
errors.add(:start_time,'Invalid empty string for start time.') unless start_time_is_valid?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start_time_is_valid?\n return false unless not_nil_and_string(self.start_time)\n return self.start_time.length > 0\n end",
"def check_time\t\n\t\treturn unless errors.blank? #this will ensure the right error count on top area\n\t\tif @start_date.present? && @start_time.present?\n\t\t\t#concatenate start_date and start_time\n\t\t\tstart_at = Time.parse(\"#{@start_date} #{@start_time}\") \n\t\t\t#variable that holds the time 12 hours from now\n\t\t\tstart_at_plus_12_hours = Time.now + (12.hours)\n\t\t\tif start_at <= Time.now\n\t\t\t\terrors.add(:start_date, \"Please do not enter a past date or past time.\")\n\t\t\t\terrors.add(:start_time, \"Please do not enter a past date or past time.\")\n\t\t\telsif start_at < start_at_plus_12_hours \n\t\t\t\terrors.add(:start_date, \"Please only enter a time 12 hours from now\")\n\t\t\tend\n\t\tend\n\tend",
"def start_time_present?\n if start_time.blank?\n errors.add('start_time',\"Please select appointment time\")\n end\n end",
"def valid_start_date\n errors.add(:start_date, 'The start date cannot be parsed.') unless start_date_is_valid?\n end",
"def start_time_before_end_time\n if start_time and end_time and start_time >= end_time\n errors.add(:start_time, \"Must be before end time\")\n errors.add(:end_time, \"Must be after start time\")\n end\n end",
"def start_time_before_end_time\n return true unless start_time && end_time\n\n errors.add(:start_time, 'must be before end time') unless start_time < end_time\n end",
"def validate_future_start_time\n\t\tif start_time <= Time.now\n\t\t\terrors.add(:start_time, \"must be in the future\")\n\t\tend\n\tend",
"def start_before_end\n if start_time > end_time\n errors.add :start_time, s_(\"BookingValidationError|must be before end 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 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_timings\n p start_time, end_time\n if (start_time > end_time)\n errors[:base] << \"Start Time must be less than End Time\"\n end\n end",
"def validate_start_and_stop_time\n if active_time\n if active_start_time.nil? or active_stop_time.nil?\n errors.add(:active_time, \"start time or end time not set\")\n end\n end\n end",
"def valid_start_date?\n return true if date_parsed?(@record.start_date.to_s)\n\n error_message = I18n.t('models.user.errors.invalid_date')\n add_error_record(:start_date, error_message)\n end",
"def validate_start_date_before_end_date\n\t\tif end_time <= start_time\n\t\t\terrors.add(:end_time, \"must be after start time\")\n\t\tend\n\tend",
"def start_end_time\n errors[:start_time] << _('errors.invalid_shift_time') if start_time.to_i > end_time.to_i\n end",
"def end_time_is_valid\n errors.add(:end_time,'Invalid empty string for end time.') unless end_time_is_valid?\n end",
"def validate_start_end_time\n if start_time && end_time && start_time.to_i >= end_time.to_i\n errors.add(:base, \"Start At cannot be greater than End At\")\n end\n\n if end_time.to_i > api_duration_seconds.to_i\n errors.add(:base, \"End At cannot be longer than the video duration: \" + api_duration_seconds.to_s)\n end\n end",
"def start_must_be_before_end_time\n unless active_start_time.nil? or active_stop_time.nil?\n errors.add(:active_start_time, \"must be before stop time\") unless\n active_start_time < active_stop_time\n end\n end",
"def validate(record)\n if !record.start_time.nil? && !record.end_time.nil? && record.start_time >= record.end_time\n record.errors[:end_time] << 'End date should be greater that start date!'\n end\n \n if !record.start_time.nil? && record.start_time < Time.now\n record.errors[:start_time] << 'Start time must be greater than current time'\n end\n end",
"def is_start_date_is_valid_datetime\n errors.add(:start_date, 'start date must be a valid datetime') if (:start_date.kind_of? DateTime)\n end",
"def time_valid\n if self.valid_from and self.valid_to then\n errors.add(:valid_from,\n \"must be before the valid to date. #{self.valid_from} >= #{self.valid_to}\") unless self.valid_from < self.valid_to\n else\n if self.valid_from or self.valid_to then\n errors.add(:valid_from,\n \" must be set when valid_to is set.\") unless self.valid_from\n errors.add(:valid_to,\n \" must be set when valid_from is set.\") unless self.valid_to\n end\n end\n end",
"def is_correct_time? #:doc:\n if(self.endTime && self.startTime && (self.endTime<=>self.startTime)==-1)\n errors.add([:starTime,:endTime],\"Attenzione l'ora di inizio è piu grande dell'ora di fine\")\n end\n end",
"def check_date\n\t\tif self.hasError\n\t\t\terrors.add(\"\", \"You entered Invalid date: \\n - \"+self.interviewer.name)\n\t\t\t# puts \"===================CHECKDATE===================\"\n\t\telsif Time.at(self.sched_end.to_i) <= Time.at(self.sched_start.to_i)\n\t\t\terrors.add(\"\", \"Start time cannot be greater than end time \\n - \"+self.interviewer.name)\n\t\tend\n\tend",
"def start_must_be_in_the_future\n errors.add(:start, \"must be in the future\") if !start.blank? and start < DateTime.now\n end",
"def ends_after_it_starts\n if !starts_before_it_ends?\n errors.add(:start_time, 'must be before the end time')\n end\n end",
"def has_start_time?\n !start_time.blank?\n end",
"def is_date_nil\n\t\tif @start_date.blank? && @start_time.blank?\n\t\t\terrors.add(:start_date, \"Please enter a date.\")\n\t\t\terrors.add(:start_time, \"Please enter a time.\")\n\t\tend\n\n\t\tif @start_date.blank? && @start_time.present?\n\t\t\terrors.add(:start_date, \"Please enter a date.\")\n\t\tend\n\n\t\tif @start_time.blank? && @start_date.present?\n\t\t\terrors.add(:start_time, \"Please enter a time.\")\n\t\tend\n\tend",
"def start_after_now\n unless start_time.nil? || end_time.nil?\n errors[:start_time] << \"can't be in the past\" if start_time < Time.now\n end\n end",
"def valid_time\n return if init.nil? || finish.nil?\n if init < Week.init || init > Week.finish\n errors.add(:init, \"Deve ser no périodo desta semana\")\n elsif finish < Week.init || finish > Week.finish\n errors.add(:finish, \"Deve ser no périodo desta semana\")\n elsif finish < init\n errors.add(:finish, \"Deve ser maior que a data de início\")\n end\n end",
"def validate_positive_times\n return true if (time_type == \"gift_given\" || time_type == \"penalty\") || start.nil? || finish.nil?\n if r = start >= finish\n errors.add(:start, \"must come before finish\")\n end\n r\n end"
]
| [
"0.7999102",
"0.7996796",
"0.7843696",
"0.77276343",
"0.7530397",
"0.7518192",
"0.75014573",
"0.7498077",
"0.7456445",
"0.7414144",
"0.73869014",
"0.7364325",
"0.73481107",
"0.7343726",
"0.73241955",
"0.7321338",
"0.7305339",
"0.7286456",
"0.72858655",
"0.72568065",
"0.72489816",
"0.72440475",
"0.71995413",
"0.7181856",
"0.71815133",
"0.7157889",
"0.71578526",
"0.71059704",
"0.7092942",
"0.70721"
]
| 0.8787081 | 0 |
Tests if start_time of course is not nil and a string and returns true or false. | def start_time_is_valid?
return false unless not_nil_and_string(self.start_time)
return self.start_time.length > 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_start_time?\n !start_time.blank?\n end",
"def start_time_is_valid\n errors.add(:start_time,'Invalid empty string for start time.') unless start_time_is_valid?\n end",
"def start_time_present?\n if start_time.blank?\n errors.add('start_time',\"Please select appointment time\")\n end\n end",
"def started?\n start_date.present?\n end",
"def parse_start\n create_params[:start].present? && create_params[:start]&.to_time\n rescue ArgumentError\n nil\n end",
"def self_directed_started?\n if course&.advance_start_at_duration\n !start_at.present? || start_at - course.advance_start_at_duration < Time.zone.now\n else\n started?\n end\n end",
"def started?\n !@start_time.nil?\n end",
"def started?\n started_at.present?\n end",
"def start_date?\r\n !event_start_date.blank?\r\n end",
"def time?(text)\n if datetime?(text)\n extract = Nickel.parse(text).occurrences[0].start_time\n extract.nil? ? false : true\n else\n false\n end\n\n rescue RuntimeError => e\n Failure.save_case(text, e)\n return false\n end",
"def started?\n !@time_started.nil?\n end",
"def self_directed_started?(course_user = nil)\n if course&.advance_start_at_duration\n time_for(course_user).start_at.blank? ||\n time_for(course_user).start_at - course.advance_start_at_duration < Time.zone.now\n else\n started?\n end\n end",
"def is_started(datetime=nil)\n unless datetime\n datetime = Time.zone.now\n end\n \n if self.start_date < datetime\n return true\n else\n return false\n end\n end",
"def end_time_is_valid?\n return false unless not_nil_and_string(self.end_time)\n return self.end_time.length > 0\n end",
"def is_start?\n type == TYPES[:start]\n end",
"def started?\n !self.started_at.nil?\n end",
"def appt_started?\n appointment.start_date.present?\n end",
"def time_define?\n !time.blank?\n end",
"def start_date_is_valid?\n begin\n date = USDateParse(self.start_date)\n self.start_date = date.strftime(\"%m/%d/%y\")\n rescue\n return false\n end\n return true\n end",
"def start_time\n if (start_time = @host.at('tag[name=HOST_START]'))\n DateTime.strptime(start_time.inner_text, fmt='%a %b %d %H:%M:%S %Y')\n else\n false\n end\n end",
"def is_date_nil\n\t\tif @start_date.blank? && @start_time.blank?\n\t\t\terrors.add(:start_date, \"Please enter a date.\")\n\t\t\terrors.add(:start_time, \"Please enter a time.\")\n\t\tend\n\n\t\tif @start_date.blank? && @start_time.present?\n\t\t\terrors.add(:start_date, \"Please enter a date.\")\n\t\tend\n\n\t\tif @start_time.blank? && @start_date.present?\n\t\t\terrors.add(:start_time, \"Please enter a time.\")\n\t\tend\n\tend",
"def starts_tomorrow?\n future? && starts_at < site(:course_check_interval).since\n end",
"def has_started?\n Date.current >= start_date\n end",
"def started?\n @description =~ /^[^\"].*started \"/\n end",
"def start(value = nil)\n return @start unless value\n @start = _parse_time(value)\n end",
"def usable?\n codes.present? && (start_time.present? || end_time.present? || time.present?)\n end",
"def has_started?\n Time.now >= start_time\n end",
"def process_start_time\n# gimme_a_syntax_error\n if event_params[\"start_time(2i)\"].length == 1\n start_month = \"0\" + event_params[\"start_time(2i)\"]\n else\n start_month = event_params[\"start_time(2i)\"]\n end\n \n # -0600 represents the default timezone of CST\n start_time = event_params[\"start_time(1i)\"] + start_month + event_params[\"start_time(3i)\"] + \"T\" + \n event_params[\"start_time(4i)\"] + \":\" + event_params[\"start_time(5i)\"] + \"-0600\"\n begin\n return DateTime.strptime(start_time, '%Y%m%dT%H:%M%z')\n rescue ArgumentError\n flash[:error] ||= \"Start date doesn't exist\"\n return nil\n end\n end",
"def start_time\n eval(start) if start.present?\n end",
"def expected_start\n val = super\n val = DatelessTime.new val unless val.blank?\n val\n end"
]
| [
"0.7924206",
"0.7236668",
"0.71151656",
"0.69725066",
"0.6866959",
"0.67938334",
"0.6708347",
"0.66759753",
"0.6662058",
"0.6644632",
"0.6598933",
"0.6592477",
"0.6556836",
"0.64680177",
"0.6377812",
"0.636196",
"0.6350664",
"0.6345295",
"0.6282905",
"0.6227318",
"0.6182376",
"0.61635554",
"0.6141208",
"0.6138558",
"0.61154777",
"0.6110926",
"0.60765654",
"0.60690933",
"0.60314864",
"0.60262907"
]
| 0.8072464 | 0 |
Adds errors if end_time_is_valid? returns false | def end_time_is_valid
errors.add(:end_time,'Invalid empty string for end time.') unless end_time_is_valid?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_end_time\n if self.end_time.present? && self.end_time < self.start_time\n errors.add(:end_time, \"can't be before start time\")\n end\n end",
"def end_time_is_valid?\n return false unless not_nil_and_string(self.end_time)\n return self.end_time.length > 0\n end",
"def ends_after_it_starts\n if !starts_before_it_ends?\n errors.add(:start_time, 'must be before the end 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 end_time_after_start_time\n return if end_time.blank? || start_time.blank?\n\n if end_time < start_time\n errors.add(:end_time, \"must be after the start time\")\n end\n end",
"def valid_end_date\n errors.add(:end_date, 'The end date cannot be parsed.') unless end_date_is_valid?\n end",
"def ends_after_start\n unless end_time.nil? || start_time.nil?\n errors[:end_time] << \"can't be before start time\" if end_time < start_time\n end\n end",
"def end_time_after_start_time\n if self.end_time && self.end_time < self.start_time\n self.errors.add(:end_time, \"The end time must be after the start time\")\n end\n end",
"def end_time_must_be_after_start_time\n if self.start_time > self.end_time\n errors.add(:end_time, 'must be after start time')\n end\n end",
"def validate_start_end_time\n if start_time && end_time && start_time.to_i >= end_time.to_i\n errors.add(:base, \"Start At cannot be greater than End At\")\n end\n\n if end_time.to_i > api_duration_seconds.to_i\n errors.add(:base, \"End At cannot be longer than the video duration: \" + api_duration_seconds.to_s)\n end\n end",
"def check_end_time\n return unless self.end_time?\n calculate_total_time unless self.total_time?\n end",
"def shift_end_hour\n if self.start_time.hour >= 0 && self.start_time.hour <= 2 && self.end_time.hour > 2 \n errors.add(:end_time, 'must be between 7am and 3am')\n end\n if self.end_time.hour > 2 && self.end_time.hour < 7\n errors.add(:end_time, 'must be between 7am and 3am')\n end \n end",
"def is_correct_time? #:doc:\n if(self.endTime && self.startTime && (self.endTime<=>self.startTime)==-1)\n errors.add([:starTime,:endTime],\"Attenzione l'ora di inizio è piu grande dell'ora di fine\")\n end\n end",
"def end_time_cannot_be_earlier_than_start_time\n\t\tif end_time && start_time \n\t\t\tif end_time < start_time\n\t\t\t\terrors.add(:end_time, \"End time should not be earlier than start time.\")\n\t\t\tend\n\t\tend\n\tend",
"def validate_timings\n p start_time, end_time\n if (start_time > end_time)\n errors[:base] << \"Start Time must be less than End Time\"\n end\n end",
"def validate(record)\n if !record.start_time.nil? && !record.end_time.nil? && record.start_time >= record.end_time\n record.errors[:end_time] << 'End date should be greater that start date!'\n end\n \n if !record.start_time.nil? && record.start_time < Time.now\n record.errors[:start_time] << 'Start time must be greater than current time'\n end\n end",
"def check_end_date\n # if self.category.eql?(\"appointment\")\n unless self.start_date.nil? or self.end_date.nil?\n if (self.end_date < self.start_date)\n self.category.eql?(\"appointment\")? self.errors.add(' ', 'End Date can\\'t be before Start Date') : self.errors.add(' ', 'Due Date can\\'t be before Start Date')\n end\n if self.end_date == self.start_date\n self.errors.add(' ', 'End Time can not be before start time') if (self.end_date.to_time < self.start_date.to_time)\n end\n end\n # end\n end",
"def end_date_is_bigger?\n return if [endDate.blank?, startDate.blank?].any?\n\n errors.add(:base, 'The end time must be later than the start time') if endDate < startDate\n end",
"def end_time_after_start_time\n if self.event_start_time && self.event_end_time\n errors.add(:event_end_time, \"must be after the event start time\") unless\n self.event_end_time >= self.event_start_time\n end\n end",
"def start_time_is_valid\n errors.add(:start_time,'Invalid empty string for start time.') unless start_time_is_valid?\n end",
"def check_time\t\n\t\treturn unless errors.blank? #this will ensure the right error count on top area\n\t\tif @start_date.present? && @start_time.present?\n\t\t\t#concatenate start_date and start_time\n\t\t\tstart_at = Time.parse(\"#{@start_date} #{@start_time}\") \n\t\t\t#variable that holds the time 12 hours from now\n\t\t\tstart_at_plus_12_hours = Time.now + (12.hours)\n\t\t\tif start_at <= Time.now\n\t\t\t\terrors.add(:start_date, \"Please do not enter a past date or past time.\")\n\t\t\t\terrors.add(:start_time, \"Please do not enter a past date or past time.\")\n\t\t\telsif start_at < start_at_plus_12_hours \n\t\t\t\terrors.add(:start_date, \"Please only enter a time 12 hours from now\")\n\t\t\tend\n\t\tend\n\tend",
"def end_time_after_start_time\n if start_time && end_time && end_time < start_time\n errors.add :end_time, \"must be after the start of shift\"\n errors.add :start_time, \"must be before the end of shift\"\n end\n end",
"def date_consistency\n\t\treturn if [start_time.blank?, end_time.blank?].any?\n\t\terrors.add(:start_time, 'must be after end_time') if start_time > end_time\n\tend",
"def date_consistency\n\t\treturn if [start_time.blank?, end_time.blank?].any?\n\t\terrors.add(:start_time, 'must be after end_time') if start_time > end_time\n\tend",
"def max_duration\n if start_time && end_time && (end_time - start_time) > 2.years\n errors.add :end_time, I18n.t('activerecord.errors.models.membership.attributes.end_time.max_duration_error')\n end\n end",
"def start_end_time\n errors[:start_time] << _('errors.invalid_shift_time') if start_time.to_i > end_time.to_i\n end",
"def start_time_before_end_time\n if start_time and end_time and start_time >= end_time\n errors.add(:start_time, \"Must be before end time\")\n errors.add(:end_time, \"Must be after start time\")\n end\n end",
"def check_end_date\n if end_date < Date.today\n \n errors.add(:end_date, \"End Date can only be later than today\")\n end\n end",
"def valid_time\n return if init.nil? || finish.nil?\n if init < Week.init || init > Week.finish\n errors.add(:init, \"Deve ser no périodo desta semana\")\n elsif finish < Week.init || finish > Week.finish\n errors.add(:finish, \"Deve ser no périodo desta semana\")\n elsif finish < init\n errors.add(:finish, \"Deve ser maior que a data de início\")\n end\n end",
"def ensure_end_date_is_valid\n return true if end_date.blank?\n unless start_date.blank?\n return true if end_date > start_date\n end\n\n errors.add(:end_date, :invalid)\n end"
]
| [
"0.8372728",
"0.80865073",
"0.7941235",
"0.7939686",
"0.76964194",
"0.7666876",
"0.76550233",
"0.76165175",
"0.75892025",
"0.7441538",
"0.74052954",
"0.74022347",
"0.7362591",
"0.7358371",
"0.73036015",
"0.72367185",
"0.7205526",
"0.71653897",
"0.71572155",
"0.71463424",
"0.7129193",
"0.71149015",
"0.70819145",
"0.70819145",
"0.7010769",
"0.7002296",
"0.69789255",
"0.6946564",
"0.69268435",
"0.68822336"
]
| 0.89177924 | 0 |
Tests if end_time of course is not nil and a string and returns true or false | def end_time_is_valid?
return false unless not_nil_and_string(self.end_time)
return self.end_time.length > 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def end_time_is_valid\n errors.add(:end_time,'Invalid empty string for end time.') unless end_time_is_valid?\n end",
"def ended?\n end_time < Time.now.utc\n end",
"def end_time_defined?(time)\n if time.empty?\n '24:00'\n else\n time\n end\n end",
"def check_end_time\n return unless self.end_time?\n calculate_total_time unless self.total_time?\n end",
"def start_time_is_valid?\n return false unless not_nil_and_string(self.start_time)\n return self.start_time.length > 0\n end",
"def ended?\n ended_at.present?\n end",
"def finished?\n @end_time != nil\n end",
"def has_start_time?\n !start_time.blank?\n end",
"def time?(text)\n if datetime?(text)\n extract = Nickel.parse(text).occurrences[0].start_time\n extract.nil? ? false : true\n else\n false\n end\n\n rescue RuntimeError => e\n Failure.save_case(text, e)\n return false\n end",
"def passed?\n (self.ends_at < Time.zone.now) && !((self.ends_at.to_date.eql?(Time.zone.now.to_date)) && self.ends_at.strftime('%H%M').eql?(\"0000\"))\n end",
"def time_define?\n !time.blank?\n end",
"def end_time_after_start_time\n return if end_time.blank? || start_time.blank?\n\n if end_time < start_time\n errors.add(:end_time, \"must be after the start time\")\n end\n end",
"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 is_ended(datetime=nil)\n unless datetime\n datetime = Time.zone.now\n end\n \n if self.end_date < datetime\n return true\n else\n return false\n end\n end",
"def has_ended?\n Time.now >= end_time\n end",
"def ends_after_start\n unless end_time.nil? || start_time.nil?\n errors[:end_time] << \"can't be before start time\" if end_time < start_time\n end\n end",
"def is_correct_time? #:doc:\n if(self.endTime && self.startTime && (self.endTime<=>self.startTime)==-1)\n errors.add([:starTime,:endTime],\"Attenzione l'ora di inizio è piu grande dell'ora di fine\")\n end\n end",
"def stopped?\n !@end_time.nil?\n end",
"def is_expired?\n (!end_time.nil? and end_time < Clock.time)\n end",
"def end_time_input\n @end_time_input || end_time.try(:strftime, \"%H:%M\")\n end",
"def ends_after_it_starts\n if !starts_before_it_ends?\n errors.add(:start_time, 'must be before the end time')\n end\n end",
"def completed?\n !@time_started.nil? && !@time_completed.nil?\n end",
"def end_date_is_valid?\n begin\n date = USDateParse(self.end_date)\n self.end_date = date.strftime(\"%m/%d/%y\")\n rescue\n return false\n end\n return true\n end",
"def valid?(text)\n datetime?(text) || datetime?(clear_text(text))\n end",
"def check_future\n current_start = DateTime.strptime(self.start_time,\"%m/%d/%y %H:%M\").to_time\n current_end = DateTime.strptime(self.end_time,\"%m/%d/%y %H:%M\").to_time \n\n # checks start time of appt is before end time #\n if current_start < current_end\n if current_start > Time.now && current_end > Time.now\n @valid = true\n else\n @valid = false\n end\n end\n @valid\n p @valid\n end",
"def ended?\n return(self.ends_at < Time.now)\n end",
"def process_end_time\n if event_params[\"end_time(2i)\"].length == 1\n end_month = \"0\" + event_params[\"end_time(2i)\"]\n else\n end_month = event_params[\"end_time(2i)\"]\n end\n \n # -0600 represents the default timezone of CST\n end_time = event_params[\"end_time(1i)\"] + end_month + event_params[\"end_time(3i)\"] + \"T\" +\n event_params[\"end_time(4i)\"] + \":\" + event_params[\"end_time(5i)\"] + \"-0600\"\n begin\n return DateTime.strptime(end_time, '%Y%m%dT%H:%M%z')\n rescue ArgumentError\n flash[:error] ||= \"End date doesn't exist\"\n return nil\n end\n end",
"def end_time_check\n if self.event_type == \"Script\" || self.event_type == \"Gamecall\"\n if end_time > start_time\n self.end_time = start_time\n end\n end\n end",
"def complete?\n !instrument_end_date.blank? && !instrument_end_time.blank? && instrument_status.to_s == \"Complete\"\n end",
"def valid_venue_time?\n valid_time = self.venue.matches.all? do |match|\n !(match.start_time >= self.start_time && match.start_time <= self.end_time || match.end_time >= self.start_time && match.end_time <= self.end_time)\n end\n errors.add(:start_time, \"The venue is not available for this time\") unless valid_time\n end"
]
| [
"0.75151235",
"0.7071533",
"0.7012782",
"0.69998944",
"0.69763255",
"0.68621856",
"0.67484266",
"0.6702217",
"0.66968906",
"0.6653403",
"0.65554947",
"0.65447974",
"0.6541156",
"0.65404207",
"0.6499381",
"0.6482098",
"0.6481419",
"0.64493936",
"0.64316547",
"0.6426057",
"0.6374419",
"0.637309",
"0.63473475",
"0.63375866",
"0.6320167",
"0.6313769",
"0.6298485",
"0.6292895",
"0.6270612",
"0.62425184"
]
| 0.8366072 | 0 |
Adds errors if number_of_classes_is_valid? returns false | def number_of_classes_is_valid
errors.add(:number_of_classes, 'Invalid number of classes') unless number_of_classes_is_valid?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def number_of_classes_is_valid?\n return ((self.number_of_classes != nil) and (self.number_of_classes > 0))\n end",
"def class_max_is_valid\n errors.add(:class_max,'Invalid class max value.') unless class_max_is_valid?\n end",
"def validate!\n validations.each do |name, attributes|\n valid = instance_variable_get(name)\n case attributes[0]\n when :presence\n raise \"Class object didn't create.\" if valid !~ /^.{1}+/.freeze\n when :format\n raise \"Class object didn't create.\" if valid !~ attributes[1]\n when :type\n raise \"Class object didn't create.\" unless valid.is_a? attributes[1]\n end\n end\n end",
"def validate_as_component\n counts = Hash.new(0)\n to_ach.each do |record|\n unless record.valid?\n klass = record.class\n errors[\"#{klass}##{counts[klass] += 1}\"] = record.errors\n end\n end\n end",
"def class_min_is_valid\n errors.add(:class_min,'Invalid class min value.') unless class_min_is_valid?\n end",
"def subclass_validations ; true ; end",
"def valid?\n @errors = []\n \n validate_instance_numbers!\n \n @errors.empty? \n end",
"def step_validation\n step_index = form_steps[:pages].index(form_step)\n\n if self.form_steps[:pages].index('title') <= step_index\n self.errors['name'] << 'You must enter a name for the dataset' if self.name.blank? || self.name.strip.blank?\n end\n\n if self.form_steps[:pages].index('connector') <= step_index\n self.errors['type'] << 'You must enter a connector type' unless CONNECTOR_TYPES.include? self.type\n self.errors['provider'] << 'You must enter a connector provider' unless CONNECTOR_PROVIDERS.include? self.provider\n self.errors['connector_url'] << 'You must enter a valid url' \\\n unless self.connector_url && !self.connector_url.blank? && valid_url?(self.connector_url)\n end\n\n if self.form_steps[:pages].index('labels') <= step_index\n unless self.legend && self.legend.is_a?(Hash)\n self.errors['legend'] << 'Labels not correctly defined'\n return\n end\n self.errors['legend'] << 'Latitude and Longitude have to be filled together' if\n self.legend[:lat].blank? ^ self.legend[:long].blank?\n self.errors['legend'] << 'Country and Region have to be filled together' if\n self.legend[:country].blank? ^ self.legend[:region].blank?\n end\n end",
"def validations_for(klass)\n validations[klass] ||= []\n end",
"def valid?\n @errors = []\n if id.blank?\n @errors << {message: \"#{class_name} id cannot be blank.\", variable: \"id\"}\n elsif !possible_values.include?(id)\n @errors << {message: \"#{class_name} id must be included in the table.\", variable: \"id\"}\n end\n \n if class_name.blank?\n @errors << {message: \"Class cannot be blank.\", variable: \"class\"}\n end\n \n @errors.empty?\n end",
"def validate\n # add errors if not validate\n end",
"def run_validations!\n super\n include_typecasting_errors\n errors.empty?\n end",
"def validation_errors\n errors = []\n ErrorCompiler.with_errors(errors) do |e|\n check_schools_consistency_in_each_round(e)\n check_legitimate_progress_through_rounds(e)\n check_wildcards(e)\n end\n errors\n end",
"def validate_attributes!\n raise TrainNumberValidationError unless valid_number?\n raise TrainTypeValidationError if type.nil? || type.empty?\n end",
"def check_errors\n unless self.valid?\n bigmessage = self.errors.full_messages.join \"\\n\" \n raise bigmessage unless bigmessage.empty?\n end\n \n documents.each {|obj| obj.check_errors } \n \n invalids = (texts).reject {|obj| obj.valid? } \n bigmessage = invalids.map { |obj| obj.errors.full_messages.join \"\\n\" }.join \"\\n\"\n raise bigmessage unless bigmessage.empty?\n\n invalids = (audios ).reject {|obj| obj.valid? } \n bigmessage = invalids.map { |obj| obj.errors.full_messages.join \"\\n\" }.join \"\\n\"\n raise bigmessage unless bigmessage.empty?\n\n invalids = (images ).reject {|obj| obj.valid? } \n bigmessage = invalids.map { |obj| obj.errors.full_messages.join \"\\n\" }.join \"\\n\"\n raise bigmessage unless bigmessage.empty? \n \n object_formats.each {|obj| obj.check_errors } \n end",
"def extra_validations\n success\n end",
"def check_errors\n unless self.valid?\n bigmessage = self.errors.full_messages.join \"\\n\" \n raise bigmessage unless bigmessage.empty?\n end\n \n documents.each {|obj| obj.check_errors } \n \n invalids = (texts).reject {|obj| obj.valid? } \n bigmessage = invalids.map { |obj| obj.errors.full_messages.join \"\\n\" }.join \"\\n\"\n raise bigmessage unless bigmessage.empty?\n\n invalids = (audios ).reject {|obj| obj.valid? } \n bigmessage = invalids.map { |obj| obj.errors.full_messages.join \"\\n\" }.join \"\\n\"\n raise bigmessage unless bigmessage.empty?\n\n invalids = (images ).reject {|obj| obj.valid? } \n bigmessage = invalids.map { |obj| obj.errors.full_messages.join \"\\n\" }.join \"\\n\"\n raise bigmessage unless bigmessage.empty? \n \n object_formats.each {|obj| obj.check_errors } \n end",
"def set_errors\n \t@errors = []\n\n \tif self.title == \"\"\n \t@errors << \"Title cannot be blank\"\n \tend\n\n if self.user_id == nil\n @errors << \"Must assign to a user\"\n end\n\n if self.category_id == nil\n @errors << \"Must assign to a category\"\n end\n \tend",
"def record_validation_errors(failed_instances)\n failed_instances = [*failed_instances].flatten\n logger.info \"0 validation errors!\" if failed_instances.empty?\n validation_errors[:total] ||= 0\n validation_errors[:total] += failed_instances.count\n errors = failed_instances.map { |fi| fi.errors.messages }\n\n if validation_logger\n failed_instances.each do |fi|\n validation_logger.info fi.errors.inspect\n end\n end\n\n errors.each do |error|\n error.each_pair do |field, messages|\n validation_errors[field] ||= {}\n messages.each do |message|\n validation_errors[field][message] ||= 0\n validation_errors[field][message] += 1\n end\n end\n end\n end",
"def valid?\n super\n errors.empty?\n end",
"def run_validations\n true\n end",
"def valid?\n validate_field_types\n @errors.length == 0\n end",
"def extra_validations\n r = check_max_allowed_admin_count\n return r unless r.success?\n\n success\n end",
"def error_messages_for(clazz)\n if clazz.present? && clazz.errors.present? && clazz.errors.count > 0\n return \"Errors: #{clazz.errors.full_messages}\"\n end\n end",
"def errors\n self.class.validator.call self\n end",
"def valid?\n @errors = []\n # check thename exists and is not empty\n if name.to_s.empty?\n @errors << {message: \"Name cannot be empty.\", variable: \"name\"}\n end\n \n # check the description exists and is not empty\n if description.to_s.empty?\n @errors << {message: \"Description cannot be empty.\", variable: \"description\"}\n end\n \n # check the description exists and is not empty\n # if studio_id.to_s.empty?\n # @errors << {message: \"Studio id cannot be empty.\", variable: \"studio_id\"}\n # elsif studio.blank?\n # @errors << {message: \"Studio id must be a member of the studios table.\", variable: \"studio_id\"}\n # end \n \n if !studio_id.valid?\n @errors += studio_id.errors\n end\n \n # check the description exists and is not empty\n # if rating_id.to_s.empty?\n # @errors << {message: \"Rating id cannot be empty.\", variable: \"rating_id\"}\n # elsif rating.blank?\n # @errors << {message: \"Rating id must be a member of the ratings table.\", variable: \"rating_id\"}\n # end\n \n if !rating_id.valid?\n @errors += rating_id.errors\n end\n # checks the number of time slots\n if length.to_s.empty?\n @errors << {message: \"Length cannot be empty.\", variable: \"length\"}\n elsif length.is_a? Integer\n if length < 1\n @errors << {message: \"Length must be greater than 0.\", variable: \"length\"}\n end\n else\n @errors << {message: \"Length must be a number.\", variable: \"length\"}\n end\n \n # returns whether @errors is empty\n @errors.empty?\n end",
"def validate\n errors.add_to_base(\"Your Volume is to long, can only store 4 characters!\") if self.volume.to_s.length > 4\n errors.add_to_base(\"Your Number is to long, can only store 3 characters!\")if self.number.to_s.length > 3\n errors.add_to_base(\"Your Semester is to long, can only store 6 characters!\")if self.semester.to_s.length > 6\n end",
"def check_destroy\n valid=true\n msg=\"\"\n if students.count > 0\n valid=false\n end\n if teachings.count > 0\n valid=false\n msg+=\" There are #{teachings.count} teachings references\"\n end\n self.errors.add(:base, \"Class school can't be destroyed:#{msg}\") unless valid\n valid\n end",
"def form_errors_class\n {:class => 'error'}\n end",
"def get_errors_for_class(klass)\n if klass.errors.any?\n klass.errors.full_messages.each do |msg|\n msg\n end\n end\n end"
]
| [
"0.7522681",
"0.7069296",
"0.67471296",
"0.656553",
"0.64563817",
"0.6422648",
"0.6338168",
"0.62567747",
"0.62289953",
"0.61848646",
"0.6147791",
"0.605664",
"0.60460085",
"0.6029689",
"0.58844614",
"0.58604866",
"0.5849429",
"0.58055294",
"0.5799057",
"0.57950073",
"0.5764261",
"0.57186794",
"0.571841",
"0.5717031",
"0.5695408",
"0.56807756",
"0.56619865",
"0.5650511",
"0.56375575",
"0.56277555"
]
| 0.85071665 | 0 |
Tests if number_of_classes for course is not nil and is greater than 0 and returns true or false. | def number_of_classes_is_valid?
return ((self.number_of_classes != nil) and (self.number_of_classes > 0))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def class_how_full?\n return [self.students.count, self.class_max]\n end",
"def class_max_is_valid?\n if ((self.class_max == nil) or (self.class_min == nil)); return false; end\n return ((self.class_max > 0) and (self.class_max >= self.class_min))\n end",
"def number_of_classes_is_valid\n errors.add(:number_of_classes, 'Invalid number of classes') unless number_of_classes_is_valid?\n end",
"def section_classes_all_there?\n section_classes_to_check.all?(&:all_there?)\n end",
"def is_used?\n self.cases_count == self.cases_max\n end",
"def has_classmates?\n belongs_to_classroom? ? !classroom.students.empty? : nil\n end",
"def has_classes?(klasses)\n klasses1 = klasses.kind_of?(Array) ? klasses : klasses.split\n klasses2 = classes.split\n for k in klasses1 do\n if not klasses2.find_index(k)\n return false\n end\n end\n return true\n end",
"def sections_classes_all_there?\n sections_classes_to_check.flatten.all?(&:all_there?)\n end",
"def can_finish(num_courses, prerequisites)\n pre_req_map = {}\n prerequisites.each do |a, b|\n pre_req_map[a] ||= []\n pre_req_map[a] << b\n pre_req_map[b] ||= []\n end\n\n confirmed = {}\n # Check if we can complete each course\n pre_req_map.keys.each do |course|\n return false unless can_finish_course(course, pre_req_map, {}, confirmed)\n end\n\n true\nend",
"def good?\n score <= Constants::THRESHOLDS[@class_type]\n end",
"def plan_to_take_course?(course)\n taking_courses.where(:course_id => course).size >0\n end",
"def is_valid_cup_count?\n if (self.large_cup_count.present? || self.medium_cup_count.present? || self.small_cup_count.present?)\n part_small_cup_count = self.small_cup_count || small_cup_count\n part_medium_cup_count = self.medium_cup_count || medium_cup_count\n part_large_cup_count = self.large_cup_count || large_cup_count\n if(part_large_cup_count < part_medium_cup_count && part_medium_cup_count > 0)\n errors.add(:base,\"Large Cup Count should be Greater than Medium Cup Count\") #adds error to Active Model in order to stop record from being saved\n else\n if(part_medium_cup_count < part_small_cup_count && part_small_cup_count > 0)\n errors.add(:base,\"Medium Cup Count should be Greater than Small Cup Count\")\n else\n return true\n end\n end\n end\n end",
"def has_classes?\n c = @context.classes.find{|c| c.document_self}\n c ? true : false\n end",
"def class_min_is_valid?\n if ((self.class_min == nil) or (self.class_max == nil)); return false; end\n return ((self.class_min > 0) and (self.class_max >= self.class_min))\n end",
"def course_full\r\n\t\tmax_enrol = Course.find_by(courseID: courseID).size\r\n\t\tcurrent_enrol = Enrollment.where(courseID: courseID).count\r\n\t\tif current_enrol < max_enrol\r\n\t\t\treturn false\r\n\t\telse\r\n\t\t\treturn true\r\n\t\tend\r\n\r\n\tend",
"def passed?\n [\n semester.min_scholarship_index <= scholarship_index,\n community?,\n professional?\n ].count { |p| p == true} >= 2\n end",
"def over_capacity\n if @students.count >= @capacity\n true\n else\n false\n end\n end",
"def enough_scores?\n self.scores.count > 2 \n end",
"def class_max_is_valid\n errors.add(:class_max,'Invalid class max value.') unless class_max_is_valid?\n end",
"def has_klass?()\n return true unless self[:klass_id].empty?\n end",
"def expected_count?\n return !!expected_count\n end",
"def passed?(transcript, courses_taken)\n return false unless courses_taken.include?(course_id)\n\n passed_minimum_grade?(transcript)\n end",
"def enrolled_fulltime?\n # implicit self\n courses.count >= 3\n # could also be: \n # self.courses.count >= 3\n end",
"def classible?\n %w[a b c d e].any? { |s| __send__(:\"class_#{s}?\") }\n end",
"def program_counter_valid?\n @program_counter >= 0 && @program_counter < @program.size\n end",
"def count_ok?\n\t\tcount <= 5\n\tend",
"def critical?\n course.critical? || course.returned_sheets > 0\n end",
"def can_add_course?\n self.available_courses > 0 || self.clearance?\n end",
"def can_finish(num_courses, prerequisites)\n node_hash = {}\n prerequisites.each do |(a, b)|\n a_node = if node_hash[a]\n node_hash[a]\n else\n node_hash[a] = Node.new(a)\n end\n\n b_node = if node_hash[b]\n node_hash[b]\n else\n node_hash[b] = Node.new(b)\n end\n\n a_node.add_dependency(b_node)\n end\n\n # Now our graph is made, we need to check if it's cyclic\n verified_nodes = {}\n\n node_hash.each do |course, node|\n return false unless can_find_end(node, {}, verified_nodes)\n end\n\n true\nend",
"def profile_finished?\n skills = self.skills.length\n projects = self.projects.length\n experiences = self.experiences.length\n\n skills < 2 || projects < 2 || experiences < 2 ? false : true\n end"
]
| [
"0.6785777",
"0.6499839",
"0.6447862",
"0.60926414",
"0.60425615",
"0.6017673",
"0.601499",
"0.59928703",
"0.5950029",
"0.59366846",
"0.59196985",
"0.59128827",
"0.582566",
"0.57868314",
"0.57623893",
"0.573326",
"0.5698248",
"0.5665097",
"0.5654583",
"0.5654574",
"0.5652654",
"0.5646277",
"0.56270397",
"0.56096184",
"0.5593197",
"0.5575612",
"0.55717623",
"0.5561023",
"0.55543876",
"0.5552291"
]
| 0.8152797 | 0 |
Adds errors if days_of_week_are_valid? returns false | def days_of_week_are_valid
errors.add(:days_of_week, "The days of the week are invalid.") unless days_of_week_are_valid?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def holiday_cannot_be_on_weekends\n if (self.date.strftime(\"%u\") == \"6\" or self.date.strftime(\"%u\") == \"7\")\n errors.add(:date, \"Holiday should not be on weekends\")\n end\n end",
"def holiday_cannot_be_on_weekends\n if (self.date.cwday == 6 or self.date.cwday == 7)\n errors.add(:date, \"Holiday should not be on weekends\")\n end\n end",
"def no_new_users_on_saturday\n\t\tif Time.now.wday == 6\n\t\t\terrors[:base] << \"No new users on saturday.\"\n\t\tend\n\tend",
"def days_of_week_are_valid?\n if (self.sunday == nil); return false; end\n if (self.monday == nil); return false; end\n if (self.tuesday == nil); return false; end\n if (self.wednesday == nil); return false; end\n if (self.thursday == nil); return false; end\n if (self.friday == nil); return false; end\n if (self.saturday == nil); return false; end\n\n if ((self.sunday != true) and (self.sunday != false)); return false; end\n if ((self.monday != true) and (self.monday != false)); return false; end\n if ((self.tuesday != true) and (self.tuesday != false)); return false; end\n if ((self.wednesday != true) and (self.wednesday != false)); return false; end\n if ((self.thursday != true) and (self.thursday != false)); return false; end\n if ((self.friday != true) and (self.friday != false)); return false; end\n if ((self.saturday != true) and (self.saturday != false)); return false; end\n return true\n end",
"def validate_week_of\n input_week_of = self.week_of\n # correct day, assuming input week is a Time object\n # http://ruby-doc.org/core-2.2.0/Time.html#method-i-sunday-3F\n return input_week_of.monday?\n end",
"def check_for_workdays\n if not work_days.empty?\n errors.add(:base, :cannot_delete)\n return false\n end\n end",
"def validate\n\n # no need to validate if disabled\n return if disabled?\n\n # validate that we've filled in all the days\n if rateType == 'Day'\n\n if dayValue == 0\n\n if requireFullWeek == true\n\n # must fill in whole week, and datValue is 0\n errors.add(:dayValue, \"You must supply a day value for all shifts, including weekends\")\n\n else\n\n # requireFullWeek is false\n if (dateValue.wday != 6 && dateValue.wday != 0)\n\n # an entry is not filled in for mon to fri\n errors.add(:dayValue, \"You must supply a day value for each shift, Mon - Fri\")\n \n end\n \n end\n\n end\n\n # return as there is no need to validate anything else\n return\n \n end\n\n # now validating hourly rate entry\n if hours.blank?\n \n # can we allow blank hours?\n if is_bank_hol == false\n \n if requireFullWeek == true\n \n # its not a bank holiday and we need the whole week\n msg = \"Hours must be supplied for all days\"\n\n else\n\n # its not a bank hol and we dont need the whole week\n if (dateValue.wday != 6 && dateValue.wday != 0)\n\n # an entry for mon-fri isnt supplied\n msg = \"Hours must be supplied for Monday - Friday\"\n \n end\n\n end\n \n end\n\n if !msg.blank?\n\n errors.add(:hours, msg)\n\n end\n\n end\n\n # validate start, end and break times\n if !startTime.blank? && !finishTime.blank? && !hours.blank? && requireTimes\n\n time_difference = Time.parse(finishTime) - Time.parse(startTime)\n break_seconds = Time.parse(breakHours) - Time.parse(\"00:00\") unless breakHours.blank?\n time_difference -= break_seconds unless break_seconds.nil?\n specified_hours = Time.parse(hours) - Time.parse(\"00:00\")\n \n if (time_difference <=> specified_hours) != 0\n \n # the time entered in hours doesnt match the calculation\n errors.add(:hours, \"Make sure the hours supplied correctly relates to the time periods\")\n \n end\n\n end\n\n # check times are valid\n if (startTime.blank? || finishTime.blank?)\n \n #logger.info(\"date: #{dateValue}, manual: #{manual}, disabled: #{disabled}, rateType: #{rateType}, rate category: #{rate.category}\")\n \n if requireTimes == true\n\n # if we dont require full week and this is a w/e then dont bother carrying on\n if requireFullWeek == false && (dateValue.wday == 6 || dateValue.wday == 0)\n return\n end\n\n # if we get here then there's a prob so display error\n errors.add(:startTime, \"You must supply start times\") if startTime.blank? && rate.category != 'Unpaid'\n errors.add(:finishTime, \"You must supply finish times\") if finishTime.blank? && rate.category != 'Unpaid'\n\n end\n\n end\n \n end",
"def schedule_day_or_week_must_have_question\n errors.add(:base, \"Either day or week has to contain character ?\") if (schedule_day != \"?\") && (schedule_week != \"?\")\n end",
"def unavailable_dates\n errors[:base] << \"Unavailable dates.(-1)\" if start_date.present? && start_date < Time.zone.today\n errors[:base] << \"Unavailable dates.(-2)\" if (start_date.present? && end_date.present?) && start_date >= end_date\n errors[:base] << \"Unavailable dates.(-3)\" if (start_time.present? && end_time.present?) && start_time >= end_time\n errors[:base] << \"Unavailable dates.(-4)\" if (day_of_week.present? && week_of_month.present?) && ([0,1].exclude?(day_of_week) && week_of_month == 6)\n end",
"def valid?\n return false if [email protected]? && @day > 7\n return false if [email protected]? && @day < 1\n true\n end",
"def at_least_one_day_selected\n unless monday or tuesday or wednesday or thursday or friday or saturday or sunday\n errors.add :on_days, \"At least one day must be selected\"\n end\n end",
"def valid_day_of_week(str)\n n = str.kind_of?(Numeric) ? str : (DATES_MAP[:day][str.to_s.downcase[0,3]]).to_i\n (n >= 1 and n <= 7) ? n : raise(ArgumentError, \"invalid day of the week `#{str}`\") \n end",
"def fee_per_meeting_is_valid\n errors.add(:fee_per_meeting, 'The fee per meeting is invalid.') unless fee_per_meeting_is_valid?\n end",
"def validate\n if self.iso_week_code.to_i == 0\n errors.add(\"iso_week_code\",\"must be a number\")\n return\n end\n \n if self.iso_week_code.length == 1\n self.iso_week_code = \"0\" + self.iso_week_code\n end\n end",
"def check_day_of_week\n if (selected_days.size - 1) > 0 && !selected_days.nil?\n d = Date.today\n weekday = Date::DAYNAMES[d.wday]\n selected_days.include?(weekday)\n else\n return true\n end\n end",
"def day_not_valid?\n return impossible_day_number? && wrong_day_number_in_month\n end",
"def check_day(d)\n\tif !$days.include?(d)\n\t\tputs \"================\"\n\t\tputs \"ERROR MESSAGE!!!\"\n\t\tputs \"\"\n\t\tputs \"Days of the week are:\"\n\t\tputs \"Monday\"\n\t\tputs \"Tuesday\"\n\t\tputs \"Wednesday\"\n\t\tputs \"Thursday\"\n\t\tputs \"Friday\"\n\t\tputs \"Saturday\"\n\t\tputs \"Sunday\"\n\t\traise \"Invalid day entered!\"\n\tend\n\t\n\t# Set the day\n\tset_index_for_cur_day($days.index(d))\nend",
"def appointment_on_is_valid\n return if appointment_on.nil? || !appointment_on_changed?\n\n unless (appointment_on.to_date - Date.today) >= MINIMUM_DAYS\n errors[:appointment_on] << \"should be at least #{MINIMUM_DAYS} days from today\"\n end\n end",
"def check_holiday?\n\t\tunless self.date_of_booking.wday != 0 \n\t\t\tself.errors[:day_validation] << \"=> Booking can't be done on holidays\"\n\t\tend\n\tend",
"def validates_dates\n ( Date.parse(self['birth_date']) rescue errors.add(:birth_date, 'invalid.date') ) if !self['birth_date'].blank?\n ( Date.parse(self['ffck_number_date']) rescue errors.add(:ffck_number_date, 'invalid.date') ) if !self['ffck_number_date'].blank?\n ( Date.parse(self['medical_certificate_date']) rescue errors.add(:medical_certificate_date, 'invalid.date') ) if !self['medical_certificate_date'].blank?\n ( Date.parse(self['tetanus_vaccine_date']) rescue errors.add(:tetanus_vaccine_date, 'invalid.date') ) if !self['tetanus_vaccine_date'].blank?\n end",
"def get_week\n\t week = Time.now.strftime(\"%W\").to_i\n\t wday = Time.now.wday\n\t week = wday <= 3 ? week - 1 : week\n\t \t\n\t # registro = ActivityReport.find(:all, :conditions => {:volunteer_id => self.volunteer_id, :semana => week})\n\t registro = ActivityReport.where(volunteer_id: self.volunteer_id, semana: week)\n\t unless registro.empty?\n\t # DEPRECATION WARNING: ActiveModel::Errors#[]= is deprecated and will be removed in Rails 5.1. Use model.errors.add(:semana, \": Ya existe un registro de esta Semana\") instead. (called from get_week at /vagrant_data/hadronapp/app/models/activity_report.rb:35)\n\t errors[:semana] = \": Ya existe un registro de esta Semana\"\n\t return false\n \tend\n\tend",
"def validate_activity_sdate\n limite = Date.today + 7\n if self.activity_date_start > limite\n errors.add('Fecha Inicio de Actividad: ', \"No se pueden capturar actividades con fecha de inicio mayor a 7 dias a partir del día de hoy\")\n end\n end",
"def check_dates\n calendar = Line.find(self.line_id).calendar\n\n # check empty fields\n if self.start_month.nil? \n unless self.start_date.nil?\n errors.add(:start_date, \"can't be filled if month is empty\")\n end \n else\n if self.start_month <= calendar.months.count\n unless self.start_date <= max_days = calendar.months.find_by(number: self.start_month).days_normal\n errors.add(:start_date, \"can't exceed number of days in the month (#{max_days})\")\n end\n else\n errors.add(:start_month, \"can't be greater than number of months (#{calendar.months.count})\")\n end\n\n end\n\n if self.end_month.nil? \n unless self.end_date.nil?\n errors.add(:end_date, \"can't be filled if month is empty\")\n errors.add(:end_month, \"must not be empty\")\n end \n else\n if self.end_year.nil?\n errors.add(:end_month, \"can't be filled if year is empty\")\n errors.add(:end_year, \"must not be empty\")\n else\n if self.end_year < self.start_year\n errors.add(:end_year, \"can't precede start year\")\n end\n end\n\n if self.end_month <= calendar.months.count\n if self.end_month < self.start_month\n errors.add(:end_month, \"can't precede start month\")\n end\n\n unless self.end_date.nil?\n if self.end_date > max_days = calendar.months.find_by(number: self.end_month).days_normal\n errors.add(:end_date, \"can't exceed number of days in the month (#{max_days})\")\n else\n if self.end_date < self.start_date\n errors.add(:end_date, \"can't precede start date\")\n end\n end\n end\n else\n errors.add(:end_month, \"can't be greater than number of months (#{calendar.months.count})\")\n end\n \n end\n end",
"def on_weekday?\n !WEEKEND_DAYS.include?(wday)\n end",
"def validate_service_exceptions\n if !service_added_dates.reject { |x| x.between?(service_start_date, service_end_date)}.empty?\n errors.add(:service_added_dates, \"service_added_dates must be within service_start_date, service_end_date range\")\n end\n if !service_except_dates.reject { |x| x.between?(service_start_date, service_end_date)}.empty?\n errors.add(:service_except_dates, \"service_except_dates must be within service_start_date, service_end_date range\")\n end\n end",
"def validate_service_exceptions\n if !service_added_dates.reject { |x| x.between?(service_start_date, service_end_date)}.empty?\n errors.add(:service_added_dates, \"service_added_dates must be within service_start_date, service_end_date range\")\n end\n if !service_except_dates.reject { |x| x.between?(service_start_date, service_end_date)}.empty?\n errors.add(:service_except_dates, \"service_except_dates must be within service_start_date, service_end_date range\")\n end\n end",
"def valid_dates\n if !start_date or start_date.month != 1 or start_date.day != 1\n errors.add(\"start_date\", \"Start date must be January 1st\")\n end\n if !end_date or end_date.month != 12 or end_date.day != 31\n errors.add(\"end_date\", \"End date must be December 31st\")\n end\n end",
"def still_valid?\n if Time.now - self.Date < 7 * 24 * 3600 #7 days\n return true\n else\n return false\n end\n end",
"def total_fee_is_valid\n errors.add(:total_fee,'The total fee is invalid.') unless total_fee_is_valid?\n end",
"def delegate_errors\n errors[:start_at].each { |e| errors.add(:start_date, e) } if errors.include?(:start_at)\n errors[:end_at].each { |e| errors.add(:end_date, e) } if errors.include?(:end_at)\n place.errors.full_messages.each { |e| errors.add(:place_reference, e) } if place\n end"
]
| [
"0.7174689",
"0.7134445",
"0.6684376",
"0.6663943",
"0.6574682",
"0.64387727",
"0.64259505",
"0.6385372",
"0.6326706",
"0.63082343",
"0.6243195",
"0.62150246",
"0.6198207",
"0.6071262",
"0.59911764",
"0.5979931",
"0.59618443",
"0.59327656",
"0.59267604",
"0.59069324",
"0.59032995",
"0.58970296",
"0.5865419",
"0.5852306",
"0.58494025",
"0.58494025",
"0.5821792",
"0.57931477",
"0.57755876",
"0.5765943"
]
| 0.90779454 | 0 |
Tests that none of the days for course are nil and that the days's values are either true or false and returns true or false. | def days_of_week_are_valid?
if (self.sunday == nil); return false; end
if (self.monday == nil); return false; end
if (self.tuesday == nil); return false; end
if (self.wednesday == nil); return false; end
if (self.thursday == nil); return false; end
if (self.friday == nil); return false; end
if (self.saturday == nil); return false; end
if ((self.sunday != true) and (self.sunday != false)); return false; end
if ((self.monday != true) and (self.monday != false)); return false; end
if ((self.tuesday != true) and (self.tuesday != false)); return false; end
if ((self.wednesday != true) and (self.wednesday != false)); return false; end
if ((self.thursday != true) and (self.thursday != false)); return false; end
if ((self.friday != true) and (self.friday != false)); return false; end
if ((self.saturday != true) and (self.saturday != false)); return false; end
return true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid?\n return false if [email protected]? && @day > 7\n return false if [email protected]? && @day < 1\n true\n end",
"def perfectDayChecker day\n\t\t\t# If all five prayers were performed\n\t\t\tif day[:fajr] == 2 && day[:zuhr] == 2 && day[:asr] == 2 && day[:maghrib] == 2 && day[:isha] == 2\n\t\t\t \ttrue \t# Return true\n\t\t\telse\n\t\t\t\tfalse\t# Return false\n\t\t\tend\n\t\tend",
"def valid?\n return false if @calendar_type.nil?\n return false if @end_date.nil?\n return false if @end_type.nil?\n return false if @frequency.nil?\n return false if @occurrence_count.nil?\n return false if @pattern_type.nil?\n return false if @period.nil?\n return false if @sliding_flag.nil?\n return false if @start_date.nil?\n return false if @week_start_day.nil?\n return false if @discriminator.nil?\n true\n end",
"def valid?(v)\n day?(v)\n end",
"def check_dates\n if start_end_dates.count > 0 && !start_end_dates.nil?\n start_end_dates.each do |d|\n return true if d.check_date_ranges\n end\n\n false\n else\n true\n end\n end",
"def valid?\n return false if @employee_id.nil?\n return false if @leave_type_id.nil?\n return false if @start_date.nil?\n return false if @end_date.nil?\n return false if @work_pattern.nil?\n return false if @is_pregnancy_related.nil?\n return false if @sufficient_notice.nil?\n true\n end",
"def fixed?\n !moving? && day.present?\n end",
"def completely_valid?\n course_valid = course.valid?\n valid? && course_valid\n end",
"def has_calendar?\n \t\t!calendar.nil?\n \tend",
"def day_not_valid?\n return impossible_day_number? && wrong_day_number_in_month\n end",
"def valid_month_day_combination?\n return false if not @@valid_months.include?(@month)\n return false if not @@valid_days.include?(@day)\n return MmDdYyyyDate.numbers_of_days_in_month(@month) >= @day.to_i\n end",
"def registration_dates_given?\n if registration_start_date.blank? || registration_end_date.blank?\n false\n else\n true\n end\n end",
"def valid?\n return false if @date.nil?\n return false if @campaign_revenue.nil?\n return false if @total_campaign_revenue.nil?\n return false if @campaign_refund.nil?\n return false if @total_campaign_refund.nil?\n return false if @campaign_discount_costs.nil?\n return false if @total_campaign_discount_costs.nil?\n return false if @campaign_refunded_discounts.nil?\n return false if @total_campaign_refunded_discounts.nil?\n return false if @campaign_free_items.nil?\n return false if @total_campaign_free_items.nil?\n return false if @coupon_redemptions.nil?\n return false if @total_coupon_redemptions.nil?\n return false if @coupon_rolledback_redemptions.nil?\n return false if @total_coupon_rolledback_redemptions.nil?\n return false if @referral_redemptions.nil?\n return false if @total_referral_redemptions.nil?\n return false if @coupons_created.nil?\n return false if @total_coupons_created.nil?\n return false if @referrals_created.nil?\n return false if @total_referrals_created.nil?\n return false if @added_loyalty_points.nil?\n return false if @total_added_loyalty_points.nil?\n return false if @deducted_loyalty_points.nil?\n return false if @total_deducted_loyalty_points.nil?\n true\n end",
"def isOpen? date = Date.today\n #no settings, by default it's open\n if self.course_settings.empty? then\n return true\n end\n\n #if the course listing is set to unavailable, then return false\n if !self.course_status.available? then\n return false\n end\n\n # convert the rules to the schedule\n schedule = IceCube::Schedule.new\n self.course_settings.each do |cs|\n case cs.course_setting_property_id\n when 2\n # day of the month\n schedule.add_recurrence_rule(\n IceCube::Rule.weekly.day_of_month(cs.value_int)\n )\n when 3\n # Nth day of the month, value_string should be a json of {week:x, day:y}\n occurance = JSON.parse cs.value_string\n schedule.add_recurrence_rule(\n IceCube::Rule.monthly.day_of_week(occurance[\"day\"].to_i => [occurance[\"week\"].to_i])\n )\n when 4\n Rails.logger.info(\"cs.value_min = #{cs.value_min}, cs.value_max=#{cs.value_max}\")\n # specific date range\n # if it's in the date range then return true\n #return false\n dateRange = Date.parse(cs.value_min)..Date.parse(cs.value_max)\n if dateRange.include? date then\n return true\n end\n else\n # default day of of the week\n schedule.add_recurrence_rule(\n IceCube::Rule.weekly.day(cs.value_int)\n )\n end\n end\n\n return !schedule.occurs_on?(date)\n\n end",
"def date_not_selected(attributes)\n puts attributes\n #puts attributes[\"date(1i)\"].to_i\n #puts attributes[\"date(2i)\"].to_i\n #puts attributes[\"date(3i)\"].to_i\n\n if attributes[\"date(1i)\"].to_i != 0 && attributes[\"date(2i)\"].to_i !=0 &&attributes[\"date(3i)\"].to_i !=0 && attributes[\"date(4i)\"].to_i !=0 && attributes[\"date(5i)\"].to_i !=0\n return false\n else\n return true\n end\n end",
"def verify_nilness_params(yearly_cost, yearly_consumption, floor_space, heat_type, water_cooking_type, nb_residents)\n if yearly_cost.zero? # if he forgot the yearly cost\n false\n else\n if yearly_consumption.zero? # if the consumption is not entered, all the other field must be present\n if [floor_space, nb_residents].include?(0) || [heat_type, water_cooking_type].include?('')\n false\n else\n true\n end\n else\n true\n end\n end\n end",
"def draft_check\n draft_tutorial = self.draft\n draft_chapters = self.chapters.where({draft: true}).empty?\n draft_steps = self.steps.where({draft: true}).empty?\n\n if draft_tutorial == true || draft_chapters == false || draft_steps == false\n return true\n else\n return false\n end\n end",
"def blank_date_parameter?\n (1..3).any? { |position| values[position].blank? }\n end",
"def dates_valid?\n date_check(params[:start_date]) && date_check(params[:end_date]) && dates_sequential?\n end",
"def checked_out?\n unfinished_day.nil?\n end",
"def day?(day)\n return (day_num_elem?(day) or day_sym_elem?(day) or day.day_sym? or day.day_num?)\nend",
"def exam_and_interview_result_exists\n !exam_result.blank? and !interview_result.blank?\n end",
"def past_all_due_dates?\n # If no section due dates /!\\ do not check empty? it could be wrong\n return false if !due_date.nil? && Time.current < due_date\n return false if section_due_dates.any? { |sec| !sec.due_date.nil? && Time.current < sec.due_date }\n\n true\n end",
"def fee_per_meeting_is_valid?\n return ((self.fee_per_meeting != nil) and (self.fee_per_meeting >= 0))\n end",
"def is_corresponding_paydate?(valid_days, day)\r\n valid_days.any? do |current_day| \r\n day.day == current_day || (day.next_day.month != day.month && day.day < current_day)\r\n end\r\n end",
"def valid?\n\t\treturn !(self.show.empty? or self.season.zero? or self.episode.zero?)\n\tend",
"def requirement_satisfied?(time_blocks, course)\n lecture_satisfied = false\n lab_satisfied = !course.lab_required # if lab isn't required, it's satisfied immediately\n tutorial_satisfied = !course.tutorial_required\n time_blocks.each do |tb|\n if (tb.section.course == course)\n if (tb.section_type == 'LectureSection')\n lecture_satisfied = true\n elsif (tb.section_type == 'LabSection')\n lab_satisfied = true\n elsif (tb.section_type == 'TutorialSection')\n tutorial_satisfied = true\n end\n end\n end\n return lecture_satisfied && lab_satisfied && tutorial_satisfied\n end",
"def day?(v = nil)\n super(v || value)\n end",
"def enforced?(events)\n case self.timeframe\n when \"at least once from Monday to Thursday\"\n check = []\n (1..4).each do |d|\n check << !Event.any_event_after?(events.where(day: d), self.hour)\n end\n return check.include?(true)\n when \"on Mondays\"\n events = events.where(day: 1)\n when \"on Tuesdays\"\n events = events.where(day: 2)\n when \"on Wednesdays\"\n events = events.where(day: 3)\n when \"on Thursdays\"\n events = events.where(day: 4)\n when \"on Fridays\"\n events = events.where(day: 5)\n when \"on Saturdays\"\n events = events.where(day: 6)\n when \"on Sundays\"\n events = events.where(day: 0)\n when \"on weekends\"\n events = events.where(day: [0, 6])\n when \"on weekdays\"\n events = events.where(day: 1..5)\n end\n\n case self.adverb\n when \"before\"\n return !Event.any_event_before?(events, self.hour)\n when \"after\"\n return !Event.any_event_after?(events, self.hour)\n when \"at all\"\n return events.count == 0\n end\n end",
"def valid_changeover?\n season = self.season\n changeover = Season.find(season).changeover\n days = self.start_date.wday + self.end_date.wday\n # date.wday returns a value (0-6), sunday is 0, saturday = 6\n # if start_date.wday + end_date.wday = 12 both days are saturday\n if (changeover == false) || (days == 12)\n return true\n else\n return false\n end\n end"
]
| [
"0.6718847",
"0.6342332",
"0.6290253",
"0.6216907",
"0.6163219",
"0.61618423",
"0.61407477",
"0.61189467",
"0.610051",
"0.6086731",
"0.59891325",
"0.5977873",
"0.5975071",
"0.5947247",
"0.5933533",
"0.5908023",
"0.5903136",
"0.5901139",
"0.5900149",
"0.58926564",
"0.5793009",
"0.578971",
"0.57792485",
"0.5772165",
"0.5767669",
"0.5767416",
"0.57616377",
"0.5752084",
"0.5731822",
"0.57178676"
]
| 0.70101815 | 0 |
Adds errors if class_min_is_valid? returns false | def class_min_is_valid
errors.add(:class_min,'Invalid class min value.') unless class_min_is_valid?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def class_max_is_valid\n errors.add(:class_max,'Invalid class max value.') unless class_max_is_valid?\n end",
"def number_of_classes_is_valid\n errors.add(:number_of_classes, 'Invalid number of classes') unless number_of_classes_is_valid?\n end",
"def validate!\n validations.each do |name, attributes|\n valid = instance_variable_get(name)\n case attributes[0]\n when :presence\n raise \"Class object didn't create.\" if valid !~ /^.{1}+/.freeze\n when :format\n raise \"Class object didn't create.\" if valid !~ attributes[1]\n when :type\n raise \"Class object didn't create.\" unless valid.is_a? attributes[1]\n end\n end\n end",
"def subclass_validations ; true ; end",
"def class_min_is_valid?\n if ((self.class_min == nil) or (self.class_max == nil)); return false; end\n return ((self.class_min > 0) and (self.class_max >= self.class_min))\n end",
"def extra_validations\n success\n end",
"def validate\n # add errors if not validate\n end",
"def validations_for(klass)\n validations[klass] ||= []\n end",
"def form_errors_class\n {:class => 'error'}\n end",
"def run_validations!\n super\n include_typecasting_errors\n errors.empty?\n end",
"def validation_class\n if self.required?\n 'required' \n else\n ''\n end\n end",
"def valid?\n super\n errors.empty?\n end",
"def valid?\n @errors = []\n \n validate_instance_numbers!\n \n @errors.empty? \n end",
"def run_validations\n true\n end",
"def valid?\n @errors = []\n if id.blank?\n @errors << {message: \"#{class_name} id cannot be blank.\", variable: \"id\"}\n elsif !possible_values.include?(id)\n @errors << {message: \"#{class_name} id must be included in the table.\", variable: \"id\"}\n end\n \n if class_name.blank?\n @errors << {message: \"Class cannot be blank.\", variable: \"class\"}\n end\n \n @errors.empty?\n end",
"def valid?\n raise \"You must override `valid?' in your class\"\n end",
"def class_max_is_valid?\n if ((self.class_max == nil) or (self.class_min == nil)); return false; end\n return ((self.class_max > 0) and (self.class_max >= self.class_min))\n end",
"def number_of_classes_is_valid?\n return ((self.number_of_classes != nil) and (self.number_of_classes > 0))\n end",
"def test_validates_presence_of_for_ruby_class\n repair_validations(Person) do\n Person.validates_presence_of :karma\n\n p = Person.new\n assert p.invalid?\n\n assert_equal [\"can't be blank\"], p.errors[:karma]\n\n p.karma = \"Cold\"\n assert p.valid?\n end\n end",
"def errors\n self.class.validator.call self\n end",
"def validation_class\n if self.required?\n if self.style == 'drop-down'\n 'validate-selection' \n elsif self.style == 'rating'\n 'validate-rating'\n elsif self.style == 'acceptance'\n 'required'\n else\n 'validate-one-required'\n end\n else\n ''\n end\n end",
"def step_validation\n step_index = form_steps[:pages].index(form_step)\n\n if self.form_steps[:pages].index('title') <= step_index\n self.errors['name'] << 'You must enter a name for the dataset' if self.name.blank? || self.name.strip.blank?\n end\n\n if self.form_steps[:pages].index('connector') <= step_index\n self.errors['type'] << 'You must enter a connector type' unless CONNECTOR_TYPES.include? self.type\n self.errors['provider'] << 'You must enter a connector provider' unless CONNECTOR_PROVIDERS.include? self.provider\n self.errors['connector_url'] << 'You must enter a valid url' \\\n unless self.connector_url && !self.connector_url.blank? && valid_url?(self.connector_url)\n end\n\n if self.form_steps[:pages].index('labels') <= step_index\n unless self.legend && self.legend.is_a?(Hash)\n self.errors['legend'] << 'Labels not correctly defined'\n return\n end\n self.errors['legend'] << 'Latitude and Longitude have to be filled together' if\n self.legend[:lat].blank? ^ self.legend[:long].blank?\n self.errors['legend'] << 'Country and Region have to be filled together' if\n self.legend[:country].blank? ^ self.legend[:region].blank?\n end\n end",
"def set_errors\n \t@errors = []\n\n \tif self.title == \"\"\n \t@errors << \"Title cannot be blank\"\n \tend\n\n if self.user_id == nil\n @errors << \"Must assign to a user\"\n end\n\n if self.category_id == nil\n @errors << \"Must assign to a category\"\n end\n \tend",
"def validity\n msg=\"\"\n valid=true\n unless self.default_location.nil?\n # test si la salle est deja allouee a une classe\n unless self.default_location.class_school.nil? || self.default_location.class_school==self\n msg=\"La salle est déja occupée (#{self.default_location.class_school.ident}) !!\"\n valid=false\n else\n if self.nb_max_student > self.default_location.location_nb_max_person\n msg=\"La salle est trop petite (#{self.default_location.location_nb_max_person}) !!\"\n valid=false\n end\n end\n end\n self.errors.add(:base, \"Class school is not valid:#{msg}\") unless valid\n valid\n end",
"def add_validation_errors(value); end",
"def invalid_field_error_class\n (\"Invalid\" + self.field_name.split(\"_\").map(&:capitalize).join + \\\n \"FieldError\").classify.safe_constantize\n end",
"def validate\r\n validate! rescue false\r\n end",
"def validate\n fail 'sub class to implement'\n end",
"def valid?\n _errors_before = self.errors.dup\n _s = super\n validate_attributes\n _errors_before.each { |e| append_error(_errors_before,e) }\n self.errors.empty?\n end",
"def error_messages_for(clazz)\n if clazz.present? && clazz.errors.present? && clazz.errors.count > 0\n return \"Errors: #{clazz.errors.full_messages}\"\n end\n end"
]
| [
"0.7651848",
"0.7138",
"0.6872949",
"0.686868",
"0.65987456",
"0.6569817",
"0.65232015",
"0.6440607",
"0.6436913",
"0.6407076",
"0.63661844",
"0.6311979",
"0.6305959",
"0.62571955",
"0.62362486",
"0.6199062",
"0.6176973",
"0.6117106",
"0.6106732",
"0.6089589",
"0.60867894",
"0.60607266",
"0.6042482",
"0.59375036",
"0.59290576",
"0.5925978",
"0.5917231",
"0.5915579",
"0.5915475",
"0.5897284"
]
| 0.84453946 | 0 |
Tests that class_min is not nil or that the class_max has not been set. It checks that the class_min is greater than 0 and that the class_max is greater than the class_min. It returns true or false. | def class_min_is_valid?
if ((self.class_min == nil) or (self.class_max == nil)); return false; end
return ((self.class_min > 0) and (self.class_max >= self.class_min))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def class_max_is_valid?\n if ((self.class_max == nil) or (self.class_min == nil)); return false; end\n return ((self.class_max > 0) and (self.class_max >= self.class_min))\n end",
"def between_min_max?(value, min, max) # TODO Repetido en concern/Methods\n return true if value >= min and value <= max\n return false\n end",
"def class_max_is_valid\n errors.add(:class_max,'Invalid class max value.') unless class_max_is_valid?\n end",
"def class_min_is_valid\n errors.add(:class_min,'Invalid class min value.') unless class_min_is_valid?\n end",
"def between_min_max?(value, min, max)\n return true if value >= min and value <= max\n return false\n end",
"def between?(min, max)\n #This is a stub, used for indexing\n end",
"def limits_ok?\n status = true\n if (@min.exp.to_s.include? '/') || (@max.exp.to_s.include? '/')\n return status\n end\n\n if @min.exp.nil? ^ @max.exp.nil?\n @limit_type = :single_sided\n if @typ.exp\n # status = false\n Origen.log.debug \"Spec #{@name} has a typical limit defined with either min or max. They are mutually exclusive, use 'target' when using min or max\"\n end\n elsif @min.exp && @max.exp\n @limit_type = :double_sided\n # Both min and max must be numerical to compare them\n if @min.value.is_a?(Numeric) && @max.value.is_a?(Numeric)\n # Check that min and max make sense\n if @max.value <= @min.value || @min.value >= @max.value\n status = false\n Origen.log.debug \"Spec #{@name} has min (#{@min.value}) and max (#{@max.value}) reversed\"\n end\n # Check that target is OK\n unless @target.nil?\n if @target.value <= @min.value || @target.value >= @max.value\n status = false\n Origen.log.debug \"Spec #{@name} has a target (#{@target.value}) that is not within the min (#{@min.value}) and max #{@max.value}) values\"\n end\n end\n end\n end\n status\n end",
"def check_min_max\n\nend",
"def min_can_not_be_bigger_than_max\n if !max_credits.nil? && !min_credits.nil? && min_credits.to_int > max_credits.to_int\n errors.add(:minimum_credits, \"can't be greater than maximum credits\")\n end\n end",
"def between?(min, max)\n self >= min and self <= max\n end",
"def define_min_and_max\n @min = acceptable_min\n @max = acceptable_max\n\n # If necessary, adjust a value depending on the other\n @min ||= floor\n @max ||= @min + ceiling || ceiling # rubocop:disable Naming/MemoizedInstanceVariableName\n end",
"def test_bounds(val, min, max)\n val >= min && val <= max\n end",
"def between?(value, min = nil, max = nil)\n if min and value < min\n return false\n elsif max and value > max\n return false\n end\n return true\n end",
"def checkcondition(min, max, num)\n if(min<=num and max >= num)\n return true\n else\n return false\n end\n end",
"def valid_range?\n (0..@max_num).cover?(@number)\n end",
"def ensure_bounds\n if self.position > min_position\n self.position = min_position\n false\n elsif self.position < max_position\n self.position = max_position\n false\n else\n true\n end\n end",
"def between(min, max, &block)\n return false unless (1..min).all? { try(&block) }\n (min..max).all? { try(&block) } # only using all?'s shortcut property\n true\n end",
"def out_of_bound?(value, min, max)\n return value > max || value < min\n end",
"def between(num, min, max)\n if min <= num && max >= num\n return true\n else \n return false\n end\nend",
"def number_of_classes_is_valid?\n return ((self.number_of_classes != nil) and (self.number_of_classes > 0))\n end",
"def max_grade_greater_than_min_grade\n if(self.max_grade.to_i < self.min_grade.to_i)\n return \"must be greater than min grade\"\n end\n end",
"def max_and_min_set?(pagefile, min, max)\n logger.trace(\"Checking if #{pagefile} has max and initial disk size values set\")\n powershell_code = <<-CODE\n $page_file = '#{pagefile}';\n $driveLetter = $page_file.split(':')[0];\n $page_file_settings = Get-CimInstance -ClassName Win32_PageFileSetting -Filter \"SettingID='pagefile.sys @ $($driveLetter):'\" -Property * -ErrorAction Stop;\n if ($page_file_settings.InitialSize -eq #{min} -and $page_file_settings.MaximumSize -eq #{max})\n { return $true }\n else\n { return $false }\n CODE\n powershell_exec!(powershell_code).result\n end",
"def validation min, max\n\n end",
"def cover?(low, high = @max)\n return false if coverage == 0 or low.nil?\n @min <= low and low <= @max and high >= @min and high <= @max\n end",
"def between?(min, max)\n utc.between?(min, max)\n end",
"def class_how_full?\n return [self.students.count, self.class_max]\n end",
"def limitcheck(num, lower, upper)\n (num >= lower and num <= upper) && num\n end",
"def limitcheck(num, lower, upper)\n (num >= lower and num <= upper) && num\n end",
"def checkBSTWithMinMax(tree, min, max)\n if tree == nil\n true\n else\n if tree.root <= min or tree.root > max\n false\n else\n if !checkBSTWithMinMax(tree.left, min, tree.root) or !checkBSTWithMinMax(tree.right, tree.root, max)\n false\n else\n true\n end\n end\n end\n\nend",
"def max\n @max ||= define_min_and_max && @max\n end"
]
| [
"0.8976752",
"0.7068911",
"0.69315034",
"0.6750686",
"0.66466933",
"0.65867406",
"0.65733033",
"0.64799",
"0.6456605",
"0.6378076",
"0.6349214",
"0.63116854",
"0.6307662",
"0.6287422",
"0.6140929",
"0.61234784",
"0.61009705",
"0.60757023",
"0.6066163",
"0.6064067",
"0.59955317",
"0.59829086",
"0.5877261",
"0.58112794",
"0.5761173",
"0.5725365",
"0.5722632",
"0.5722632",
"0.5711182",
"0.5691495"
]
| 0.894168 | 1 |
Adds errors if class_max_is_valid? returns false | def class_max_is_valid
errors.add(:class_max,'Invalid class max value.') unless class_max_is_valid?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def number_of_classes_is_valid\n errors.add(:number_of_classes, 'Invalid number of classes') unless number_of_classes_is_valid?\n end",
"def class_min_is_valid\n errors.add(:class_min,'Invalid class min value.') unless class_min_is_valid?\n end",
"def class_max_is_valid?\n if ((self.class_max == nil) or (self.class_min == nil)); return false; end\n return ((self.class_max > 0) and (self.class_max >= self.class_min))\n end",
"def number_of_classes_is_valid?\n return ((self.number_of_classes != nil) and (self.number_of_classes > 0))\n end",
"def class_min_is_valid?\n if ((self.class_min == nil) or (self.class_max == nil)); return false; end\n return ((self.class_min > 0) and (self.class_max >= self.class_min))\n end",
"def validate!\n validations.each do |name, attributes|\n valid = instance_variable_get(name)\n case attributes[0]\n when :presence\n raise \"Class object didn't create.\" if valid !~ /^.{1}+/.freeze\n when :format\n raise \"Class object didn't create.\" if valid !~ attributes[1]\n when :type\n raise \"Class object didn't create.\" unless valid.is_a? attributes[1]\n end\n end\n end",
"def subclass_validations ; true ; end",
"def extra_validations\n r = check_max_allowed_admin_count\n return r unless r.success?\n\n success\n end",
"def validate\n if offering_review_criterion && !score.blank? && score > max_score\n errors.add(:score, \"cannot be greater than the maximum score of #{max_score}\") \n end\n end",
"def validations_for(klass)\n validations[klass] ||= []\n end",
"def reduce_max_times_if_no_more_registrations\n errors.add(:max_times, 'already has more registrations') if max_times_changed? && max_times < registrations.count && max_times != 0\n end",
"def form_errors_class\n {:class => 'error'}\n end",
"def validation min, max\n\n end",
"def valid?\n @errors = []\n \n validate_instance_numbers!\n \n @errors.empty? \n end",
"def invalid_field_error_class\n (\"Invalid\" + self.field_name.split(\"_\").map(&:capitalize).join + \\\n \"FieldError\").classify.safe_constantize\n end",
"def validate_as_component\n counts = Hash.new(0)\n to_ach.each do |record|\n unless record.valid?\n klass = record.class\n errors[\"#{klass}##{counts[klass] += 1}\"] = record.errors\n end\n end\n end",
"def error_messages_for(clazz)\n if clazz.present? && clazz.errors.present? && clazz.errors.count > 0\n return \"Errors: #{clazz.errors.full_messages}\"\n end\n end",
"def pokemon_count_valid?\n if self.trainer.pokemons.count >= 6\n self.errors.add(:team_max, \"Hey, don't get crazy! The max number of pokemons is 6!\")\n end\n end",
"def validity\n msg=\"\"\n valid=true\n unless self.default_location.nil?\n # test si la salle est deja allouee a une classe\n unless self.default_location.class_school.nil? || self.default_location.class_school==self\n msg=\"La salle est déja occupée (#{self.default_location.class_school.ident}) !!\"\n valid=false\n else\n if self.nb_max_student > self.default_location.location_nb_max_person\n msg=\"La salle est trop petite (#{self.default_location.location_nb_max_person}) !!\"\n valid=false\n end\n end\n end\n self.errors.add(:base, \"Class school is not valid:#{msg}\") unless valid\n valid\n end",
"def validate\n # add errors if not validate\n end",
"def run_validations!\n super\n include_typecasting_errors\n errors.empty?\n end",
"def valid?\n @errors = []\n if id.blank?\n @errors << {message: \"#{class_name} id cannot be blank.\", variable: \"id\"}\n elsif !possible_values.include?(id)\n @errors << {message: \"#{class_name} id must be included in the table.\", variable: \"id\"}\n end\n \n if class_name.blank?\n @errors << {message: \"Class cannot be blank.\", variable: \"class\"}\n end\n \n @errors.empty?\n end",
"def extra_validations\n success\n end",
"def participation_validation\n if play_condition.participation_points.blank?\n self.errors.add(:base, \"Количество очков за участие должно быть больше 0\")\n elsif play_condition.difficulty_level.present? && play_condition.difficulty_level.difficulty_level_setting.send(\"#{self.class.to_s.underscore}_max_points\").to_f < play_condition.participation_points.to_f\n self.errors.add(:base, \"Количество очков за участие должно быть не больше #{play_condition.difficulty_level.difficulty_level_setting.send(\"#{self.class.to_s.underscore}_max_points\")}\")\n end\n end",
"def validate_max_number_slides\n errors.add(:base, :too_many_slides) if @lesson && !@slide && Slide.where(:lesson_id => @lesson.id).count == SETTINGS['max_number_slides_in_a_lesson']\n end",
"def validation_max\n validation = validations? && validations.find do |validation|\n validation.kind == :numericality\n end\n if validation\n # We can't determine an appropriate value for :greater_than with a float/decimal column\n raise IndeterminableMaximumAttributeError if validation.options[:less_than] && column? && [:float, :decimal].include?(column.type)\n\n if validation.options[:less_than_or_equal_to]\n return (validation.options[:less_than_or_equal_to].call(object)) if validation.options[:less_than_or_equal_to].kind_of?(Proc)\n return (validation.options[:less_than_or_equal_to])\n end\n\n if validation.options[:less_than]\n return ((validation.options[:less_than].call(object)) - 1) if validation.options[:less_than].kind_of?(Proc)\n return (validation.options[:less_than] - 1)\n end\n end\n end",
"def validation_class\n if self.required?\n 'required' \n else\n ''\n end\n end",
"def validate\n errors.add_to_base(\"Your Volume is to long, can only store 4 characters!\") if self.volume.to_s.length > 4\n errors.add_to_base(\"Your Number is to long, can only store 3 characters!\")if self.number.to_s.length > 3\n errors.add_to_base(\"Your Semester is to long, can only store 6 characters!\")if self.semester.to_s.length > 6\n end",
"def valid?\n return false if @class_id.nil?\n class_id_validator = EnumAttributeValidator.new('String', [\"aaa.AuditRecord\", \"aaa.RetentionConfig\", \"aaa.RetentionPolicy\", \"access.Policy\", \"adapter.ConfigPolicy\", \"adapter.ExtEthInterface\", \"adapter.HostEthInterface\", \"adapter.HostFcInterface\", \"adapter.HostIscsiInterface\", \"adapter.Unit\", \"adapter.UnitExpander\", \"appliance.AppStatus\", \"appliance.AutoRmaPolicy\", \"appliance.Backup\", \"appliance.BackupPolicy\", \"appliance.CertificateSetting\", \"appliance.DataExportPolicy\", \"appliance.DeviceCertificate\", \"appliance.DeviceClaim\", \"appliance.DeviceUpgradePolicy\", \"appliance.DiagSetting\", \"appliance.ExternalSyslogSetting\", \"appliance.FileGateway\", \"appliance.FileSystemStatus\", \"appliance.GroupStatus\", \"appliance.ImageBundle\", \"appliance.NodeInfo\", \"appliance.NodeStatus\", \"appliance.ReleaseNote\", \"appliance.RemoteFileImport\", \"appliance.Restore\", \"appliance.SetupInfo\", \"appliance.SystemInfo\", \"appliance.SystemStatus\", \"appliance.Upgrade\", \"appliance.UpgradePolicy\", \"asset.ClusterMember\", \"asset.Deployment\", \"asset.DeploymentDevice\", \"asset.DeviceClaim\", \"asset.DeviceConfiguration\", \"asset.DeviceConnectorManager\", \"asset.DeviceContractInformation\", \"asset.DeviceRegistration\", \"asset.Subscription\", \"asset.SubscriptionAccount\", \"asset.SubscriptionDeviceContractInformation\", \"asset.Target\", \"bios.BootDevice\", \"bios.BootMode\", \"bios.Policy\", \"bios.SystemBootOrder\", \"bios.TokenSettings\", \"bios.Unit\", \"bios.VfSelectMemoryRasConfiguration\", \"boot.CddDevice\", \"boot.DeviceBootMode\", \"boot.DeviceBootSecurity\", \"boot.HddDevice\", \"boot.IscsiDevice\", \"boot.NvmeDevice\", \"boot.PchStorageDevice\", \"boot.PrecisionPolicy\", \"boot.PxeDevice\", \"boot.SanDevice\", \"boot.SdDevice\", \"boot.UefiShellDevice\", \"boot.UsbDevice\", \"boot.VmediaDevice\", \"bulk.Export\", \"bulk.ExportedItem\", \"bulk.MoCloner\", \"bulk.MoMerger\", \"bulk.Request\", \"bulk.SubRequestObj\", \"capability.AdapterUnitDescriptor\", \"capability.Catalog\", \"capability.ChassisDescriptor\", \"capability.ChassisManufacturingDef\", \"capability.CimcFirmwareDescriptor\", \"capability.EquipmentPhysicalDef\", \"capability.EquipmentSlotArray\", \"capability.FanModuleDescriptor\", \"capability.FanModuleManufacturingDef\", \"capability.IoCardCapabilityDef\", \"capability.IoCardDescriptor\", \"capability.IoCardManufacturingDef\", \"capability.PortGroupAggregationDef\", \"capability.PsuDescriptor\", \"capability.PsuManufacturingDef\", \"capability.ServerSchemaDescriptor\", \"capability.SiocModuleCapabilityDef\", \"capability.SiocModuleDescriptor\", \"capability.SiocModuleManufacturingDef\", \"capability.SwitchCapability\", \"capability.SwitchDescriptor\", \"capability.SwitchManufacturingDef\", \"certificatemanagement.Policy\", \"chassis.ConfigChangeDetail\", \"chassis.ConfigImport\", \"chassis.ConfigResult\", \"chassis.ConfigResultEntry\", \"chassis.IomProfile\", \"chassis.Profile\", \"cloud.AwsBillingUnit\", \"cloud.AwsKeyPair\", \"cloud.AwsNetworkInterface\", \"cloud.AwsOrganizationalUnit\", \"cloud.AwsSecurityGroup\", \"cloud.AwsSubnet\", \"cloud.AwsVirtualMachine\", \"cloud.AwsVolume\", \"cloud.AwsVpc\", \"cloud.CollectInventory\", \"cloud.Regions\", \"cloud.SkuContainerType\", \"cloud.SkuDatabaseType\", \"cloud.SkuInstanceType\", \"cloud.SkuNetworkType\", \"cloud.SkuRegionRateCards\", \"cloud.SkuVolumeType\", \"cloud.TfcAgentpool\", \"cloud.TfcOrganization\", \"cloud.TfcWorkspace\", \"comm.HttpProxyPolicy\", \"compute.BiosPostPolicy\", \"compute.Blade\", \"compute.BladeIdentity\", \"compute.Board\", \"compute.Mapping\", \"compute.PhysicalSummary\", \"compute.RackUnit\", \"compute.RackUnitIdentity\", \"compute.ServerPowerPolicy\", \"compute.ServerSetting\", \"compute.Vmedia\", \"cond.Alarm\", \"cond.AlarmAggregation\", \"cond.HclStatus\", \"cond.HclStatusDetail\", \"cond.HclStatusJob\", \"connectorpack.ConnectorPackUpgrade\", \"connectorpack.UpgradeImpact\", \"convergedinfra.HealthCheckDefinition\", \"convergedinfra.HealthCheckExecution\", \"convergedinfra.Pod\", \"crd.CustomResource\", \"deviceconnector.Policy\", \"equipment.Chassis\", \"equipment.ChassisIdentity\", \"equipment.ChassisOperation\", \"equipment.DeviceSummary\", \"equipment.ExpanderModule\", \"equipment.Fan\", \"equipment.FanControl\", \"equipment.FanModule\", \"equipment.Fex\", \"equipment.FexIdentity\", \"equipment.FexOperation\", \"equipment.Fru\", \"equipment.IdentitySummary\", \"equipment.IoCard\", \"equipment.IoCardOperation\", \"equipment.IoExpander\", \"equipment.LocatorLed\", \"equipment.Psu\", \"equipment.PsuControl\", \"equipment.RackEnclosure\", \"equipment.RackEnclosureSlot\", \"equipment.SharedIoModule\", \"equipment.SwitchCard\", \"equipment.SystemIoController\", \"equipment.Tpm\", \"equipment.Transceiver\", \"ether.HostPort\", \"ether.NetworkPort\", \"ether.PhysicalPort\", \"ether.PortChannel\", \"externalsite.Authorization\", \"fabric.AppliancePcRole\", \"fabric.ApplianceRole\", \"fabric.ConfigChangeDetail\", \"fabric.ConfigResult\", \"fabric.ConfigResultEntry\", \"fabric.ElementIdentity\", \"fabric.EstimateImpact\", \"fabric.EthNetworkControlPolicy\", \"fabric.EthNetworkGroupPolicy\", \"fabric.EthNetworkPolicy\", \"fabric.FcNetworkPolicy\", \"fabric.FcUplinkPcRole\", \"fabric.FcUplinkRole\", \"fabric.FcoeUplinkPcRole\", \"fabric.FcoeUplinkRole\", \"fabric.FlowControlPolicy\", \"fabric.LinkAggregationPolicy\", \"fabric.LinkControlPolicy\", \"fabric.MulticastPolicy\", \"fabric.PcMember\", \"fabric.PcOperation\", \"fabric.PortMode\", \"fabric.PortOperation\", \"fabric.PortPolicy\", \"fabric.ServerRole\", \"fabric.SwitchClusterProfile\", \"fabric.SwitchControlPolicy\", \"fabric.SwitchProfile\", \"fabric.SystemQosPolicy\", \"fabric.UplinkPcRole\", \"fabric.UplinkRole\", \"fabric.Vlan\", \"fabric.Vsan\", \"fault.Instance\", \"fc.PhysicalPort\", \"fc.PortChannel\", \"fcpool.FcBlock\", \"fcpool.Lease\", \"fcpool.Pool\", \"fcpool.PoolMember\", \"fcpool.Universe\", \"feedback.FeedbackPost\", \"firmware.BiosDescriptor\", \"firmware.BoardControllerDescriptor\", \"firmware.ChassisUpgrade\", \"firmware.CimcDescriptor\", \"firmware.DimmDescriptor\", \"firmware.Distributable\", \"firmware.DistributableMeta\", \"firmware.DriveDescriptor\", \"firmware.DriverDistributable\", \"firmware.Eula\", \"firmware.FirmwareSummary\", \"firmware.GpuDescriptor\", \"firmware.HbaDescriptor\", \"firmware.IomDescriptor\", \"firmware.MswitchDescriptor\", \"firmware.NxosDescriptor\", \"firmware.PcieDescriptor\", \"firmware.PsuDescriptor\", \"firmware.RunningFirmware\", \"firmware.SasExpanderDescriptor\", \"firmware.ServerConfigurationUtilityDistributable\", \"firmware.StorageControllerDescriptor\", \"firmware.SwitchUpgrade\", \"firmware.UnsupportedVersionUpgrade\", \"firmware.Upgrade\", \"firmware.UpgradeImpact\", \"firmware.UpgradeImpactStatus\", \"firmware.UpgradeStatus\", \"forecast.Catalog\", \"forecast.Definition\", \"forecast.Instance\", \"graphics.Card\", \"graphics.Controller\", \"hcl.CompatibilityStatus\", \"hcl.DriverImage\", \"hcl.ExemptedCatalog\", \"hcl.HyperflexSoftwareCompatibilityInfo\", \"hcl.OperatingSystem\", \"hcl.OperatingSystemVendor\", \"hcl.SupportedDriverName\", \"hyperflex.Alarm\", \"hyperflex.AppCatalog\", \"hyperflex.AutoSupportPolicy\", \"hyperflex.BackupCluster\", \"hyperflex.CapabilityInfo\", \"hyperflex.CiscoHypervisorManager\", \"hyperflex.Cluster\", \"hyperflex.ClusterBackupPolicy\", \"hyperflex.ClusterBackupPolicyDeployment\", \"hyperflex.ClusterBackupPolicyInventory\", \"hyperflex.ClusterHealthCheckExecutionSnapshot\", \"hyperflex.ClusterNetworkPolicy\", \"hyperflex.ClusterProfile\", \"hyperflex.ClusterReplicationNetworkPolicy\", \"hyperflex.ClusterReplicationNetworkPolicyDeployment\", \"hyperflex.ClusterStoragePolicy\", \"hyperflex.ConfigResult\", \"hyperflex.ConfigResultEntry\", \"hyperflex.DataProtectionPeer\", \"hyperflex.DatastoreStatistic\", \"hyperflex.DevicePackageDownloadState\", \"hyperflex.Drive\", \"hyperflex.ExtFcStoragePolicy\", \"hyperflex.ExtIscsiStoragePolicy\", \"hyperflex.FeatureLimitExternal\", \"hyperflex.FeatureLimitInternal\", \"hyperflex.Health\", \"hyperflex.HealthCheckDefinition\", \"hyperflex.HealthCheckExecution\", \"hyperflex.HealthCheckExecutionSnapshot\", \"hyperflex.HealthCheckPackageChecksum\", \"hyperflex.HxapCluster\", \"hyperflex.HxapDatacenter\", \"hyperflex.HxapDvUplink\", \"hyperflex.HxapDvswitch\", \"hyperflex.HxapHost\", \"hyperflex.HxapHostInterface\", \"hyperflex.HxapHostVswitch\", \"hyperflex.HxapNetwork\", \"hyperflex.HxapVirtualDisk\", \"hyperflex.HxapVirtualMachine\", \"hyperflex.HxapVirtualMachineNetworkInterface\", \"hyperflex.HxdpVersion\", \"hyperflex.License\", \"hyperflex.LocalCredentialPolicy\", \"hyperflex.Node\", \"hyperflex.NodeConfigPolicy\", \"hyperflex.NodeProfile\", \"hyperflex.ProtectedCluster\", \"hyperflex.ProxySettingPolicy\", \"hyperflex.ServerFirmwareVersion\", \"hyperflex.ServerFirmwareVersionEntry\", \"hyperflex.ServerModel\", \"hyperflex.ServiceAuthToken\", \"hyperflex.SoftwareDistributionComponent\", \"hyperflex.SoftwareDistributionEntry\", \"hyperflex.SoftwareDistributionVersion\", \"hyperflex.SoftwareVersionPolicy\", \"hyperflex.StorageContainer\", \"hyperflex.SysConfigPolicy\", \"hyperflex.UcsmConfigPolicy\", \"hyperflex.VcenterConfigPolicy\", \"hyperflex.VmBackupInfo\", \"hyperflex.VmImportOperation\", \"hyperflex.VmRestoreOperation\", \"hyperflex.VmSnapshotInfo\", \"hyperflex.Volume\", \"hyperflex.WitnessConfiguration\", \"iaas.ConnectorPack\", \"iaas.DeviceStatus\", \"iaas.DiagnosticMessages\", \"iaas.LicenseInfo\", \"iaas.MostRunTasks\", \"iaas.ServiceRequest\", \"iaas.UcsdInfo\", \"iaas.UcsdManagedInfra\", \"iaas.UcsdMessages\", \"iam.Account\", \"iam.AccountExperience\", \"iam.ApiKey\", \"iam.AppRegistration\", \"iam.BannerMessage\", \"iam.Certificate\", \"iam.CertificateRequest\", \"iam.DomainGroup\", \"iam.EndPointPrivilege\", \"iam.EndPointRole\", \"iam.EndPointUser\", \"iam.EndPointUserPolicy\", \"iam.EndPointUserRole\", \"iam.Idp\", \"iam.IdpReference\", \"iam.IpAccessManagement\", \"iam.IpAddress\", \"iam.LdapGroup\", \"iam.LdapPolicy\", \"iam.LdapProvider\", \"iam.LocalUserPassword\", \"iam.LocalUserPasswordPolicy\", \"iam.OAuthToken\", \"iam.Permission\", \"iam.PrivateKeySpec\", \"iam.Privilege\", \"iam.PrivilegeSet\", \"iam.Qualifier\", \"iam.ResourceLimits\", \"iam.ResourcePermission\", \"iam.ResourceRoles\", \"iam.Role\", \"iam.SecurityHolder\", \"iam.ServiceProvider\", \"iam.Session\", \"iam.SessionLimits\", \"iam.System\", \"iam.TrustPoint\", \"iam.User\", \"iam.UserGroup\", \"iam.UserPreference\", \"inventory.DeviceInfo\", \"inventory.DnMoBinding\", \"inventory.GenericInventory\", \"inventory.GenericInventoryHolder\", \"inventory.Request\", \"ipmioverlan.Policy\", \"ippool.BlockLease\", \"ippool.IpLease\", \"ippool.Pool\", \"ippool.PoolMember\", \"ippool.ShadowBlock\", \"ippool.ShadowPool\", \"ippool.Universe\", \"iqnpool.Block\", \"iqnpool.Lease\", \"iqnpool.Pool\", \"iqnpool.PoolMember\", \"iqnpool.Universe\", \"iwotenant.TenantStatus\", \"kubernetes.AciCniApic\", \"kubernetes.AciCniProfile\", \"kubernetes.AciCniTenantClusterAllocation\", \"kubernetes.AddonDefinition\", \"kubernetes.AddonPolicy\", \"kubernetes.AddonRepository\", \"kubernetes.BaremetalNodeProfile\", \"kubernetes.Catalog\", \"kubernetes.Cluster\", \"kubernetes.ClusterAddonProfile\", \"kubernetes.ClusterProfile\", \"kubernetes.ConfigResult\", \"kubernetes.ConfigResultEntry\", \"kubernetes.ContainerRuntimePolicy\", \"kubernetes.DaemonSet\", \"kubernetes.Deployment\", \"kubernetes.Ingress\", \"kubernetes.NetworkPolicy\", \"kubernetes.Node\", \"kubernetes.NodeGroupProfile\", \"kubernetes.Pod\", \"kubernetes.Service\", \"kubernetes.StatefulSet\", \"kubernetes.SysConfigPolicy\", \"kubernetes.TrustedRegistriesPolicy\", \"kubernetes.Version\", \"kubernetes.VersionPolicy\", \"kubernetes.VirtualMachineInfraConfigPolicy\", \"kubernetes.VirtualMachineInfrastructureProvider\", \"kubernetes.VirtualMachineInstanceType\", \"kubernetes.VirtualMachineNodeProfile\", \"kvm.Policy\", \"kvm.Session\", \"kvm.Tunnel\", \"license.AccountLicenseData\", \"license.CustomerOp\", \"license.IwoCustomerOp\", \"license.IwoLicenseCount\", \"license.LicenseInfo\", \"license.LicenseReservationOp\", \"license.SmartlicenseToken\", \"ls.ServiceProfile\", \"macpool.IdBlock\", \"macpool.Lease\", \"macpool.Pool\", \"macpool.PoolMember\", \"macpool.Universe\", \"management.Controller\", \"management.Entity\", \"management.Interface\", \"memory.Array\", \"memory.PersistentMemoryConfigResult\", \"memory.PersistentMemoryConfiguration\", \"memory.PersistentMemoryNamespace\", \"memory.PersistentMemoryNamespaceConfigResult\", \"memory.PersistentMemoryPolicy\", \"memory.PersistentMemoryRegion\", \"memory.PersistentMemoryUnit\", \"memory.Unit\", \"meta.Definition\", \"network.Element\", \"network.ElementSummary\", \"network.FcZoneInfo\", \"network.VlanPortInfo\", \"networkconfig.Policy\", \"niaapi.ApicCcoPost\", \"niaapi.ApicFieldNotice\", \"niaapi.ApicHweol\", \"niaapi.ApicLatestMaintainedRelease\", \"niaapi.ApicReleaseRecommend\", \"niaapi.ApicSweol\", \"niaapi.DcnmCcoPost\", \"niaapi.DcnmFieldNotice\", \"niaapi.DcnmHweol\", \"niaapi.DcnmLatestMaintainedRelease\", \"niaapi.DcnmReleaseRecommend\", \"niaapi.DcnmSweol\", \"niaapi.FileDownloader\", \"niaapi.NiaMetadata\", \"niaapi.NibFileDownloader\", \"niaapi.NibMetadata\", \"niaapi.VersionRegex\", \"niatelemetry.AaaLdapProviderDetails\", \"niatelemetry.AaaRadiusProviderDetails\", \"niatelemetry.AaaTacacsProviderDetails\", \"niatelemetry.ApicAppPluginDetails\", \"niatelemetry.ApicCoreFileDetails\", \"niatelemetry.ApicDbgexpRsExportDest\", \"niatelemetry.ApicDbgexpRsTsScheduler\", \"niatelemetry.ApicFanDetails\", \"niatelemetry.ApicFexDetails\", \"niatelemetry.ApicFlashDetails\", \"niatelemetry.ApicNtpAuth\", \"niatelemetry.ApicPsuDetails\", \"niatelemetry.ApicRealmDetails\", \"niatelemetry.ApicSnmpClientGrpDetails\", \"niatelemetry.ApicSnmpCommunityAccessDetails\", \"niatelemetry.ApicSnmpCommunityDetails\", \"niatelemetry.ApicSnmpTrapDetails\", \"niatelemetry.ApicSnmpTrapFwdServerDetails\", \"niatelemetry.ApicSnmpVersionThreeDetails\", \"niatelemetry.ApicSysLogGrp\", \"niatelemetry.ApicSysLogSrc\", \"niatelemetry.ApicTransceiverDetails\", \"niatelemetry.ApicUiPageCounts\", \"niatelemetry.AppDetails\", \"niatelemetry.CommonPolicies\", \"niatelemetry.DcnmFanDetails\", \"niatelemetry.DcnmFexDetails\", \"niatelemetry.DcnmModuleDetails\", \"niatelemetry.DcnmPsuDetails\", \"niatelemetry.DcnmTransceiverDetails\", \"niatelemetry.Epg\", \"niatelemetry.FabricModuleDetails\", \"niatelemetry.FabricPodProfile\", \"niatelemetry.FabricPodSs\", \"niatelemetry.Fault\", \"niatelemetry.HttpsAclContractDetails\", \"niatelemetry.HttpsAclContractFilterMap\", \"niatelemetry.HttpsAclEpgContractMap\", \"niatelemetry.HttpsAclEpgDetails\", \"niatelemetry.HttpsAclFilterDetails\", \"niatelemetry.Lc\", \"niatelemetry.MsoContractDetails\", \"niatelemetry.MsoEpgDetails\", \"niatelemetry.MsoSchemaDetails\", \"niatelemetry.MsoSiteDetails\", \"niatelemetry.MsoTenantDetails\", \"niatelemetry.NexusDashboardControllerDetails\", \"niatelemetry.NexusDashboardDetails\", \"niatelemetry.NexusDashboardMemoryDetails\", \"niatelemetry.NexusDashboards\", \"niatelemetry.NiaFeatureUsage\", \"niatelemetry.NiaInventory\", \"niatelemetry.NiaInventoryDcnm\", \"niatelemetry.NiaInventoryFabric\", \"niatelemetry.NiaLicenseState\", \"niatelemetry.PasswordStrengthCheck\", \"niatelemetry.PodCommPolicies\", \"niatelemetry.PodSnmpPolicies\", \"niatelemetry.PodTimeServerPolicies\", \"niatelemetry.SiteInventory\", \"niatelemetry.SnmpSrc\", \"niatelemetry.SshVersionTwo\", \"niatelemetry.SupervisorModuleDetails\", \"niatelemetry.SyslogRemoteDest\", \"niatelemetry.SyslogSysMsg\", \"niatelemetry.SyslogSysMsgFacFilter\", \"niatelemetry.SystemControllerDetails\", \"niatelemetry.Tenant\", \"notification.AccountSubscription\", \"ntp.Policy\", \"oprs.Deployment\", \"oprs.SyncTargetListMessage\", \"organization.Organization\", \"os.BulkInstallInfo\", \"os.Catalog\", \"os.ConfigurationFile\", \"os.Distribution\", \"os.Install\", \"os.OsSupport\", \"os.SupportedVersion\", \"os.TemplateFile\", \"os.ValidInstallTarget\", \"pci.CoprocessorCard\", \"pci.Device\", \"pci.Link\", \"pci.Switch\", \"port.Group\", \"port.MacBinding\", \"port.SubGroup\", \"power.ControlState\", \"power.Policy\", \"processor.Unit\", \"rack.UnitPersonality\", \"recommendation.CapacityRunway\", \"recommendation.PhysicalItem\", \"recovery.BackupConfigPolicy\", \"recovery.BackupProfile\", \"recovery.ConfigResult\", \"recovery.ConfigResultEntry\", \"recovery.OnDemandBackup\", \"recovery.Restore\", \"recovery.ScheduleConfigPolicy\", \"resource.Group\", \"resource.GroupMember\", \"resource.LicenseResourceCount\", \"resource.Membership\", \"resource.MembershipHolder\", \"resource.Reservation\", \"resourcepool.Lease\", \"resourcepool.LeaseResource\", \"resourcepool.Pool\", \"resourcepool.PoolMember\", \"resourcepool.Universe\", \"rproxy.ReverseProxy\", \"sdcard.Policy\", \"sdwan.Profile\", \"sdwan.RouterNode\", \"sdwan.RouterPolicy\", \"sdwan.VmanageAccountPolicy\", \"search.SearchItem\", \"search.TagItem\", \"security.Unit\", \"server.ConfigChangeDetail\", \"server.ConfigImport\", \"server.ConfigResult\", \"server.ConfigResultEntry\", \"server.Profile\", \"server.ProfileTemplate\", \"smtp.Policy\", \"snmp.Policy\", \"software.ApplianceDistributable\", \"software.DownloadHistory\", \"software.HclMeta\", \"software.HyperflexBundleDistributable\", \"software.HyperflexDistributable\", \"software.ReleaseMeta\", \"software.SolutionDistributable\", \"software.UcsdBundleDistributable\", \"software.UcsdDistributable\", \"softwarerepository.Authorization\", \"softwarerepository.CachedImage\", \"softwarerepository.Catalog\", \"softwarerepository.CategoryMapper\", \"softwarerepository.CategoryMapperModel\", \"softwarerepository.CategorySupportConstraint\", \"softwarerepository.DownloadSpec\", \"softwarerepository.OperatingSystemFile\", \"softwarerepository.Release\", \"sol.Policy\", \"ssh.Policy\", \"storage.Controller\", \"storage.DiskGroup\", \"storage.DiskSlot\", \"storage.DriveGroup\", \"storage.Enclosure\", \"storage.EnclosureDisk\", \"storage.EnclosureDiskSlotEp\", \"storage.FlexFlashController\", \"storage.FlexFlashControllerProps\", \"storage.FlexFlashPhysicalDrive\", \"storage.FlexFlashVirtualDrive\", \"storage.FlexUtilController\", \"storage.FlexUtilPhysicalDrive\", \"storage.FlexUtilVirtualDrive\", \"storage.HitachiArray\", \"storage.HitachiController\", \"storage.HitachiDisk\", \"storage.HitachiHost\", \"storage.HitachiHostLun\", \"storage.HitachiParityGroup\", \"storage.HitachiPool\", \"storage.HitachiPort\", \"storage.HitachiVolume\", \"storage.HyperFlexStorageContainer\", \"storage.HyperFlexVolume\", \"storage.Item\", \"storage.NetAppAggregate\", \"storage.NetAppBaseDisk\", \"storage.NetAppCluster\", \"storage.NetAppEthernetPort\", \"storage.NetAppExportPolicy\", \"storage.NetAppFcInterface\", \"storage.NetAppFcPort\", \"storage.NetAppInitiatorGroup\", \"storage.NetAppIpInterface\", \"storage.NetAppLicense\", \"storage.NetAppLun\", \"storage.NetAppLunMap\", \"storage.NetAppNode\", \"storage.NetAppNtpServer\", \"storage.NetAppSensor\", \"storage.NetAppStorageVm\", \"storage.NetAppVolume\", \"storage.NetAppVolumeSnapshot\", \"storage.PhysicalDisk\", \"storage.PhysicalDiskExtension\", \"storage.PhysicalDiskUsage\", \"storage.PureArray\", \"storage.PureController\", \"storage.PureDisk\", \"storage.PureHost\", \"storage.PureHostGroup\", \"storage.PureHostLun\", \"storage.PurePort\", \"storage.PureProtectionGroup\", \"storage.PureProtectionGroupSnapshot\", \"storage.PureReplicationSchedule\", \"storage.PureSnapshotSchedule\", \"storage.PureVolume\", \"storage.PureVolumeSnapshot\", \"storage.SasExpander\", \"storage.SasPort\", \"storage.Span\", \"storage.StoragePolicy\", \"storage.VdMemberEp\", \"storage.VirtualDrive\", \"storage.VirtualDriveContainer\", \"storage.VirtualDriveExtension\", \"storage.VirtualDriveIdentity\", \"syslog.Policy\", \"tam.AdvisoryCount\", \"tam.AdvisoryDefinition\", \"tam.AdvisoryInfo\", \"tam.AdvisoryInstance\", \"tam.SecurityAdvisory\", \"task.HitachiScopedInventory\", \"task.HxapScopedInventory\", \"task.NetAppScopedInventory\", \"task.PublicCloudScopedInventory\", \"task.PureScopedInventory\", \"task.ServerScopedInventory\", \"techsupportmanagement.CollectionControlPolicy\", \"techsupportmanagement.Download\", \"techsupportmanagement.TechSupportBundle\", \"techsupportmanagement.TechSupportStatus\", \"terminal.AuditLog\", \"terraform.Executor\", \"thermal.Policy\", \"top.System\", \"ucsd.BackupInfo\", \"uuidpool.Block\", \"uuidpool.Pool\", \"uuidpool.PoolMember\", \"uuidpool.Universe\", \"uuidpool.UuidLease\", \"virtualization.Host\", \"virtualization.VirtualDisk\", \"virtualization.VirtualMachine\", \"virtualization.VirtualNetwork\", \"virtualization.VmwareCluster\", \"virtualization.VmwareDatacenter\", \"virtualization.VmwareDatastore\", \"virtualization.VmwareDatastoreCluster\", \"virtualization.VmwareDistributedNetwork\", \"virtualization.VmwareDistributedSwitch\", \"virtualization.VmwareFolder\", \"virtualization.VmwareHost\", \"virtualization.VmwareKernelNetwork\", \"virtualization.VmwareNetwork\", \"virtualization.VmwarePhysicalNetworkInterface\", \"virtualization.VmwareUplinkPort\", \"virtualization.VmwareVcenter\", \"virtualization.VmwareVirtualDisk\", \"virtualization.VmwareVirtualMachine\", \"virtualization.VmwareVirtualMachineSnapshot\", \"virtualization.VmwareVirtualNetworkInterface\", \"virtualization.VmwareVirtualSwitch\", \"vmedia.Policy\", \"vmrc.Console\", \"vnc.Console\", \"vnic.EthAdapterPolicy\", \"vnic.EthIf\", \"vnic.EthNetworkPolicy\", \"vnic.EthQosPolicy\", \"vnic.FcAdapterPolicy\", \"vnic.FcIf\", \"vnic.FcNetworkPolicy\", \"vnic.FcQosPolicy\", \"vnic.IscsiAdapterPolicy\", \"vnic.IscsiBootPolicy\", \"vnic.IscsiStaticTargetPolicy\", \"vnic.LanConnectivityPolicy\", \"vnic.LcpStatus\", \"vnic.SanConnectivityPolicy\", \"vnic.ScpStatus\", \"vrf.Vrf\", \"workflow.BatchApiExecutor\", \"workflow.BuildTaskMeta\", \"workflow.BuildTaskMetaOwner\", \"workflow.Catalog\", \"workflow.CustomDataTypeDefinition\", \"workflow.ErrorResponseHandler\", \"workflow.PendingDynamicWorkflowInfo\", \"workflow.RollbackWorkflow\", \"workflow.SolutionActionDefinition\", \"workflow.SolutionActionInstance\", \"workflow.SolutionDefinition\", \"workflow.SolutionInstance\", \"workflow.SolutionOutput\", \"workflow.TaskDebugLog\", \"workflow.TaskDefinition\", \"workflow.TaskInfo\", \"workflow.TaskMetadata\", \"workflow.TaskNotification\", \"workflow.TemplateEvaluation\", \"workflow.TemplateFunctionMeta\", \"workflow.WorkflowDefinition\", \"workflow.WorkflowInfo\", \"workflow.WorkflowMeta\", \"workflow.WorkflowMetadata\", \"workflow.WorkflowNotification\"])\n return false unless class_id_validator.valid?(@class_id)\n return false if @object_type.nil?\n object_type_validator = EnumAttributeValidator.new('String', [\"aaa.AuditRecord\", \"aaa.RetentionConfig\", \"aaa.RetentionPolicy\", \"access.Policy\", \"adapter.ConfigPolicy\", \"adapter.ExtEthInterface\", \"adapter.HostEthInterface\", \"adapter.HostFcInterface\", \"adapter.HostIscsiInterface\", \"adapter.Unit\", \"adapter.UnitExpander\", \"appliance.AppStatus\", \"appliance.AutoRmaPolicy\", \"appliance.Backup\", \"appliance.BackupPolicy\", \"appliance.CertificateSetting\", \"appliance.DataExportPolicy\", \"appliance.DeviceCertificate\", \"appliance.DeviceClaim\", \"appliance.DeviceUpgradePolicy\", \"appliance.DiagSetting\", \"appliance.ExternalSyslogSetting\", \"appliance.FileGateway\", \"appliance.FileSystemStatus\", \"appliance.GroupStatus\", \"appliance.ImageBundle\", \"appliance.NodeInfo\", \"appliance.NodeStatus\", \"appliance.ReleaseNote\", \"appliance.RemoteFileImport\", \"appliance.Restore\", \"appliance.SetupInfo\", \"appliance.SystemInfo\", \"appliance.SystemStatus\", \"appliance.Upgrade\", \"appliance.UpgradePolicy\", \"asset.ClusterMember\", \"asset.Deployment\", \"asset.DeploymentDevice\", \"asset.DeviceClaim\", \"asset.DeviceConfiguration\", \"asset.DeviceConnectorManager\", \"asset.DeviceContractInformation\", \"asset.DeviceRegistration\", \"asset.Subscription\", \"asset.SubscriptionAccount\", \"asset.SubscriptionDeviceContractInformation\", \"asset.Target\", \"bios.BootDevice\", \"bios.BootMode\", \"bios.Policy\", \"bios.SystemBootOrder\", \"bios.TokenSettings\", \"bios.Unit\", \"bios.VfSelectMemoryRasConfiguration\", \"boot.CddDevice\", \"boot.DeviceBootMode\", \"boot.DeviceBootSecurity\", \"boot.HddDevice\", \"boot.IscsiDevice\", \"boot.NvmeDevice\", \"boot.PchStorageDevice\", \"boot.PrecisionPolicy\", \"boot.PxeDevice\", \"boot.SanDevice\", \"boot.SdDevice\", \"boot.UefiShellDevice\", \"boot.UsbDevice\", \"boot.VmediaDevice\", \"bulk.Export\", \"bulk.ExportedItem\", \"bulk.MoCloner\", \"bulk.MoMerger\", \"bulk.Request\", \"bulk.SubRequestObj\", \"capability.AdapterUnitDescriptor\", \"capability.Catalog\", \"capability.ChassisDescriptor\", \"capability.ChassisManufacturingDef\", \"capability.CimcFirmwareDescriptor\", \"capability.EquipmentPhysicalDef\", \"capability.EquipmentSlotArray\", \"capability.FanModuleDescriptor\", \"capability.FanModuleManufacturingDef\", \"capability.IoCardCapabilityDef\", \"capability.IoCardDescriptor\", \"capability.IoCardManufacturingDef\", \"capability.PortGroupAggregationDef\", \"capability.PsuDescriptor\", \"capability.PsuManufacturingDef\", \"capability.ServerSchemaDescriptor\", \"capability.SiocModuleCapabilityDef\", \"capability.SiocModuleDescriptor\", \"capability.SiocModuleManufacturingDef\", \"capability.SwitchCapability\", \"capability.SwitchDescriptor\", \"capability.SwitchManufacturingDef\", \"certificatemanagement.Policy\", \"chassis.ConfigChangeDetail\", \"chassis.ConfigImport\", \"chassis.ConfigResult\", \"chassis.ConfigResultEntry\", \"chassis.IomProfile\", \"chassis.Profile\", \"cloud.AwsBillingUnit\", \"cloud.AwsKeyPair\", \"cloud.AwsNetworkInterface\", \"cloud.AwsOrganizationalUnit\", \"cloud.AwsSecurityGroup\", \"cloud.AwsSubnet\", \"cloud.AwsVirtualMachine\", \"cloud.AwsVolume\", \"cloud.AwsVpc\", \"cloud.CollectInventory\", \"cloud.Regions\", \"cloud.SkuContainerType\", \"cloud.SkuDatabaseType\", \"cloud.SkuInstanceType\", \"cloud.SkuNetworkType\", \"cloud.SkuRegionRateCards\", \"cloud.SkuVolumeType\", \"cloud.TfcAgentpool\", \"cloud.TfcOrganization\", \"cloud.TfcWorkspace\", \"comm.HttpProxyPolicy\", \"compute.BiosPostPolicy\", \"compute.Blade\", \"compute.BladeIdentity\", \"compute.Board\", \"compute.Mapping\", \"compute.PhysicalSummary\", \"compute.RackUnit\", \"compute.RackUnitIdentity\", \"compute.ServerPowerPolicy\", \"compute.ServerSetting\", \"compute.Vmedia\", \"cond.Alarm\", \"cond.AlarmAggregation\", \"cond.HclStatus\", \"cond.HclStatusDetail\", \"cond.HclStatusJob\", \"connectorpack.ConnectorPackUpgrade\", \"connectorpack.UpgradeImpact\", \"convergedinfra.HealthCheckDefinition\", \"convergedinfra.HealthCheckExecution\", \"convergedinfra.Pod\", \"crd.CustomResource\", \"deviceconnector.Policy\", \"equipment.Chassis\", \"equipment.ChassisIdentity\", \"equipment.ChassisOperation\", \"equipment.DeviceSummary\", \"equipment.ExpanderModule\", \"equipment.Fan\", \"equipment.FanControl\", \"equipment.FanModule\", \"equipment.Fex\", \"equipment.FexIdentity\", \"equipment.FexOperation\", \"equipment.Fru\", \"equipment.IdentitySummary\", \"equipment.IoCard\", \"equipment.IoCardOperation\", \"equipment.IoExpander\", \"equipment.LocatorLed\", \"equipment.Psu\", \"equipment.PsuControl\", \"equipment.RackEnclosure\", \"equipment.RackEnclosureSlot\", \"equipment.SharedIoModule\", \"equipment.SwitchCard\", \"equipment.SystemIoController\", \"equipment.Tpm\", \"equipment.Transceiver\", \"ether.HostPort\", \"ether.NetworkPort\", \"ether.PhysicalPort\", \"ether.PortChannel\", \"externalsite.Authorization\", \"fabric.AppliancePcRole\", \"fabric.ApplianceRole\", \"fabric.ConfigChangeDetail\", \"fabric.ConfigResult\", \"fabric.ConfigResultEntry\", \"fabric.ElementIdentity\", \"fabric.EstimateImpact\", \"fabric.EthNetworkControlPolicy\", \"fabric.EthNetworkGroupPolicy\", \"fabric.EthNetworkPolicy\", \"fabric.FcNetworkPolicy\", \"fabric.FcUplinkPcRole\", \"fabric.FcUplinkRole\", \"fabric.FcoeUplinkPcRole\", \"fabric.FcoeUplinkRole\", \"fabric.FlowControlPolicy\", \"fabric.LinkAggregationPolicy\", \"fabric.LinkControlPolicy\", \"fabric.MulticastPolicy\", \"fabric.PcMember\", \"fabric.PcOperation\", \"fabric.PortMode\", \"fabric.PortOperation\", \"fabric.PortPolicy\", \"fabric.ServerRole\", \"fabric.SwitchClusterProfile\", \"fabric.SwitchControlPolicy\", \"fabric.SwitchProfile\", \"fabric.SystemQosPolicy\", \"fabric.UplinkPcRole\", \"fabric.UplinkRole\", \"fabric.Vlan\", \"fabric.Vsan\", \"fault.Instance\", \"fc.PhysicalPort\", \"fc.PortChannel\", \"fcpool.FcBlock\", \"fcpool.Lease\", \"fcpool.Pool\", \"fcpool.PoolMember\", \"fcpool.Universe\", \"feedback.FeedbackPost\", \"firmware.BiosDescriptor\", \"firmware.BoardControllerDescriptor\", \"firmware.ChassisUpgrade\", \"firmware.CimcDescriptor\", \"firmware.DimmDescriptor\", \"firmware.Distributable\", \"firmware.DistributableMeta\", \"firmware.DriveDescriptor\", \"firmware.DriverDistributable\", \"firmware.Eula\", \"firmware.FirmwareSummary\", \"firmware.GpuDescriptor\", \"firmware.HbaDescriptor\", \"firmware.IomDescriptor\", \"firmware.MswitchDescriptor\", \"firmware.NxosDescriptor\", \"firmware.PcieDescriptor\", \"firmware.PsuDescriptor\", \"firmware.RunningFirmware\", \"firmware.SasExpanderDescriptor\", \"firmware.ServerConfigurationUtilityDistributable\", \"firmware.StorageControllerDescriptor\", \"firmware.SwitchUpgrade\", \"firmware.UnsupportedVersionUpgrade\", \"firmware.Upgrade\", \"firmware.UpgradeImpact\", \"firmware.UpgradeImpactStatus\", \"firmware.UpgradeStatus\", \"forecast.Catalog\", \"forecast.Definition\", \"forecast.Instance\", \"graphics.Card\", \"graphics.Controller\", \"hcl.CompatibilityStatus\", \"hcl.DriverImage\", \"hcl.ExemptedCatalog\", \"hcl.HyperflexSoftwareCompatibilityInfo\", \"hcl.OperatingSystem\", \"hcl.OperatingSystemVendor\", \"hcl.SupportedDriverName\", \"hyperflex.Alarm\", \"hyperflex.AppCatalog\", \"hyperflex.AutoSupportPolicy\", \"hyperflex.BackupCluster\", \"hyperflex.CapabilityInfo\", \"hyperflex.CiscoHypervisorManager\", \"hyperflex.Cluster\", \"hyperflex.ClusterBackupPolicy\", \"hyperflex.ClusterBackupPolicyDeployment\", \"hyperflex.ClusterBackupPolicyInventory\", \"hyperflex.ClusterHealthCheckExecutionSnapshot\", \"hyperflex.ClusterNetworkPolicy\", \"hyperflex.ClusterProfile\", \"hyperflex.ClusterReplicationNetworkPolicy\", \"hyperflex.ClusterReplicationNetworkPolicyDeployment\", \"hyperflex.ClusterStoragePolicy\", \"hyperflex.ConfigResult\", \"hyperflex.ConfigResultEntry\", \"hyperflex.DataProtectionPeer\", \"hyperflex.DatastoreStatistic\", \"hyperflex.DevicePackageDownloadState\", \"hyperflex.Drive\", \"hyperflex.ExtFcStoragePolicy\", \"hyperflex.ExtIscsiStoragePolicy\", \"hyperflex.FeatureLimitExternal\", \"hyperflex.FeatureLimitInternal\", \"hyperflex.Health\", \"hyperflex.HealthCheckDefinition\", \"hyperflex.HealthCheckExecution\", \"hyperflex.HealthCheckExecutionSnapshot\", \"hyperflex.HealthCheckPackageChecksum\", \"hyperflex.HxapCluster\", \"hyperflex.HxapDatacenter\", \"hyperflex.HxapDvUplink\", \"hyperflex.HxapDvswitch\", \"hyperflex.HxapHost\", \"hyperflex.HxapHostInterface\", \"hyperflex.HxapHostVswitch\", \"hyperflex.HxapNetwork\", \"hyperflex.HxapVirtualDisk\", \"hyperflex.HxapVirtualMachine\", \"hyperflex.HxapVirtualMachineNetworkInterface\", \"hyperflex.HxdpVersion\", \"hyperflex.License\", \"hyperflex.LocalCredentialPolicy\", \"hyperflex.Node\", \"hyperflex.NodeConfigPolicy\", \"hyperflex.NodeProfile\", \"hyperflex.ProtectedCluster\", \"hyperflex.ProxySettingPolicy\", \"hyperflex.ServerFirmwareVersion\", \"hyperflex.ServerFirmwareVersionEntry\", \"hyperflex.ServerModel\", \"hyperflex.ServiceAuthToken\", \"hyperflex.SoftwareDistributionComponent\", \"hyperflex.SoftwareDistributionEntry\", \"hyperflex.SoftwareDistributionVersion\", \"hyperflex.SoftwareVersionPolicy\", \"hyperflex.StorageContainer\", \"hyperflex.SysConfigPolicy\", \"hyperflex.UcsmConfigPolicy\", \"hyperflex.VcenterConfigPolicy\", \"hyperflex.VmBackupInfo\", \"hyperflex.VmImportOperation\", \"hyperflex.VmRestoreOperation\", \"hyperflex.VmSnapshotInfo\", \"hyperflex.Volume\", \"hyperflex.WitnessConfiguration\", \"iaas.ConnectorPack\", \"iaas.DeviceStatus\", \"iaas.DiagnosticMessages\", \"iaas.LicenseInfo\", \"iaas.MostRunTasks\", \"iaas.ServiceRequest\", \"iaas.UcsdInfo\", \"iaas.UcsdManagedInfra\", \"iaas.UcsdMessages\", \"iam.Account\", \"iam.AccountExperience\", \"iam.ApiKey\", \"iam.AppRegistration\", \"iam.BannerMessage\", \"iam.Certificate\", \"iam.CertificateRequest\", \"iam.DomainGroup\", \"iam.EndPointPrivilege\", \"iam.EndPointRole\", \"iam.EndPointUser\", \"iam.EndPointUserPolicy\", \"iam.EndPointUserRole\", \"iam.Idp\", \"iam.IdpReference\", \"iam.IpAccessManagement\", \"iam.IpAddress\", \"iam.LdapGroup\", \"iam.LdapPolicy\", \"iam.LdapProvider\", \"iam.LocalUserPassword\", \"iam.LocalUserPasswordPolicy\", \"iam.OAuthToken\", \"iam.Permission\", \"iam.PrivateKeySpec\", \"iam.Privilege\", \"iam.PrivilegeSet\", \"iam.Qualifier\", \"iam.ResourceLimits\", \"iam.ResourcePermission\", \"iam.ResourceRoles\", \"iam.Role\", \"iam.SecurityHolder\", \"iam.ServiceProvider\", \"iam.Session\", \"iam.SessionLimits\", \"iam.System\", \"iam.TrustPoint\", \"iam.User\", \"iam.UserGroup\", \"iam.UserPreference\", \"inventory.DeviceInfo\", \"inventory.DnMoBinding\", \"inventory.GenericInventory\", \"inventory.GenericInventoryHolder\", \"inventory.Request\", \"ipmioverlan.Policy\", \"ippool.BlockLease\", \"ippool.IpLease\", \"ippool.Pool\", \"ippool.PoolMember\", \"ippool.ShadowBlock\", \"ippool.ShadowPool\", \"ippool.Universe\", \"iqnpool.Block\", \"iqnpool.Lease\", \"iqnpool.Pool\", \"iqnpool.PoolMember\", \"iqnpool.Universe\", \"iwotenant.TenantStatus\", \"kubernetes.AciCniApic\", \"kubernetes.AciCniProfile\", \"kubernetes.AciCniTenantClusterAllocation\", \"kubernetes.AddonDefinition\", \"kubernetes.AddonPolicy\", \"kubernetes.AddonRepository\", \"kubernetes.BaremetalNodeProfile\", \"kubernetes.Catalog\", \"kubernetes.Cluster\", \"kubernetes.ClusterAddonProfile\", \"kubernetes.ClusterProfile\", \"kubernetes.ConfigResult\", \"kubernetes.ConfigResultEntry\", \"kubernetes.ContainerRuntimePolicy\", \"kubernetes.DaemonSet\", \"kubernetes.Deployment\", \"kubernetes.Ingress\", \"kubernetes.NetworkPolicy\", \"kubernetes.Node\", \"kubernetes.NodeGroupProfile\", \"kubernetes.Pod\", \"kubernetes.Service\", \"kubernetes.StatefulSet\", \"kubernetes.SysConfigPolicy\", \"kubernetes.TrustedRegistriesPolicy\", \"kubernetes.Version\", \"kubernetes.VersionPolicy\", \"kubernetes.VirtualMachineInfraConfigPolicy\", \"kubernetes.VirtualMachineInfrastructureProvider\", \"kubernetes.VirtualMachineInstanceType\", \"kubernetes.VirtualMachineNodeProfile\", \"kvm.Policy\", \"kvm.Session\", \"kvm.Tunnel\", \"license.AccountLicenseData\", \"license.CustomerOp\", \"license.IwoCustomerOp\", \"license.IwoLicenseCount\", \"license.LicenseInfo\", \"license.LicenseReservationOp\", \"license.SmartlicenseToken\", \"ls.ServiceProfile\", \"macpool.IdBlock\", \"macpool.Lease\", \"macpool.Pool\", \"macpool.PoolMember\", \"macpool.Universe\", \"management.Controller\", \"management.Entity\", \"management.Interface\", \"memory.Array\", \"memory.PersistentMemoryConfigResult\", \"memory.PersistentMemoryConfiguration\", \"memory.PersistentMemoryNamespace\", \"memory.PersistentMemoryNamespaceConfigResult\", \"memory.PersistentMemoryPolicy\", \"memory.PersistentMemoryRegion\", \"memory.PersistentMemoryUnit\", \"memory.Unit\", \"meta.Definition\", \"network.Element\", \"network.ElementSummary\", \"network.FcZoneInfo\", \"network.VlanPortInfo\", \"networkconfig.Policy\", \"niaapi.ApicCcoPost\", \"niaapi.ApicFieldNotice\", \"niaapi.ApicHweol\", \"niaapi.ApicLatestMaintainedRelease\", \"niaapi.ApicReleaseRecommend\", \"niaapi.ApicSweol\", \"niaapi.DcnmCcoPost\", \"niaapi.DcnmFieldNotice\", \"niaapi.DcnmHweol\", \"niaapi.DcnmLatestMaintainedRelease\", \"niaapi.DcnmReleaseRecommend\", \"niaapi.DcnmSweol\", \"niaapi.FileDownloader\", \"niaapi.NiaMetadata\", \"niaapi.NibFileDownloader\", \"niaapi.NibMetadata\", \"niaapi.VersionRegex\", \"niatelemetry.AaaLdapProviderDetails\", \"niatelemetry.AaaRadiusProviderDetails\", \"niatelemetry.AaaTacacsProviderDetails\", \"niatelemetry.ApicAppPluginDetails\", \"niatelemetry.ApicCoreFileDetails\", \"niatelemetry.ApicDbgexpRsExportDest\", \"niatelemetry.ApicDbgexpRsTsScheduler\", \"niatelemetry.ApicFanDetails\", \"niatelemetry.ApicFexDetails\", \"niatelemetry.ApicFlashDetails\", \"niatelemetry.ApicNtpAuth\", \"niatelemetry.ApicPsuDetails\", \"niatelemetry.ApicRealmDetails\", \"niatelemetry.ApicSnmpClientGrpDetails\", \"niatelemetry.ApicSnmpCommunityAccessDetails\", \"niatelemetry.ApicSnmpCommunityDetails\", \"niatelemetry.ApicSnmpTrapDetails\", \"niatelemetry.ApicSnmpTrapFwdServerDetails\", \"niatelemetry.ApicSnmpVersionThreeDetails\", \"niatelemetry.ApicSysLogGrp\", \"niatelemetry.ApicSysLogSrc\", \"niatelemetry.ApicTransceiverDetails\", \"niatelemetry.ApicUiPageCounts\", \"niatelemetry.AppDetails\", \"niatelemetry.CommonPolicies\", \"niatelemetry.DcnmFanDetails\", \"niatelemetry.DcnmFexDetails\", \"niatelemetry.DcnmModuleDetails\", \"niatelemetry.DcnmPsuDetails\", \"niatelemetry.DcnmTransceiverDetails\", \"niatelemetry.Epg\", \"niatelemetry.FabricModuleDetails\", \"niatelemetry.FabricPodProfile\", \"niatelemetry.FabricPodSs\", \"niatelemetry.Fault\", \"niatelemetry.HttpsAclContractDetails\", \"niatelemetry.HttpsAclContractFilterMap\", \"niatelemetry.HttpsAclEpgContractMap\", \"niatelemetry.HttpsAclEpgDetails\", \"niatelemetry.HttpsAclFilterDetails\", \"niatelemetry.Lc\", \"niatelemetry.MsoContractDetails\", \"niatelemetry.MsoEpgDetails\", \"niatelemetry.MsoSchemaDetails\", \"niatelemetry.MsoSiteDetails\", \"niatelemetry.MsoTenantDetails\", \"niatelemetry.NexusDashboardControllerDetails\", \"niatelemetry.NexusDashboardDetails\", \"niatelemetry.NexusDashboardMemoryDetails\", \"niatelemetry.NexusDashboards\", \"niatelemetry.NiaFeatureUsage\", \"niatelemetry.NiaInventory\", \"niatelemetry.NiaInventoryDcnm\", \"niatelemetry.NiaInventoryFabric\", \"niatelemetry.NiaLicenseState\", \"niatelemetry.PasswordStrengthCheck\", \"niatelemetry.PodCommPolicies\", \"niatelemetry.PodSnmpPolicies\", \"niatelemetry.PodTimeServerPolicies\", \"niatelemetry.SiteInventory\", \"niatelemetry.SnmpSrc\", \"niatelemetry.SshVersionTwo\", \"niatelemetry.SupervisorModuleDetails\", \"niatelemetry.SyslogRemoteDest\", \"niatelemetry.SyslogSysMsg\", \"niatelemetry.SyslogSysMsgFacFilter\", \"niatelemetry.SystemControllerDetails\", \"niatelemetry.Tenant\", \"notification.AccountSubscription\", \"ntp.Policy\", \"oprs.Deployment\", \"oprs.SyncTargetListMessage\", \"organization.Organization\", \"os.BulkInstallInfo\", \"os.Catalog\", \"os.ConfigurationFile\", \"os.Distribution\", \"os.Install\", \"os.OsSupport\", \"os.SupportedVersion\", \"os.TemplateFile\", \"os.ValidInstallTarget\", \"pci.CoprocessorCard\", \"pci.Device\", \"pci.Link\", \"pci.Switch\", \"port.Group\", \"port.MacBinding\", \"port.SubGroup\", \"power.ControlState\", \"power.Policy\", \"processor.Unit\", \"rack.UnitPersonality\", \"recommendation.CapacityRunway\", \"recommendation.PhysicalItem\", \"recovery.BackupConfigPolicy\", \"recovery.BackupProfile\", \"recovery.ConfigResult\", \"recovery.ConfigResultEntry\", \"recovery.OnDemandBackup\", \"recovery.Restore\", \"recovery.ScheduleConfigPolicy\", \"resource.Group\", \"resource.GroupMember\", \"resource.LicenseResourceCount\", \"resource.Membership\", \"resource.MembershipHolder\", \"resource.Reservation\", \"resourcepool.Lease\", \"resourcepool.LeaseResource\", \"resourcepool.Pool\", \"resourcepool.PoolMember\", \"resourcepool.Universe\", \"rproxy.ReverseProxy\", \"sdcard.Policy\", \"sdwan.Profile\", \"sdwan.RouterNode\", \"sdwan.RouterPolicy\", \"sdwan.VmanageAccountPolicy\", \"search.SearchItem\", \"search.TagItem\", \"security.Unit\", \"server.ConfigChangeDetail\", \"server.ConfigImport\", \"server.ConfigResult\", \"server.ConfigResultEntry\", \"server.Profile\", \"server.ProfileTemplate\", \"smtp.Policy\", \"snmp.Policy\", \"software.ApplianceDistributable\", \"software.DownloadHistory\", \"software.HclMeta\", \"software.HyperflexBundleDistributable\", \"software.HyperflexDistributable\", \"software.ReleaseMeta\", \"software.SolutionDistributable\", \"software.UcsdBundleDistributable\", \"software.UcsdDistributable\", \"softwarerepository.Authorization\", \"softwarerepository.CachedImage\", \"softwarerepository.Catalog\", \"softwarerepository.CategoryMapper\", \"softwarerepository.CategoryMapperModel\", \"softwarerepository.CategorySupportConstraint\", \"softwarerepository.DownloadSpec\", \"softwarerepository.OperatingSystemFile\", \"softwarerepository.Release\", \"sol.Policy\", \"ssh.Policy\", \"storage.Controller\", \"storage.DiskGroup\", \"storage.DiskSlot\", \"storage.DriveGroup\", \"storage.Enclosure\", \"storage.EnclosureDisk\", \"storage.EnclosureDiskSlotEp\", \"storage.FlexFlashController\", \"storage.FlexFlashControllerProps\", \"storage.FlexFlashPhysicalDrive\", \"storage.FlexFlashVirtualDrive\", \"storage.FlexUtilController\", \"storage.FlexUtilPhysicalDrive\", \"storage.FlexUtilVirtualDrive\", \"storage.HitachiArray\", \"storage.HitachiController\", \"storage.HitachiDisk\", \"storage.HitachiHost\", \"storage.HitachiHostLun\", \"storage.HitachiParityGroup\", \"storage.HitachiPool\", \"storage.HitachiPort\", \"storage.HitachiVolume\", \"storage.HyperFlexStorageContainer\", \"storage.HyperFlexVolume\", \"storage.Item\", \"storage.NetAppAggregate\", \"storage.NetAppBaseDisk\", \"storage.NetAppCluster\", \"storage.NetAppEthernetPort\", \"storage.NetAppExportPolicy\", \"storage.NetAppFcInterface\", \"storage.NetAppFcPort\", \"storage.NetAppInitiatorGroup\", \"storage.NetAppIpInterface\", \"storage.NetAppLicense\", \"storage.NetAppLun\", \"storage.NetAppLunMap\", \"storage.NetAppNode\", \"storage.NetAppNtpServer\", \"storage.NetAppSensor\", \"storage.NetAppStorageVm\", \"storage.NetAppVolume\", \"storage.NetAppVolumeSnapshot\", \"storage.PhysicalDisk\", \"storage.PhysicalDiskExtension\", \"storage.PhysicalDiskUsage\", \"storage.PureArray\", \"storage.PureController\", \"storage.PureDisk\", \"storage.PureHost\", \"storage.PureHostGroup\", \"storage.PureHostLun\", \"storage.PurePort\", \"storage.PureProtectionGroup\", \"storage.PureProtectionGroupSnapshot\", \"storage.PureReplicationSchedule\", \"storage.PureSnapshotSchedule\", \"storage.PureVolume\", \"storage.PureVolumeSnapshot\", \"storage.SasExpander\", \"storage.SasPort\", \"storage.Span\", \"storage.StoragePolicy\", \"storage.VdMemberEp\", \"storage.VirtualDrive\", \"storage.VirtualDriveContainer\", \"storage.VirtualDriveExtension\", \"storage.VirtualDriveIdentity\", \"syslog.Policy\", \"tam.AdvisoryCount\", \"tam.AdvisoryDefinition\", \"tam.AdvisoryInfo\", \"tam.AdvisoryInstance\", \"tam.SecurityAdvisory\", \"task.HitachiScopedInventory\", \"task.HxapScopedInventory\", \"task.NetAppScopedInventory\", \"task.PublicCloudScopedInventory\", \"task.PureScopedInventory\", \"task.ServerScopedInventory\", \"techsupportmanagement.CollectionControlPolicy\", \"techsupportmanagement.Download\", \"techsupportmanagement.TechSupportBundle\", \"techsupportmanagement.TechSupportStatus\", \"terminal.AuditLog\", \"terraform.Executor\", \"thermal.Policy\", \"top.System\", \"ucsd.BackupInfo\", \"uuidpool.Block\", \"uuidpool.Pool\", \"uuidpool.PoolMember\", \"uuidpool.Universe\", \"uuidpool.UuidLease\", \"virtualization.Host\", \"virtualization.VirtualDisk\", \"virtualization.VirtualMachine\", \"virtualization.VirtualNetwork\", \"virtualization.VmwareCluster\", \"virtualization.VmwareDatacenter\", \"virtualization.VmwareDatastore\", \"virtualization.VmwareDatastoreCluster\", \"virtualization.VmwareDistributedNetwork\", \"virtualization.VmwareDistributedSwitch\", \"virtualization.VmwareFolder\", \"virtualization.VmwareHost\", \"virtualization.VmwareKernelNetwork\", \"virtualization.VmwareNetwork\", \"virtualization.VmwarePhysicalNetworkInterface\", \"virtualization.VmwareUplinkPort\", \"virtualization.VmwareVcenter\", \"virtualization.VmwareVirtualDisk\", \"virtualization.VmwareVirtualMachine\", \"virtualization.VmwareVirtualMachineSnapshot\", \"virtualization.VmwareVirtualNetworkInterface\", \"virtualization.VmwareVirtualSwitch\", \"vmedia.Policy\", \"vmrc.Console\", \"vnc.Console\", \"vnic.EthAdapterPolicy\", \"vnic.EthIf\", \"vnic.EthNetworkPolicy\", \"vnic.EthQosPolicy\", \"vnic.FcAdapterPolicy\", \"vnic.FcIf\", \"vnic.FcNetworkPolicy\", \"vnic.FcQosPolicy\", \"vnic.IscsiAdapterPolicy\", \"vnic.IscsiBootPolicy\", \"vnic.IscsiStaticTargetPolicy\", \"vnic.LanConnectivityPolicy\", \"vnic.LcpStatus\", \"vnic.SanConnectivityPolicy\", \"vnic.ScpStatus\", \"vrf.Vrf\", \"workflow.BatchApiExecutor\", \"workflow.BuildTaskMeta\", \"workflow.BuildTaskMetaOwner\", \"workflow.Catalog\", \"workflow.CustomDataTypeDefinition\", \"workflow.ErrorResponseHandler\", \"workflow.PendingDynamicWorkflowInfo\", \"workflow.RollbackWorkflow\", \"workflow.SolutionActionDefinition\", \"workflow.SolutionActionInstance\", \"workflow.SolutionDefinition\", \"workflow.SolutionInstance\", \"workflow.SolutionOutput\", \"workflow.TaskDebugLog\", \"workflow.TaskDefinition\", \"workflow.TaskInfo\", \"workflow.TaskMetadata\", \"workflow.TaskNotification\", \"workflow.TemplateEvaluation\", \"workflow.TemplateFunctionMeta\", \"workflow.WorkflowDefinition\", \"workflow.WorkflowInfo\", \"workflow.WorkflowMeta\", \"workflow.WorkflowMetadata\", \"workflow.WorkflowNotification\"])\n return false unless object_type_validator.valid?(@object_type)\n true\n end",
"def validates_max_length(max, atts, opts={})\n validatable_attributes(atts, opts){|a,v,m| (m || \"is longer than #{max} characters\") unless v && v.length <= max}\n end"
]
| [
"0.76212156",
"0.7602966",
"0.7227967",
"0.66246027",
"0.64286155",
"0.64081997",
"0.6334596",
"0.6237823",
"0.6090215",
"0.6060761",
"0.59815574",
"0.5877955",
"0.58717567",
"0.58577055",
"0.58097744",
"0.58062315",
"0.57630754",
"0.5756526",
"0.575159",
"0.57459027",
"0.5696629",
"0.5689557",
"0.56871575",
"0.5664687",
"0.56539863",
"0.56424344",
"0.5635835",
"0.5630395",
"0.56223357",
"0.5605868"
]
| 0.89256746 | 0 |
Tests that class_max is not nil or that the class_min has not been set. It checks that the class_max is greater than 0 and that the class_max is greater than the class_min. It returns true or false. | def class_max_is_valid?
if ((self.class_max == nil) or (self.class_min == nil)); return false; end
return ((self.class_max > 0) and (self.class_max >= self.class_min))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def class_min_is_valid?\n if ((self.class_min == nil) or (self.class_max == nil)); return false; end\n return ((self.class_min > 0) and (self.class_max >= self.class_min))\n end",
"def class_max_is_valid\n errors.add(:class_max,'Invalid class max value.') unless class_max_is_valid?\n end",
"def between_min_max?(value, min, max) # TODO Repetido en concern/Methods\n return true if value >= min and value <= max\n return false\n end",
"def class_min_is_valid\n errors.add(:class_min,'Invalid class min value.') unless class_min_is_valid?\n end",
"def between_min_max?(value, min, max)\n return true if value >= min and value <= max\n return false\n end",
"def limits_ok?\n status = true\n if (@min.exp.to_s.include? '/') || (@max.exp.to_s.include? '/')\n return status\n end\n\n if @min.exp.nil? ^ @max.exp.nil?\n @limit_type = :single_sided\n if @typ.exp\n # status = false\n Origen.log.debug \"Spec #{@name} has a typical limit defined with either min or max. They are mutually exclusive, use 'target' when using min or max\"\n end\n elsif @min.exp && @max.exp\n @limit_type = :double_sided\n # Both min and max must be numerical to compare them\n if @min.value.is_a?(Numeric) && @max.value.is_a?(Numeric)\n # Check that min and max make sense\n if @max.value <= @min.value || @min.value >= @max.value\n status = false\n Origen.log.debug \"Spec #{@name} has min (#{@min.value}) and max (#{@max.value}) reversed\"\n end\n # Check that target is OK\n unless @target.nil?\n if @target.value <= @min.value || @target.value >= @max.value\n status = false\n Origen.log.debug \"Spec #{@name} has a target (#{@target.value}) that is not within the min (#{@min.value}) and max #{@max.value}) values\"\n end\n end\n end\n end\n status\n end",
"def min_can_not_be_bigger_than_max\n if !max_credits.nil? && !min_credits.nil? && min_credits.to_int > max_credits.to_int\n errors.add(:minimum_credits, \"can't be greater than maximum credits\")\n end\n end",
"def check_min_max\n\nend",
"def number_of_classes_is_valid?\n return ((self.number_of_classes != nil) and (self.number_of_classes > 0))\n end",
"def between?(min, max)\n #This is a stub, used for indexing\n end",
"def checkcondition(min, max, num)\n if(min<=num and max >= num)\n return true\n else\n return false\n end\n end",
"def max_grade_greater_than_min_grade\n if(self.max_grade.to_i < self.min_grade.to_i)\n return \"must be greater than min grade\"\n end\n end",
"def max\n @max ||= define_min_and_max && @max\n end",
"def valid_range?\n (0..@max_num).cover?(@number)\n end",
"def between?(min, max)\n self >= min and self <= max\n end",
"def define_min_and_max\n @min = acceptable_min\n @max = acceptable_max\n\n # If necessary, adjust a value depending on the other\n @min ||= floor\n @max ||= @min + ceiling || ceiling # rubocop:disable Naming/MemoizedInstanceVariableName\n end",
"def between?(value, min = nil, max = nil)\n if min and value < min\n return false\n elsif max and value > max\n return false\n end\n return true\n end",
"def max?\n @number == @max_num\n end",
"def test_bounds(val, min, max)\n val >= min && val <= max\n end",
"def out_of_bound?(value, min, max)\n return value > max || value < min\n end",
"def max_and_min_set?(pagefile, min, max)\n logger.trace(\"Checking if #{pagefile} has max and initial disk size values set\")\n powershell_code = <<-CODE\n $page_file = '#{pagefile}';\n $driveLetter = $page_file.split(':')[0];\n $page_file_settings = Get-CimInstance -ClassName Win32_PageFileSetting -Filter \"SettingID='pagefile.sys @ $($driveLetter):'\" -Property * -ErrorAction Stop;\n if ($page_file_settings.InitialSize -eq #{min} -and $page_file_settings.MaximumSize -eq #{max})\n { return $true }\n else\n { return $false }\n CODE\n powershell_exec!(powershell_code).result\n end",
"def ensure_bounds\n if self.position > min_position\n self.position = min_position\n false\n elsif self.position < max_position\n self.position = max_position\n false\n else\n true\n end\n end",
"def class_how_full?\n return [self.students.count, self.class_max]\n end",
"def between(num, min, max)\n if min <= num && max >= num\n return true\n else \n return false\n end\nend",
"def set_max( max )\n if IntegerOption.bounds_ok?( @min, max )\n @max = max\n else\n @max = nil\n raise \"invalid upper bound: #{ max.to_s }\"\n end\n end",
"def between(min, max, &block)\n return false unless (1..min).all? { try(&block) }\n (min..max).all? { try(&block) } # only using all?'s shortcut property\n true\n end",
"def checkBSTWithMinMax(tree, min, max)\n if tree == nil\n true\n else\n if tree.root <= min or tree.root > max\n false\n else\n if !checkBSTWithMinMax(tree.left, min, tree.root) or !checkBSTWithMinMax(tree.right, tree.root, max)\n false\n else\n true\n end\n end\n end\n\nend",
"def validation min, max\n\n end",
"def cover?(low, high = @max)\n return false if coverage == 0 or low.nil?\n @min <= low and low <= @max and high >= @min and high <= @max\n end",
"def is_max_number?()\n return @ucItemNumber.value == @ucItemNumber.max\n end"
]
| [
"0.8701463",
"0.7271286",
"0.68165153",
"0.6568958",
"0.64566576",
"0.64448696",
"0.6411269",
"0.63438433",
"0.62115705",
"0.6198311",
"0.6154437",
"0.6086009",
"0.6051319",
"0.6032028",
"0.5990534",
"0.59790343",
"0.5978076",
"0.5970896",
"0.5964176",
"0.5936864",
"0.5927225",
"0.58781654",
"0.5872911",
"0.5740021",
"0.5721285",
"0.5703978",
"0.56474763",
"0.56313175",
"0.5608031",
"0.5580675"
]
| 0.914462 | 0 |
Adds errors if fee_per_meeting_is_valid? returns false | def fee_per_meeting_is_valid
errors.add(:fee_per_meeting, 'The fee per meeting is invalid.') unless fee_per_meeting_is_valid?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def total_fee_is_valid\n errors.add(:total_fee,'The total fee is invalid.') unless total_fee_is_valid?\n end",
"def fee_per_meeting_is_valid?\n return ((self.fee_per_meeting != nil) and (self.fee_per_meeting >= 0))\n end",
"def fee_for_additional_materials_is_valid\n errors.add(:fee_for_additional_materials, 'The fee for additional materials is invalid.') unless fee_for_additional_materials_is_valid?\n end",
"def total_fee_is_valid?\n return ((self.total_fee != nil) and (self.total_fee >= 0))\n end",
"def days_of_week_are_valid\n errors.add(:days_of_week, \"The days of the week are invalid.\") unless days_of_week_are_valid?\n end",
"def extra_validations\n success\n end",
"def edit_fee_fields_filled\n if !params[:edit_fees].nil?\n edit_fees_vals = params[:edit_fees].values\n edit_fees_vals.each_slice(3) do |fee, time, remove|\n if fee.empty? || time.empty?\n return false\n end\n end\n end\n return true\n end",
"def validate\n validate_amount\n validate_game\n validate_period\n end",
"def valid_registration_date\n errors.add(:registration_deadline, 'The registration deadline could not be parsed.') unless registration_date_is_valid?\n end",
"def time_collision_validation\n\t\tappointments = Appointment.all\n\n\t\t#if duration is equals to 0, it means it is fixed pay. \n\t\t#Here, duration is set to 0 so it will not be validated \n\t\t#This will execute if is_pay_per hour is set to 0\n\t\tif @start_date.present? && @start_time.present? && duration == 0.to_s\n\t\t\tstart_at = Time.parse(\"#{@start_date} #{@start_time}\") + (1.hours)\n\t\t\t\n\t\t\tappointments.each do |a|\n\t\t\t\t# will ensure that the appointment to compare will not be compared to itself in the database if it exists\n\t\t\t\tif a.id.to_s != @appointment_id.to_s\n\t\t\t\t\t# compare fixed-pay input to pay per hour appointment\n\t\t\t\t\tif a.task.is_pay_per_hour && start_at < a.end_at && start_at >= a.start_at \n\t\t\t\t\t\terrors.add(:start_time, \"Please select a different date or time.\")\n\t\t\t\t\t\terrors.add(:start_date, \"An appointment is already \n\t\t\t\t\t\t\tset at #{a.start_at.strftime(\"%I:%M%p\")}, #{a.start_at.strftime(\"%d/%m/%Y\")} \n\t\t\t\t\t\t\tto #{a.end_at.strftime(\"%I:%M%p\")} on #{a.end_at.strftime(\"%d/%m/%Y\")}. \n\t\t\t\t\t\t\tPlease select a different date or time.\")\n\t\t\t\t\t\tbreak\n\n\n\t\t\t\t\t\t#compare fixed-pay input to fixed pay appointment\n\t\t\t\t\telsif !a.task.is_pay_per_hour && start_at == a.start_at \n\t\t\t\t\t\terrors.add(:start_time, \"Please select a different date or time.\")\n\t\t\t\t\t\terrors.add(:start_date, \"A fixed pay appointment is aleady set at #{a.start_at.strftime(\"%I:%M%p\")}\n\t\t\t\t\t\t\t, #{a.start_at.strftime(\"%d/%m/%Y\")}. \n\t\t\t\t\t\t\tPlease select a different date or time.\")\n\t\t\t\t\t\tbreak\n\t\t\t\t\tend \t\n\t\t\t\tend \t\n\t\t\tend\n\n\n\t\t\t\t#Here, duration should be present and will be always validated\n\t\t\t\t#This will execute if is_pay_per hour is set to 1\n\t\t\telsif @start_date.present? && @start_time.present? && duration.present?\n\t\t\t\tstart_at = Time.parse(\"#{@start_date} #{@start_time}\") + (1.hours)\n\t\t\t\tend_at = Time.parse(\"#{@start_date} #{@start_time}\") + (@duration.to_f.hours+ (1.hours))\n\n\t\t\t\tappointments.each do |a|\n\t\t\t\t\t# will ensure that the appointment to compare will not be compared to itself in the database if it exists\n\t\t\t\t\tif a.id.to_s != @appointment_id.to_s\n\t\t\t\t\t\t# compare pay per hour input to pay per hour appointment\n\t\t\t\t\t\tif a.task.is_pay_per_hour && start_at < a.end_at && a.start_at < end_at \n\n\t\t\t\t\t\t\terrors.add(:start_time, \"Please select a different date or time.\")\n\t\t\t\t\t\t\terrors.add(:start_date, \"An appointment already \n\t\t\t\t\t\t\t\texists at #{a.start_at.strftime(\"%I:%M%p\")}, #{a.start_at.strftime(\"%d/%m/%Y\")} \n\t\t\t\t\t\t\t\tto #{a.end_at.strftime(\"%I:%M%p\")} on #{a.end_at.strftime(\"%d/%m/%Y\")}. \n\t\t\t\t\t\t\t\tPlease select a different date or time.\")\n\t\t\t\t\t\t\tbreak\n\n\t\t\t\t\t\t\t#compare pay per hour input to fixed pay appointment\n\t\t\t\t\t\telsif !a.task.is_pay_per_hour && a.start_at <= end_at && a.start_at >= start_at\n\n\t\t\t\t\t\t\terrors.add(:start_time, \"Please select a different date or time.\")\n\t\t\t\t\t\t\terrors.add(:start_date, \"A fixed pay appointment is aleady set at #{a.start_at.strftime(\"%I:%M%p\")}\n\t\t\t\t\t\t\t\t, #{a.start_at.strftime(\"%d/%m/%Y\")}. \n\t\t\t\t\t\t\t\tPlease select a different date or time.\")\n\t\t\t\t\t\t\tbreak\t\t\t\t\n\t\t\t\t\t\tend\t\t\t\n\t\t\t\t\tend \n\t\t\t\tend\n\t\t\tend \n\t\tend",
"def valid?\n super\n if attendee.valid?\n validate_mandatory_plan_cats(selected_plans)\n validate_single_plan_categories(selected_plans)\n validate_disabled_plans(persisted_plan_selections, selected_plans)\n validate_models(selected_attendee_plans)\n validate_activities\n else\n merge_errors(attendee.errors)\n end\n @errors.empty?\n end",
"def validate_funding\n # randomize funding method!\n validate_random_day 'Funding Method', EngagementRequest::FUNDING_METHODS[self.funding_method]\n\n # sponsor is funding it!\n if self.cost_center != self.sponsor.department.cost_center\n add_validation \"Cost Center should match the Sponsor's cost center\"\n end\n\n # detailed estimate must be funding approved!\n if self.detailed_estimate? && ! (self.approved? || self.budget?)\n add_validation EngagementRequest::ENGAGEMENT_TYPES[self.engagement_type] + ' must have budget ' +\n EngagementRequest::FUNDING_STATUSES[\"approved\"] + ' or ' +\n EngagementRequest::FUNDING_STATUSES[\"budget\"]\n end\n # scheduling or rescue must have budget!\n if (self.scheduling? || self.rescue?) && ! self.budget?\n add_validation EngagementRequest::ENGAGEMENT_TYPES[self.engagement_type] + ' must have ' +\n EngagementRequest::FUNDING_STATUSES[\"budget\"]\n end\n\n # must have a decent budget!\n if self.budget_allocated < 100_000\n add_validation 'Projects with a budget of less than $100,000 are not accepted'\n end\n end",
"def test_invalid_with_empty_attributes\r\n fee_schedule = FeeSchedule.new\r\n assert !fee_schedule.valid?, fee_schedule.errors.full_messages\r\n assert fee_schedule.errors.invalid?(:start_date)\r\n assert fee_schedule.errors.invalid?(:end_date)\r\n end",
"def fee_for_additional_materials_is_valid?\n return ((self.fee_for_additional_materials != nil) and (self.fee_for_additional_materials >= 0))\n end",
"def verify_fees(test_data)\n fees = test_data[UseOfCollections::FEE_GRP.name] || [UseOfCollections.empty_fee]\n fees.each_with_index do |fee, index|\n verify_values_match(fee[UseOfCollections::FEE_CURRENCY.name], element_value(fee_currency_input index))\n verify_values_match(fee[UseOfCollections::FEE_VALUE.name], element_value(fee_value_input index))\n verify_values_match(fee[UseOfCollections::FEE_NOTE.name], element_value(fee_note_input index))\n end\n end",
"def update_errors\n @errors = []\n @errors << 'Expiration date is a required field' unless expiration_date\n @errors << 'Expiration Date is not a valid date' unless expiration_date.is_a? Date\n @errors << 'Card type is a required field' unless card_type\n @errors << 'Card type is not supported' unless check_card_type\n @errors << 'Card number is not valid' unless card_number_valid?\n @errors\n end",
"def check_amount_of_people\n if people > 8\n errors.add(:people, I18n.t('helpers.models.sulten.reservation.errors.people.too_many_people'))\n elsif people < 1\n errors.add(:people, I18n.t('helpers.models.sulten.reservation.errors.people.too_few_people'))\n end\n end",
"def validate\n # add errors if not validate\n end",
"def verify_fees(test_data)\n fees = test_data[CoreUseOfCollectionsData::FEE_GRP.name] || [CoreUseOfCollectionsData.empty_fee]\n fees.each_with_index do |fee, index|\n verify_values_match(fee[CoreUseOfCollectionsData::FEE_CURRENCY.name], element_value(fee_currency_input index))\n verify_values_match(fee[CoreUseOfCollectionsData::FEE_VALUE.name], element_value(fee_value_input index))\n verify_values_match(fee[CoreUseOfCollectionsData::FEE_NOTE.name], element_value(fee_note_input index))\n end\n end",
"def time_period_for_room_reservation\n time_period = (self.start_date.year * 12 + self.start_date.month) - (Date.today.year * 12 + Date.today.month)\n errors.add(:start_date, \"you can book your room before 6 months only\") if time_period > 6\n end",
"def add_fee_filled_or_empty\n if !params[:add_fee].nil?\n add_fee_keys = params[:add_fee].keys\n add_fee_vals = params[:add_fee].values\n add_fee_vals.each_slice(3) do |student_type, amount, time_period|\n if !((!student_type.empty? && !amount.empty? && !time_period.empty?) ||\n (student_type.empty? && amount.empty? && time_period.empty?))\n return false\n end\n end\n end\n return true\n end",
"def participation_validation\n if play_condition.participation_points.blank?\n self.errors.add(:base, \"Количество очков за участие должно быть больше 0\")\n elsif play_condition.difficulty_level.present? && play_condition.difficulty_level.difficulty_level_setting.send(\"#{self.class.to_s.underscore}_max_points\").to_f < play_condition.participation_points.to_f\n self.errors.add(:base, \"Количество очков за участие должно быть не больше #{play_condition.difficulty_level.difficulty_level_setting.send(\"#{self.class.to_s.underscore}_max_points\")}\")\n end\n end",
"def update_errors\n @errors = []\n @errors << 'One of the cards needs attention' unless cards.all?(&:valid?)\n if email\n @errors << 'Email is not in correct format' unless email_well_formed?\n else\n @errors << 'Email is a required field'\n end\n @errors << 'Wallet token is a required field' unless wallet_token\n @errors\n end",
"def check_dates\n calendar = Line.find(self.line_id).calendar\n\n # check empty fields\n if self.start_month.nil? \n unless self.start_date.nil?\n errors.add(:start_date, \"can't be filled if month is empty\")\n end \n else\n if self.start_month <= calendar.months.count\n unless self.start_date <= max_days = calendar.months.find_by(number: self.start_month).days_normal\n errors.add(:start_date, \"can't exceed number of days in the month (#{max_days})\")\n end\n else\n errors.add(:start_month, \"can't be greater than number of months (#{calendar.months.count})\")\n end\n\n end\n\n if self.end_month.nil? \n unless self.end_date.nil?\n errors.add(:end_date, \"can't be filled if month is empty\")\n errors.add(:end_month, \"must not be empty\")\n end \n else\n if self.end_year.nil?\n errors.add(:end_month, \"can't be filled if year is empty\")\n errors.add(:end_year, \"must not be empty\")\n else\n if self.end_year < self.start_year\n errors.add(:end_year, \"can't precede start year\")\n end\n end\n\n if self.end_month <= calendar.months.count\n if self.end_month < self.start_month\n errors.add(:end_month, \"can't precede start month\")\n end\n\n unless self.end_date.nil?\n if self.end_date > max_days = calendar.months.find_by(number: self.end_month).days_normal\n errors.add(:end_date, \"can't exceed number of days in the month (#{max_days})\")\n else\n if self.end_date < self.start_date\n errors.add(:end_date, \"can't precede start date\")\n end\n end\n end\n else\n errors.add(:end_month, \"can't be greater than number of months (#{calendar.months.count})\")\n end\n \n end\n end",
"def validate_timing\n v = Float(@duration_number) rescue false\n puts \"v = #{v}\"\n if @until_radio == \"date\" && !(Float(@duration_number) rescue false)\n errors.add(:timing_duration, \"you need a duration\")\n end\n if self.kind_of_timing == \"Frequency\" && @freak_number.blank?\n errors.add(:freak_number, \"how often?\")\n end\n end",
"def check_count\n if FantasyPoint.count > 0\n errors[:base] << 'there are too many FantasyPoint records'\n end\n end",
"def run_validations\n true\n end",
"def validate_amount\n errors.add(:claiming_amount, :ads_amount) if claim_amount_required? && ads_amount.to_i < claiming_amount.to_i\n end",
"def test_valid_with_attributes\r\n fee_schedule = FeeSchedule.new\r\n fee_schedule.start_date = fee_schedules(:fee_schedule_00001).start_date\r\n fee_schedule.end_date = fee_schedules(:fee_schedule_00001).end_date\r\n assert fee_schedule.valid?, fee_schedule.errors.full_messages \r\n end",
"def validate_fields\n @edit[:wf].get_dialog_order.each do |d|\n @edit[:wf].get_all_fields(d, false).each_value do |field|\n if field[:error].present?\n @error_div ||= d.to_s\n add_flash(field[:error], :error)\n end\n end\n end\n end"
]
| [
"0.79279375",
"0.74114054",
"0.7103139",
"0.6207525",
"0.6129603",
"0.60691947",
"0.59894615",
"0.59121746",
"0.58904517",
"0.58663905",
"0.5836151",
"0.5826796",
"0.5826259",
"0.5804788",
"0.57486326",
"0.57260144",
"0.5715971",
"0.5714275",
"0.57007545",
"0.5699851",
"0.56937677",
"0.56905717",
"0.56564635",
"0.5621809",
"0.5606719",
"0.55900025",
"0.55890626",
"0.55670273",
"0.5551435",
"0.5514318"
]
| 0.91105443 | 0 |
Tests that the fee_per_meeting for course is not nil and greater than or equal to 0 and returns true or false. | def fee_per_meeting_is_valid?
return ((self.fee_per_meeting != nil) and (self.fee_per_meeting >= 0))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def total_fee_is_valid?\n return ((self.total_fee != nil) and (self.total_fee >= 0))\n end",
"def free?\n self.setupFee == 0 && self.laborFee == 0 && self.oneTimeFee == 0 && self.recurringFee == 0 && self.hourlyRecurringFee == 0\n end",
"def fee_per_meeting_is_valid\n errors.add(:fee_per_meeting, 'The fee per meeting is invalid.') unless fee_per_meeting_is_valid?\n end",
"def fee_for_additional_materials_is_valid?\n return ((self.fee_for_additional_materials != nil) and (self.fee_for_additional_materials >= 0))\n end",
"def free?\n\t\t\t\tnot(fee?)\n\t\t\tend",
"def add_fee_filled_or_empty\n if !params[:add_fee].nil?\n add_fee_keys = params[:add_fee].keys\n add_fee_vals = params[:add_fee].values\n add_fee_vals.each_slice(3) do |student_type, amount, time_period|\n if !((!student_type.empty? && !amount.empty? && !time_period.empty?) ||\n (student_type.empty? && amount.empty? && time_period.empty?))\n return false\n end\n end\n end\n return true\n end",
"def check_free_venue\n if @total >= 20\n return true\n end\n end",
"def calculated?\n fee_type&.calculated?.nil? ? true : fee_type.calculated?\n end",
"def fully_paid?\n amount_owed <= 0\n end",
"def has_tickets?\n (!tickets_remaining.blank?) && (tickets_remaining.to_i > 0)\n end",
"def money_enough?\n remaining_sum > 0\n end",
"def can_pay_total?\n\n conf_payment_enabled = SystemConfiguration::Variable.get_value('booking.payment', 'false').to_bool\n conf_payment_total = (['total','deposit_and_total'].include?(SystemConfiguration::Variable.get_value('booking.payment_amount_setup', 'deposit')))\n\n if self.status == :pending_confirmation\n (conf_payment_enabled or force_allow_payment) and conf_payment_total and self.total_paid == 0 and ((!expired? and payment_cadence_allowed?) or force_allow_payment)\n elsif self.status == :confirmed # Confirmed in the back-office without payment\n (conf_payment_enabled or force_allow_payment) and conf_payment_total and self.total_paid == 0 and self.total_pending > 0\n else\n return false\n end\n\n end",
"def is_percentage_fee_overriden?\n if !self.override_percentage_fee.blank? and self.override_percentage_fee > 0 and self.override_percentage_fee != StaticDataLancer::JOB_ORDER_PERCENTAGE_FEE\n return true\n else\n return false\n end\n end",
"def add_fee_is_integer\n if !params[:add_fee].nil?\n add_fee_vals = params[:add_fee].values\n add_fee_vals.each_slice(3) do |student_type, amount, time_period|\n if !amount.empty? && !(amount.to_i.to_s.eql? amount)\n return false\n end\n end\n end\n return true\n end",
"def payment_required?\n billing_total.to_f > 0.0\n end",
"def booking_deadline_has_passed?\n Date.current > deadline\n end",
"def calculate_fee\n Application::courses_fee(course_selections_count > 1 ? :multiple : :single)\n end",
"def total_fee_is_valid\n errors.add(:total_fee,'The total fee is invalid.') unless total_fee_is_valid?\n end",
"def allowed_to_pay_renewal_member_fee?\n return false if admin?\n\n (current_member? || in_grace_period?) &&\n RequirementsForRenewal.requirements_excluding_payments_met?(self)\n end",
"def charge_fee\r\n\t\tif_member = Participant.find_by(participantID: participantID)\r\n\t\tif_course = Course.find_by(courseID: courseID)\r\n\t\t\r\n\t\tif if_course != nil && if_member != nil\r\n\t\t\tearlyBirdTime = if_course.startDate.months_ago(1)\r\n\t\t\tif if_member.expirydate > Date.today\r\n\t\t\t\tif Date.today >= earlyBirdTime && Date.today < if_course.startDate\r\n\t\t\t\t\treturn if_course.earlybirdPrice\r\n\t\t\t\telse\r\n\t\t\t\t\treturn if_course.memberPrice\r\n\t\t\t\tend\r\n\t\t\telse\r\n\t\t\t\treturn if_course.nonmemberPrice\r\n\t\t\tend\r\n\t\tend\r\n\tend",
"def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n if @total_servicos.nil?\n return false\n end\n\n \n \n \n \n \n if @total_parcelado_nacionais.nil?\n return false\n end\n\n \n \n \n \n \n if @total_parcelado_internacionais.nil?\n return false\n end\n\n \n \n \n \n end",
"def valid?\n return false if [email protected]? && @period > 2147483647\n return false if !@until_occurrences.nil? && @until_occurrences > 2147483647\n true\n end",
"def allowed_to_pay_member_fee?\n return false if admin?\n\n if current_member? || in_grace_period?\n allowed_to_pay_renewal_member_fee?\n else\n allowed_to_pay_new_membership_fee?\n end\n end",
"def free?\n cost == 0.0 || payment_not_required\n end",
"def ticket_count_and_tall_enough?\n ticket_count && tall_enough?\n end",
"def loose?\n return true if budget.actual_earnings < 0\n return true if simulator.initial_budget and budget.total_used > 1.25 * simulator.initial_budget\n return true if simulator.actual_duration and simulator.actual_duration > 1.25 * simulator.original_duration\n return true if simulator.day and simulator.day > simulator.actual_duration\n false\n end",
"def fulfilled?\n amount_remaining.zero?\n end",
"def is_booking_possible?(member, tour)\n return false unless tour.current_bookings.to_i < tour.max_capacity\n return false unless tour.difficulty <= member.ability\n return false if member.tours.include?(tour)\n return true\n end",
"def passed?\n [\n semester.min_scholarship_index <= scholarship_index,\n community?,\n professional?\n ].count { |p| p == true} >= 2\n end",
"def has_hours?\n return ( total() > 0.0 )\n end"
]
| [
"0.7554179",
"0.6729728",
"0.6571799",
"0.6494584",
"0.64643955",
"0.623191",
"0.60558814",
"0.6021846",
"0.5957028",
"0.5939857",
"0.59163016",
"0.5915074",
"0.59145695",
"0.5905023",
"0.5884392",
"0.5862706",
"0.5860865",
"0.5856659",
"0.5826776",
"0.5820091",
"0.5798362",
"0.5729879",
"0.5727409",
"0.5725966",
"0.57160294",
"0.56912833",
"0.56898844",
"0.56747466",
"0.5612577",
"0.5596805"
]
| 0.8527851 | 0 |
Adds errors if fee_for_additional_materials returns false | def fee_for_additional_materials_is_valid
errors.add(:fee_for_additional_materials, 'The fee for additional materials is invalid.') unless fee_for_additional_materials_is_valid?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fee_for_additional_materials_is_valid?\n return ((self.fee_for_additional_materials != nil) and (self.fee_for_additional_materials >= 0))\n end",
"def total_fee_is_valid\n errors.add(:total_fee,'The total fee is invalid.') unless total_fee_is_valid?\n end",
"def fee_per_meeting_is_valid\n errors.add(:fee_per_meeting, 'The fee per meeting is invalid.') unless fee_per_meeting_is_valid?\n end",
"def update_errors\n @errors = []\n @errors << 'One of the cards needs attention' unless cards.all?(&:valid?)\n if email\n @errors << 'Email is not in correct format' unless email_well_formed?\n else\n @errors << 'Email is a required field'\n end\n @errors << 'Wallet token is a required field' unless wallet_token\n @errors\n end",
"def extra_validations\n success\n end",
"def mods_assets_update_validation\n i = 0\n desc_metadata = params[:asset][:descMetadata]\n unless desc_metadata.nil?\n while desc_metadata.has_key? \"person_#{i}_computing_id\".to_sym\n if desc_metadata[\"person_#{i}_first_name\".to_sym][\"0\"].blank? or desc_metadata[\"person_#{i}_last_name\".to_sym][\"0\"].blank?\n flash[:error] = \"The First and Last names are required for all authors.\"\n return false\n end\n i += 1\n end\n end\n return true\n end",
"def update_errors\n @errors = []\n @errors << 'Expiration date is a required field' unless expiration_date\n @errors << 'Expiration Date is not a valid date' unless expiration_date.is_a? Date\n @errors << 'Card type is a required field' unless card_type\n @errors << 'Card type is not supported' unless check_card_type\n @errors << 'Card number is not valid' unless card_number_valid?\n @errors\n end",
"def fees_particulars_create2\n batch=Batch.find(params[:finance_fee_particular][:batch_id])\n @tax_slabs = TaxSlab.all if @tax_enabled\n if params[:particular] and params[:particular][:receiver_id]\n\n all_admission_no = admission_no=params[:particular][:receiver_id].split(',')\n all_students = batch.students.map { |stu| stu.admission_no }.flatten\n rejected_admission_no = admission_no.select { |adm| !all_students.include? adm }\n unless (rejected_admission_no.empty?)\n @error = true\n @finance_fee_particular = batch.finance_fee_particulars.new(params[:finance_fee_particular])\n @finance_fee_particular.save\n @finance_fee_particular.errors.add_to_base(\"#{rejected_admission_no.join(',')} #{t('does_not_belong_to_batch')} #{batch.full_name}\")\n end\n\n selected_admission_no = all_admission_no.select { |adm| all_students.include? adm }\n selected_admission_no.each do |a|\n s = Student.first(:conditions => [\"admission_no LIKE BINARY(?)\", a])\n if s.nil?\n @error = true\n @finance_fee_particular = batch.finance_fee_particulars.new(params[:finance_fee_particular])\n @finance_fee_particular.save\n @finance_fee_particular.errors.add_to_base(\"#{a} #{t('does_not_exist')}\")\n end\n end\n unless @error\n unless selected_admission_no.present?\n @finance_fee_particular=batch.finance_fee_particulars.new(params[:finance_fee_particular])\n @finance_fee_particular.save\n @finance_fee_particular.errors.add_to_base(\"#{t('admission_no_cant_be_blank')}\")\n @error = true\n else\n selected_admission_no.each do |a|\n s = Student.first(:conditions => [\"admission_no LIKE BINARY(?)\", a])\n @finance_fee_particular = batch.finance_fee_particulars.new(params[:finance_fee_particular])\n @finance_fee_particular.receiver_id=s.id\n @error = true unless @finance_fee_particular.save\n end\n end\n end\n elsif params[:finance_fee_particular][:receiver_type]==\"Batch\"\n\n @finance_fee_particular = batch.finance_fee_particulars.new(params[:finance_fee_particular])\n @finance_fee_particular.receiver_id=batch.id\n @error = true unless @finance_fee_particular.save\n else\n @finance_fee_particular = batch.finance_fee_particulars.new(params[:finance_fee_particular])\n @error = true unless @finance_fee_particular.save\n @finance_fee_particular.errors.add_to_base(\"#{t('category_cant_be_blank')}\") if params[:finance_fee_particular][:receiver_id]==\"\"\n end\n @batch=batch\n @finance_fee_category = FinanceFeeCategory.find(params[:finance_fee_particular][:finance_fee_category_id])\n include_associations = @tax_enabled ? [:tax_slabs] : []\n @particulars = FinanceFeeParticular.paginate(:page => params[:page],\n :include => include_associations, :conditions => [\"is_deleted = '#{false}' and\n finance_fee_category_id = '#{@finance_fee_category.id}' and batch_id='#{@batch.id}' \"])\n\n end",
"def edit_fee_fields_filled\n if !params[:edit_fees].nil?\n edit_fees_vals = params[:edit_fees].values\n edit_fees_vals.each_slice(3) do |fee, time, remove|\n if fee.empty? || time.empty?\n return false\n end\n end\n end\n return true\n end",
"def create\n if !validate_params(material_params) then\n redirect_to !material_params['currency'] ? \"/materials/new_internal\" : \"/materials/new\", notice: 'تعذر تسجيل عملية الشراء. برجاء مراجعة المدخلات'\n else\n @material = Material.new(material_params)\n @material.user_name = current_user.name\n\n raw_materials = RawMaterial.find(params['raw_material_ids'])\n @material.price = 0\n @material.prices.each_with_index do |price, i|\n @material.price = @material.price + price.to_f * @material.quantities[i].to_f\n end\n if params['paid_amount'].present? && @material.price_with_taxes < params['paid_amount'].to_f\n redirect_to '/materials/new', notice: 'لا يمكن أن يكون المبلغ المدفوع أكبر من السعر الكلي'\n return\n end\n if (@material.payment_state == \"آجل\")\n @material.debt = @material.price_with_taxes - params[\"paid_amount\"].to_f\n else\n @material.debt = 0\n end\n\n if !check_treasury(material_params[:payment_method], (params['price'].to_f - params['debt'].to_f))\n redirect_to !material_params['currency'] ? \"/materials/new_internal\" : \"/materials/new\", notice: 'المبلغ الموجود بالخزنة أقل من المبلغ المطلوب'\n return\n end\n respond_to do |format|\n if @material.save\n if (@material.debt != @material.price_with_taxes)\n update_treasury(@material.payment_method, @material.debt - @material.price_with_taxes, MATERIAL, @material.id, \"عملية شراء\", 0, @material.date_added)\n end\n\n @material.raw_material_ids.each_with_index do |r, i|\n raw_material = RawMaterial.find(r)\n raw_material.in_stock = raw_material.in_stock + @material.quantities[i].to_f\n raw_material.save\n end\n supplier = Supplier.find(@material.supplier_id)\n supplier.credit = supplier.credit + @material.debt\n permission1 = AddMaterialPermission.create!({transaction_id: @material.id})\n permission2 = ReleaseMoneyPermission.create!({transaction_for: MATERIAL, transaction_id: @material.id, quantity: @material.price - @material.debt})\n supplier.save\n MaterialPaymentDetail.create()\n format.html { redirect_to \"/permission/material/#{permission1.id}/#{permission2.id}\" }\n format.json { render :show, status: :created, location: @material }\n else\n format.html { redirect_to \"/materials/new\", notice: 'تعذر تسجيل عملية الشراء. برجاء مراجعة المدخلات' }\n format.json { render json: @material.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def add_fee_filled_or_empty\n if !params[:add_fee].nil?\n add_fee_keys = params[:add_fee].keys\n add_fee_vals = params[:add_fee].values\n add_fee_vals.each_slice(3) do |student_type, amount, time_period|\n if !((!student_type.empty? && !amount.empty? && !time_period.empty?) ||\n (student_type.empty? && amount.empty? && time_period.empty?))\n return false\n end\n end\n end\n return true\n end",
"def add_additional_errors(vehicle, params)\n # Add make missing error (if we should)\n if (params[:make_missing] == true) && !vehicle.custom_make_enabled?\n vehicle.errors.messages[:make] = [ I18n.t(\"views.shared.required\") ]\n end\n\n # Add member_email error if member (buyer) is missing.\n if vehicle.errors.messages[:member_id].present?\n vehicle.errors.messages[:member_email] = [ I18n.t(\"models.vehicle.errors.required\") ]\n end\n\n # Owner - if a validation error exists and its cause is\n # missing Owner or missing Owner->Contact add\n # errors to the required contact fields.\n #\n if vehicle.owner.present? && vehicle.owner.company.nil? && vehicle.errors.messages[:\"owner.company\"].present?\n vehicle.errors.messages[:\"owner.company_name\"] = [ I18n.t(\"views.shared.required\") ]\n vehicle.errors.messages[:\"owner.vat_id\"] = [ I18n.t(\"views.shared.required\") ]\n end\n if vehicle.owner.nil?\n # This is a second if condition so the elsif below only\n # fires when an owner exists\n if vehicle.errors.messages[:owner].present?\n vehicle.errors.messages[:\"owner.company\"] = [ I18n.t(\"views.shared.required\") ]\n end\n else\n if (vehicle.owner.company? || !vehicle.owner.company?) && vehicle.owner.contact.blank?\n vehicle.errors.messages[:\"owner.contact.first_name\"] = [ I18n.t(\"views.shared.required\") ]\n vehicle.errors.messages[:\"owner.contact.last_name\"] = [ I18n.t(\"views.shared.required\") ]\n end\n if vehicle.owner.address.blank? \n vehicle.errors.messages[:\"owner.address.line1\"] = [I18n.t(\"views.shared.required\")]\n vehicle.errors.messages[:\"owner.address.country\"] = [I18n.t(\"views.shared.required\")]\n vehicle.errors.messages[:\"owner.address.city\"] = [I18n.t(\"views.shared.required\")]\n end\n end\n \n # Insured - if a validation error exists and its cause is\n # missing Insured or missing Insured->Contact add\n # errors to the required contact fields.\n #\n if vehicle.insured.present? && vehicle.insured.company.nil? && vehicle.errors.messages[:\"insured.company\"].present?\n vehicle.errors.messages[:\"insured.company_name\"] = [ I18n.t(\"views.shared.required\") ]\n vehicle.errors.messages[:\"insured.vat_id\"] = [ I18n.t(\"views.shared.required\") ]\n end\n if vehicle.insured.nil?\n if vehicle.errors.messages[:insured].present?\n vehicle.errors.messages[:\"insured.company\"] = [ I18n.t(\"views.shared.required\") ]\n end\n else\n if !vehicle.insured.company? && vehicle.insured.contact.blank?\n vehicle.errors.messages[:\"insured.contact.first_name\"] = [ I18n.t(\"views.shared.required\") ]\n vehicle.errors.messages[:\"insured.contact.last_name\"] = [ I18n.t(\"views.shared.required\") ]\n end\n if vehicle.insured.address.blank?\n vehicle.errors.messages[:\"insured.address.line1\"] = [I18n.t(\"views.shared.required\")]\n vehicle.errors.messages[:\"insured.address.country\"] = [I18n.t(\"views.shared.required\")]\n vehicle.errors.messages[:\"insured.address.city\"] = [I18n.t(\"views.shared.required\")]\n end\n end\n\n if vehicle.errors.messages[:pickup_location].present?\n vehicle.errors.add(:pickup_location_kind, I18n.t(\"activerecord.errors.models.facility.attributes.kind.blank\"))\n end\n \n # Pickup - add errors for missing address/contact cases\n if vehicle.errors.messages[:\"pickup_location.address\"].present? &&\n vehicle.pickup_location.address.nil?\n vehicle.errors.messages[:\"pickup_location.address.city\"] = [ I18n.t(\"views.shared.required\") ]\n vehicle.errors.messages[:\"pickup_location.address.country\"] = [ I18n.t(\"views.shared.required\") ]\n vehicle.errors.messages[:\"pickup_location.address.line1\"] = [ I18n.t(\"views.shared.required\") ]\n vehicle.errors.messages[:\"pickup_location.address.zip\"] = [ I18n.t(\"views.shared.required\") ]\n end\n\n if vehicle.errors.messages[:\"pickup_location.contact\"].present? &&\n vehicle.pickup_location.contact.nil?\n vehicle.errors.messages[:\"pickup_location.contact.primary_phone\"] = [ I18n.t(\"views.shared.required\") ]\n end\n\n end",
"def add_errors(member_alias)\n @errors[:schedule_not_fetched] = \"-#{member_alias}- #{@errors[:schedule_not_fetched]}\"\n end",
"def amount_is_valid\n errors.add(:amount, 'ticket amount is not right. Please double check') if amount < 40 || amount > 200\n end",
"def total_fee_is_valid?\n return ((self.total_fee != nil) and (self.total_fee >= 0))\n end",
"def fee\n\tparams['mc_fee']\n end",
"def no_all_zero_quantity\n if ok_quantity.present? and broken_quantity.present? and repairable_quantity.present? and\n ok_quantity == 0 and broken_quantity == 0 and repairable_quantity == 0 \n errors.add(:ok_quantity , \"OK, gagal, dan perbaiki tidak boleh bernilai 0 bersamaan\" ) \n errors.add(:broken_quantity , \"OK, gagal, dan perbaiki tidak boleh bernilai 0 bersamaan\" ) \n errors.add(:repairable_quantity , \"OK, gagal, dan perbaiki tidak boleh bernilai 0 bersamaan\" ) \n end\n end",
"def check_for_child_validation_errors\n result = true\n result &= check_for_child_validation_error(:current_user)\n result &= check_for_child_validation_error(:company)\n result &= check_for_child_validation_error(:account_type)\n result &= check_for_child_validation_error(:address)\n result\n end",
"def no_all_zero_quantity\n if ok_quantity.present? and broken_quantity.present? and bad_source_quantity.present? and \n ok_quantity == 0 and broken_quantity == 0 and bad_source_quantity == 0 \n errors.add(:ok_quantity , \"OK, gagal, dan perbaiki tidak boleh bernilai 0 bersamaan\" ) \n errors.add(:broken_quantity , \"OK, gagal, dan perbaiki tidak boleh bernilai 0 bersamaan\" ) \n errors.add(:bad_source_quantity , \"OK, gagal, dan perbaiki tidak boleh bernilai 0 bersamaan\" ) \n end\n end",
"def cards_validation\n if cards.any?(&:invalid?)\n errors[:base] << 'Wallet has an invalid card'\n end\n end",
"def can_be_unconfirmed?\n \n if self.purchase_receival_entries.count != 0\n self.errors.add(:generic_errors, \"Tidak bisa unconfirm karena sudah ada penerimaan barang\")\n return false \n end\n \n if self.purchase_return_entries.count != 0 \n self.errors.add(:generic_errors, \"Tidak bisa unconfirm karena sudah ada pengembalian barang\")\n return false\n end\n\n \n \n reverse_adjustment_quantity = -1*quantity \n \n final_item_quantity = item.pending_receival + reverse_adjustment_quantity\n final_warehouse_item_quantity = warehouse_item.pending_receival + reverse_adjustment_quantity\n \n if final_item_quantity < 0 or final_warehouse_item_quantity < 0 \n msg = \"Tidak bisa unconfirm karena akan menyebabkan jumlah #{item.name} pending receival menjadi #{final_item_quantity} \" + \n \" dan jumlah item gudang menjadi :#{final_warehouse_item_quantity}\"\n self.errors.add(:generic_errors, msg )\n return false \n end\n \n return true \n end",
"def verify_fees(test_data)\n fees = test_data[UseOfCollections::FEE_GRP.name] || [UseOfCollections.empty_fee]\n fees.each_with_index do |fee, index|\n verify_values_match(fee[UseOfCollections::FEE_CURRENCY.name], element_value(fee_currency_input index))\n verify_values_match(fee[UseOfCollections::FEE_VALUE.name], element_value(fee_value_input index))\n verify_values_match(fee[UseOfCollections::FEE_NOTE.name], element_value(fee_note_input index))\n end\n end",
"def verify_fees(test_data)\n fees = test_data[CoreUseOfCollectionsData::FEE_GRP.name] || [CoreUseOfCollectionsData.empty_fee]\n fees.each_with_index do |fee, index|\n verify_values_match(fee[CoreUseOfCollectionsData::FEE_CURRENCY.name], element_value(fee_currency_input index))\n verify_values_match(fee[CoreUseOfCollectionsData::FEE_VALUE.name], element_value(fee_value_input index))\n verify_values_match(fee[CoreUseOfCollectionsData::FEE_NOTE.name], element_value(fee_note_input index))\n end\n end",
"def fees_particulars_create\n if request.get?\n redirect_to :action => \"fees_particulars_new\"\n else\n @finance_category=FinanceFeeCategory.find_by_id(params[:finance_fee_particular][:finance_fee_category_id])\n @tax_slabs = TaxSlab.all if @tax_enabled\n @batches= Batch.find(:all,\n :joins => \"INNER JOIN `category_batches` ON `batches`.id = `category_batches`.batch_id\n INNER JOIN finance_fee_categories on finance_fee_categories.id=category_batches.finance_fee_category_id \n INNER JOIN courses on courses.id=batches.course_id\",\n :conditions => [\"finance_fee_categories.name = ? and finance_fee_categories.description = ?\",\n \"#{@finance_category.name}\", \"#{@finance_category.description}\"],\n :order => \"courses.code ASC\") if @finance_category\n if params[:particular] and params[:particular][:batch_ids]\n batches=Batch.find(params[:particular][:batch_ids])\n @cat_ids=params[:particular][:batch_ids]\n if params[:particular][:receiver_id].present?\n all_admission_no = admission_no=params[:particular][:receiver_id].split(',')\n all_students = batches.map { |b| b.students.map { |stu| stu.admission_no } }.flatten\n rejected_admission_no = admission_no.select { |adm| !all_students.include? adm }\n unless (rejected_admission_no.empty?)\n @error = true\n @finance_fee_particular = FinanceFeeParticular.new(params[:finance_fee_particular])\n @finance_fee_particular.batch_id=1\n @finance_fee_particular.save\n @finance_fee_particular.errors.add_to_base(\"#{rejected_admission_no.join(',')} #{t('does_not_belong_to_batch')} #{batches.map { |batch| batch.full_name }.join(',')}\")\n end\n\n selected_admission_no = all_admission_no.select { |adm| all_students.include? adm }\n selected_admission_no.each do |a|\n s = Student.first(:conditions => [\"admission_no LIKE BINARY(?)\", a])\n if s.nil?\n @error = true\n @finance_fee_particular = FinanceFeeParticular.new(params[:finance_fee_particular])\n @finance_fee_particular.save\n @finance_fee_particular.errors.add_to_base(\"#{a} #{t('does_not_exist')}\")\n end\n end\n unless @error\n\n selected_admission_no.each do |a|\n s = Student.first(:conditions => [\"admission_no LIKE BINARY(?)\", a])\n batch=s.batch\n @finance_fee_particular = batch.finance_fee_particulars.new(params[:finance_fee_particular])\n @finance_fee_particular.receiver_id=s.id\n @error = true unless @finance_fee_particular.save\n end\n end\n else\n batches.each do |batch|\n if params[:finance_fee_particular][:receiver_type]==\"Batch\"\n\n @finance_fee_particular = batch.finance_fee_particulars.new(params[:finance_fee_particular])\n @finance_fee_particular.receiver_id=batch.id\n @error = true unless @finance_fee_particular.save\n elsif params[:finance_fee_particular][:receiver_type]==\"StudentCategory\"\n @finance_fee_particular = batch.finance_fee_particulars.new(params[:finance_fee_particular])\n @error = true unless @finance_fee_particular.save\n @finance_fee_particular.errors.add_to_base(\"#{t('category_cant_be_blank')}\") if params[:finance_fee_particular][:receiver_id]==\"\"\n else\n\n @finance_fee_particular = batch.finance_fee_particulars.new(params[:finance_fee_particular])\n @error = true unless @finance_fee_particular.save\n @finance_fee_particular.errors.add_to_base(\"#{t('admission_no_cant_be_blank')}\")\n end\n\n end\n end\n else\n @error=true\n @finance_fee_particular =FinanceFeeParticular.new(params[:finance_fee_particular])\n @finance_fee_particular.save\n end\n\n if @error\n @fees_categories = FinanceFeeCategory.find(:all, :group => :name, :conditions => \"is_deleted = 0 and is_master = 1\")\n @student_categories = StudentCategory.active\n @master_fee_particulars = MasterFeeParticular.core\n @render=true\n if params[:finance_fee_particular][:receiver_type]==\"Student\"\n @student=true\n elsif params[:finance_fee_particular][:receiver_type]==\"StudentCategory\"\n @category=true\n else\n @all=true\n end\n\n render :action => 'fees_particulars_new'\n else\n flash[:notice]=\"#{t('particulars_created_successfully')}\"\n redirect_to :action => \"fees_particulars_new\"\n end\n end\n end",
"def fulfillment_fee\n begin\n if variant.product_costs.where(:retailer_id => self.order.retailer_id).first.fulfillment_fee > 0\n variant.product_costs.where(:retailer_id => self.order.retailer_id).first.fulfillment_fee * quantity\n else\n self.order.retailer.fulfillment_fee * quantity\n end\n rescue\n begin\n self.order.retailer.fulfillment_fee * quantity\n rescue\n 0.0\n end\n end\n end",
"def fee\n params['mc_fee']\n end",
"def fee\n params['mc_fee']\n end",
"def presence_of_mandatory_fields\n if promo_amount.blank? and info.blank?\n errors[:base] << 'Au moins un des champs doivent être remplis'\n end\n end",
"def valid_non_transportation_line_item\n lb_return = true\n if non_ts_service == \"Y\"\n if service_date.blank?\n errors.add(:service_date, \"is required.\")\n lb_return = false\n end\n\n if actual_cost.blank?\n errors.add(:actual_cost, \"is required.\")\n lb_return = false\n end\n end\n return lb_return\n end",
"def validate_not_all_mandatory\n errors.add(:service_codes, :invalid_cafm_helpdesk_billable) if (service_codes - self.class::MANDATORY_SERVICES).empty?\n end"
]
| [
"0.7586528",
"0.7028197",
"0.6256086",
"0.60872483",
"0.58942425",
"0.58825755",
"0.5809041",
"0.5793246",
"0.5720905",
"0.56903046",
"0.56727296",
"0.55360746",
"0.55143297",
"0.5492163",
"0.5482173",
"0.5459941",
"0.54315907",
"0.5414651",
"0.53672326",
"0.5363375",
"0.5329091",
"0.52817273",
"0.52700603",
"0.5256597",
"0.52421576",
"0.52244174",
"0.52244174",
"0.52094895",
"0.52065873",
"0.5199275"
]
| 0.89261824 | 0 |
Tests that fee_for_additional_material for course is not nil and greater than or equal to 0 and returns true or false. | def fee_for_additional_materials_is_valid?
return ((self.fee_for_additional_materials != nil) and (self.fee_for_additional_materials >= 0))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def total_fee_is_valid?\n return ((self.total_fee != nil) and (self.total_fee >= 0))\n end",
"def fee_per_meeting_is_valid?\n return ((self.fee_per_meeting != nil) and (self.fee_per_meeting >= 0))\n end",
"def fee_for_additional_materials_is_valid\n errors.add(:fee_for_additional_materials, 'The fee for additional materials is invalid.') unless fee_for_additional_materials_is_valid?\n end",
"def add_fee_filled_or_empty\n if !params[:add_fee].nil?\n add_fee_keys = params[:add_fee].keys\n add_fee_vals = params[:add_fee].values\n add_fee_vals.each_slice(3) do |student_type, amount, time_period|\n if !((!student_type.empty? && !amount.empty? && !time_period.empty?) ||\n (student_type.empty? && amount.empty? && time_period.empty?))\n return false\n end\n end\n end\n return true\n end",
"def free?\n self.setupFee == 0 && self.laborFee == 0 && self.oneTimeFee == 0 && self.recurringFee == 0 && self.hourlyRecurringFee == 0\n end",
"def free?\n\t\t\t\tnot(fee?)\n\t\t\tend",
"def valid?\n return false if @is_included.nil?\n return false if !@material_efficiency.nil? && @material_efficiency > 25\n return false if !@material_efficiency.nil? && @material_efficiency < 0\n return false if @quantity.nil?\n return false if @record_id.nil?\n return false if [email protected]? && @runs < -1\n return false if !@time_efficiency.nil? && @time_efficiency > 20\n return false if !@time_efficiency.nil? && @time_efficiency < 0\n return false if @type_id.nil?\n true\n end",
"def free?\n cost == 0.0 || payment_not_required\n end",
"def calculated?\n fee_type&.calculated?.nil? ? true : fee_type.calculated?\n end",
"def applicable?\n mandatory || amount != 0\n end",
"def add_fee_is_integer\n if !params[:add_fee].nil?\n add_fee_vals = params[:add_fee].values\n add_fee_vals.each_slice(3) do |student_type, amount, time_period|\n if !amount.empty? && !(amount.to_i.to_s.eql? amount)\n return false\n end\n end\n end\n return true\n end",
"def payment_required?\n billing_total.to_f > 0.0\n end",
"def total_fee_is_valid\n errors.add(:total_fee,'The total fee is invalid.') unless total_fee_is_valid?\n end",
"def claim_amount_required?\n @full_repayment_of_ads != 'Y'\n end",
"def fully_paid?\n amount_owed <= 0\n end",
"def money_enough?\n remaining_sum > 0\n end",
"def calculation_required?\n [editable?, calculated?, agfs? || (lgfs? && is_fixed?)].all?\n end",
"def valid?\n return false if @date.nil?\n return false if @campaign_revenue.nil?\n return false if @total_campaign_revenue.nil?\n return false if @campaign_refund.nil?\n return false if @total_campaign_refund.nil?\n return false if @campaign_discount_costs.nil?\n return false if @total_campaign_discount_costs.nil?\n return false if @campaign_refunded_discounts.nil?\n return false if @total_campaign_refunded_discounts.nil?\n return false if @campaign_free_items.nil?\n return false if @total_campaign_free_items.nil?\n return false if @coupon_redemptions.nil?\n return false if @total_coupon_redemptions.nil?\n return false if @coupon_rolledback_redemptions.nil?\n return false if @total_coupon_rolledback_redemptions.nil?\n return false if @referral_redemptions.nil?\n return false if @total_referral_redemptions.nil?\n return false if @coupons_created.nil?\n return false if @total_coupons_created.nil?\n return false if @referrals_created.nil?\n return false if @total_referrals_created.nil?\n return false if @added_loyalty_points.nil?\n return false if @total_added_loyalty_points.nil?\n return false if @deducted_loyalty_points.nil?\n return false if @total_deducted_loyalty_points.nil?\n true\n end",
"def bonus_grade?\n return false if grade_entry_item.nil?\n grade_entry_item.bonus?\n end",
"def valid?\n return false if @merchant_id.nil?\n return false if @capacity.nil?\n return false if @date_time.nil?\n true\n end",
"def loose?\n return true if budget.actual_earnings < 0\n return true if simulator.initial_budget and budget.total_used > 1.25 * simulator.initial_budget\n return true if simulator.actual_duration and simulator.actual_duration > 1.25 * simulator.original_duration\n return true if simulator.day and simulator.day > simulator.actual_duration\n false\n end",
"def allowed_to_pay_renewal_member_fee?\n return false if admin?\n\n (current_member? || in_grace_period?) &&\n RequirementsForRenewal.requirements_excluding_payments_met?(self)\n end",
"def fulfilled?\n amount_remaining.zero?\n end",
"def for_profit?\n !foreign? && !facility_code.nil? && facility_code[0] == \"2\"\n end",
"def delivery_required?\n total_weight > BigDecimal(0)\n end",
"def renewal_or_review_mandatory?\n existing_agreement? && waste_producer_water_discount?\n end",
"def valid?\n return false if @plan.nil?\n return false if [email protected]? && @amount < 0\n return false if [email protected]? && @quantity < 1\n return false if !@plan_version.nil? && @plan_version < 1\n return false if !@grace_duration.nil? && @grace_duration < 0\n return false if @signup_method.nil?\n return true\n end",
"def valid?\n return false if @additional_details.nil?\n return false if @blockchain.nil?\n blockchain_validator = EnumAttributeValidator.new('String', [\"bitcoin\", \"bitcoin-cash\", \"litecoin\", \"dogecoin\", \"dash\", \"ethereum\", \"ethereum-classic\", \"xrp\", \"zcash\"])\n return false unless blockchain_validator.valid?(@blockchain)\n return false if @fee_priority.nil?\n fee_priority_validator = EnumAttributeValidator.new('String', [\"slow\", \"standard\", \"fast\"])\n return false unless fee_priority_validator.valid?(@fee_priority)\n return false if @network.nil?\n network_validator = EnumAttributeValidator.new('String', [\"mainnet\", \"testnet\", \"ropsten\", \"mordor\"])\n return false unless network_validator.valid?(@network)\n return false if @recipients.nil?\n return false if @total_transaction_amount.nil?\n return false if @transaction_request_status.nil?\n transaction_request_status_validator = EnumAttributeValidator.new('String', [\"created\", \"await-approval\", \"pending\", \"prepared\", \"signed\", \"broadcasted\", \"success\", \"failed\", \"rejected\", \"mined\"])\n return false unless transaction_request_status_validator.valid?(@transaction_request_status)\n return false if @transaction_type.nil?\n transaction_type_validator = EnumAttributeValidator.new('String', [\"coin\", \"token\"])\n return false unless transaction_type_validator.valid?(@transaction_type)\n return false if @unit.nil?\n return false if @wallet_id.nil?\n true\n end",
"def free?\n price.blank? || price.zero?\n end",
"def check_data_validation\r\n if @tx_interest.text.to_f > 0 and \r\n @tx_interest.text.to_f < 0.1 and\r\n @tx_amount.text.to_i >= 1000 and\r\n @tx_years.text.to_i >= 1 then\r\n tf = true\r\n else\r\n tf = false\r\n end\r\n return tf\r\n end"
]
| [
"0.761037",
"0.714761",
"0.70305824",
"0.67311174",
"0.672941",
"0.6692722",
"0.6377599",
"0.6359446",
"0.63240474",
"0.6311671",
"0.6284458",
"0.6261357",
"0.6254491",
"0.62404966",
"0.61201787",
"0.6103666",
"0.6011824",
"0.5986649",
"0.5969618",
"0.58939934",
"0.58906364",
"0.5881687",
"0.5867753",
"0.5847329",
"0.58313406",
"0.58132935",
"0.5797049",
"0.5791858",
"0.5776051",
"0.57360286"
]
| 0.8457905 | 0 |
Adds errors if total_fee_is_valid? returns false | def total_fee_is_valid
errors.add(:total_fee,'The total fee is invalid.') unless total_fee_is_valid?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fee_for_additional_materials_is_valid\n errors.add(:fee_for_additional_materials, 'The fee for additional materials is invalid.') unless fee_for_additional_materials_is_valid?\n end",
"def fee_per_meeting_is_valid\n errors.add(:fee_per_meeting, 'The fee per meeting is invalid.') unless fee_per_meeting_is_valid?\n end",
"def total_fee_is_valid?\n return ((self.total_fee != nil) and (self.total_fee >= 0))\n end",
"def fee_for_additional_materials_is_valid?\n return ((self.fee_for_additional_materials != nil) and (self.fee_for_additional_materials >= 0))\n end",
"def fee_per_meeting_is_valid?\n return ((self.fee_per_meeting != nil) and (self.fee_per_meeting >= 0))\n end",
"def amount_is_valid\n errors.add(:amount, 'ticket amount is not right. Please double check') if amount < 40 || amount > 200\n end",
"def total_fee\n fee + fee2 + fee3 + fee4\n end",
"def total\n (amount + fee) if amount\n end",
"def validate_amount\n errors.add(:claiming_amount, :ads_amount) if claim_amount_required? && ads_amount.to_i < claiming_amount.to_i\n end",
"def extra_validations\n success\n end",
"def check_total_charges_limit\n check_charges_limit([validate_total_limit])\n end",
"def add_fee_filled_or_empty\n if !params[:add_fee].nil?\n add_fee_keys = params[:add_fee].keys\n add_fee_vals = params[:add_fee].values\n add_fee_vals.each_slice(3) do |student_type, amount, time_period|\n if !((!student_type.empty? && !amount.empty? && !time_period.empty?) ||\n (student_type.empty? && amount.empty? && time_period.empty?))\n return false\n end\n end\n end\n return true\n end",
"def fee\n @fee || DEFAULT_FEE\n end",
"def edit_fee_fields_filled\n if !params[:edit_fees].nil?\n edit_fees_vals = params[:edit_fees].values\n edit_fees_vals.each_slice(3) do |fee, time, remove|\n if fee.empty? || time.empty?\n return false\n end\n end\n end\n return true\n end",
"def total_amount_validation\n @items.each do |i|\n next if i[:quantity].to_i * (i[:unit_price].to_i - i[:total_discount_amount].to_i) == i[:total_amount].to_i\n\n raise Klarna::Checkout::Errors::OrderValidationError.new(\n 'inconsistent_order_line_totals', 'total_line_amount_not_matching_qty_times_unit_price'\n )\n end\n end",
"def total_correcto\n suma = subtotal + iva + ieps\n unless suma == total\n errors.add(:total, 'La sumatoria del subtotal, IVA e IEPS, no concuerda')\n end\n end",
"def verify_fees(test_data)\n fees = test_data[CoreUseOfCollectionsData::FEE_GRP.name] || [CoreUseOfCollectionsData.empty_fee]\n fees.each_with_index do |fee, index|\n verify_values_match(fee[CoreUseOfCollectionsData::FEE_CURRENCY.name], element_value(fee_currency_input index))\n verify_values_match(fee[CoreUseOfCollectionsData::FEE_VALUE.name], element_value(fee_value_input index))\n verify_values_match(fee[CoreUseOfCollectionsData::FEE_NOTE.name], element_value(fee_note_input index))\n end\n end",
"def verify_fees(test_data)\n fees = test_data[UseOfCollections::FEE_GRP.name] || [UseOfCollections.empty_fee]\n fees.each_with_index do |fee, index|\n verify_values_match(fee[UseOfCollections::FEE_CURRENCY.name], element_value(fee_currency_input index))\n verify_values_match(fee[UseOfCollections::FEE_VALUE.name], element_value(fee_value_input index))\n verify_values_match(fee[UseOfCollections::FEE_NOTE.name], element_value(fee_note_input index))\n end\n end",
"def validate_funding\n # randomize funding method!\n validate_random_day 'Funding Method', EngagementRequest::FUNDING_METHODS[self.funding_method]\n\n # sponsor is funding it!\n if self.cost_center != self.sponsor.department.cost_center\n add_validation \"Cost Center should match the Sponsor's cost center\"\n end\n\n # detailed estimate must be funding approved!\n if self.detailed_estimate? && ! (self.approved? || self.budget?)\n add_validation EngagementRequest::ENGAGEMENT_TYPES[self.engagement_type] + ' must have budget ' +\n EngagementRequest::FUNDING_STATUSES[\"approved\"] + ' or ' +\n EngagementRequest::FUNDING_STATUSES[\"budget\"]\n end\n # scheduling or rescue must have budget!\n if (self.scheduling? || self.rescue?) && ! self.budget?\n add_validation EngagementRequest::ENGAGEMENT_TYPES[self.engagement_type] + ' must have ' +\n EngagementRequest::FUNDING_STATUSES[\"budget\"]\n end\n\n # must have a decent budget!\n if self.budget_allocated < 100_000\n add_validation 'Projects with a budget of less than $100,000 are not accepted'\n end\n end",
"def fee\n (amount * 0.005) if amount\n end",
"def fee\n params['amount_fee']\n end",
"def fees\n total_input - total_output\n end",
"def total_non_insured_fees\n total_fee - total_insured_fees\n end",
"def validate_fee_rate(code = nil)\n if @record.quantity.positive? && @record.rate <= 0\n add_error(:rate, code ? \"#{code.downcase}_invalid\".to_sym : :invalid)\n elsif @record.quantity <= 0 && @record.rate.positive?\n add_error(:quantity, code ? \"#{code.downcase}_invalid\".to_sym : :invalid)\n end\n end",
"def validate\n # add errors if not validate\n end",
"def fulfillment_fee\n begin\n if variant.product_costs.where(:retailer_id => self.order.retailer_id).first.fulfillment_fee > 0\n variant.product_costs.where(:retailer_id => self.order.retailer_id).first.fulfillment_fee * quantity\n else\n self.order.retailer.fulfillment_fee * quantity\n end\n rescue\n begin\n self.order.retailer.fulfillment_fee * quantity\n rescue\n 0.0\n end\n end\n end",
"def days_of_week_are_valid\n errors.add(:days_of_week, \"The days of the week are invalid.\") unless days_of_week_are_valid?\n end",
"def add_fee(args)\n result = Spreedly.post(\"/subscribers/#{id}/fees.xml\", :body => Spreedly.to_xml_params(:fee => args))\n\n case result.code.to_s\n when /2../\n when '404'\n raise \"Not Found\"\n when '422'\n raise \"Unprocessable Entity - #{result.body}\"\n else\n raise \"Could not add fee to subscriber: result code #{result.code}.\"\n end\n end",
"def validate_amount\n if params[:amount].blank?\n update_error('amount', 'Please enter an amount.')\n end\n end",
"def saldo_suficiente\n if same_currency? && cuenta.monto < monto\n errors.add(:base, \"Debe tener suficiente dinero para efectuar el pago\")\n end\n end"
]
| [
"0.7769707",
"0.77040637",
"0.75535625",
"0.6664327",
"0.6526046",
"0.6336517",
"0.62817496",
"0.61141074",
"0.61026436",
"0.6056936",
"0.60406977",
"0.60235614",
"0.6018698",
"0.6001351",
"0.5959651",
"0.5934791",
"0.5877435",
"0.58740693",
"0.586765",
"0.58670926",
"0.58668923",
"0.5846708",
"0.5844545",
"0.5833874",
"0.58133936",
"0.5806793",
"0.579581",
"0.57682705",
"0.5764585",
"0.57617605"
]
| 0.913758 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.